fix: polish pages and validate data (#46)

This commit is contained in:
Fine0830
2022-03-30 16:29:19 +08:00
committed by GitHub
parent 61d182b986
commit 767c92c60d
26 changed files with 241 additions and 192 deletions

View File

@@ -26,6 +26,8 @@ export enum MetricQueryTypes {
export enum Calculations {
Percentage = "percentage",
ByteToKB = "byteToKB",
ByteToMB = "ByteToMB",
ByteToGB = "ByteToGB",
Apdex = "apdex",
Precision = "precision",
ConvertSeconds = "convertSeconds",

View File

@@ -28,6 +28,9 @@ export function useQueryProcessor(config: any) {
if (!(config.metrics && config.metrics[0])) {
return;
}
if (!(config.metricTypes && config.metricTypes[0])) {
return;
}
const appStore = useAppStoreWithOut();
const dashboardStore = useDashboardStore();
const selectorStore = useSelectorStore();
@@ -221,13 +224,19 @@ export function useQueryPodsMetrics(
config: { metrics: string[]; metricTypes: string[] },
scope: string
) {
if (!(config.metrics && config.metrics[0])) {
return;
}
if (!(config.metricTypes && config.metricTypes[0])) {
return;
}
const appStore = useAppStoreWithOut();
const selectorStore = useSelectorStore();
const conditions: { [key: string]: unknown } = {
duration: appStore.durationTime,
};
const variables: string[] = [`$duration: Duration!`];
const { currentService } = selectorStore;
const currentService = selectorStore.currentService || {};
const fragmentList = pods.map(
(
d: (Instance | Endpoint | Service) & { normal: boolean },
@@ -324,6 +333,12 @@ export function aggregation(val: number, config: any): number | string {
case Calculations.ByteToKB:
data = val / 1024;
break;
case Calculations.ByteToMB:
data = val / 1024 / 1024;
break;
case Calculations.ByteToGB:
data = val / 1024 / 1024 / 1024;
break;
case Calculations.Apdex:
data = val / 10000;
break;