mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-22 11:35:56 +00:00
Merge 4aa76f50cc
into be2faf64ce
This commit is contained in:
commit
97d41f45c8
2 changed files with 49 additions and 0 deletions
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
<button class="btn-outline-normal" @click="pauseDialog"><font-awesome-icon icon="pause" size="sm" /> {{ $t("Pause") }}</button>
|
<button class="btn-outline-normal" @click="pauseDialog"><font-awesome-icon icon="pause" size="sm" /> {{ $t("Pause") }}</button>
|
||||||
<button class="btn-outline-normal" @click="resumeSelected"><font-awesome-icon icon="play" size="sm" /> {{ $t("Resume") }}</button>
|
<button class="btn-outline-normal" @click="resumeSelected"><font-awesome-icon icon="play" size="sm" /> {{ $t("Resume") }}</button>
|
||||||
|
<button class="btn-outline-normal text-danger" @click="deleteSelectedDialog"><font-awesome-icon icon="trash" size="sm" /> {{ $t("Delete") }}</button>
|
||||||
|
|
||||||
<span v-if="selectedMonitorCount > 0">
|
<span v-if="selectedMonitorCount > 0">
|
||||||
{{ $t("selectedMonitorCount", [ selectedMonitorCount ]) }}
|
{{ $t("selectedMonitorCount", [ selectedMonitorCount ]) }}
|
||||||
|
@ -64,9 +65,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Confirm Dialogs -->
|
||||||
<Confirm ref="confirmPause" :yes-text="$t('Yes')" :no-text="$t('No')" @yes="pauseSelected">
|
<Confirm ref="confirmPause" :yes-text="$t('Yes')" :no-text="$t('No')" @yes="pauseSelected">
|
||||||
{{ $t("pauseMonitorMsg") }}
|
{{ $t("pauseMonitorMsg") }}
|
||||||
</Confirm>
|
</Confirm>
|
||||||
|
<Confirm ref="confirmDeleteSelected" :yes-text="$t('Yes')" :no-text="$t('No')" @yes="deleteSelected">
|
||||||
|
{{ $t("deleteSelectedMonitorMsg") }}
|
||||||
|
</Confirm>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -306,6 +311,49 @@ export default {
|
||||||
|
|
||||||
this.cancelSelectMode();
|
this.cancelSelectMode();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the confirmation dialog for deleting the selected monitors.
|
||||||
|
* This method triggers the display of a confirmation modal where the user can
|
||||||
|
* confirm or cancel the deletion of the selected monitors.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
deleteSelectedDialog() {
|
||||||
|
// Show the confirmation dialog for deletion
|
||||||
|
this.$refs.confirmDeleteSelected.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete each selected monitor and update the UI once the deletion is complete.
|
||||||
|
* This method initiates the deletion process for all selected monitors, updates
|
||||||
|
* the user interface, and reloads the page to reflect the changes.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
deleteSelected() {
|
||||||
|
// Delete each selected monitor
|
||||||
|
Object.keys(this.selectedMonitors).forEach(id => {
|
||||||
|
this.$root.deleteMonitor(id, (res) => {
|
||||||
|
// Display a response message for the operation
|
||||||
|
this.$root.toastRes(res);
|
||||||
|
|
||||||
|
// Remove the monitor from the selection if deletion is successful
|
||||||
|
if (res.ok) {
|
||||||
|
delete this.selectedMonitors[id];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Delay for UI updates before reloading the page
|
||||||
|
setTimeout(() => {
|
||||||
|
if (!Object.keys(this.selectedMonitors).length) {
|
||||||
|
window.location.reload(); // Refresh the page to show updates
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
|
// Exit selection mode as deletion is in progress
|
||||||
|
this.cancelSelectMode();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether a monitor should be displayed based on the filters
|
* Whether a monitor should be displayed based on the filters
|
||||||
* @param {object} monitor Monitor to check
|
* @param {object} monitor Monitor to check
|
||||||
|
|
|
@ -569,6 +569,7 @@
|
||||||
"grpcMethodDescription": "Method name is convert to camelCase format such as sayHello, check, etc.",
|
"grpcMethodDescription": "Method name is convert to camelCase format such as sayHello, check, etc.",
|
||||||
"acceptedStatusCodesDescription": "Select status codes which are considered as a successful response.",
|
"acceptedStatusCodesDescription": "Select status codes which are considered as a successful response.",
|
||||||
"deleteMonitorMsg": "Are you sure want to delete this monitor?",
|
"deleteMonitorMsg": "Are you sure want to delete this monitor?",
|
||||||
|
"deleteSelectedMonitorMsg": "Are you sure want to delete the following monitors?",
|
||||||
"deleteMaintenanceMsg": "Are you sure want to delete this maintenance?",
|
"deleteMaintenanceMsg": "Are you sure want to delete this maintenance?",
|
||||||
"deleteNotificationMsg": "Are you sure want to delete this notification for all monitors?",
|
"deleteNotificationMsg": "Are you sure want to delete this notification for all monitors?",
|
||||||
"dnsPortDescription": "DNS server port. Defaults to 53. You can change the port at any time.",
|
"dnsPortDescription": "DNS server port. Defaults to 53. You can change the port at any time.",
|
||||||
|
|
Loading…
Add table
Reference in a new issue