mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-05-26 00:22:33 +02:00
Remove redundant code
This commit is contained in:
parent
853e84178e
commit
2d67631cb2
6 changed files with 86 additions and 1273 deletions
|
@ -72,17 +72,11 @@ export default {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
show(group, monitor) {
|
show(group, monitor) {
|
||||||
// Check if monitor exists and has required properties
|
|
||||||
if (!monitor || !monitor.id) {
|
|
||||||
console.error("Invalid monitor object", monitor);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.monitor = {
|
this.monitor = {
|
||||||
id: monitor.id,
|
id: monitor.element.id,
|
||||||
name: monitor.name,
|
name: monitor.element.name,
|
||||||
monitor_index: monitor.index || 0,
|
monitor_index: monitor.index,
|
||||||
group_index: group.index || 0,
|
group_index: group.index,
|
||||||
isClickAble: this.showLink(monitor),
|
isClickAble: this.showLink(monitor),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -109,18 +103,12 @@ export default {
|
||||||
* @returns {boolean} Should the link be shown?
|
* @returns {boolean} Should the link be shown?
|
||||||
*/
|
*/
|
||||||
showLink(monitor, ignoreSendUrl = false) {
|
showLink(monitor, ignoreSendUrl = false) {
|
||||||
if (!monitor || !monitor.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We must check if there are any elements in monitorList to
|
// We must check if there are any elements in monitorList to
|
||||||
// prevent undefined errors if it hasn't been loaded yet
|
// prevent undefined errors if it hasn't been loaded yet
|
||||||
if (this.$parent.editMode && ignoreSendUrl && Object.keys(this.$root.monitorList).length) {
|
if (this.$parent.editMode && ignoreSendUrl && Object.keys(this.$root.monitorList).length) {
|
||||||
return this.$root.monitorList[monitor.id].type === "http" ||
|
return this.$root.monitorList[monitor.element.id].type === "http" || this.$root.monitorList[monitor.element.id].type === "keyword" || this.$root.monitorList[monitor.element.id].type === "json-query";
|
||||||
this.$root.monitorList[monitor.id].type === "keyword" ||
|
|
||||||
this.$root.monitorList[monitor.id].type === "json-query";
|
|
||||||
}
|
}
|
||||||
return monitor.sendUrl && monitor.url && monitor.url !== "https://" && !this.editMode;
|
return monitor.element.sendUrl && monitor.element.url && monitor.element.url !== "https://" && !this.editMode;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -20,8 +20,8 @@ import {
|
||||||
faTachometerAlt,
|
faTachometerAlt,
|
||||||
faTimes,
|
faTimes,
|
||||||
faTimesCircle,
|
faTimesCircle,
|
||||||
faCheckCircle,
|
|
||||||
faTrash,
|
faTrash,
|
||||||
|
faCheckCircle,
|
||||||
faStream,
|
faStream,
|
||||||
faSave,
|
faSave,
|
||||||
faExclamationCircle,
|
faExclamationCircle,
|
||||||
|
@ -50,8 +50,6 @@ import {
|
||||||
faInfoCircle,
|
faInfoCircle,
|
||||||
faClone,
|
faClone,
|
||||||
faCertificate,
|
faCertificate,
|
||||||
faArrowUp,
|
|
||||||
faArrowDown,
|
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
library.add(
|
library.add(
|
||||||
|
@ -68,8 +66,8 @@ library.add(
|
||||||
faTachometerAlt,
|
faTachometerAlt,
|
||||||
faTimes,
|
faTimes,
|
||||||
faTimesCircle,
|
faTimesCircle,
|
||||||
faCheckCircle,
|
|
||||||
faTrash,
|
faTrash,
|
||||||
|
faCheckCircle,
|
||||||
faStream,
|
faStream,
|
||||||
faSave,
|
faSave,
|
||||||
faExclamationCircle,
|
faExclamationCircle,
|
||||||
|
@ -99,8 +97,6 @@ library.add(
|
||||||
faInfoCircle,
|
faInfoCircle,
|
||||||
faClone,
|
faClone,
|
||||||
faCertificate,
|
faCertificate,
|
||||||
faArrowUp,
|
|
||||||
faArrowDown,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
export { FontAwesomeIcon };
|
export { FontAwesomeIcon };
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
"Current": "Current",
|
"Current": "Current",
|
||||||
"Uptime": "Uptime",
|
"Uptime": "Uptime",
|
||||||
"Cert Exp.": "Cert Exp.",
|
"Cert Exp.": "Cert Exp.",
|
||||||
"Sort By": "Sort By",
|
|
||||||
"Monitor": "Monitor | Monitors",
|
"Monitor": "Monitor | Monitors",
|
||||||
"now": "now",
|
"now": "now",
|
||||||
"time ago": "{0} ago",
|
"time ago": "{0} ago",
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
"notificationDescription": "通知必须被分配给监控项才能正常工作。",
|
"notificationDescription": "通知必须被分配给监控项才能正常工作。",
|
||||||
"keywordDescription": "在纯 HTML 或 JSON 响应中搜索关键字,区分大小写。",
|
"keywordDescription": "在纯 HTML 或 JSON 响应中搜索关键字,区分大小写。",
|
||||||
"pauseDashboardHome": "暂停",
|
"pauseDashboardHome": "暂停",
|
||||||
"Sort By": "排序方式",
|
|
||||||
"deleteMonitorMsg": "确定要删除此监控项吗?",
|
"deleteMonitorMsg": "确定要删除此监控项吗?",
|
||||||
"deleteMaintenanceMsg": "确定要删除此维护吗?",
|
"deleteMaintenanceMsg": "确定要删除此维护吗?",
|
||||||
"deleteNotificationMsg": "确定要为所有监控项删除此通知吗?",
|
"deleteNotificationMsg": "确定要为所有监控项删除此通知吗?",
|
||||||
|
@ -1118,7 +1117,5 @@
|
||||||
"wayToGetWahaApiKey": "API 密钥是你用于运行 WAHA 的 WHATSAPP_API_KEY 环境变量值。",
|
"wayToGetWahaApiKey": "API 密钥是你用于运行 WAHA 的 WHATSAPP_API_KEY 环境变量值。",
|
||||||
"telegramTemplateFormatDescription": "Telegram 允许在消息中使用不同的标记语言,具体细节请参见 Telegram {0}。",
|
"telegramTemplateFormatDescription": "Telegram 允许在消息中使用不同的标记语言,具体细节请参见 Telegram {0}。",
|
||||||
"YZJ Webhook URL": "YZJ Webhook 地址",
|
"YZJ Webhook URL": "YZJ Webhook 地址",
|
||||||
"YZJ Robot Token": "YZJ 机器人令牌",
|
"YZJ Robot Token": "YZJ 机器人令牌"
|
||||||
"Search...": "搜索...",
|
|
||||||
"No services found": "未找到服务"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,7 +328,7 @@
|
||||||
👀 {{ $t("statusPageNothing") }}
|
👀 {{ $t("statusPageNothing") }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<PublicGroupList :edit-mode="enableEditMode" :show-tags="config.showTags" :show-certificate-expiry="config.showCertificateExpiry" :slug="slug" />
|
<PublicGroupList :edit-mode="enableEditMode" :show-tags="config.showTags" :show-certificate-expiry="config.showCertificateExpiry" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer class="mt-5 mb-4">
|
<footer class="mt-5 mb-4">
|
||||||
|
@ -773,12 +773,10 @@ export default {
|
||||||
if (! this.editMode) {
|
if (! this.editMode) {
|
||||||
axios.get("/api/status-page/heartbeat/" + this.slug).then((res) => {
|
axios.get("/api/status-page/heartbeat/" + this.slug).then((res) => {
|
||||||
const { heartbeatList, uptimeList } = res.data;
|
const { heartbeatList, uptimeList } = res.data;
|
||||||
|
|
||||||
this.$root.heartbeatList = heartbeatList;
|
this.$root.heartbeatList = heartbeatList;
|
||||||
this.$root.uptimeList = uptimeList;
|
this.$root.uptimeList = uptimeList;
|
||||||
|
|
||||||
// 注:移除了原有的"宕机优先"排序逻辑
|
|
||||||
// 现在监控器的排序将完全由PublicGroupList组件的排序功能控制
|
|
||||||
|
|
||||||
const heartbeatIds = Object.keys(heartbeatList);
|
const heartbeatIds = Object.keys(heartbeatList);
|
||||||
const downMonitors = heartbeatIds.reduce((downMonitorsAmount, currentId) => {
|
const downMonitors = heartbeatIds.reduce((downMonitorsAmount, currentId) => {
|
||||||
const monitorHeartbeats = heartbeatList[currentId];
|
const monitorHeartbeats = heartbeatList[currentId];
|
||||||
|
|
Loading…
Add table
Reference in a new issue