From 9cd7bb3f1fbc24bf3057f4210432967e2fff82ae Mon Sep 17 00:00:00 2001 From: Phil Bastian <155411597+PhilBastian@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:59:46 +0800 Subject: [PATCH] Elastic scale patch (#2056) * fix results count in healthy endpoints and change look of results count * enable non-tracked endpoint to be deleted * Display only a single toaster * No need to await --------- Co-authored-by: John Simons --- src/Frontend/src/components/NoData.vue | 4 +- src/Frontend/src/components/ResultsCount.vue | 2 +- .../heartbeats/EndpointInstances.vue | 49 ++++++++++++++----- .../heartbeats/HealthyEndpoints.vue | 1 + 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/Frontend/src/components/NoData.vue b/src/Frontend/src/components/NoData.vue index 9f77cfc99..b8929b154 100644 --- a/src/Frontend/src/components/NoData.vue +++ b/src/Frontend/src/components/NoData.vue @@ -12,7 +12,9 @@ const props = defineProps<{

{{ props.message }}

-

 

+ +

 

+
diff --git a/src/Frontend/src/components/ResultsCount.vue b/src/Frontend/src/components/ResultsCount.vue index 0e87b1efd..2340aa8c7 100644 --- a/src/Frontend/src/components/ResultsCount.vue +++ b/src/Frontend/src/components/ResultsCount.vue @@ -15,6 +15,6 @@ defineProps<{ .format-showing-results { display: flex; align-items: flex-end; - color: gray; + font-style: italic; } diff --git a/src/Frontend/src/components/heartbeats/EndpointInstances.vue b/src/Frontend/src/components/heartbeats/EndpointInstances.vue index 2a6577bfc..323997db7 100644 --- a/src/Frontend/src/components/heartbeats/EndpointInstances.vue +++ b/src/Frontend/src/components/heartbeats/EndpointInstances.vue @@ -26,12 +26,13 @@ enum Operation { } const route = useRoute(); +const router = useRouter(); const endpointName = route.params.endpointName.toString(); const store = useHeartbeatInstancesStore(); const { filteredInstances, sortedInstances, instanceFilterString, sortByInstances } = storeToRefs(store); const endpointSettings = ref([endpointSettingsClient.defaultEndpointSettingsValue()]); const backLink = ref(routeLinks.heartbeats.root); -const filterInstances = (data: EndpointsView[]) => +const filterToValidInstances = (data: EndpointsView[]) => data .filter((instance) => instance.name === endpointName) .filter((instance) => { @@ -42,8 +43,8 @@ const filterInstances = (data: EndpointsView[]) => return true; }); -const instances = computed(() => filterInstances(filteredInstances.value)); -const totalInstances = computed(() => filterInstances(sortedInstances.value)); +const filteredValidInstances = computed(() => filterToValidInstances(filteredInstances.value)); +const totalValidInstances = computed(() => filterToValidInstances(sortedInstances.value)); const showBulkWarningDialog = ref(false); const dialogWarningOperation = ref(Operation.Mute); @@ -68,7 +69,9 @@ async function proceedWarningDialog() { showBulkWarningDialog.value = false; try { - await store.toggleEndpointMonitor(instances.value.filter((instance) => (dialogWarningOperation.value === Operation.Unmute && !instance.monitor_heartbeat) || (dialogWarningOperation.value === Operation.Mute && instance.monitor_heartbeat))); + await store.toggleEndpointMonitor( + filteredValidInstances.value.filter((instance) => (dialogWarningOperation.value === Operation.Unmute && !instance.monitor_heartbeat) || (dialogWarningOperation.value === Operation.Mute && instance.monitor_heartbeat)) + ); useShowToast(TYPE.SUCCESS, `All endpoint instances ${dialogWarningOperation.value}`, "", false, { timeout: 1000 }); } catch { useShowToast(TYPE.ERROR, "Save failed", "", false, { timeout: 3000 }); @@ -84,6 +87,16 @@ async function deleteInstance(instance: EndpointsView) { } } +async function deleteAllInstances() { + try { + await Promise.all(sortedInstances.value.filter((instance) => instance.name === endpointName).map((instance) => store.deleteEndpointInstance(instance))); + useShowToast(TYPE.SUCCESS, "Endpoint deleted", "", false, { timeout: 1000 }); + await router.replace(backLink.value); + } catch { + useShowToast(TYPE.ERROR, "Delete failed", "", false, { timeout: 3000 }); + } +} + async function toggleAlerts(instance: EndpointsView) { try { await store.toggleEndpointMonitor([instance]); @@ -99,7 +112,7 @@ async function toggleAlerts(instance: EndpointsView) { @@ -119,19 +132,19 @@ async function toggleAlerts(instance: EndpointsView) {
- -
- +
@@ -180,9 +193,15 @@ async function toggleAlerts(instance: EndpointsView) { - + +
+ You may + + this endpoint +
+
- +