Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6ccf741bc4 | ||
|
0a58069742 | ||
|
2b57b3e863 | ||
|
6cd6a2edf0 | ||
|
6961b1bdd2 | ||
|
54d4c4d3f7 | ||
|
c47b6c5995 | ||
|
1a9b013fc2 | ||
|
1326761a8a | ||
|
e48a987b9c | ||
|
6437ef198f | ||
|
973d5692d0 | ||
|
468cb004d6 | ||
|
f7d41a30fa | ||
|
0ef686ac2f | ||
|
3b5893ea60 | ||
|
21cd4d64c3 | ||
|
db757123ba | ||
|
4dcf31621e | ||
|
9c1ba97e7d | ||
|
e9564619f1 | ||
|
40ebc2df79 | ||
|
0e30843a75 | ||
|
2103edb604 | ||
|
b059a36e66 |
@ -7,9 +7,9 @@
|
|||||||
<img src="./public/icon.svg" width="128" alt="" />
|
<img src="./public/icon.svg" width="128" alt="" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
It is a self-hosted monitoring tool like "Uptime Robot".
|
Uptime Kuma is an easy-to-use self-hosted monitoring tool.
|
||||||
|
|
||||||
<img src="https://uptime.kuma.pet/img/dark.jpg" width="700" alt="" />
|
<img src="https://user-images.githubusercontent.com/1336778/212262296-e6205815-ad62-488c-83ec-a5b0d0689f7c.jpg" width="700" alt="" />
|
||||||
|
|
||||||
## 🥔 Live Demo
|
## 🥔 Live Demo
|
||||||
|
|
||||||
|
2393
package-lock.json
generated
2393
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "uptime-kuma",
|
"name": "uptime-kuma",
|
||||||
"version": "1.19.5",
|
"version": "1.19.6",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -39,7 +39,7 @@
|
|||||||
"build-docker-nightly-amd64": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:nightly-amd64 --target nightly . --push --progress plain",
|
"build-docker-nightly-amd64": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:nightly-amd64 --target nightly . --push --progress plain",
|
||||||
"build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test --target pr-test . --push",
|
"build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test --target pr-test . --push",
|
||||||
"upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain",
|
"upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain",
|
||||||
"setup": "git checkout 1.19.5 && npm ci --production && npm run download-dist",
|
"setup": "git checkout 1.19.6 && npm ci --production && npm run download-dist",
|
||||||
"download-dist": "node extra/download-dist.js",
|
"download-dist": "node extra/download-dist.js",
|
||||||
"mark-as-nightly": "node extra/mark-as-nightly.js",
|
"mark-as-nightly": "node extra/mark-as-nightly.js",
|
||||||
"reset-password": "node extra/reset-password.js",
|
"reset-password": "node extra/reset-password.js",
|
||||||
@ -67,7 +67,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "~1.7.3",
|
"@grpc/grpc-js": "~1.7.3",
|
||||||
"@louislam/ping": "~0.4.2-mod.0",
|
"@louislam/ping": "~0.4.2-mod.1",
|
||||||
"@louislam/sqlite3": "15.1.2",
|
"@louislam/sqlite3": "15.1.2",
|
||||||
"args-parser": "~1.3.0",
|
"args-parser": "~1.3.0",
|
||||||
"axios": "~0.27.0",
|
"axios": "~0.27.0",
|
||||||
@ -96,6 +96,7 @@
|
|||||||
"jsonwebtoken": "~9.0.0",
|
"jsonwebtoken": "~9.0.0",
|
||||||
"jwt-decode": "~3.1.2",
|
"jwt-decode": "~3.1.2",
|
||||||
"limiter": "~2.1.0",
|
"limiter": "~2.1.0",
|
||||||
|
"mongodb": "~4.13.0",
|
||||||
"mqtt": "~4.3.7",
|
"mqtt": "~4.3.7",
|
||||||
"mssql": "~8.1.4",
|
"mssql": "~8.1.4",
|
||||||
"mysql2": "~2.3.3",
|
"mysql2": "~2.3.3",
|
||||||
@ -110,6 +111,7 @@
|
|||||||
"prometheus-api-metrics": "~3.2.1",
|
"prometheus-api-metrics": "~3.2.1",
|
||||||
"protobufjs": "~7.1.1",
|
"protobufjs": "~7.1.1",
|
||||||
"redbean-node": "~0.2.0",
|
"redbean-node": "~0.2.0",
|
||||||
|
"redis": "~4.5.1",
|
||||||
"socket.io": "~4.5.3",
|
"socket.io": "~4.5.3",
|
||||||
"socket.io-client": "~4.5.3",
|
"socket.io-client": "~4.5.3",
|
||||||
"socks-proxy-agent": "6.1.1",
|
"socks-proxy-agent": "6.1.1",
|
||||||
|
@ -3,7 +3,9 @@ const dayjs = require("dayjs");
|
|||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
const { Prometheus } = require("../prometheus");
|
const { Prometheus } = require("../prometheus");
|
||||||
const { log, UP, DOWN, PENDING, MAINTENANCE, flipStatus, TimeLogger, MAX_INTERVAL_SECOND, MIN_INTERVAL_SECOND } = require("../../src/util");
|
const { log, UP, DOWN, PENDING, MAINTENANCE, flipStatus, TimeLogger, MAX_INTERVAL_SECOND, MIN_INTERVAL_SECOND } = require("../../src/util");
|
||||||
const { tcping, ping, dnsResolve, checkCertificate, checkStatusCode, getTotalClientInRoom, setting, mssqlQuery, postgresQuery, mysqlQuery, mqttAsync, setSetting, httpNtlm, radius, grpcQuery } = require("../util-server");
|
const { tcping, ping, dnsResolve, checkCertificate, checkStatusCode, getTotalClientInRoom, setting, mssqlQuery, postgresQuery, mysqlQuery, mqttAsync, setSetting, httpNtlm, radius, grpcQuery,
|
||||||
|
redisPingAsync, mongodbPing,
|
||||||
|
} = require("../util-server");
|
||||||
const { R } = require("redbean-node");
|
const { R } = require("redbean-node");
|
||||||
const { BeanModel } = require("redbean-node/dist/bean-model");
|
const { BeanModel } = require("redbean-node/dist/bean-model");
|
||||||
const { Notification } = require("../notification");
|
const { Notification } = require("../notification");
|
||||||
@ -493,13 +495,17 @@ class Monitor extends BeanModel {
|
|||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
url: `/containers/${this.docker_container}/json`,
|
url: `/containers/${this.docker_container}/json`,
|
||||||
|
timeout: this.interval * 1000 * 0.8,
|
||||||
headers: {
|
headers: {
|
||||||
"Accept": "*/*",
|
"Accept": "*/*",
|
||||||
"User-Agent": "Uptime-Kuma/" + version,
|
"User-Agent": "Uptime-Kuma/" + version,
|
||||||
},
|
},
|
||||||
httpsAgent: new https.Agent({
|
httpsAgent: CacheableDnsHttpAgent.getHttpsAgent({
|
||||||
maxCachedSessions: 0, // Use Custom agent to disable session reuse (https://github.com/nodejs/node/issues/3940)
|
maxCachedSessions: 0, // Use Custom agent to disable session reuse (https://github.com/nodejs/node/issues/3940)
|
||||||
rejectUnauthorized: ! this.getIgnoreTls(),
|
rejectUnauthorized: !this.getIgnoreTls(),
|
||||||
|
}),
|
||||||
|
httpAgent: CacheableDnsHttpAgent.getHttpAgent({
|
||||||
|
maxCachedSessions: 0,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -580,6 +586,15 @@ class Monitor extends BeanModel {
|
|||||||
bean.msg = "";
|
bean.msg = "";
|
||||||
bean.status = UP;
|
bean.status = UP;
|
||||||
bean.ping = dayjs().valueOf() - startTime;
|
bean.ping = dayjs().valueOf() - startTime;
|
||||||
|
} else if (this.type === "mongodb") {
|
||||||
|
let startTime = dayjs().valueOf();
|
||||||
|
|
||||||
|
await mongodbPing(this.databaseConnectionString);
|
||||||
|
|
||||||
|
bean.msg = "";
|
||||||
|
bean.status = UP;
|
||||||
|
bean.ping = dayjs().valueOf() - startTime;
|
||||||
|
|
||||||
} else if (this.type === "radius") {
|
} else if (this.type === "radius") {
|
||||||
let startTime = dayjs().valueOf();
|
let startTime = dayjs().valueOf();
|
||||||
|
|
||||||
@ -616,6 +631,12 @@ class Monitor extends BeanModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bean.ping = dayjs().valueOf() - startTime;
|
bean.ping = dayjs().valueOf() - startTime;
|
||||||
|
} else if (this.type === "redis") {
|
||||||
|
let startTime = dayjs().valueOf();
|
||||||
|
|
||||||
|
bean.msg = await redisPingAsync(this.databaseConnectionString);
|
||||||
|
bean.status = UP;
|
||||||
|
bean.ping = dayjs().valueOf() - startTime;
|
||||||
} else {
|
} else {
|
||||||
bean.msg = "Unknown Monitor Type";
|
bean.msg = "Unknown Monitor Type";
|
||||||
bean.status = PENDING;
|
bean.status = PENDING;
|
||||||
|
@ -941,13 +941,21 @@ let needSetup = false;
|
|||||||
try {
|
try {
|
||||||
checkLogin(socket);
|
checkLogin(socket);
|
||||||
|
|
||||||
let bean = await R.findOne("monitor", " id = ? ", [ tag.id ]);
|
let bean = await R.findOne("tag", " id = ? ", [ tag.id ]);
|
||||||
|
if (bean == null) {
|
||||||
|
callback({
|
||||||
|
ok: false,
|
||||||
|
msg: "Tag not found",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
bean.name = tag.name;
|
bean.name = tag.name;
|
||||||
bean.color = tag.color;
|
bean.color = tag.color;
|
||||||
await R.store(bean);
|
await R.store(bean);
|
||||||
|
|
||||||
callback({
|
callback({
|
||||||
ok: true,
|
ok: true,
|
||||||
|
msg: "Saved",
|
||||||
tag: await bean.toJSON(),
|
tag: await bean.toJSON(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -14,11 +14,13 @@ const mssql = require("mssql");
|
|||||||
const { Client } = require("pg");
|
const { Client } = require("pg");
|
||||||
const postgresConParse = require("pg-connection-string").parse;
|
const postgresConParse = require("pg-connection-string").parse;
|
||||||
const mysql = require("mysql2");
|
const mysql = require("mysql2");
|
||||||
|
const { MongoClient } = require("mongodb");
|
||||||
const { NtlmClient } = require("axios-ntlm");
|
const { NtlmClient } = require("axios-ntlm");
|
||||||
const { Settings } = require("./settings");
|
const { Settings } = require("./settings");
|
||||||
const grpc = require("@grpc/grpc-js");
|
const grpc = require("@grpc/grpc-js");
|
||||||
const protojs = require("protobufjs");
|
const protojs = require("protobufjs");
|
||||||
const radiusClient = require("node-radius-client");
|
const radiusClient = require("node-radius-client");
|
||||||
|
const redis = require("redis");
|
||||||
const {
|
const {
|
||||||
dictionaries: {
|
dictionaries: {
|
||||||
rfc2865: { file, attributes },
|
rfc2865: { file, attributes },
|
||||||
@ -323,6 +325,23 @@ exports.mysqlQuery = function (connectionString, query) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to and Ping a MongoDB database
|
||||||
|
* @param {string} connectionString The database connection string
|
||||||
|
* @returns {Promise<(string[]|Object[]|Object)>}
|
||||||
|
*/
|
||||||
|
exports.mongodbPing = async function (connectionString) {
|
||||||
|
let client = await MongoClient.connect(connectionString);
|
||||||
|
let dbPing = await client.db().command({ ping: 1 });
|
||||||
|
await client.close();
|
||||||
|
|
||||||
|
if (dbPing["ok"] === 1) {
|
||||||
|
return "UP";
|
||||||
|
} else {
|
||||||
|
throw Error("failed");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query radius server
|
* Query radius server
|
||||||
* @param {string} hostname Hostname of radius server
|
* @param {string} hostname Hostname of radius server
|
||||||
@ -360,6 +379,30 @@ exports.radius = function (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redis server ping
|
||||||
|
* @param {string} dsn The redis connection string
|
||||||
|
*/
|
||||||
|
exports.redisPingAsync = function (dsn) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const client = redis.createClient({
|
||||||
|
url: dsn,
|
||||||
|
});
|
||||||
|
client.on("error", (err) => {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
client.connect().then(() => {
|
||||||
|
client.ping().then((res, err) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
|
resolve(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve value of setting based on key
|
* Retrieve value of setting based on key
|
||||||
* @param {string} key Key of setting to retrieve
|
* @param {string} key Key of setting to retrieve
|
||||||
|
@ -2,4 +2,8 @@ html[lang='fa'] {
|
|||||||
#app {
|
#app {
|
||||||
font-family: 'IRANSans', 'Iranian Sans','B Nazanin', 'Tahoma', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, segoe ui, Roboto, helvetica neue, Arial, noto sans, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol, noto color emoji;
|
font-family: 'IRANSans', 'Iranian Sans','B Nazanin', 'Tahoma', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, segoe ui, Roboto, helvetica neue, Arial, noto sans, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol, noto color emoji;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul.multiselect__content {
|
||||||
|
padding-left: 0 !important;
|
||||||
|
}
|
||||||
|
@ -73,7 +73,7 @@ export default {
|
|||||||
emits: [ "added" ],
|
emits: [ "added" ],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
model: null,
|
modal: null,
|
||||||
processing: false,
|
processing: false,
|
||||||
id: null,
|
id: null,
|
||||||
connectionTypes: [ "socket", "tcp" ],
|
connectionTypes: [ "socket", "tcp" ],
|
||||||
|
@ -41,7 +41,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
displayText() {
|
displayText() {
|
||||||
if (this.item.value === "") {
|
if (this.item.value === "" || this.item.value === undefined) {
|
||||||
return this.item.name;
|
return this.item.name;
|
||||||
} else {
|
} else {
|
||||||
return `${this.item.name}: ${this.item.value}`;
|
return `${this.item.name}: ${this.item.value}`;
|
||||||
|
376
src/components/TagEditDialog.vue
Normal file
376
src/components/TagEditDialog.vue
Normal file
@ -0,0 +1,376 @@
|
|||||||
|
<template>
|
||||||
|
<form @submit.prevent="submit">
|
||||||
|
<div ref="modal" class="modal fade" tabindex="-1" data-bs-backdrop="static">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 id="exampleModalLabel" class="modal-title">
|
||||||
|
{{ $t("Edit Tag") }}
|
||||||
|
</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" />
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="tag-name" class="form-label">{{ $t("Name") }}</label>
|
||||||
|
<input id="tag-name" v-model="tag.name" type="text" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="tag-color" class="form-label">{{ $t("Color") }}</label>
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="col-8 pe-1">
|
||||||
|
<vue-multiselect
|
||||||
|
v-model="selectedColor"
|
||||||
|
:options="colorOptions"
|
||||||
|
:multiple="false"
|
||||||
|
:searchable="true"
|
||||||
|
:placeholder="$t('color')"
|
||||||
|
track-by="color"
|
||||||
|
label="name"
|
||||||
|
select-label=""
|
||||||
|
deselect-label=""
|
||||||
|
>
|
||||||
|
<template #option="{ option }">
|
||||||
|
<div
|
||||||
|
class="mx-2 py-1 px-3 rounded d-inline-flex"
|
||||||
|
style="height: 24px; color: white;"
|
||||||
|
:style="{ backgroundColor: option.color + ' !important' }"
|
||||||
|
>
|
||||||
|
<span>{{ option.name }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #singleLabel="{ option }">
|
||||||
|
<div
|
||||||
|
class="py-1 px-3 rounded d-inline-flex"
|
||||||
|
style="height: 24px; color: white;"
|
||||||
|
:style="{ backgroundColor: option.color + ' !important' }"
|
||||||
|
>
|
||||||
|
<span>{{ option.name }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</vue-multiselect>
|
||||||
|
</div>
|
||||||
|
<div class="col-4 ps-1">
|
||||||
|
<input id="tag-color-hex" v-model="tag.color" type="text" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="tag-monitors" class="form-label">{{ $tc("Monitor", selectedMonitors.length) }}</label>
|
||||||
|
<div class="tag-monitors-list">
|
||||||
|
<router-link v-for="monitor in selectedMonitors" :key="monitor.id" class="d-flex align-items-center justify-content-between text-decoration-none tag-monitors-list-row py-2 px-3" :to="monitorURL(monitor.id)" @click="modal.hide()">
|
||||||
|
<span>{{ monitor.name }}</span>
|
||||||
|
<button type="button" class="btn-rm-monitor btn btn-outline-danger ms-2 py-1" @click.stop.prevent="removeMonitor(monitor.id)">
|
||||||
|
<font-awesome-icon class="" icon="times" />
|
||||||
|
</button>
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
<div v-if="allMonitorList.length > 0" class="pt-3 px-3">
|
||||||
|
<label class="form-label">{{ $t("Add a monitor") }}:</label>
|
||||||
|
<select v-model="selectedAddMonitor" class="form-control">
|
||||||
|
<option v-for="monitor in allMonitorList" :key="monitor.id" :value="monitor">{{ monitor.name }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button v-if="tag" type="button" class="btn btn-danger" :disabled="processing" @click="deleteConfirm">
|
||||||
|
{{ $t("Delete") }}
|
||||||
|
</button>
|
||||||
|
<button type="submit" class="btn btn-primary" :disabled="processing">
|
||||||
|
<div v-if="processing" class="spinner-border spinner-border-sm me-1"></div>
|
||||||
|
{{ $t("Save") }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<Confirm ref="confirmDelete" btn-style="btn-danger" :yes-text="$t('Yes')" :no-text="$t('No')" @yes="deleteTag">
|
||||||
|
{{ $t("confirmDeleteTagMsg") }}
|
||||||
|
</Confirm>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { Modal } from "bootstrap";
|
||||||
|
import Confirm from "./Confirm.vue";
|
||||||
|
import VueMultiselect from "vue-multiselect";
|
||||||
|
import { colorOptions } from "../util-frontend";
|
||||||
|
import { useToast } from "vue-toastification";
|
||||||
|
import { getMonitorRelativeURL } from "../util.ts";
|
||||||
|
const toast = useToast();
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
VueMultiselect,
|
||||||
|
Confirm,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
updated: {
|
||||||
|
type: Function,
|
||||||
|
default: () => {},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
modal: null,
|
||||||
|
processing: false,
|
||||||
|
selectedColor: {
|
||||||
|
name: null,
|
||||||
|
color: null,
|
||||||
|
},
|
||||||
|
tag: {
|
||||||
|
id: null,
|
||||||
|
name: "",
|
||||||
|
color: "",
|
||||||
|
// Do not set default value here, please scroll to show()
|
||||||
|
},
|
||||||
|
monitors: [],
|
||||||
|
removingMonitor: [],
|
||||||
|
addingMonitor: [],
|
||||||
|
selectedAddMonitor: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
colorOptions() {
|
||||||
|
if (!colorOptions(this).find(option => option.color === this.tag.color)) {
|
||||||
|
return colorOptions(this).concat(
|
||||||
|
{
|
||||||
|
name: "custom",
|
||||||
|
color: this.tag.color
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return colorOptions(this);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectedMonitors() {
|
||||||
|
return this.monitors
|
||||||
|
.concat(Object.values(this.$root.monitorList).filter(monitor => this.addingMonitor.includes(monitor.id)))
|
||||||
|
.filter(monitor => !this.removingMonitor.includes(monitor.id));
|
||||||
|
},
|
||||||
|
allMonitorList() {
|
||||||
|
return Object.values(this.$root.monitorList).filter(monitor => !this.selectedMonitors.includes(monitor));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
// Set color option to "Custom" when a unknown color is entered
|
||||||
|
"tag.color"(to, from) {
|
||||||
|
if (colorOptions(this).find(x => x.color === to) == null) {
|
||||||
|
this.selectedColor.name = this.$t("Custom");
|
||||||
|
this.selectedColor.color = to;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectedColor(to, from) {
|
||||||
|
if (to != null) {
|
||||||
|
this.tag.color = to.color;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Selected a monitor and add to the list.
|
||||||
|
*/
|
||||||
|
selectedAddMonitor(monitor) {
|
||||||
|
if (monitor) {
|
||||||
|
if (this.removingMonitor.includes(monitor.id)) {
|
||||||
|
this.removingMonitor = this.removingMonitor.filter(id => id !== monitor.id);
|
||||||
|
} else {
|
||||||
|
this.addingMonitor.push(monitor.id);
|
||||||
|
}
|
||||||
|
this.selectedAddMonitor = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.modal = new Modal(this.$refs.modal);
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* Show confirmation for deleting a tag
|
||||||
|
*/
|
||||||
|
deleteConfirm() {
|
||||||
|
this.$refs.confirmDelete.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load tag information for display in the edit dialog
|
||||||
|
* @param {Object} tag tag object to edit
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
show(tag) {
|
||||||
|
if (tag) {
|
||||||
|
this.selectedColor = this.colorOptions.find(x => x.color === tag.color) ?? {
|
||||||
|
name: this.$t("Custom"),
|
||||||
|
color: tag.color
|
||||||
|
};
|
||||||
|
this.tag.id = tag.id;
|
||||||
|
this.tag.name = tag.name;
|
||||||
|
this.tag.color = tag.color;
|
||||||
|
this.monitors = this.monitorsByTag(tag.id);
|
||||||
|
this.removingMonitor = [];
|
||||||
|
this.addingMonitor = [];
|
||||||
|
this.selectedAddMonitor = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.modal.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit tag and monitorTag changes to server
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
async submit() {
|
||||||
|
this.processing = true;
|
||||||
|
let editResult = true;
|
||||||
|
|
||||||
|
for (let addId of this.addingMonitor) {
|
||||||
|
await this.addMonitorTagAsync(this.tag.id, addId, "").then((res) => {
|
||||||
|
if (!res.ok) {
|
||||||
|
toast.error(res.msg);
|
||||||
|
editResult = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let removeId of this.removingMonitor) {
|
||||||
|
this.monitors.find(monitor => monitor.id === removeId)?.tags.forEach(async (monitorTag) => {
|
||||||
|
await this.deleteMonitorTagAsync(this.tag.id, removeId, monitorTag.value).then((res) => {
|
||||||
|
if (!res.ok) {
|
||||||
|
toast.error(res.msg);
|
||||||
|
editResult = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$root.getSocket().emit("editTag", this.tag, (res) => {
|
||||||
|
this.$root.toastRes(res);
|
||||||
|
this.processing = false;
|
||||||
|
|
||||||
|
if (res.ok && editResult) {
|
||||||
|
this.updated();
|
||||||
|
this.modal.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the editing tag from server
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
deleteTag() {
|
||||||
|
this.processing = true;
|
||||||
|
this.$root.getSocket().emit("deleteTag", this.tag.id, (res) => {
|
||||||
|
this.$root.toastRes(res);
|
||||||
|
this.processing = false;
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
this.updated();
|
||||||
|
this.modal.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a monitor from the monitors list locally
|
||||||
|
* @param {number} id id of the tag to remove
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
removeMonitor(id) {
|
||||||
|
if (this.addingMonitor.includes(id)) {
|
||||||
|
this.addingMonitor = this.addingMonitor.filter(x => x !== id);
|
||||||
|
} else {
|
||||||
|
this.removingMonitor.push(id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get monitors which has a specific tag locally
|
||||||
|
* @param {number} tagId id of the tag to filter
|
||||||
|
* @returns {Object[]} list of monitors which has a specific tag
|
||||||
|
*/
|
||||||
|
monitorsByTag(tagId) {
|
||||||
|
return Object.values(this.$root.monitorList).filter((monitor) => {
|
||||||
|
return monitor.tags.find(monitorTag => monitorTag.tag_id === tagId);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get URL of monitor
|
||||||
|
* @param {number} id ID of monitor
|
||||||
|
* @returns {string} Relative URL of monitor
|
||||||
|
*/
|
||||||
|
monitorURL(id) {
|
||||||
|
return getMonitorRelativeURL(id);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a tag to a monitor asynchronously
|
||||||
|
* @param {number} tagId ID of tag to add
|
||||||
|
* @param {number} monitorId ID of monitor to add tag to
|
||||||
|
* @param {string} value Value of tag
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
addMonitorTagAsync(tagId, monitorId, value) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$root.getSocket().emit("addMonitorTag", tagId, monitorId, value, resolve);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Delete a tag from a monitor asynchronously
|
||||||
|
* @param {number} tagId ID of tag to remove
|
||||||
|
* @param {number} monitorId ID of monitor to remove tag from
|
||||||
|
* @param {string} value Value of tag
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
deleteMonitorTagAsync(tagId, monitorId, value) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$root.getSocket().emit("deleteMonitorTag", tagId, monitorId, value, resolve);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import "../assets/vars.scss";
|
||||||
|
|
||||||
|
.dark {
|
||||||
|
.modal-dialog .form-text, .modal-dialog p {
|
||||||
|
color: $dark-font-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-rm-monitor {
|
||||||
|
padding-left: 11px;
|
||||||
|
padding-right: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-monitors-list {
|
||||||
|
max-height: 40vh;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-monitors-list .tag-monitors-list-row {
|
||||||
|
cursor: pointer;
|
||||||
|
border-bottom: 1px solid rgba(0, 0, 0, 0.125);
|
||||||
|
|
||||||
|
.dark & {
|
||||||
|
border-bottom: 1px solid $dark-border-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: $highlight-white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark &:hover {
|
||||||
|
background-color: $dark-bg2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
@ -130,6 +130,7 @@
|
|||||||
import { Modal } from "bootstrap";
|
import { Modal } from "bootstrap";
|
||||||
import VueMultiselect from "vue-multiselect";
|
import VueMultiselect from "vue-multiselect";
|
||||||
import { useToast } from "vue-toastification";
|
import { useToast } from "vue-toastification";
|
||||||
|
import { colorOptions } from "../util-frontend";
|
||||||
import Tag from "../components/Tag.vue";
|
import Tag from "../components/Tag.vue";
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
|
|
||||||
@ -176,24 +177,7 @@ export default {
|
|||||||
return this.preSelectedTags.concat(this.newTags).filter(tag => !this.deleteTags.find(monitorTag => monitorTag.id === tag.id));
|
return this.preSelectedTags.concat(this.newTags).filter(tag => !this.deleteTags.find(monitorTag => monitorTag.id === tag.id));
|
||||||
},
|
},
|
||||||
colorOptions() {
|
colorOptions() {
|
||||||
return [
|
return colorOptions(this);
|
||||||
{ name: this.$t("Gray"),
|
|
||||||
color: "#4B5563" },
|
|
||||||
{ name: this.$t("Red"),
|
|
||||||
color: "#DC2626" },
|
|
||||||
{ name: this.$t("Orange"),
|
|
||||||
color: "#D97706" },
|
|
||||||
{ name: this.$t("Green"),
|
|
||||||
color: "#059669" },
|
|
||||||
{ name: this.$t("Blue"),
|
|
||||||
color: "#2563EB" },
|
|
||||||
{ name: this.$t("Indigo"),
|
|
||||||
color: "#4F46E5" },
|
|
||||||
{ name: this.$t("Purple"),
|
|
||||||
color: "#7C3AED" },
|
|
||||||
{ name: this.$t("Pink"),
|
|
||||||
color: "#DB2777" },
|
|
||||||
];
|
|
||||||
},
|
},
|
||||||
validateDraftTag() {
|
validateDraftTag() {
|
||||||
let nameInvalid = false;
|
let nameInvalid = false;
|
||||||
|
171
src/components/settings/Tags.vue
Normal file
171
src/components/settings/Tags.vue
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="tags-list my-3">
|
||||||
|
<div v-for="(tag, index) in tagsList" :key="tag.id" class="d-flex align-items-center mx-4 py-1 tags-list-row" :disabled="processing" @click="editTag(index)">
|
||||||
|
<div class="col-5 ps-1">
|
||||||
|
<Tag :item="tag" />
|
||||||
|
</div>
|
||||||
|
<div class="col-5 px-1">
|
||||||
|
<div>{{ monitorsByTag(tag.id).length }} {{ $tc("Monitor", monitorsByTag(tag.id).length) }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-2 pe-3 d-flex justify-content-end">
|
||||||
|
<button type="button" class="btn ms-2 py-1">
|
||||||
|
<font-awesome-icon class="" icon="edit" />
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn-rm-tag btn btn-outline-danger ms-2 py-1" :disabled="processing" @click.stop="deleteConfirm(index)">
|
||||||
|
<font-awesome-icon class="" icon="trash" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<TagEditDialog ref="tagEditDialog" :updated="tagsUpdated" />
|
||||||
|
<Confirm ref="confirmDelete" btn-style="btn-danger" :yes-text="$t('Yes')" :no-text="$t('No')" @yes="deleteTag">
|
||||||
|
{{ $t("confirmDeleteTagMsg") }}
|
||||||
|
</Confirm>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { useToast } from "vue-toastification";
|
||||||
|
import TagEditDialog from "../../components/TagEditDialog.vue";
|
||||||
|
import Tag from "../Tag.vue";
|
||||||
|
import Confirm from "../Confirm.vue";
|
||||||
|
const toast = useToast();
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Confirm,
|
||||||
|
TagEditDialog,
|
||||||
|
Tag,
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
processing: false,
|
||||||
|
tagsList: null,
|
||||||
|
deletingTag: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
settings() {
|
||||||
|
return this.$parent.$parent.$parent.settings;
|
||||||
|
},
|
||||||
|
saveSettings() {
|
||||||
|
return this.$parent.$parent.$parent.saveSettings;
|
||||||
|
},
|
||||||
|
settingsLoaded() {
|
||||||
|
return this.$parent.$parent.$parent.settingsLoaded;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.getExistingTags();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* Reflect tag changes in the UI by fetching data. Callback for the edit tag dialog.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
tagsUpdated() {
|
||||||
|
this.getExistingTags();
|
||||||
|
this.$root.getMonitorList();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of tags from server
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
getExistingTags() {
|
||||||
|
this.processing = true;
|
||||||
|
this.$root.getSocket().emit("getTags", (res) => {
|
||||||
|
this.processing = false;
|
||||||
|
if (res.ok) {
|
||||||
|
this.tagsList = res.tags;
|
||||||
|
} else {
|
||||||
|
toast.error(res.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show confirmation for deleting a tag
|
||||||
|
* @param {number} index index of the tag to delete in the local tagsList
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
deleteConfirm(index) {
|
||||||
|
this.deletingTag = this.tagsList[index];
|
||||||
|
this.$refs.confirmDelete.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show dialog for editing a tag
|
||||||
|
* @param {number} index index of the tag to edit in the local tagsList
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
editTag(index) {
|
||||||
|
this.$refs.tagEditDialog.show(this.tagsList[index]);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the tag "deletingTag" from server
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
deleteTag() {
|
||||||
|
this.processing = true;
|
||||||
|
this.$root.getSocket().emit("deleteTag", this.deletingTag.id, (res) => {
|
||||||
|
this.$root.toastRes(res);
|
||||||
|
this.processing = false;
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
this.tagsUpdated();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get monitors which has a specific tag locally
|
||||||
|
* @param {number} tagId id of the tag to filter
|
||||||
|
* @returns {Object[]} list of monitors which has a specific tag
|
||||||
|
*/
|
||||||
|
monitorsByTag(tagId) {
|
||||||
|
return Object.values(this.$root.monitorList).filter((monitor) => {
|
||||||
|
return monitor.tags.find(monitorTag => monitorTag.tag_id === tagId);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import "../../assets/vars.scss";
|
||||||
|
|
||||||
|
.btn-rm-tag {
|
||||||
|
padding-left: 11px;
|
||||||
|
padding-right: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags-list .tags-list-row {
|
||||||
|
cursor: pointer;
|
||||||
|
border-bottom: 1px solid rgba(0, 0, 0, 0.125);
|
||||||
|
|
||||||
|
.dark & {
|
||||||
|
border-bottom: 1px solid $dark-border-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: $highlight-white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark &:hover {
|
||||||
|
background-color: $dark-bg2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags-list .tags-list-row:last-child {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
@ -591,7 +591,7 @@ export default {
|
|||||||
"You can divide numbers with": "Čísla můžete dělit pomocí",
|
"You can divide numbers with": "Čísla můžete dělit pomocí",
|
||||||
"or": "nebo",
|
"or": "nebo",
|
||||||
recurringInterval: "Interval",
|
recurringInterval: "Interval",
|
||||||
"Recurring": "Recurring",
|
"Recurring": "Opakující se",
|
||||||
strategyManual: "Aktivní/Neaktivní Ručně",
|
strategyManual: "Aktivní/Neaktivní Ručně",
|
||||||
warningTimezone: "Používá se časové pásmo serveru",
|
warningTimezone: "Používá se časové pásmo serveru",
|
||||||
weekdayShortMon: "Po",
|
weekdayShortMon: "Po",
|
||||||
|
@ -74,6 +74,7 @@ export default {
|
|||||||
Current: "Current",
|
Current: "Current",
|
||||||
Uptime: "Uptime",
|
Uptime: "Uptime",
|
||||||
"Cert Exp.": "Cert Exp.",
|
"Cert Exp.": "Cert Exp.",
|
||||||
|
Monitor: "Monitor | Monitors",
|
||||||
day: "day | days",
|
day: "day | days",
|
||||||
"-day": "-day",
|
"-day": "-day",
|
||||||
hour: "hour",
|
hour: "hour",
|
||||||
@ -190,6 +191,7 @@ export default {
|
|||||||
Indigo: "Indigo",
|
Indigo: "Indigo",
|
||||||
Purple: "Purple",
|
Purple: "Purple",
|
||||||
Pink: "Pink",
|
Pink: "Pink",
|
||||||
|
Custom: "Custom",
|
||||||
"Search...": "Search...",
|
"Search...": "Search...",
|
||||||
"Avg. Ping": "Avg. Ping",
|
"Avg. Ping": "Avg. Ping",
|
||||||
"Avg. Response": "Avg. Response",
|
"Avg. Response": "Avg. Response",
|
||||||
@ -678,4 +680,5 @@ export default {
|
|||||||
"Specific Monitor Type": "Specific Monitor Type",
|
"Specific Monitor Type": "Specific Monitor Type",
|
||||||
dataRetentionTimeError: "Retention period must be 0 or greater",
|
dataRetentionTimeError: "Retention period must be 0 or greater",
|
||||||
infiniteRetention: "Set to 0 for infinite retention.",
|
infiniteRetention: "Set to 0 for infinite retention.",
|
||||||
|
confirmDeleteTagMsg: "Are you sure you want to delete this tag? Monitors associated with this tag will not be deleted.",
|
||||||
};
|
};
|
||||||
|
@ -57,9 +57,15 @@
|
|||||||
<option value="mysql">
|
<option value="mysql">
|
||||||
MySQL/MariaDB
|
MySQL/MariaDB
|
||||||
</option>
|
</option>
|
||||||
|
<option value="mongodb">
|
||||||
|
MongoDB
|
||||||
|
</option>
|
||||||
<option value="radius">
|
<option value="radius">
|
||||||
Radius
|
Radius
|
||||||
</option>
|
</option>
|
||||||
|
<option value="redis">
|
||||||
|
Redis
|
||||||
|
</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -267,6 +273,24 @@
|
|||||||
<textarea id="sqlQuery" v-model="monitor.databaseQuery" class="form-control" placeholder="Example: select getdate()"></textarea>
|
<textarea id="sqlQuery" v-model="monitor.databaseQuery" class="form-control" placeholder="Example: select getdate()"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- Redis -->
|
||||||
|
<template v-if="monitor.type === 'redis'">
|
||||||
|
<div class="my-3">
|
||||||
|
<label for="redisConnectionString" class="form-label">{{ $t("Connection String") }}</label>
|
||||||
|
<input id="redisConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control" placeholder="redis://user:password@host:port">
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- MongoDB -->
|
||||||
|
<template v-if="monitor.type === 'mongodb'">
|
||||||
|
<div class="my-3">
|
||||||
|
<label for="sqlConnectionString" class="form-label">{{ $t("Connection String") }}</label>
|
||||||
|
|
||||||
|
<template v-if="monitor.type === 'mongodb'">
|
||||||
|
<input id="sqlConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control" placeholder="mongodb://username:password@host:port/database">
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- Interval -->
|
<!-- Interval -->
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
|
@ -95,6 +95,9 @@ export default {
|
|||||||
"reverse-proxy": {
|
"reverse-proxy": {
|
||||||
title: this.$t("Reverse Proxy"),
|
title: this.$t("Reverse Proxy"),
|
||||||
},
|
},
|
||||||
|
tags: {
|
||||||
|
title: this.$t("Tags"),
|
||||||
|
},
|
||||||
"monitor-history": {
|
"monitor-history": {
|
||||||
title: this.$t("Monitor History"),
|
title: this.$t("Monitor History"),
|
||||||
},
|
},
|
||||||
|
@ -24,6 +24,7 @@ import Appearance from "./components/settings/Appearance.vue";
|
|||||||
import General from "./components/settings/General.vue";
|
import General from "./components/settings/General.vue";
|
||||||
const Notifications = () => import("./components/settings/Notifications.vue");
|
const Notifications = () => import("./components/settings/Notifications.vue");
|
||||||
import ReverseProxy from "./components/settings/ReverseProxy.vue";
|
import ReverseProxy from "./components/settings/ReverseProxy.vue";
|
||||||
|
import Tags from "./components/settings/Tags.vue";
|
||||||
import MonitorHistory from "./components/settings/MonitorHistory.vue";
|
import MonitorHistory from "./components/settings/MonitorHistory.vue";
|
||||||
const Security = () => import("./components/settings/Security.vue");
|
const Security = () => import("./components/settings/Security.vue");
|
||||||
import Proxies from "./components/settings/Proxies.vue";
|
import Proxies from "./components/settings/Proxies.vue";
|
||||||
@ -95,6 +96,10 @@ const routes = [
|
|||||||
path: "reverse-proxy",
|
path: "reverse-proxy",
|
||||||
component: ReverseProxy,
|
component: ReverseProxy,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "tags",
|
||||||
|
component: Tags,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "monitor-history",
|
path: "monitor-history",
|
||||||
component: MonitorHistory,
|
component: MonitorHistory,
|
||||||
|
@ -94,3 +94,29 @@ export function hostNameRegexPattern(mqtt = false) {
|
|||||||
|
|
||||||
return `${ipRegexPattern}|${hostNameRegexPattern}`;
|
return `${ipRegexPattern}|${hostNameRegexPattern}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the tag color options
|
||||||
|
* Shared between components
|
||||||
|
* @returns {Object[]}
|
||||||
|
*/
|
||||||
|
export function colorOptions(self) {
|
||||||
|
return [
|
||||||
|
{ name: self.$t("Gray"),
|
||||||
|
color: "#4B5563" },
|
||||||
|
{ name: self.$t("Red"),
|
||||||
|
color: "#DC2626" },
|
||||||
|
{ name: self.$t("Orange"),
|
||||||
|
color: "#D97706" },
|
||||||
|
{ name: self.$t("Green"),
|
||||||
|
color: "#059669" },
|
||||||
|
{ name: self.$t("Blue"),
|
||||||
|
color: "#2563EB" },
|
||||||
|
{ name: self.$t("Indigo"),
|
||||||
|
color: "#4F46E5" },
|
||||||
|
{ name: self.$t("Purple"),
|
||||||
|
color: "#7C3AED" },
|
||||||
|
{ name: self.$t("Pink"),
|
||||||
|
color: "#DB2777" },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user