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