This commit is contained in:
Fine 2022-11-29 13:11:28 +08:00
parent 5be106fc4f
commit 538287b539
3 changed files with 25 additions and 11 deletions

View File

@ -60,7 +60,10 @@ limitations under the License. -->
/>
</el-popover>
<span
v-show="states.isList || states.metricTypes[0] === 'readMetricsValues'"
v-show="
states.isList ||
states.metricTypes[0] === ProtocolTypes.ReadMetricsValues
"
>
<Icon
class="cp mr-5"
@ -106,6 +109,7 @@ import {
ChartTypes,
PodsChartTypes,
MetricsType,
ProtocolTypes,
} from "../../../data";
import { ElMessage } from "element-plus";
import Icon from "@/components/Icon.vue";
@ -425,13 +429,7 @@ function setMetricTypeList(type: string) {
return MetricTypes[type];
}
if (states.isList || graph.value.type === "Table") {
return [
{ label: "read all values in the duration", value: "readMetricsValues" },
{
label: "read the single value in the duration",
value: "readMetricsValue",
},
];
return [MetricTypes.REGULAR_VALUE[0], MetricTypes.REGULAR_VALUE[1]];
}
return MetricTypes[type];
}

View File

@ -97,7 +97,7 @@ import { useI18n } from "vue-i18n";
import { SortOrder, CalculationOpts } from "../../../data";
import { useDashboardStore } from "@/store/modules/dashboard";
import { MetricConfigOpt } from "@/types/dashboard";
import { ListChartTypes } from "../../../data";
import { ListChartTypes, ProtocolTypes } from "../../../data";
/*global defineEmits, defineProps */
const props = defineProps({
@ -122,11 +122,18 @@ const hasLabel = computed(() => {
const graph = dashboardStore.selectedGrid.graph || {};
return (
ListChartTypes.includes(graph.type) ||
["readLabeledMetricsValues", "readMetricsValues"].includes(metricType.value)
[
ProtocolTypes.ReadLabeledMetricsValues,
ProtocolTypes.ReadMetricsValues,
].includes(metricType.value)
);
});
const isTopn = computed(() =>
["sortMetrics", "readSampledRecords"].includes(metricTypes[props.index])
[
ProtocolTypes.SortMetrics,
ProtocolTypes.ReadSampledRecords,
ProtocolTypes.ReadRecords,
].includes(metricTypes[props.index])
);
function updateConfig(index: number, param: { [key: string]: string }) {
const key = Object.keys(param)[0];

View File

@ -47,6 +47,15 @@ export const MetricChartType: any = {
readSampledRecords: [{ label: "Top List", value: "TopList" }],
readRecords: [{ label: "Top List", value: "TopList" }],
};
export enum ProtocolTypes {
ReadRecords = "readRecords",
ReadSampledRecords = "readSampledRecords",
SortMetrics = "sortMetrics",
ReadLabeledMetricsValues = "readLabeledMetricsValues",
ReadHeatMap = "readHeatMap",
ReadMetricsValues = "readMetricsValues",
ReadMetricsValue = "readMetricsValue",
}
export const DefaultGraphConfig: { [key: string]: any } = {
Bar: {
type: "Bar",