Added a settings page & localization

This commit is contained in:
c0derMo 2022-07-24 12:34:43 +00:00
parent e356d5f623
commit fb3b407577
6 changed files with 74 additions and 9 deletions

View File

@ -48,6 +48,9 @@ class DockerHost {
throw new Error("docker host not found"); throw new Error("docker host not found");
} }
// Delete removed proxy from monitors if exists
await R.exec("UPDATE monitor SET docker_host = null WHERE docker_host = ?", [ dockerHostID ]);
await R.trash(bean); await R.trash(bean);
} }

View File

@ -0,0 +1,50 @@
<template>
<div>
<div class="dockerHost-list my-4">
<p v-if="$root.dockerHostList.length === 0">
{{ $t("Not available, please setup.") }}
</p>
<ul class="list-group mb-3" style="border-radius: 1rem;">
<li v-for="(dockerHost, index) in $root.dockerHostList" :key="index" class="list-group-item">
{{ dockerHost.name }}<br>
<a href="#" @click="$refs.dockerHostDialog.show(dockerHost.id)">{{ $t("Edit") }}</a>
</li>
</ul>
<button class="btn btn-primary me-2" type="button" @click="$refs.dockerHostDialog.show()">
{{ $t("Setup Docker Host") }}
</button>
</div>
<DockerHostDialog ref="dockerHostDialog" />
</div>
</template>
<script>
import DockerHostDialog from "../../components/DockerHostDialog.vue";
import ActionInput from "../ActionInput.vue";
export default {
components: {
DockerHostDialog,
ActionInput,
},
data() {
return {};
},
computed: {
settings() {
return this.$parent.$parent.$parent.settings;
},
saveSettings() {
return this.$parent.$parent.$parent.saveSettings;
},
settingsLoaded() {
return this.$parent.$parent.$parent.settingsLoaded;
},
}
};
</script>

View File

@ -372,12 +372,6 @@ export default {
smtpDkimHashAlgo: "Hash Algorithm (Optional)", smtpDkimHashAlgo: "Hash Algorithm (Optional)",
smtpDkimheaderFieldNames: "Header Keys to sign (Optional)", smtpDkimheaderFieldNames: "Header Keys to sign (Optional)",
smtpDkimskipFields: "Header Keys not to sign (Optional)", smtpDkimskipFields: "Header Keys not to sign (Optional)",
"Container Name / ID": "Container Name / ID",
"Docker Daemon": "Docker Daemon",
"Docker Container": "Docker Container",
"Docker Type": "Connection Type",
docker_socket: "Socket",
docker_tcp: "TCP / HTTP",
wayToGetPagerDutyKey: "You can get this by going to Service -> Service Directory -> (Select a service) -> Integrations -> Add integration. Here you can search for \"Events API V2\". More info {0}", wayToGetPagerDutyKey: "You can get this by going to Service -> Service Directory -> (Select a service) -> Integrations -> Add integration. Here you can search for \"Events API V2\". More info {0}",
"Integration Key": "Integration Key", "Integration Key": "Integration Key",
"Integration URL": "Integration URL", "Integration URL": "Integration URL",
@ -487,7 +481,7 @@ export default {
"Leave blank to use a shared sender number.": "Leave blank to use a shared sender number.", "Leave blank to use a shared sender number.": "Leave blank to use a shared sender number.",
"Octopush API Version": "Octopush API Version", "Octopush API Version": "Octopush API Version",
"Legacy Octopush-DM": "Legacy Octopush-DM", "Legacy Octopush-DM": "Legacy Octopush-DM",
"endpoint": "endpoint", endpoint: "endpoint",
octopushAPIKey: "\"API key\" from HTTP API credentials in control panel", octopushAPIKey: "\"API key\" from HTTP API credentials in control panel",
octopushLogin: "\"Login\" from HTTP API credentials in control panel", octopushLogin: "\"Login\" from HTTP API credentials in control panel",
promosmsLogin: "API Login Name", promosmsLogin: "API Login Name",
@ -531,7 +525,17 @@ export default {
"Coming Soon": "Coming Soon", "Coming Soon": "Coming Soon",
wayToGetClickSendSMSToken: "You can get API Username and API Key from {0} .", wayToGetClickSendSMSToken: "You can get API Username and API Key from {0} .",
"Connection String": "Connection String", "Connection String": "Connection String",
"Query": "Query", Query: "Query",
settingsCertificateExpiry: "TLS Certificate Expiry", settingsCertificateExpiry: "TLS Certificate Expiry",
certificationExpiryDescription: "HTTPS Monitors trigger notification when TLS certificate expires in:", certificationExpiryDescription: "HTTPS Monitors trigger notification when TLS certificate expires in:",
"Setup Docker Host": "Setup Docker Host",
"Connection Type": "Connection Type",
"Docker Daemon": "Docker Daemon",
deleteDockerHostMsg: "Are you sure want to delete this docker host for all monitors?",
socket: "Socket",
tcp: "TCP / HTTP",
"Docker Container": "Docker Container",
"Container Name / ID": "Container Name / ID",
"Docker Host": "Docker Host",
"Docker Hosts": "Docker Hosts"
}; };

View File

@ -156,7 +156,7 @@
{{ $t("Not available, please setup.") }} {{ $t("Not available, please setup.") }}
</p> </p>
<div class="mb-3"> <div class="mb-3" v-else>
<label for="docker-host" class="form-label">{{ $t("Docker Host") }}</label> <label for="docker-host" class="form-label">{{ $t("Docker Host") }}</label>
<select id="docket-host" v-model="monitor.docker_host" class="form-select"> <select id="docket-host" v-model="monitor.docker_host" class="form-select">
<option v-for="host in $root.dockerHostList" :key="host.id" :value="host.id">{{ host.name }}</option> <option v-for="host in $root.dockerHostList" :key="host.id" :value="host.id">{{ host.name }}</option>

View File

@ -89,6 +89,9 @@ export default {
"monitor-history": { "monitor-history": {
title: this.$t("Monitor History"), title: this.$t("Monitor History"),
}, },
"docker-hosts": {
title: this.$t("Docker Hosts"),
},
security: { security: {
title: this.$t("Security"), title: this.$t("Security"),
}, },

View File

@ -25,6 +25,7 @@ const Security = () => import("./components/settings/Security.vue");
import Proxies from "./components/settings/Proxies.vue"; import Proxies from "./components/settings/Proxies.vue";
import Backup from "./components/settings/Backup.vue"; import Backup from "./components/settings/Backup.vue";
import About from "./components/settings/About.vue"; import About from "./components/settings/About.vue";
import DockerHosts from "./components/settings/Docker.vue";
const routes = [ const routes = [
{ {
@ -95,6 +96,10 @@ const routes = [
path: "monitor-history", path: "monitor-history",
component: MonitorHistory, component: MonitorHistory,
}, },
{
path: "docker-hosts",
component: DockerHosts,
},
{ {
path: "security", path: "security",
component: Security, component: Security,