debug
This commit is contained in:
@@ -1,11 +1,107 @@
|
||||
<template>
|
||||
<div class="home card">
|
||||
<img class="home-bg" src="@/assets/images/welcome.png" alt="welcome" />
|
||||
<div class="home-bootstrap-actions">
|
||||
<el-button type="primary" @click="openBootstrapCenter('overview')">打开 Bootstrap 总控台</el-button>
|
||||
<el-button type="warning" plain @click="openBootstrapCenter({ tab: 'ops', opsFocus: { panel: 'oncall', stage: 'all', clearHostFocus: true, hostConsolePanel: 'oncall' } })">值班待办</el-button>
|
||||
<el-button type="danger" plain @click="openBootstrapCenter({ tab: 'ops', opsFocus: { panel: 'attention', stage: 'attention', clearHostFocus: true, hostConsolePanel: 'runs' } })">异常聚焦</el-button>
|
||||
<el-button type="info" plain @click="openBootstrapCenter('env')">查看环境模板</el-button>
|
||||
</div>
|
||||
<BootstrapOpsOverview />
|
||||
<BootstrapEnvOverview action-text="前往站点页查看环境模板" @open-dialog="goSitePage" />
|
||||
<BootstrapAdminCenter ref="bootstrapAdminCenterRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="home"></script>
|
||||
<script setup lang="ts" name="home">
|
||||
import { useRouter } from "vue-router";
|
||||
import BootstrapOpsOverview from "@/views/site/bootstrapOpsOverview.vue";
|
||||
import BootstrapEnvOverview from "@/views/site/bootstrapEnvOverview.vue";
|
||||
import BootstrapAdminCenter from "@/views/site/bootstrapAdminCenter.vue";
|
||||
import { ref } from "vue";
|
||||
|
||||
const router = useRouter();
|
||||
const bootstrapAdminCenterRef = ref<InstanceType<typeof BootstrapAdminCenter> | null>(null);
|
||||
type BootstrapFocusMode = "all" | "task" | "oncall" | "pipeline" | "import" | "release";
|
||||
type BootstrapFocusPayload = BootstrapFocusMode | BootstrapFocusMode[];
|
||||
type BootstrapComparePreset =
|
||||
| "latest_two"
|
||||
| "latest_applied_vs_dry_run"
|
||||
| "latest_template_two"
|
||||
| "latest_template_apply_vs_preview"
|
||||
| "latest_restore_two"
|
||||
| "latest_restore_apply_vs_preview";
|
||||
type BootstrapRestorePreset = "latest_restore_after_preview" | "latest_restore_before_preview";
|
||||
type BootstrapHistoryActionPreset = "template_family" | "restore_family" | "restore_preview_only" | "restore_apply_only";
|
||||
type BootstrapDialogPayload =
|
||||
| BootstrapFocusPayload
|
||||
| {
|
||||
focusMode?: BootstrapFocusPayload;
|
||||
comparePreset?: BootstrapComparePreset;
|
||||
restorePreset?: BootstrapRestorePreset;
|
||||
historyActionPreset?: BootstrapHistoryActionPreset;
|
||||
};
|
||||
type OpsPanelKey = "queue" | "oncall" | "tasks" | "runs" | "attention" | "completed";
|
||||
type BootstrapStageKey =
|
||||
| "all"
|
||||
| "ready_to_register"
|
||||
| "ready_to_apply"
|
||||
| "ready_for_prepare"
|
||||
| "ready_to_import"
|
||||
| "ready_to_release_dry_run"
|
||||
| "ready_to_publish"
|
||||
| "attention"
|
||||
| "published";
|
||||
type HostConsolePanelKey = "bundle" | "oncall" | "runs" | "completed";
|
||||
type OpsInspectorKind = "bundle" | "oncall" | "task" | "run" | "attention_bundle" | "failed_run" | "completed";
|
||||
type BootstrapOpsFocusPayload = {
|
||||
panel?: OpsPanelKey;
|
||||
stage?: BootstrapStageKey;
|
||||
host?: string;
|
||||
keyword?: string;
|
||||
clearHostFocus?: boolean;
|
||||
hostConsolePanel?: HostConsolePanelKey;
|
||||
inspectorKind?: OpsInspectorKind | "default";
|
||||
};
|
||||
type BootstrapAdminOpenPayload =
|
||||
| "overview"
|
||||
| "ops"
|
||||
| "env"
|
||||
| {
|
||||
tab?: "overview" | "ops" | "env";
|
||||
opsFocus?: BootstrapOpsFocusPayload;
|
||||
envDialog?: BootstrapDialogPayload;
|
||||
refresh?: boolean;
|
||||
};
|
||||
|
||||
const openBootstrapCenter = (payload: BootstrapAdminOpenPayload = "overview") => {
|
||||
bootstrapAdminCenterRef.value?.openDialog(payload);
|
||||
};
|
||||
|
||||
const goSitePage = (payload: BootstrapDialogPayload = "all") => {
|
||||
const normalizedFocus = typeof payload === "string" || Array.isArray(payload) ? payload : payload.focusMode ?? "all";
|
||||
const comparePreset = typeof payload === "string" || Array.isArray(payload) ? undefined : payload.comparePreset;
|
||||
const restorePreset = typeof payload === "string" || Array.isArray(payload) ? undefined : payload.restorePreset;
|
||||
const historyActionPreset = typeof payload === "string" || Array.isArray(payload) ? undefined : payload.historyActionPreset;
|
||||
const queryFocus = Array.isArray(normalizedFocus) ? normalizedFocus.join(",") : normalizedFocus;
|
||||
router.push({
|
||||
path: "/site/index",
|
||||
query: {
|
||||
...(queryFocus === "all" ? {} : { bootstrapFocus: queryFocus }),
|
||||
...(comparePreset ? { bootstrapComparePreset: comparePreset } : {}),
|
||||
...(restorePreset ? { bootstrapRestorePreset: restorePreset } : {}),
|
||||
...(historyActionPreset ? { bootstrapHistoryActionPreset: historyActionPreset } : {})
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "./index.scss";
|
||||
@use "./index.scss" as *;
|
||||
|
||||
.home-bootstrap-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user