fix dashboards

This commit is contained in:
Qiuxia Fan 2022-03-19 11:33:10 +08:00
parent aa73338e47
commit eea641d8ce
3 changed files with 6 additions and 3 deletions

View File

@ -78,7 +78,7 @@ async function setTemplate() {
dashboardStore.setCurrentDashboard({ dashboardStore.setCurrentDashboard({
layer: p.layerId, layer: p.layerId,
entity: p.entity, entity: p.entity,
name: p.name, name: String(p.name).split("-").join(" "),
id: c.id, id: c.id,
isRoot: layout.isRoot, isRoot: layout.isRoot,
}); });

View File

@ -214,8 +214,7 @@ function handleView(row: DashboardItem) {
} }
async function setRoot(row: DashboardItem) { async function setRoot(row: DashboardItem) {
console.log(row); const items: DashboardItem[] = [];
const items: any[] = [];
loading.value = true; loading.value = true;
for (const d of dashboardStore.dashboards) { for (const d of dashboardStore.dashboards) {
if (d.id === row.id) { if (d.id === row.id) {

View File

@ -42,6 +42,7 @@ limitations under the License. -->
import { defineComponent, onBeforeUnmount } from "vue"; import { defineComponent, onBeforeUnmount } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { useDashboardStore } from "@/store/modules/dashboard"; import { useDashboardStore } from "@/store/modules/dashboard";
import { useSelectorStore } from "@/store/modules/selectors";
import { LayoutConfig } from "@/types/dashboard"; import { LayoutConfig } from "@/types/dashboard";
import controls from "../controls/index"; import controls from "../controls/index";
@ -51,6 +52,7 @@ export default defineComponent({
setup() { setup() {
const { t } = useI18n(); const { t } = useI18n();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const selectorStore = useSelectorStore();
function layoutUpdatedEvent(newLayout: LayoutConfig[]) { function layoutUpdatedEvent(newLayout: LayoutConfig[]) {
dashboardStore.setLayout(newLayout); dashboardStore.setLayout(newLayout);
} }
@ -60,6 +62,8 @@ export default defineComponent({
} }
onBeforeUnmount(() => { onBeforeUnmount(() => {
dashboardStore.setLayout([]); dashboardStore.setLayout([]);
selectorStore.setCurrentService(null);
selectorStore.setCurrentPod(null);
}); });
return { return {
dashboardStore, dashboardStore,