Fix: Show API Keys disabled msg. when disabled Auth (#4723)

Co-authored-by: Frank Elsinga <frank@elsinga.de>
pull/4757/head
Nelson Chan 7 months ago committed by GitHub
parent 2778929f74
commit 59f10d542b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,5 +1,12 @@
<template> <template>
<div> <div>
<div
v-if="settings.disableAuth"
class="mt-5 d-flex align-items-center justify-content-center my-3"
>
{{ $t("apiKeysDisabledMsg") }}
</div>
<div v-else>
<div class="add-btn"> <div class="add-btn">
<button class="btn btn-primary me-2" type="button" @click="$refs.apiKeyDialog.show()"> <button class="btn btn-primary me-2" type="button" @click="$refs.apiKeyDialog.show()">
<font-awesome-icon icon="plus" /> {{ $t("Add API Key") }} <font-awesome-icon icon="plus" /> {{ $t("Add API Key") }}
@ -7,7 +14,10 @@
</div> </div>
<div> <div>
<span v-if="Object.keys(keyList).length === 0" class="d-flex align-items-center justify-content-center my-3"> <span
v-if="Object.keys(keyList).length === 0"
class="d-flex align-items-center justify-content-center my-3"
>
{{ $t("No API Keys") }} {{ $t("No API Keys") }}
</span> </span>
@ -18,9 +28,7 @@
:class="item.status" :class="item.status"
> >
<div class="left-part"> <div class="left-part">
<div <div class="circle"></div>
class="circle"
></div>
<div class="info"> <div class="info">
<div class="title">{{ item.name }}</div> <div class="title">{{ item.name }}</div>
<div class="status"> <div class="status">
@ -30,7 +38,8 @@
{{ $t("Created") }}: {{ item.createdDate }} {{ $t("Created") }}: {{ item.createdDate }}
</div> </div>
<div class="date"> <div class="date">
{{ $t("Expires") }}: {{ item.expires || $t("Never") }} {{ $t("Expires") }}:
{{ item.expires || $t("Never") }}
</div> </div>
</div> </div>
</div> </div>
@ -52,6 +61,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="text-center mt-3" style="font-size: 13px;"> <div class="text-center mt-3" style="font-size: 13px;">
<a href="https://github.com/louislam/uptime-kuma/wiki/API-Keys" target="_blank">{{ $t("Learn More") }}</a> <a href="https://github.com/louislam/uptime-kuma/wiki/API-Keys" target="_blank">{{ $t("Learn More") }}</a>
@ -90,6 +100,9 @@ export default {
let result = Object.values(this.$root.apiKeyList); let result = Object.values(this.$root.apiKeyList);
return result; return result;
}, },
settings() {
return this.$parent.$parent.$parent.settings;
},
}, },
methods: { methods: {
@ -127,7 +140,9 @@ export default {
* Pause maintenance * Pause maintenance
*/ */
disableKey() { disableKey() {
this.$root.getSocket().emit("disableAPIKey", this.selectedKeyID, (res) => { this.$root
.getSocket()
.emit("disableAPIKey", this.selectedKeyID, (res) => {
this.$root.toastRes(res); this.$root.toastRes(res);
}); });
}, },

@ -820,5 +820,6 @@
"showCertificateExpiry": "Show Certificate Expiry", "showCertificateExpiry": "Show Certificate Expiry",
"noOrBadCertificate": "No/Bad Certificate", "noOrBadCertificate": "No/Bad Certificate",
"gamedigGuessPort": "Gamedig: Guess Port", "gamedigGuessPort": "Gamedig: Guess Port",
"gamedigGuessPortDescription": "The port used by Valve Server Query Protocol may be different from the client port. Try this if the monitor cannot connect to your server." "gamedigGuessPortDescription": "The port used by Valve Server Query Protocol may be different from the client port. Try this if the monitor cannot connect to your server.",
"apiKeysDisabledMsg": "API keys are disabled because authentication is disabled."
} }

Loading…
Cancel
Save