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",
|
||||
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.",
|
||||
tabExpressions: "Tab Expressions",
|
||||
};
|
||||
export default msg;
|
||||
|
@ -384,5 +384,6 @@ const msg = {
|
||||
unhealthyExpression: "Unhealthy Expression",
|
||||
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.",
|
||||
tabExpressions: "Tab Expressions",
|
||||
};
|
||||
export default msg;
|
||||
|
@ -382,5 +382,6 @@ const msg = {
|
||||
unhealthyExpression: "非健康表达式",
|
||||
traceDesc:
|
||||
"Trace Segment代表在单一操作系统进程(例如JVM)中执行的追踪部分。它包含了一组跨度(spans),这些跨度通常与单一请求或执行上下文关联。",
|
||||
tabExpressions: "Tab表达式",
|
||||
};
|
||||
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[];
|
||||
metricTypes?: string[];
|
||||
typesOfMQE?: string[];
|
||||
children?: { name: string; children: LayoutConfig[] }[];
|
||||
children?: { name: string; children: LayoutConfig[]; expression?: string }[];
|
||||
activedTabIndex?: number;
|
||||
metricConfig?: MetricConfigOpt[];
|
||||
id?: string;
|
||||
|
@ -12,8 +12,11 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License. -->
|
||||
<template>
|
||||
<div class="item">
|
||||
<span class="label">{{ t("expressions") }}</span>
|
||||
<el-input class="input" v-model="expressions" size="small" @change="changeConfig" />
|
||||
<span class="label">{{ t("tabExpressions") }}</span>
|
||||
<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 class="footer">
|
||||
<el-button size="small" @click="cancelConfig">
|
||||
@ -26,23 +29,31 @@ limitations under the License. -->
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { ref } from "vue";
|
||||
import { reactive } from "vue";
|
||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const { t } = useI18n();
|
||||
const dashboardStore = useDashboardStore();
|
||||
const originConfig = dashboardStore.selectedGrid;
|
||||
const expressions = ref<string>(originConfig.expressions);
|
||||
const expressions = reactive<{ [key: string]: string }>({});
|
||||
|
||||
function changeConfig() {
|
||||
if (!expressions.value.includes("is_present")) {
|
||||
for (const child of originConfig.children || []) {
|
||||
expressions[child.name] = child.expression || "";
|
||||
}
|
||||
function changeExpression(name: string) {
|
||||
if (!expressions[name].includes("is_present")) {
|
||||
ElMessage.error("Only support the is_present function");
|
||||
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() {
|
||||
dashboardStore.setConfigPanel(false);
|
||||
@ -80,4 +91,9 @@ limitations under the License. -->
|
||||
width: 100%;
|
||||
background-color: $theme-background;
|
||||
}
|
||||
|
||||
.name {
|
||||
width: 180px;
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
|
@ -149,6 +149,7 @@ limitations under the License. -->
|
||||
dashboardStore.setCurrentTabItems(dashboardStore.layout[l].children[activeTabIndex.value].children);
|
||||
dashboardStore.setActiveTabIndex(activeTabIndex.value, props.data.i);
|
||||
}
|
||||
console.log(props.data);
|
||||
|
||||
// if (props.needQuery || !dashboardStore.currentDashboard.id) {
|
||||
// queryExpressions();
|
||||
@ -240,12 +241,16 @@ limitations under the License. -->
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.data.expressions,
|
||||
() => (props.data.children || []).map((d: { name: string }) => d.name),
|
||||
() => {
|
||||
queryExpressions();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user