fix: add ProcessRelation to entity types (#194)

This commit is contained in:
Fine0830 2022-11-28 22:49:23 +08:00 committed by GitHub
parent d8f91bbdf3
commit 5be106fc4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 73 deletions

View File

@ -73,35 +73,9 @@ export function useQueryProcessor(config: any) {
topN: c.topN || 10,
order: c.sortOrder || "DES",
};
} else if ([MetricQueryTypes.ReadRecords].includes(metricType)) {
variables.push(`$condition${index}: RecordCondition!`);
conditions[`condition${index}`] = {
name,
parentEntity: {
scope: config.catalog,
normal: selectorStore.currentService
? selectorStore.currentService.normal
: true,
serviceName: ["All"].includes(dashboardStore.entity)
? null
: selectorStore.currentService.value,
},
topN: c.topN || 10,
order: c.sortOrder || "DES",
};
} else {
if (metricType === MetricQueryTypes.ReadLabeledMetricsValues) {
const labels = (c.labelsIndex || "")
.split(",")
.map((item: string) => item.replace(/^\s*|\s*$/g, ""));
variables.push(`$labels${index}: [String!]!`);
conditions[`labels${index}`] = labels;
}
variables.push(`$condition${index}: MetricsCondition!`);
conditions[`condition${index}`] = {
name,
entity: {
scope: dashboardStore.entity,
const entity = {
scope: config.catalog,
serviceName:
dashboardStore.entity === "All"
? undefined
@ -137,15 +111,36 @@ export function useQueryProcessor(config: any) {
: undefined,
destEndpointName:
dashboardStore.entity === "EndpointRelation"
? selectorStore.currentDestPod &&
selectorStore.currentDestPod.value
? selectorStore.currentDestPod && selectorStore.currentDestPod.value
: undefined,
destProcessName: dashboardStore.entity.includes("ProcessRelation")
? selectorStore.currentDestProcess &&
selectorStore.currentDestProcess.value
: undefined,
},
};
if ([MetricQueryTypes.ReadRecords].includes(metricType)) {
variables.push(`$condition${index}: RecordCondition!`);
conditions[`condition${index}`] = {
name,
parentEntity: entity,
topN: c.topN || 10,
order: c.sortOrder || "DES",
};
} else {
entity.scope = dashboardStore.entity;
if (metricType === MetricQueryTypes.ReadLabeledMetricsValues) {
const labels = (c.labelsIndex || "")
.split(",")
.map((item: string) => item.replace(/^\s*|\s*$/g, ""));
variables.push(`$labels${index}: [String!]!`);
conditions[`labels${index}`] = labels;
}
variables.push(`$condition${index}: MetricsCondition!`);
conditions[`condition${index}`] = {
name,
entity,
};
}
}
if (metricType === MetricQueryTypes.ReadLabeledMetricsValues) {
return `${name}${index}: ${metricType}(condition: $condition${index}, labels: $labels${index}, duration: $duration)${RespFields[metricType]}`;

View File

@ -107,7 +107,7 @@ if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) {
} else {
appStore.setIsMobile(false);
}
const isCollapse = ref(true);
const isCollapse = ref(false);
const controlMenu = () => {
isCollapse.value = !isCollapse.value;
};

View File

@ -145,6 +145,7 @@ export enum MetricCatalog {
SERVICE_RELATION = "ServiceRelation",
SERVICE_INSTANCE_RELATION = "ServiceInstanceRelation",
ENDPOINT_RELATION = "EndpointRelation",
PROCESS_RELATION = "ProcessRelation",
}
export const EntityType = [
{ value: "Service", label: "Service", key: 1 },

View File

@ -43,7 +43,11 @@ limitations under the License. -->
</div>
<el-progress
:stroke-width="6"
:percentage="(i.value / maxValue) * 100"
:percentage="
isNaN(Number(i.value) / maxValue)
? 0
: (Number(i.value) / maxValue) * 100
"
:color="TextColors[config.color || 'purple']"
:show-text="false"
/>

View File

@ -69,8 +69,8 @@ const activeNames = ref([0]);
const conditionsList = ref<NetworkProfilingRequest[]>([
{
uriRegex: "",
when4xx: InitTaskField.Whenxx[0].value,
when5xx: InitTaskField.Whenxx[1].value,
when4xx: InitTaskField.Whenxx[1].value,
when5xx: InitTaskField.Whenxx[0].value,
minDuration: NaN,
},
]);