optimize widgets

This commit is contained in:
Qiuxia Fan 2022-06-15 16:59:11 +08:00
parent 7813c92673
commit 30efdbc09e
8 changed files with 39 additions and 10 deletions

View File

@ -29,7 +29,7 @@ limitations under the License. -->
<span>{{ t("delete") }}</span> <span>{{ t("delete") }}</span>
</div> </div>
</el-popover> </el-popover>
<Header /> <Header :needQuery="needQuery" />
<Content /> <Content />
</div> </div>
</template> </template>
@ -47,6 +47,7 @@ const props = defineProps({
default: () => ({ graph: {} }), default: () => ({ graph: {} }),
}, },
activeIndex: { type: String, default: "" }, activeIndex: { type: String, default: "" },
needQuery: { type: Boolean, default: true },
}); });
const { t } = useI18n(); const { t } = useI18n();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();

View File

@ -30,7 +30,7 @@ limitations under the License. -->
</div> </div>
</el-popover> </el-popover>
<div class="header"> <div class="header">
<Header /> <Header :needQuery="needQuery" />
</div> </div>
<div class="log"> <div class="log">
<List /> <List />
@ -50,6 +50,7 @@ const props = defineProps({
default: () => ({}), default: () => ({}),
}, },
activeIndex: { type: String, default: "" }, activeIndex: { type: String, default: "" },
needQuery: { type: Boolean, default: true },
}); });
const { t } = useI18n(); const { t } = useI18n();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();

View File

@ -29,7 +29,7 @@ limitations under the License. -->
<span>{{ t("delete") }}</span> <span>{{ t("delete") }}</span>
</div> </div>
</el-popover> </el-popover>
<Header /> <Header :needQuery="needQuery" />
<Content /> <Content />
</div> </div>
</template> </template>
@ -47,6 +47,7 @@ const props = defineProps({
default: () => ({ graph: {} }), default: () => ({ graph: {} }),
}, },
activeIndex: { type: String, default: "" }, activeIndex: { type: String, default: "" },
needQuery: { type: Boolean, default: true },
}); });
const { t } = useI18n(); const { t } = useI18n();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();

View File

@ -30,7 +30,7 @@ limitations under the License. -->
</div> </div>
</el-popover> </el-popover>
<div class="header"> <div class="header">
<Filter /> <Filter :needQuery="needQuery" />
</div> </div>
<div class="trace flex-h"> <div class="trace flex-h">
<TraceList /> <TraceList />
@ -53,6 +53,7 @@ const props = defineProps({
default: () => ({ graph: {} }), default: () => ({ graph: {} }),
}, },
activeIndex: { type: String, default: "" }, activeIndex: { type: String, default: "" },
needQuery: { type: Boolean, default: true },
}); });
const { t } = useI18n(); const { t } = useI18n();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();

View File

@ -39,6 +39,10 @@ import { useDashboardStore } from "@/store/modules/dashboard";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import { EntityType } from "../../data"; import { EntityType } from "../../data";
/*global defineProps */
const props = defineProps({
needQuery: { type: Boolean, default: true },
});
const ebpfStore = useEbpfStore(); const ebpfStore = useEbpfStore();
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
@ -46,7 +50,9 @@ const dashboardStore = useDashboardStore();
const { t } = useI18n(); const { t } = useI18n();
const newTask = ref<boolean>(false); const newTask = ref<boolean>(false);
searchTasks(); if (props.needQuery) {
searchTasks();
}
async function searchTasks() { async function searchTasks() {
const serviceId = const serviceId =

View File

@ -142,6 +142,10 @@ import { ElMessage } from "element-plus";
import { EntityType } from "../../data"; import { EntityType } from "../../data";
import { ErrorCategory } from "./data"; import { ErrorCategory } from "./data";
/*global defineProps */
const props = defineProps({
needQuery: { type: Boolean, default: true },
});
const { t } = useI18n(); const { t } = useI18n();
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
@ -161,8 +165,9 @@ const state = reactive<any>({
service: { value: "", label: "" }, service: { value: "", label: "" },
category: { value: "ALL", label: "All" }, category: { value: "ALL", label: "All" },
}); });
if (props.needQuery) {
init(); init();
}
async function init() { async function init() {
const resp = await logStore.getLogsByKeywords(); const resp = await logStore.getLogsByKeywords();

View File

@ -59,6 +59,10 @@ import { useDashboardStore } from "@/store/modules/dashboard";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import { EntityType } from "../../data"; import { EntityType } from "../../data";
/*global defineProps */
const props = defineProps({
needQuery: { type: Boolean, default: true },
});
const profileStore = useProfileStore(); const profileStore = useProfileStore();
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
@ -67,8 +71,10 @@ const { t } = useI18n();
const endpointName = ref<string>(""); const endpointName = ref<string>("");
const newTask = ref<boolean>(false); const newTask = ref<boolean>(false);
searchTasks(); if (props.needQuery) {
searchEndpoints(""); searchTasks();
searchEndpoints("");
}
async function searchEndpoints(keyword: string) { async function searchEndpoints(keyword: string) {
if (!selectorStore.currentService) { if (!selectorStore.currentService) {
@ -109,6 +115,7 @@ watch(
() => selectorStore.currentService, () => selectorStore.currentService,
() => { () => {
searchTasks(); searchTasks();
console.log("service");
} }
); );
watch( watch(

View File

@ -104,6 +104,10 @@ import ConditionTags from "@/views/components/ConditionTags.vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { EntityType } from "../../data"; import { EntityType } from "../../data";
/*global defineProps */
const props = defineProps({
needQuery: { type: Boolean, default: true },
});
const { t } = useI18n(); const { t } = useI18n();
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
@ -121,7 +125,10 @@ const state = reactive<any>({
service: { value: "", label: "" }, service: { value: "", label: "" },
}); });
init(); if (props.needQuery) {
init();
}
async function init() { async function init() {
if (dashboardStore.entity === EntityType[1].value) { if (dashboardStore.entity === EntityType[1].value) {
await getServices(); await getServices();