mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-06-17 02:47:35 +00:00
feat: enhance the TTL Tab on Setting page (#473)
This commit is contained in:
parent
e4a43d91e2
commit
35a1ff9b24
@ -397,8 +397,8 @@ const msg = {
|
|||||||
instances: "Instances",
|
instances: "Instances",
|
||||||
snapshot: "Snapshot",
|
snapshot: "Snapshot",
|
||||||
expression: "Expression",
|
expression: "Expression",
|
||||||
metricsTTL: "Metrics TTL",
|
metricsTTL: "Metrics TTL (day)",
|
||||||
recordsTTL: "Records TTL",
|
recordsTTL: "Records TTL (day)",
|
||||||
clusterNodes: "Cluster Nodes",
|
clusterNodes: "Cluster Nodes",
|
||||||
debuggingConfigDump: "Dump Effective Configurations",
|
debuggingConfigDump: "Dump Effective Configurations",
|
||||||
customDuration: "Custom Duration",
|
customDuration: "Custom Duration",
|
||||||
|
@ -397,8 +397,8 @@ const msg = {
|
|||||||
snapshot: "Snapshot",
|
snapshot: "Snapshot",
|
||||||
expression: "Expression",
|
expression: "Expression",
|
||||||
asSelector: "As Selector",
|
asSelector: "As Selector",
|
||||||
metricsTTL: "Metrics TTL",
|
metricsTTL: "Metrics TTL (day)",
|
||||||
recordsTTL: "Records TTL",
|
recordsTTL: "Records TTL (day)",
|
||||||
clusterNodes: "Cluster Nodes",
|
clusterNodes: "Cluster Nodes",
|
||||||
debuggingConfigDump: "Dump Effective Configurations",
|
debuggingConfigDump: "Dump Effective Configurations",
|
||||||
customDuration: "Duración Personalizada",
|
customDuration: "Duración Personalizada",
|
||||||
|
@ -395,8 +395,8 @@ const msg = {
|
|||||||
instances: "实例",
|
instances: "实例",
|
||||||
snapshot: "快照",
|
snapshot: "快照",
|
||||||
expression: "表达式",
|
expression: "表达式",
|
||||||
metricsTTL: "Metrics TTL",
|
metricsTTL: "Metrics TTL (day)",
|
||||||
recordsTTL: "Records TTL",
|
recordsTTL: "Records TTL (day)",
|
||||||
clusterNodes: "集群节点",
|
clusterNodes: "集群节点",
|
||||||
debuggingConfigDump: "转储有效配置",
|
debuggingConfigDump: "转储有效配置",
|
||||||
customDuration: "自定义时长",
|
customDuration: "自定义时长",
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { WidgetType } from "@/views/dashboard/data";
|
import { WidgetType } from "@/views/dashboard/data";
|
||||||
|
import { HotAndWarmOpt } from "@/views/settings/data";
|
||||||
|
|
||||||
export const NewControl = {
|
export const NewControl = {
|
||||||
x: 0,
|
x: 0,
|
||||||
@ -58,3 +59,18 @@ export enum EBPFProfilingTriggerType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const EndpointsTopNDefault = 20;
|
export const EndpointsTopNDefault = 20;
|
||||||
|
|
||||||
|
export const TTLTypes = {
|
||||||
|
HotAndWarm: "Hot / Warm",
|
||||||
|
Cold: "Cold",
|
||||||
|
};
|
||||||
|
export const TTLColdMap: Indexable<string> = {
|
||||||
|
coldDay: HotAndWarmOpt[0],
|
||||||
|
coldHour: HotAndWarmOpt[1],
|
||||||
|
coldMinute: HotAndWarmOpt[2],
|
||||||
|
coldNormal: HotAndWarmOpt[3],
|
||||||
|
coldTrace: HotAndWarmOpt[4],
|
||||||
|
coldZipkinTrace: HotAndWarmOpt[5],
|
||||||
|
coldLog: HotAndWarmOpt[6],
|
||||||
|
coldBrowserErrorLog: HotAndWarmOpt[7],
|
||||||
|
};
|
||||||
|
@ -18,6 +18,8 @@ import { defineStore } from "pinia";
|
|||||||
import { store } from "@/store";
|
import { store } from "@/store";
|
||||||
import fetchQuery from "@/graphql/http";
|
import fetchQuery from "@/graphql/http";
|
||||||
import type { ClusterNode, ConfigTTL } from "@/types/settings";
|
import type { ClusterNode, ConfigTTL } from "@/types/settings";
|
||||||
|
import { HotAndWarmOpt } from "@/views/settings/data";
|
||||||
|
import { TTLTypes, TTLColdMap } from "../data";
|
||||||
|
|
||||||
interface SettingsState {
|
interface SettingsState {
|
||||||
clusterNodes: ClusterNode[];
|
clusterNodes: ClusterNode[];
|
||||||
@ -46,7 +48,20 @@ export const settingsStore = defineStore({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "ConfigTTL",
|
path: "ConfigTTL",
|
||||||
});
|
});
|
||||||
this.configTTL = response;
|
for (const item of Object.keys(response)) {
|
||||||
|
const rows = [];
|
||||||
|
const row: Indexable<string> = { type: TTLTypes.HotAndWarm };
|
||||||
|
const rowCold: Indexable<string> = { type: TTLTypes.Cold };
|
||||||
|
for (const key of Object.keys(response[item])) {
|
||||||
|
if (HotAndWarmOpt.includes(key)) {
|
||||||
|
row[key] = response[item][key];
|
||||||
|
} else {
|
||||||
|
rowCold[TTLColdMap[key] as string] = response[item][key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rows.push(row, rowCold);
|
||||||
|
this.configTTL[item] = rows;
|
||||||
|
}
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
async getDebuggingConfigDump() {
|
async getDebuggingConfigDump() {
|
||||||
|
@ -15,43 +15,16 @@ limitations under the License. -->
|
|||||||
<template>
|
<template>
|
||||||
<div class="ttl">
|
<div class="ttl">
|
||||||
<div class="label">{{ t("metricsTTL") }}</div>
|
<div class="label">{{ t("metricsTTL") }}</div>
|
||||||
<el-table
|
<TTLTable :data="settingsStore.configTTL.metrics" :metricsRows="MetricsTTLRow" />
|
||||||
:data="[settingsStore.configTTL.metrics]"
|
|
||||||
class="mb-5"
|
|
||||||
:row-style="{ backgroundColor: 'var(--layout-background)' }"
|
|
||||||
>
|
|
||||||
<el-table-column v-for="item in MetricsTTLRow" :prop="item.value" :label="item.label" :key="item.value">
|
|
||||||
{{
|
|
||||||
settingsStore.configTTL?.metrics
|
|
||||||
? settingsStore.configTTL.metrics[item.value] < 0
|
|
||||||
? "N/A"
|
|
||||||
: (settingsStore.configTTL?.metrics ?? {})[item.value]
|
|
||||||
: "N/A"
|
|
||||||
}}
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<div class="label">{{ t("recordsTTL") }}</div>
|
<div class="label">{{ t("recordsTTL") }}</div>
|
||||||
<el-table
|
<TTLTable :data="settingsStore.configTTL.records" :metricsRows="RecordsTTLRow" />
|
||||||
:data="[settingsStore.configTTL.records]"
|
|
||||||
class="mb-5"
|
|
||||||
:row-style="{ backgroundColor: 'var(--layout-background)' }"
|
|
||||||
>
|
|
||||||
<el-table-column v-for="item in RecordsTTLRow" :prop="item.value" :label="item.label" :key="item.value">
|
|
||||||
{{
|
|
||||||
settingsStore.configTTL?.records
|
|
||||||
? settingsStore.configTTL?.records[item.value] < 0
|
|
||||||
? "N/A"
|
|
||||||
: (settingsStore.configTTL?.records || {})[item.value]
|
|
||||||
: "N/A"
|
|
||||||
}}
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted } from "vue";
|
import { onMounted } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useSettingsStore } from "@/store/modules/settings";
|
import { useSettingsStore } from "@/store/modules/settings";
|
||||||
|
import TTLTable from "./TTLTable.vue";
|
||||||
import { MetricsTTLRow, RecordsTTLRow } from "../data";
|
import { MetricsTTLRow, RecordsTTLRow } from "../data";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
44
src/views/settings/components/TTLTable.vue
Normal file
44
src/views/settings/components/TTLTable.vue
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License. -->
|
||||||
|
<template>
|
||||||
|
<el-table
|
||||||
|
:data="data"
|
||||||
|
class="mb-5"
|
||||||
|
:row-style="{ backgroundColor: 'var(--layout-background)' }"
|
||||||
|
:cell-style="(data: Indexable) => (data.columnIndex === 0 ? { backgroundColor: 'var(--el-table-header-bg-color)' } : {})"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
v-for="item in metricsRows"
|
||||||
|
:prop="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:key="item.value"
|
||||||
|
:width="item.width"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
{{ scope.row && scope.row[item.value] ? (scope.row[item.value] < 0 ? "N/A" : scope.row[item.value]) : "N/A" }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
/*global PropType, Indexable */
|
||||||
|
defineProps({
|
||||||
|
metricsRows: {
|
||||||
|
type: Array as PropType<{ width?: number; value: string; label: string }[]>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
data: { type: Array as PropType<Indexable[]>, default: () => [] },
|
||||||
|
});
|
||||||
|
</script>
|
@ -49,72 +49,53 @@ export const SettingsTabs = [
|
|||||||
value: "dumpEffectiveConfigurations",
|
value: "dumpEffectiveConfigurations",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const HotAndWarmOpt = ["day", "hour", "minute", "normal", "trace", "zipkinTrace", "log", "browserErrorLog"];
|
||||||
|
|
||||||
export const MetricsTTLRow = [
|
export const MetricsTTLRow = [
|
||||||
|
{
|
||||||
|
label: "Type",
|
||||||
|
value: "type",
|
||||||
|
width: 260,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Day",
|
label: "Day",
|
||||||
value: "day",
|
value: HotAndWarmOpt[0],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Hour",
|
label: "Hour",
|
||||||
value: "hour",
|
value: HotAndWarmOpt[1],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Minute",
|
label: "Minute",
|
||||||
value: "minute",
|
value: HotAndWarmOpt[2],
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Cold Day",
|
|
||||||
value: "coldDay",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Cold Hour",
|
|
||||||
value: "coldHour",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Cold Minute",
|
|
||||||
value: "coldMinute",
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const RecordsTTLRow = [
|
export const RecordsTTLRow = [
|
||||||
|
{
|
||||||
|
label: "Type",
|
||||||
|
value: "type",
|
||||||
|
width: 260,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Normal",
|
label: "Normal",
|
||||||
value: "normal",
|
value: HotAndWarmOpt[3],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Trace",
|
label: "Trace",
|
||||||
value: "trace",
|
value: HotAndWarmOpt[4],
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Log",
|
|
||||||
value: "log",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Zipkin Trace",
|
label: "Zipkin Trace",
|
||||||
value: "zipkinTrace",
|
value: HotAndWarmOpt[5],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Log",
|
||||||
|
value: HotAndWarmOpt[6],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Browser Error Log",
|
label: "Browser Error Log",
|
||||||
value: "browserErrorLog",
|
value: HotAndWarmOpt[7],
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Cold Normal",
|
|
||||||
value: "coldNormal",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Cold Trace",
|
|
||||||
value: "coldTrace",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Cold Zipkin Trace",
|
|
||||||
value: "coldZipkinTrace",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Cold Log",
|
|
||||||
value: "coldLog",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Cold Browser Error Log",
|
|
||||||
value: "coldBrowserErrorLog",
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user