🔨 优化异常处理逻辑.
This commit is contained in:
@@ -58,15 +58,13 @@
|
|||||||
// 修改配置
|
// 修改配置
|
||||||
appStore.updateSettings({ [key]: value });
|
appStore.updateSettings({ [key]: value });
|
||||||
// 同步偏好
|
// 同步偏好
|
||||||
try {
|
|
||||||
await updatePreference({
|
await updatePreference({
|
||||||
type: 'SYSTEM',
|
type: 'SYSTEM',
|
||||||
item: key,
|
item: key,
|
||||||
value
|
value
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
treeData.value = await cacheStore.loadHostGroupTree();
|
treeData.value = await cacheStore.loadHostGroupTree();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
emits('setLoading', false);
|
emits('setLoading', false);
|
||||||
}
|
}
|
||||||
@@ -300,7 +299,6 @@
|
|||||||
});
|
});
|
||||||
// 移动分组
|
// 移动分组
|
||||||
moveNode(treeData.value, dragNode, dropNode, dropPosition);
|
moveNode(treeData.value, dragNode, dropNode, dropPosition);
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
emits('setLoading', false);
|
emits('setLoading', false);
|
||||||
}
|
}
|
||||||
@@ -312,7 +310,6 @@
|
|||||||
emits('setLoading', true);
|
emits('setLoading', true);
|
||||||
const groups = await cacheStore.loadHostGroupTree(force);
|
const groups = await cacheStore.loadHostGroupTree(force);
|
||||||
treeData.value = groups || [];
|
treeData.value = groups || [];
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
emits('setLoading', false);
|
emits('setLoading', false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,6 @@
|
|||||||
username: s.username,
|
username: s.username,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,6 @@
|
|||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,7 +160,6 @@
|
|||||||
hosts.value = data;
|
hosts.value = data;
|
||||||
// 设置主机搜索选项
|
// 设置主机搜索选项
|
||||||
filterOptions.value = getAuthorizedHostOptions(data.hostList);
|
filterOptions.value = getAuthorizedHostOptions(data.hostList);
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,6 @@
|
|||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,6 @@
|
|||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ export default class LogAppender implements ILogAppender {
|
|||||||
this.client.close();
|
this.client.close();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,6 @@
|
|||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
pagination.pageSize = request.limit;
|
pagination.pageSize = request.limit;
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,6 @@
|
|||||||
setVisible(false);
|
setVisible(false);
|
||||||
Message.error('cron 表达式错误');
|
Message.error('cron 表达式错误');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,6 @@
|
|||||||
Message.success('回滚成功');
|
Message.success('回滚成功');
|
||||||
emits('updated');
|
emits('updated');
|
||||||
handleClear();
|
handleClear();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -144,7 +143,6 @@
|
|||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
pagination.pageSize = request.limit;
|
pagination.pageSize = request.limit;
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,6 @@
|
|||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
value: s.agentKey,
|
value: s.agentKey,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,6 @@
|
|||||||
origin: s
|
origin: s
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,6 @@
|
|||||||
title: '根目录',
|
title: '根目录',
|
||||||
children: render([...menus])
|
children: render([...menus])
|
||||||
}];
|
}];
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,10 +96,16 @@
|
|||||||
const reloadAllMessage = async () => {
|
const reloadAllMessage = async () => {
|
||||||
hasMore.value = true;
|
hasMore.value = true;
|
||||||
messageList.value = [];
|
messageList.value = [];
|
||||||
|
try {
|
||||||
|
await Promise.all([
|
||||||
// 查询数量
|
// 查询数量
|
||||||
queryMessageCount();
|
queryMessageCount(),
|
||||||
// 加载列表
|
// 加载列表
|
||||||
await loadMessage();
|
loadMessage()
|
||||||
|
]);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('load message error', e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取数量
|
// 获取数量
|
||||||
@@ -108,7 +114,6 @@
|
|||||||
try {
|
try {
|
||||||
const { data } = await getSystemMessageCount(queryUnread.value);
|
const { data } = await getSystemMessageCount(queryUnread.value);
|
||||||
classifyCount.value = data;
|
classifyCount.value = data;
|
||||||
} catch (ex) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setFetchLoading(false);
|
setFetchLoading(false);
|
||||||
}
|
}
|
||||||
@@ -135,17 +140,16 @@
|
|||||||
limit: messageLimit,
|
limit: messageLimit,
|
||||||
classify: currentClassify.value,
|
classify: currentClassify.value,
|
||||||
queryUnread: queryUnread.value,
|
queryUnread: queryUnread.value,
|
||||||
maxId,
|
maxId
|
||||||
});
|
});
|
||||||
data.forEach(s => {
|
data.forEach(s => {
|
||||||
messageList.value.push({
|
messageList.value.push({
|
||||||
...s,
|
...s,
|
||||||
content: clearHtmlTag(s.content),
|
content: clearHtmlTag(s.content),
|
||||||
contentHtml: replaceHtmlTag(s.content),
|
contentHtml: replaceHtmlTag(s.content)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
hasMore.value = data.length === messageLimit;
|
hasMore.value = data.length === messageLimit;
|
||||||
} catch (ex) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setFetchLoading(false);
|
setFetchLoading(false);
|
||||||
}
|
}
|
||||||
@@ -159,7 +163,6 @@
|
|||||||
await updateSystemMessageReadAll(currentClassify.value);
|
await updateSystemMessageReadAll(currentClassify.value);
|
||||||
// 修改状态
|
// 修改状态
|
||||||
messageList.value.forEach(s => s.status = MessageStatus.READ);
|
messageList.value.forEach(s => s.status = MessageStatus.READ);
|
||||||
} catch (ex) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setMessageLoading(false);
|
setMessageLoading(false);
|
||||||
}
|
}
|
||||||
@@ -171,7 +174,6 @@
|
|||||||
try {
|
try {
|
||||||
// 清理消息
|
// 清理消息
|
||||||
await clearSystemMessage(currentClassify.value);
|
await clearSystemMessage(currentClassify.value);
|
||||||
} catch (ex) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setMessageLoading(false);
|
setMessageLoading(false);
|
||||||
}
|
}
|
||||||
@@ -204,7 +206,6 @@
|
|||||||
// 移除
|
// 移除
|
||||||
const index = messageList.value.findIndex(s => s.id === message.id);
|
const index = messageList.value.findIndex(s => s.id === message.id);
|
||||||
messageList.value.splice(index, 1);
|
messageList.value.splice(index, 1);
|
||||||
} catch (ex) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setMessageLoading(false);
|
setMessageLoading(false);
|
||||||
}
|
}
|
||||||
@@ -237,7 +238,7 @@
|
|||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
localStorage.setItem(MESSAGE_CONFIG_KEY, JSON.stringify({
|
localStorage.setItem(MESSAGE_CONFIG_KEY, JSON.stringify({
|
||||||
currentClassify: currentClassify.value,
|
currentClassify: currentClassify.value,
|
||||||
queryUnread: queryUnread.value,
|
queryUnread: queryUnread.value
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,6 @@
|
|||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,6 @@
|
|||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,6 @@
|
|||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,6 @@
|
|||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,8 +127,6 @@
|
|||||||
// 清空
|
// 清空
|
||||||
handlerClear();
|
handlerClear();
|
||||||
emits('updated');
|
emits('updated');
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ export default class TerminalSessionManager implements ITerminalSessionManager {
|
|||||||
// 移除 resize 事件
|
// 移除 resize 事件
|
||||||
removeEventListen(window, 'resize', this.dispatchFitFn);
|
removeEventListen(window, 'resize', this.dispatchFitFn);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user