Skip to content

Commit

Permalink
feat(#1939): implement button to trigger refresh of applications
Browse files Browse the repository at this point in the history
  • Loading branch information
SteKoe committed Dec 23, 2024
1 parent 339b3d1 commit 5ed573a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"status": "Status",
"label": "Anwendungen",
"shutdown": "Möchten Sie die Anwendung <code>{name}</code> herunterfahren?",
"refreshed": "Anwendungen wurden aktualisiert.",
"restart": "Möchten Sie Anwendung <code>{name}</code> neu starten?",
"restarted": "Die Anwendung wurde neu gestartet.",
"unregister": "Möchten Sie die Anwendung <code>{name}</code> deregistrieren?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"offline": "offline",
"shutdown": "Shutdown application <code>{name}</code>?",
"shutdown_successful": "Successfully shutdown application {name}.",
"refreshed": "Applications refreshed.",
"restart": "Restart application <code>{name}</code>?",
"restarted": "Successfully restarted application <code>{name}</code>.",
"unregister": "Deregister application <code>{name}</code>?",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
- Copyright 2014-2019 the original author or authors.
- Copyright 2014-2024 the original author or authors.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
Expand All @@ -21,6 +21,9 @@
<sba-sticky-subnav>
<div class="container mx-auto flex">
<ApplicationStats />
<sba-confirm-button class="mr-1" @click="refreshContext">
<font-awesome-icon :icon="'rotate-left'" />
</sba-confirm-button>
<ApplicationNotificationCenter
v-if="hasNotificationFiltersSupport"
:notification-filters="notificationFilters"
Expand Down Expand Up @@ -196,6 +199,9 @@ import ApplicationStats from '@/views/applications/ApplicationStats.vue';
import ApplicationStatusHero from '@/views/applications/ApplicationStatusHero.vue';
import InstancesList from '@/views/applications/InstancesList.vue';
import NotificationFilterSettings from '@/views/applications/NotificationFilterSettings.vue';
import SbaButton from '@/components/sba-button.vue';
import SbaConfirmButton from '@/components/sba-confirm-button.vue';
import axios from '@/utils/axios';

const props = defineProps({
error: {
Expand Down Expand Up @@ -320,6 +326,12 @@ const grouped = computed(() => {
return sortBy(list, [(item) => getApplicationStatus(item)]);
});

const refreshContext = () => {
axios.post('/applications').then(() => {
notificationCenter.success(t('applications.refreshed'));
});
};

function getApplicationStatus(item: InstancesListType): string {
return applicationStore.findApplicationByInstanceId(item.instances[0].id)
?.status;
Expand Down

0 comments on commit 5ed573a

Please sign in to comment.