mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-17 17:35:24 +00:00
update param
This commit is contained in:
parent
64eafab10d
commit
abcd41e5d1
@ -13,8 +13,8 @@ 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>
|
||||
<Edit v-if="hasRoot" @update="changeStatus" />
|
||||
<div class="no-root" v-else>
|
||||
<Edit v-if="dashboardStore.currentDashboard" />
|
||||
<div v-else class="no-root">
|
||||
{{ t("noRoot") }} {{ dashboardStore.layerId }}
|
||||
</div>
|
||||
</template>
|
||||
@ -26,9 +26,11 @@ import { EntityType } from "./dashboard/data";
|
||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||
import Edit from "./dashboard/Edit.vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const appStore = useAppStoreWithOut();
|
||||
const dashboardStore = useDashboardStore();
|
||||
const routeNames = [
|
||||
"GeneralServices",
|
||||
@ -43,7 +45,6 @@ const routeNames = [
|
||||
"Browser",
|
||||
];
|
||||
const layer = ref<string>("GENERAL");
|
||||
const hasRoot = ref<boolean>(false);
|
||||
|
||||
getDashboard();
|
||||
|
||||
@ -52,11 +53,22 @@ async function getDashboard() {
|
||||
dashboardStore.setLayer(layer.value);
|
||||
dashboardStore.setEntity(EntityType[1].value);
|
||||
dashboardStore.setMode(false);
|
||||
await dashboardStore.setDashboards();
|
||||
const index = dashboardStore.dashboards.findIndex(
|
||||
(d: { name: string; isRoot: boolean; layer: string; entity: string }) =>
|
||||
d.layer === dashboardStore.layerId &&
|
||||
d.entity === EntityType[1].value &&
|
||||
d.isRoot
|
||||
);
|
||||
if (index < 0) {
|
||||
appStore.setPageTitle(dashboardStore.layer);
|
||||
dashboardStore.setCurrentDashboard(null);
|
||||
return;
|
||||
}
|
||||
const item = dashboardStore.dashboards[index];
|
||||
dashboardStore.setCurrentDashboard(item);
|
||||
}
|
||||
|
||||
function changeStatus(p: boolean) {
|
||||
hasRoot.value = p;
|
||||
}
|
||||
function setLayer(n: string) {
|
||||
switch (n) {
|
||||
case routeNames[0]:
|
||||
|
@ -43,35 +43,18 @@ import TopologyConfig from "./configuration/Topology.vue";
|
||||
import WidgetConfig from "./configuration/Widget.vue";
|
||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||
import { EntityType } from "./data";
|
||||
|
||||
/*global defineEmits */
|
||||
const emit = defineEmits(["update"]);
|
||||
const dashboardStore = useDashboardStore();
|
||||
const appStore = useAppStoreWithOut();
|
||||
const { t } = useI18n();
|
||||
const p = useRoute().params;
|
||||
const layoutKey = ref<string>(`${p.layerId}_${p.entity}_${p.name}`);
|
||||
dashboardStore.setCurrentDashboard({});
|
||||
|
||||
setTemplate();
|
||||
async function setTemplate() {
|
||||
await dashboardStore.setDashboards();
|
||||
|
||||
if (!p.entity) {
|
||||
const index = dashboardStore.dashboards.findIndex(
|
||||
(d: { name: string; isRoot: boolean; layer: string; entity: string }) =>
|
||||
d.layer === dashboardStore.layerId &&
|
||||
d.entity === EntityType[1].value &&
|
||||
d.isRoot
|
||||
);
|
||||
if (index < 0) {
|
||||
appStore.setPageTitle(dashboardStore.layer);
|
||||
dashboardStore.setCurrentDashboard(null);
|
||||
emit("update", false);
|
||||
return;
|
||||
}
|
||||
const item = dashboardStore.dashboards[index];
|
||||
dashboardStore.setCurrentDashboard(item);
|
||||
const { layer, entity, name } = dashboardStore.currentDashboard;
|
||||
layoutKey.value = `${layer}_${entity}_${name}`;
|
||||
}
|
||||
@ -81,7 +64,6 @@ async function setTemplate() {
|
||||
const layout: any = c.configuration || {};
|
||||
dashboardStore.setLayout(layout.children || []);
|
||||
appStore.setPageTitle(layout.name);
|
||||
|
||||
if (p.entity) {
|
||||
dashboardStore.setCurrentDashboard({
|
||||
layer: p.layerId,
|
||||
@ -91,7 +73,6 @@ async function setTemplate() {
|
||||
isRoot: layout.isRoot,
|
||||
});
|
||||
}
|
||||
emit("update", true);
|
||||
}
|
||||
|
||||
function handleClick(e: any) {
|
||||
|
@ -165,12 +165,6 @@ function setCurrentDashboard() {
|
||||
if (params.layerId) {
|
||||
dashboardStore.setLayer(params.layerId);
|
||||
dashboardStore.setEntity(params.entity);
|
||||
const item = getDashboard({
|
||||
name: String(params.name),
|
||||
layer: dashboardStore.layerId,
|
||||
entity: EntityType[3].value,
|
||||
});
|
||||
dashboardStore.setCurrentDashboard(item || null);
|
||||
}
|
||||
const type = EntityType.filter(
|
||||
(d: Option) => d.value === dashboardStore.entity
|
||||
@ -213,7 +207,8 @@ async function setSelector() {
|
||||
}
|
||||
selectorStore.setCurrentService(currentService);
|
||||
selectorStore.setCurrentDestService(currentDestService);
|
||||
states.currentService = selectorStore.currentService.value;
|
||||
states.currentService =
|
||||
selectorStore.currentService && selectorStore.currentService.value;
|
||||
states.currentDestService =
|
||||
selectorStore.currentDestService && selectorStore.currentDestService.value;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user