mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-12 15:52:57 +00:00
feat: update config
This commit is contained in:
parent
b8cf8fea4b
commit
57f13f2ac5
@ -384,5 +384,6 @@ const msg = {
|
|||||||
unhealthyExpression: "Unhealthy Expression",
|
unhealthyExpression: "Unhealthy Expression",
|
||||||
traceDesc:
|
traceDesc:
|
||||||
"The trace segment serves as a representation of a trace portion executed within one single OS process, such as a JVM. It comprises a collection of spans, typically associated with and collected from a single request or execution context.",
|
"The trace segment serves as a representation of a trace portion executed within one single OS process, such as a JVM. It comprises a collection of spans, typically associated with and collected from a single request or execution context.",
|
||||||
|
tabExpressions: "Tab Expressions",
|
||||||
};
|
};
|
||||||
export default msg;
|
export default msg;
|
||||||
|
@ -384,5 +384,6 @@ const msg = {
|
|||||||
unhealthyExpression: "Unhealthy Expression",
|
unhealthyExpression: "Unhealthy Expression",
|
||||||
traceDesc:
|
traceDesc:
|
||||||
"The trace segment serves as a representation of a trace portion executed within one single OS process, such as a JVM. It comprises a collection of spans, typically associated with and collected from a single request or execution context.",
|
"The trace segment serves as a representation of a trace portion executed within one single OS process, such as a JVM. It comprises a collection of spans, typically associated with and collected from a single request or execution context.",
|
||||||
|
tabExpressions: "Tab Expressions",
|
||||||
};
|
};
|
||||||
export default msg;
|
export default msg;
|
||||||
|
@ -382,5 +382,6 @@ const msg = {
|
|||||||
unhealthyExpression: "非健康表达式",
|
unhealthyExpression: "非健康表达式",
|
||||||
traceDesc:
|
traceDesc:
|
||||||
"Trace Segment代表在单一操作系统进程(例如JVM)中执行的追踪部分。它包含了一组跨度(spans),这些跨度通常与单一请求或执行上下文关联。",
|
"Trace Segment代表在单一操作系统进程(例如JVM)中执行的追踪部分。它包含了一组跨度(spans),这些跨度通常与单一请求或执行上下文关联。",
|
||||||
|
tabExpressions: "Tab表达式",
|
||||||
};
|
};
|
||||||
export default msg;
|
export default msg;
|
||||||
|
2
src/types/dashboard.d.ts
vendored
2
src/types/dashboard.d.ts
vendored
@ -36,7 +36,7 @@ export interface LayoutConfig {
|
|||||||
expressions?: string[];
|
expressions?: string[];
|
||||||
metricTypes?: string[];
|
metricTypes?: string[];
|
||||||
typesOfMQE?: string[];
|
typesOfMQE?: string[];
|
||||||
children?: { name: string; children: LayoutConfig[] }[];
|
children?: { name: string; children: LayoutConfig[]; expression?: string }[];
|
||||||
activedTabIndex?: number;
|
activedTabIndex?: number;
|
||||||
metricConfig?: MetricConfigOpt[];
|
metricConfig?: MetricConfigOpt[];
|
||||||
id?: string;
|
id?: string;
|
||||||
|
@ -12,8 +12,11 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<span class="label">{{ t("expressions") }}</span>
|
<span class="label">{{ t("tabExpressions") }}</span>
|
||||||
<el-input class="input" v-model="expressions" size="small" @change="changeConfig" />
|
<div class="mt-10" v-for="(child, index) in dashboardStore.selectedGrid.children || []" :key="index">
|
||||||
|
<span class="name">{{ child.name }}</span>
|
||||||
|
<el-input class="input" size="small" v-model="expressions[child.name]" @change="changeExpression(child.name)" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<el-button size="small" @click="cancelConfig">
|
<el-button size="small" @click="cancelConfig">
|
||||||
@ -26,23 +29,31 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { ref } from "vue";
|
import { reactive } from "vue";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const originConfig = dashboardStore.selectedGrid;
|
const originConfig = dashboardStore.selectedGrid;
|
||||||
const expressions = ref<string>(originConfig.expressions);
|
const expressions = reactive<{ [key: string]: string }>({});
|
||||||
|
|
||||||
function changeConfig() {
|
for (const child of originConfig.children || []) {
|
||||||
if (!expressions.value.includes("is_present")) {
|
expressions[child.name] = child.expression || "";
|
||||||
|
}
|
||||||
|
function changeExpression(name: string) {
|
||||||
|
if (!expressions[name].includes("is_present")) {
|
||||||
ElMessage.error("Only support the is_present function");
|
ElMessage.error("Only support the is_present function");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { selectedGrid } = dashboardStore;
|
const children = dashboardStore.selectedGrid.children || [];
|
||||||
|
|
||||||
dashboardStore.selectWidget({ ...selectedGrid, expressions: expressions.value });
|
for (const item of children) {
|
||||||
|
if (item.name === name) {
|
||||||
|
item.expression = expressions[name];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dashboardStore.selectWidget({ ...dashboardStore.selectedGrid, children });
|
||||||
}
|
}
|
||||||
function applyConfig() {
|
function applyConfig() {
|
||||||
dashboardStore.setConfigPanel(false);
|
dashboardStore.setConfigPanel(false);
|
||||||
@ -80,4 +91,9 @@ limitations under the License. -->
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: $theme-background;
|
background-color: $theme-background;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
width: 180px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -149,6 +149,7 @@ limitations under the License. -->
|
|||||||
dashboardStore.setCurrentTabItems(dashboardStore.layout[l].children[activeTabIndex.value].children);
|
dashboardStore.setCurrentTabItems(dashboardStore.layout[l].children[activeTabIndex.value].children);
|
||||||
dashboardStore.setActiveTabIndex(activeTabIndex.value, props.data.i);
|
dashboardStore.setActiveTabIndex(activeTabIndex.value, props.data.i);
|
||||||
}
|
}
|
||||||
|
console.log(props.data);
|
||||||
|
|
||||||
// if (props.needQuery || !dashboardStore.currentDashboard.id) {
|
// if (props.needQuery || !dashboardStore.currentDashboard.id) {
|
||||||
// queryExpressions();
|
// queryExpressions();
|
||||||
@ -240,12 +241,16 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function queryExpressions() {
|
async function queryExpressions() {
|
||||||
const params = (await useExpressionsQueryProcessor({ metrics: [props.data.expressions] })) || {};
|
const metrics = [];
|
||||||
|
for (const child of props.data.children || []) {
|
||||||
|
child.expression && metrics.push(child.expression);
|
||||||
|
}
|
||||||
|
const params = (await useExpressionsQueryProcessor({ metrics })) || {};
|
||||||
console.log(params);
|
console.log(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.data.expressions,
|
() => (props.data.children || []).map((d: { name: string }) => d.name),
|
||||||
() => {
|
() => {
|
||||||
queryExpressions();
|
queryExpressions();
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user