mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-18 07:05:25 +00:00
add mode
This commit is contained in:
parent
774ca4656f
commit
96116fa17d
@ -41,6 +41,7 @@ interface DashboardState {
|
|||||||
currentTabItems: LayoutConfig[];
|
currentTabItems: LayoutConfig[];
|
||||||
dashboards: DashboardItem[];
|
dashboards: DashboardItem[];
|
||||||
currentDashboard: Nullable<DashboardItem>;
|
currentDashboard: Nullable<DashboardItem>;
|
||||||
|
editMode: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const dashboardStore = defineStore({
|
export const dashboardStore = defineStore({
|
||||||
@ -58,11 +59,15 @@ export const dashboardStore = defineStore({
|
|||||||
currentTabItems: [],
|
currentTabItems: [],
|
||||||
dashboards: [],
|
dashboards: [],
|
||||||
currentDashboard: null,
|
currentDashboard: null,
|
||||||
|
editMode: true,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
setLayout(data: LayoutConfig[]) {
|
setLayout(data: LayoutConfig[]) {
|
||||||
this.layout = data;
|
this.layout = data;
|
||||||
},
|
},
|
||||||
|
setMode(mode: boolean) {
|
||||||
|
this.editMode = mode;
|
||||||
|
},
|
||||||
resetDashboards(list: DashboardItem[]) {
|
resetDashboards(list: DashboardItem[]) {
|
||||||
this.dashboards = list;
|
this.dashboards = list;
|
||||||
sessionStorage.setItem("dashboards", JSON.stringify(list));
|
sessionStorage.setItem("dashboards", JSON.stringify(list));
|
||||||
|
@ -46,6 +46,7 @@ const layer = ref<string>("GENERAL");
|
|||||||
getDashboard();
|
getDashboard();
|
||||||
|
|
||||||
async function getDashboard() {
|
async function getDashboard() {
|
||||||
|
dashboardStore.setMode(false);
|
||||||
dashboardStore.setCurrentDashboard(null);
|
dashboardStore.setCurrentDashboard(null);
|
||||||
setLayer(String(route.name));
|
setLayer(String(route.name));
|
||||||
await dashboardStore.setDashboards();
|
await dashboardStore.setDashboards();
|
||||||
|
@ -13,11 +13,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<Tool v-if="p.entity" />
|
<Tool v-if="dashboardStore.editMode" />
|
||||||
<div
|
<div
|
||||||
class="ds-main"
|
class="ds-main"
|
||||||
@click="handleClick"
|
@click="handleClick"
|
||||||
:style="{ height: p.entity ? 'calc(100% - 45px)' : '100%' }"
|
:style="{ height: dashboardStore.editMode ? 'calc(100% - 45px)' : '100%' }"
|
||||||
>
|
>
|
||||||
<grid-layout />
|
<grid-layout />
|
||||||
<el-dialog
|
<el-dialog
|
||||||
|
@ -18,7 +18,7 @@ limitations under the License. -->
|
|||||||
placement="bottom"
|
placement="bottom"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
:width="100"
|
:width="100"
|
||||||
v-if="routeParams.entity"
|
v-if="dashboardStore.editMode"
|
||||||
>
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<span class="delete cp">
|
<span class="delete cp">
|
||||||
@ -39,7 +39,6 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import Header from "../related/log/Header.vue";
|
import Header from "../related/log/Header.vue";
|
||||||
import List from "../related/log/List.vue";
|
import List from "../related/log/List.vue";
|
||||||
@ -53,7 +52,6 @@ const props = defineProps({
|
|||||||
activeIndex: { type: String, default: "" },
|
activeIndex: { type: String, default: "" },
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const routeParams = useRoute().params;
|
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
|
|
||||||
function removeWidget() {
|
function removeWidget() {
|
||||||
|
@ -18,7 +18,7 @@ limitations under the License. -->
|
|||||||
placement="bottom"
|
placement="bottom"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
:width="100"
|
:width="100"
|
||||||
v-if="routeParams.entity"
|
v-if="dashboardStore.editMode"
|
||||||
>
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<span class="delete cp">
|
<span class="delete cp">
|
||||||
@ -39,7 +39,6 @@ import { useI18n } from "vue-i18n";
|
|||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import Header from "../related/profile/Header.vue";
|
import Header from "../related/profile/Header.vue";
|
||||||
import Content from "../related/profile/Content.vue";
|
import Content from "../related/profile/Content.vue";
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
|
|
||||||
/*global defineProps */
|
/*global defineProps */
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -50,8 +49,8 @@ const props = defineProps({
|
|||||||
activeIndex: { type: String, default: "" },
|
activeIndex: { type: String, default: "" },
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const routeParams = useRoute().params;
|
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
|
|
||||||
function removeWidget() {
|
function removeWidget() {
|
||||||
dashboardStore.removeControls(props.data);
|
dashboardStore.removeControls(props.data);
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,10 @@ limitations under the License. -->
|
|||||||
size="sm"
|
size="sm"
|
||||||
iconName="cancel"
|
iconName="cancel"
|
||||||
@click="deleteTabItem($event, idx)"
|
@click="deleteTabItem($event, idx)"
|
||||||
v-if="routeParams.entity"
|
v-if="dashboardStore.editMode"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<span class="tab-icons" v-if="routeParams.entity">
|
<span class="tab-icons" v-if="dashboardStore.editMode">
|
||||||
<el-tooltip content="Add tab items" placement="bottom">
|
<el-tooltip content="Add tab items" placement="bottom">
|
||||||
<i @click="addTabItem">
|
<i @click="addTabItem">
|
||||||
<Icon size="middle" iconName="add" />
|
<Icon size="middle" iconName="add" />
|
||||||
@ -45,7 +45,7 @@ limitations under the License. -->
|
|||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="operations" v-if="routeParams.entity">
|
<div class="operations" v-if="dashboardStore.editMode">
|
||||||
<el-popover
|
<el-popover
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
@ -113,7 +113,6 @@ limitations under the License. -->
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ref, watch, defineComponent, toRefs } from "vue";
|
import { ref, watch, defineComponent, toRefs } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import { LayoutConfig } from "@/types/dashboard";
|
import { LayoutConfig } from "@/types/dashboard";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
@ -136,7 +135,6 @@ export default defineComponent({
|
|||||||
props,
|
props,
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const routeParams = useRoute().params;
|
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const activeTabIndex = ref<number>(0);
|
const activeTabIndex = ref<number>(0);
|
||||||
const activeTabWidget = ref<string>("");
|
const activeTabWidget = ref<string>("");
|
||||||
@ -247,7 +245,6 @@ export default defineComponent({
|
|||||||
needQuery,
|
needQuery,
|
||||||
canEditTabName,
|
canEditTabName,
|
||||||
showTools,
|
showTools,
|
||||||
routeParams,
|
|
||||||
t,
|
t,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -19,7 +19,7 @@ limitations under the License. -->
|
|||||||
placement="bottom"
|
placement="bottom"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
:width="100"
|
:width="100"
|
||||||
v-if="routeParams.entity"
|
v-if="dashboardStore.editMode"
|
||||||
>
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<span>
|
<span>
|
||||||
@ -39,7 +39,6 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import Topology from "../related/topology/Index.vue";
|
import Topology from "../related/topology/Index.vue";
|
||||||
@ -53,7 +52,6 @@ const props = defineProps({
|
|||||||
activeIndex: { type: String, default: "" },
|
activeIndex: { type: String, default: "" },
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const routeParams = useRoute().params;
|
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
|
|
||||||
function removeTopo() {
|
function removeTopo() {
|
||||||
|
@ -20,7 +20,7 @@ limitations under the License. -->
|
|||||||
<Icon iconName="ellipsis_v" size="middle" class="operation" />
|
<Icon iconName="ellipsis_v" size="middle" class="operation" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<div class="tools" @click="removeWidget" v-if="routeParams.entity">
|
<div class="tools" @click="removeWidget" v-if="dashboardStore.editMode">
|
||||||
<span>{{ t("delete") }}</span>
|
<span>{{ t("delete") }}</span>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
@ -35,7 +35,6 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
import Filter from "../related/trace/Filter.vue";
|
import Filter from "../related/trace/Filter.vue";
|
||||||
import TraceList from "../related/trace/TraceList.vue";
|
import TraceList from "../related/trace/TraceList.vue";
|
||||||
import TraceDetail from "../related/trace/Detail.vue";
|
import TraceDetail from "../related/trace/Detail.vue";
|
||||||
@ -51,7 +50,6 @@ const props = defineProps({
|
|||||||
activeIndex: { type: String, default: "" },
|
activeIndex: { type: String, default: "" },
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const routeParams = useRoute().params;
|
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
function removeWidget() {
|
function removeWidget() {
|
||||||
dashboardStore.removeControls(props.data);
|
dashboardStore.removeControls(props.data);
|
||||||
|
@ -38,7 +38,7 @@ limitations under the License. -->
|
|||||||
placement="bottom"
|
placement="bottom"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
:width="100"
|
:width="100"
|
||||||
v-if="routeParams.entity"
|
v-if="dashboardStore.editMode"
|
||||||
>
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<span>
|
<span>
|
||||||
@ -74,7 +74,6 @@ limitations under the License. -->
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { toRefs, reactive, defineComponent, ref, watch } from "vue";
|
import { toRefs, reactive, defineComponent, ref, watch } from "vue";
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
import { LayoutConfig } from "@/types/dashboard";
|
import { LayoutConfig } from "@/types/dashboard";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
@ -98,7 +97,6 @@ export default defineComponent({
|
|||||||
props,
|
props,
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const routeParams = useRoute().params;
|
|
||||||
const loading = ref<boolean>(false);
|
const loading = ref<boolean>(false);
|
||||||
const state = reactive<{ source: { [key: string]: unknown } }>({
|
const state = reactive<{ source: { [key: string]: unknown } }>({
|
||||||
source: {},
|
source: {},
|
||||||
@ -196,7 +194,7 @@ export default defineComponent({
|
|||||||
editConfig,
|
editConfig,
|
||||||
data,
|
data,
|
||||||
loading,
|
loading,
|
||||||
routeParams,
|
dashboardStore,
|
||||||
t,
|
t,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -225,6 +225,7 @@ const states = reactive<{
|
|||||||
linkDashboards: [],
|
linkDashboards: [],
|
||||||
nodeDashboards: [],
|
nodeDashboards: [],
|
||||||
});
|
});
|
||||||
|
console.log(dashboardStore.selectedGrid);
|
||||||
const isService = [EntityType[0].value, EntityType[1].value].includes(
|
const isService = [EntityType[0].value, EntityType[1].value].includes(
|
||||||
dashboardStore.entity
|
dashboardStore.entity
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user