mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-14 00:37:33 +00:00
refactor
This commit is contained in:
parent
5be106fc4f
commit
538287b539
@ -60,7 +60,10 @@ limitations under the License. -->
|
|||||||
/>
|
/>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
<span
|
<span
|
||||||
v-show="states.isList || states.metricTypes[0] === 'readMetricsValues'"
|
v-show="
|
||||||
|
states.isList ||
|
||||||
|
states.metricTypes[0] === ProtocolTypes.ReadMetricsValues
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
class="cp mr-5"
|
class="cp mr-5"
|
||||||
@ -106,6 +109,7 @@ import {
|
|||||||
ChartTypes,
|
ChartTypes,
|
||||||
PodsChartTypes,
|
PodsChartTypes,
|
||||||
MetricsType,
|
MetricsType,
|
||||||
|
ProtocolTypes,
|
||||||
} from "../../../data";
|
} from "../../../data";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import Icon from "@/components/Icon.vue";
|
import Icon from "@/components/Icon.vue";
|
||||||
@ -425,13 +429,7 @@ function setMetricTypeList(type: string) {
|
|||||||
return MetricTypes[type];
|
return MetricTypes[type];
|
||||||
}
|
}
|
||||||
if (states.isList || graph.value.type === "Table") {
|
if (states.isList || graph.value.type === "Table") {
|
||||||
return [
|
return [MetricTypes.REGULAR_VALUE[0], MetricTypes.REGULAR_VALUE[1]];
|
||||||
{ label: "read all values in the duration", value: "readMetricsValues" },
|
|
||||||
{
|
|
||||||
label: "read the single value in the duration",
|
|
||||||
value: "readMetricsValue",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
return MetricTypes[type];
|
return MetricTypes[type];
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ import { useI18n } from "vue-i18n";
|
|||||||
import { SortOrder, CalculationOpts } from "../../../data";
|
import { SortOrder, CalculationOpts } from "../../../data";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import { MetricConfigOpt } from "@/types/dashboard";
|
import { MetricConfigOpt } from "@/types/dashboard";
|
||||||
import { ListChartTypes } from "../../../data";
|
import { ListChartTypes, ProtocolTypes } from "../../../data";
|
||||||
|
|
||||||
/*global defineEmits, defineProps */
|
/*global defineEmits, defineProps */
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -122,11 +122,18 @@ const hasLabel = computed(() => {
|
|||||||
const graph = dashboardStore.selectedGrid.graph || {};
|
const graph = dashboardStore.selectedGrid.graph || {};
|
||||||
return (
|
return (
|
||||||
ListChartTypes.includes(graph.type) ||
|
ListChartTypes.includes(graph.type) ||
|
||||||
["readLabeledMetricsValues", "readMetricsValues"].includes(metricType.value)
|
[
|
||||||
|
ProtocolTypes.ReadLabeledMetricsValues,
|
||||||
|
ProtocolTypes.ReadMetricsValues,
|
||||||
|
].includes(metricType.value)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
const isTopn = computed(() =>
|
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 }) {
|
function updateConfig(index: number, param: { [key: string]: string }) {
|
||||||
const key = Object.keys(param)[0];
|
const key = Object.keys(param)[0];
|
||||||
|
@ -47,6 +47,15 @@ export const MetricChartType: any = {
|
|||||||
readSampledRecords: [{ label: "Top List", value: "TopList" }],
|
readSampledRecords: [{ label: "Top List", value: "TopList" }],
|
||||||
readRecords: [{ 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 } = {
|
export const DefaultGraphConfig: { [key: string]: any } = {
|
||||||
Bar: {
|
Bar: {
|
||||||
type: "Bar",
|
type: "Bar",
|
||||||
|
Loading…
Reference in New Issue
Block a user