Merge branch 'main' of github.com:apache/skywalking-booster-ui into bugfix/traceID

This commit is contained in:
Fine 2023-02-07 18:24:11 +08:00
commit 3a63353e13
10 changed files with 73 additions and 28 deletions

View File

@ -25,5 +25,6 @@ limitations under the License. -->
.app-main { .app-main {
height: calc(100% - 40px); height: calc(100% - 40px);
background: #f7f9fa; background: #f7f9fa;
overflow: auto;
} }
</style> </style>

View File

@ -182,7 +182,7 @@ const msg = {
iframeWidgetTip: "Add a link to a widget", iframeWidgetTip: "Add a link to a widget",
iframeSrc: "Iframe Link", iframeSrc: "Iframe Link",
generateLink: "Generate Link", generateLink: "Generate Link",
setDuration: "Set Duration", setDuration: "Lock Query Duration",
openFunction: "OpenFunction", openFunction: "OpenFunction",
seconds: "Seconds", seconds: "Seconds",
hourTip: "Select Hour", hourTip: "Select Hour",
@ -202,7 +202,7 @@ const msg = {
topology: "Topology", topology: "Topology",
trace: "Trace", trace: "Trace",
alarm: "Alerting", alarm: "Alerting",
auto: "Auto", auto: "Auto Fresh",
reload: "Reload", reload: "Reload",
version: "Version", version: "Version",
copy: "Copy", copy: "Copy",

View File

@ -165,7 +165,7 @@ const msg = {
iframeWidgetTip: "Añadir enlaces a los gadgets", iframeWidgetTip: "Añadir enlaces a los gadgets",
iframeSrc: "Enlace Iframe", iframeSrc: "Enlace Iframe",
generateLink: "Generar enlaces", generateLink: "Generar enlaces",
setDuration: "Establecer la duración", setDuration: "Duración de la consulta de bloqueo",
openFunction: "OpenFunction", openFunction: "OpenFunction",
seconds: "Segundos", seconds: "Segundos",
hourTip: "Seleccione Hora", hourTip: "Seleccione Hora",
@ -200,7 +200,7 @@ const msg = {
topology: "Topología", topology: "Topología",
trace: "Traza", trace: "Traza",
alarm: "Recordatorio en curso", alarm: "Recordatorio en curso",
auto: "Auto", auto: "Auto Fresh",
reload: "Recargar", reload: "Recargar",
version: "Versión", version: "Versión",
copy: "Copiar", copy: "Copiar",

View File

@ -179,7 +179,7 @@ const msg = {
iframeWidgetTip: "添加widget的链接", iframeWidgetTip: "添加widget的链接",
iframeSrc: "Iframe链接", iframeSrc: "Iframe链接",
generateLink: "生成链接", generateLink: "生成链接",
setDuration: "设置时间区间", setDuration: "锁定查询持续时间",
openFunction: "OpenFunction", openFunction: "OpenFunction",
seconds: "秒", seconds: "秒",
hourTip: "选择小时", hourTip: "选择小时",
@ -199,7 +199,7 @@ const msg = {
trace: "追踪", trace: "追踪",
alarm: "告警", alarm: "告警",
event: "事件", event: "事件",
auto: "自动", auto: "自动更新",
reload: "刷新", reload: "刷新",
editmode: "编辑模式", editmode: "编辑模式",
version: "版本", version: "版本",

View File

@ -32,6 +32,7 @@ limitations under the License. -->
</el-dialog> </el-dialog>
<el-dialog <el-dialog
v-model="dashboardStore.showLinkConfig" v-model="dashboardStore.showLinkConfig"
width="800px"
:destroy-on-close="true" :destroy-on-close="true"
@closed="dashboardStore.setWidgetLink(false)" @closed="dashboardStore.setWidgetLink(false)"
> >

View File

@ -54,6 +54,7 @@ limitations under the License. -->
import { useQueryProcessor, useSourceProcessor, useGetMetricEntity } from "@/hooks/useMetricsProcessor"; import { useQueryProcessor, useSourceProcessor, useGetMetricEntity } from "@/hooks/useMetricsProcessor";
import graphs from "./graphs"; import graphs from "./graphs";
import { EntityType } from "./data"; import { EntityType } from "./data";
import timeFormat from "@/utils/timeFormat";
export default defineComponent({ export default defineComponent({
name: "WidgetPage", name: "WidgetPage",
@ -77,9 +78,20 @@ limitations under the License. -->
async function init() { async function init() {
dashboardStore.setLayer(route.params.layer); dashboardStore.setLayer(route.params.layer);
dashboardStore.setEntity(route.params.entity); dashboardStore.setEntity(route.params.entity);
const { auto } = config.value;
if (auto) {
await setDuration();
appStoreWithOut.setReloadTimer(setInterval(setDuration, auto));
}
await setSelector(); await setSelector();
await queryMetrics(); await queryMetrics();
} }
async function setDuration() {
const dates: Date[] = [new Date(new Date().getTime() - config.value.auto), new Date()];
appStoreWithOut.setDuration(timeFormat(dates));
}
async function setSelector() { async function setSelector() {
const { serviceId, podId, processId, destServiceId, destPodId, destProcessId, entity } = route.params; const { serviceId, podId, processId, destServiceId, destPodId, destProcessId, entity } = route.params;
if (serviceId) { if (serviceId) {

View File

@ -15,18 +15,23 @@ limitations under the License. -->
<template> <template>
<div class="link-content"> <div class="link-content">
<div> <div>
<label class="mr-5">{{ t("setDuration") }}</label> <label>{{ t("setDuration") }}</label>
<el-switch v-model="hasDuration" /> <el-switch v-model="hasDuration" />
</div> </div>
<div v-if="hasDuration"> <div v-if="hasDuration">
<label class="mr-20">{{ t("duration") }}</label> <label>{{ t("duration") }}</label>
<TimePicker <TimePicker
:value="[appStore.durationRow.start, appStore.durationRow.end]" :value="[appStore.durationRow.start, appStore.durationRow.end]"
position="bottom" position="right"
format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
@input="changeTimeRange" @input="changeTimeRange"
/> />
</div> </div>
<div v-if="!hasDuration">
<label>{{ t("auto") }}</label>
<el-switch class="mr-5" v-model="auto" style="height: 25px" />
<Selector v-model="freshOpt" :options="RefreshOptions" size="small" />
</div>
<el-button size="small" type="primary" class="mt-20" @click="getLink">{{ t("generateLink") }}</el-button> <el-button size="small" type="primary" class="mt-20" @click="getLink">{{ t("generateLink") }}</el-button>
<div v-show="widgetLink" class="mt-10"> <div v-show="widgetLink" class="mt-10">
<span @click="viewPage" class="link"> <span @click="viewPage" class="link">
@ -46,15 +51,19 @@ limitations under the License. -->
import { useSelectorStore } from "@/store/modules/selectors"; import { useSelectorStore } from "@/store/modules/selectors";
import router from "@/router"; import router from "@/router";
import copy from "@/utils/copy"; import copy from "@/utils/copy";
import { RefreshOptions } from "@/views/dashboard/data";
import { TimeType } from "@/constants/data";
const { t } = useI18n(); const { t } = useI18n();
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
const hasDuration = ref<boolean>(true); const hasDuration = ref<boolean>(false);
const widgetLink = ref<string>(""); const widgetLink = ref<string>("");
const dates = ref<Date[]>([]); const dates = ref<Date[]>([]);
const host = window.location.host; const host = window.location.host;
const auto = ref<boolean>(true);
const freshOpt = ref<string>(RefreshOptions[0].value);
function changeTimeRange(val: Date[] | any) { function changeTimeRange(val: Date[] | any) {
dates.value = val; dates.value = val;
@ -75,28 +84,42 @@ limitations under the License. -->
step: appStore.durationRow.step, step: appStore.durationRow.step,
utc: appStore.utc, utc: appStore.utc,
}); });
const w = { const { widget, graph, metrics, metricTypes, metricConfig } = dashboardStore.selectedGrid;
title: encodeURIComponent(dashboardStore.selectedGrid.widget.title || ""), const c = (metricConfig || []).map((d: any) => {
tips: encodeURIComponent(dashboardStore.selectedGrid.widget.tips || ""), const t: any = {};
};
const metricConfig = (dashboardStore.selectedGrid.metricConfig || []).map((d: any) => {
if (d.label) { if (d.label) {
d.label = encodeURIComponent(d.label); t.label = encodeURIComponent(d.label);
} }
if (d.unit) { if (d.unit) {
d.unit = encodeURIComponent(d.unit); t.unit = encodeURIComponent(d.unit);
} }
return d; return { ...d, ...t };
}); });
const config = JSON.stringify({ const opt: any = {
type: dashboardStore.selectedGrid.type, type: dashboardStore.selectedGrid.type,
widget: w, graph: graph,
graph: dashboardStore.selectedGrid.graph, metrics: metrics,
metrics: dashboardStore.selectedGrid.metrics, metricTypes: metricTypes,
metricTypes: dashboardStore.selectedGrid.metricTypes, metricConfig: c,
metricConfig: metricConfig,
height: dashboardStore.selectedGrid.h * 20 + 60, height: dashboardStore.selectedGrid.h * 20 + 60,
}); };
if (widget) {
opt.widget = {
title: encodeURIComponent(widget.title || ""),
tips: encodeURIComponent(widget.tips || ""),
};
}
if (auto.value) {
const f = RefreshOptions.filter((d: { value: string }) => d.value === freshOpt.value)[0] || {};
opt.auto = Number(f.value) * 60 * 1000;
if (f.step === TimeType.HOUR_TIME) {
opt.auto = Number(f.value) * 60 * 60 * 1000;
}
if (f.step === TimeType.DAY_TIME) {
opt.auto = Number(f.value) * 60 * 60 * 60 * 1000;
}
}
const config = JSON.stringify(opt);
const path = `/page/${dashboardStore.layerId}/${ const path = `/page/${dashboardStore.layerId}/${
dashboardStore.entity dashboardStore.entity
}/${serviceId}/${podId}/${processId}/${destServiceId}/${destPodId}/${destProcessId}/${encodeURIComponent(config)}`; }/${serviceId}/${podId}/${processId}/${destServiceId}/${destPodId}/${destProcessId}/${encodeURIComponent(config)}`;
@ -120,6 +143,11 @@ limitations under the License. -->
height: 300px; height: 300px;
font-size: 12px; font-size: 12px;
overflow: auto; overflow: auto;
padding-bottom: 10px; padding-bottom: 50px;
}
label {
display: inline-block;
width: 250px;
} }
</style> </style>

View File

@ -318,3 +318,8 @@ export const RefIdTypes = [
{ label: "Trace ID", value: "traceId" }, { label: "Trace ID", value: "traceId" },
{ label: "None", value: "none" }, { label: "None", value: "none" },
]; ];
export const RefreshOptions = [
{ label: "Last 30 minutes", value: "30", step: "MINUTE" },
{ label: "Last 8 hours", value: "8", step: "HOUR" },
{ label: "Last 7 days", value: "7", step: "DAY" },
];

View File

@ -104,7 +104,6 @@ limitations under the License. -->
() => selectorStore.currentService, () => selectorStore.currentService,
() => { () => {
searchTasks(); searchTasks();
console.log("service");
}, },
); );
watch( watch(

View File

@ -220,7 +220,6 @@ limitations under the License. -->
visGraph.value.on("select", (data: { items: number[] }) => { visGraph.value.on("select", (data: { items: number[] }) => {
const index = data.items[0]; const index = data.items[0];
currentEvent.value = events[index - 1 || 0] || {}; currentEvent.value = events[index - 1 || 0] || {};
console.log(currentEvent.value);
if (data.items.length) { if (data.items.length) {
showEventDetail.value = true; showEventDetail.value = true;
return; return;