diff --git a/src/store/modules/event.ts b/src/store/modules/event.ts
index 2fbd14e7..e993a4ee 100644
--- a/src/store/modules/event.ts
+++ b/src/store/modules/event.ts
@@ -38,7 +38,7 @@ export const eventStore = defineStore({
loading: false,
events: [],
total: 0,
- services: [{ value: "", label: "All" }],
+ services: [{ value: "", label: "" }],
instances: [{ value: "", label: "All" }],
endpoints: [{ value: "", label: "All" }],
condition: {
diff --git a/src/views/event/Content.vue b/src/views/event/Content.vue
index 0bfd7fd7..b01b9854 100644
--- a/src/views/event/Content.vue
+++ b/src/views/event/Content.vue
@@ -72,15 +72,15 @@ limitations under the License. -->
>
{{ t("currentService") }}:
+ >{{ t("service") }}:
{{ currentEvent[eventKey.class].service }}
- {{ t("currentEndpoint") }}:
+ {{ t("endpoint") }}:
{{ currentEvent[eventKey.class].endpoint }}
- {{ t("currentInstance") }}:
+ {{ t("instance") }}:
{{ currentEvent[eventKey.class].serviceInstance }}
diff --git a/src/views/event/Header.vue b/src/views/event/Header.vue
index 556f0373..e70cf819 100644
--- a/src/views/event/Header.vue
+++ b/src/views/event/Header.vue
@@ -29,7 +29,7 @@ limitations under the License. -->
{{ t("service") }}:
{{ t("instance") }}:
{{ t("endpoint") }}:
/>
-
+
small
:style="`--el-pagination-bg-color: #f0f2f5; --el-pagination-button-disabled-bg-color: #f0f2f5;`"
/>
-
+
@@ -108,16 +108,16 @@ const state = reactive<{
currentLayer: string;
layers: string[];
eventType: string;
- service: { id: string; value: string; label: string };
- instance: { id: string; value: string; label: string };
- endpoint: { id: string; value: string; label: string };
+ service: string;
+ instance: string;
+ endpoint: string;
}>({
currentLayer: "",
layers: [],
eventType: "",
- service: { id: "", value: "", label: "" },
- instance: { id: "", value: "", label: "" },
- endpoint: { id: "", value: "", label: "" },
+ service: "",
+ instance: "",
+ endpoint: "",
});
getSelectors();
@@ -127,14 +127,7 @@ async function getSelectors() {
if (!state.currentLayer) {
return;
}
- await getServices();
- if (!state.service.id) {
- queryEvents();
- return;
- }
- getEndpoints();
- getInstances();
- queryEvents();
+ getServices();
}
async function getServices() {
@@ -143,24 +136,31 @@ async function getServices() {
ElMessage.error(resp.errors);
return;
}
- state.service = eventStore.services[0];
+ state.service = eventStore.services[0].value;
+ if (!eventStore.services[0].id) {
+ queryEvents();
+ return;
+ }
+ getEndpoints(eventStore.services[0].id);
+ getInstances(eventStore.services[0].id);
+ queryEvents();
}
-async function getEndpoints() {
- const resp = await eventStore.getEndpoints(state.service.id);
+async function getEndpoints(id: string) {
+ const resp = await eventStore.getEndpoints(id);
if (resp.errors) {
ElMessage.error(resp.errors);
return;
}
- state.endpoint = eventStore.endpoints[0];
+ state.endpoint = eventStore.endpoints[0].value;
}
-async function getInstances() {
- const resp = await eventStore.getInstances(state.service.id);
+async function getInstances(id: string) {
+ const resp = await eventStore.getInstances(id);
if (resp.errors) {
ElMessage.error(resp.errors);
return;
}
- state.instance = eventStore.instances[0];
+ state.instance = eventStore.instances[0].value;
}
async function getLayers() {
@@ -183,9 +183,9 @@ async function queryEvents() {
needTotal: true,
},
source: {
- service: state.service.value || "",
- endpoint: state.endpoint.value || "",
- serviceInstance: state.instance.value || "",
+ service: state.service || "",
+ endpoint: state.endpoint || "",
+ serviceInstance: state.instance || "",
},
type: state.eventType || undefined,
});
@@ -198,32 +198,31 @@ async function queryEvents() {
async function selectLayer(opt: any) {
state.currentLayer = opt[0].value;
await getServices();
- if (!state.service.id) {
- return;
- }
- getEndpoints();
- getInstances();
}
function selectService(opt: any) {
- state.service = opt[0];
- if (!state.service.id) {
+ state.service = opt[0].value;
+ queryEvents();
+ if (!opt[0].id) {
return;
}
- getEndpoints();
- getInstances();
+ getEndpoints(opt[0].id);
+ getInstances(opt[0].id);
}
function selectInstance(opt: any) {
- state.instance = opt[0];
+ state.instance = opt[0].value;
+ queryEvents();
}
function selectEndpoint(opt: any) {
- state.endpoint = opt[0];
+ state.endpoint = opt[0].value;
+ queryEvents();
}
function selectType(opt: any) {
state.eventType = opt[0].value;
+ queryEvents();
}
function updatePage(p: number) {