🔨 优化异常处理逻辑.
This commit is contained in:
@@ -137,7 +137,6 @@
|
|||||||
// 无数据
|
// 无数据
|
||||||
Message.warning('当前条件未查询到数据');
|
Message.warning('当前条件未查询到数据');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -159,7 +158,6 @@
|
|||||||
// 清空
|
// 清空
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
handlerClear();
|
handlerClear();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,7 +264,6 @@
|
|||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -280,7 +279,6 @@
|
|||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -304,7 +302,6 @@
|
|||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
pagination.pageSize = request.limit;
|
pagination.pageSize = request.limit;
|
||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -328,7 +325,6 @@
|
|||||||
record.status = HostConnectStatus.FORCE_OFFLINE;
|
record.status = HostConnectStatus.FORCE_OFFLINE;
|
||||||
record.endTime = Date.now();
|
record.endTime = Date.now();
|
||||||
Message.success('已下线');
|
Message.success('已下线');
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,6 @@
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { data } = await getTerminalConnectSessions(formModel);
|
const { data } = await getTerminalConnectSessions(formModel);
|
||||||
tableRenderData.value = data;
|
tableRenderData.value = data;
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -177,7 +176,6 @@
|
|||||||
Message.success('已下线');
|
Message.success('已下线');
|
||||||
// 移除行
|
// 移除行
|
||||||
tableRenderData.value.splice(tableRenderData.value.findIndex(s => s.id === record.id), 1);
|
tableRenderData.value.splice(tableRenderData.value.findIndex(s => s.id === record.id), 1);
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,7 +239,6 @@
|
|||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
pagination.pageSize = request.limit;
|
pagination.pageSize = request.limit;
|
||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -260,7 +259,6 @@
|
|||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -276,7 +274,6 @@
|
|||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,6 @@
|
|||||||
const hosts = await cacheStore.loadHosts();
|
const hosts = await cacheStore.loadHosts();
|
||||||
selectedGroupHosts.value = data.map(s => hosts.find(h => h.id === s) as HostQueryResponse)
|
selectedGroupHosts.value = data.map(s => hosts.find(h => h.id === s) as HostQueryResponse)
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -120,7 +119,6 @@
|
|||||||
const { data } = await getAuthorizedHostGroup(request);
|
const { data } = await getAuthorizedHostGroup(request);
|
||||||
authorizedGroups.value = data;
|
authorizedGroups.value = data;
|
||||||
checkedGroups.value = data;
|
checkedGroups.value = data;
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -138,7 +136,6 @@
|
|||||||
Message.success('授权成功');
|
Message.success('授权成功');
|
||||||
// 清空缓存
|
// 清空缓存
|
||||||
cacheStore.reset('authorizedHost_ALL', 'authorizedHost_SSH');
|
cacheStore.reset('authorizedHost_ALL', 'authorizedHost_SSH');
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,6 @@
|
|||||||
try {
|
try {
|
||||||
const { data } = await getAuthorizedHostIdentity(request);
|
const { data } = await getAuthorizedHostIdentity(request);
|
||||||
selectedKeys.value = data;
|
selectedKeys.value = data;
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -99,7 +98,6 @@
|
|||||||
Message.success('授权成功');
|
Message.success('授权成功');
|
||||||
// 清空缓存
|
// 清空缓存
|
||||||
cacheStore.reset('authorizedHostIdentities');
|
cacheStore.reset('authorizedHostIdentities');
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -136,7 +134,6 @@
|
|||||||
hostIdentities.value = await cacheStore.loadHostIdentities();
|
hostIdentities.value = await cacheStore.loadHostIdentities();
|
||||||
// 加载主机密钥
|
// 加载主机密钥
|
||||||
hostKeys.value = await cacheStore.loadHostKeys();
|
hostKeys.value = await cacheStore.loadHostKeys();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,6 @@
|
|||||||
try {
|
try {
|
||||||
const { data } = await getAuthorizedHostKey(request);
|
const { data } = await getAuthorizedHostKey(request);
|
||||||
selectedKeys.value = data;
|
selectedKeys.value = data;
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -75,7 +74,6 @@
|
|||||||
Message.success('授权成功');
|
Message.success('授权成功');
|
||||||
// 清空缓存
|
// 清空缓存
|
||||||
cacheStore.reset('authorizedHostKeys');
|
cacheStore.reset('authorizedHostKeys');
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -109,7 +107,6 @@
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
hostKeys.value = await cacheStore.loadHostKeys();
|
hostKeys.value = await cacheStore.loadHostKeys();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,6 @@
|
|||||||
emits('loading', true);
|
emits('loading', true);
|
||||||
const { data } = await getHostGroupRelList(groupId as number);
|
const { data } = await getHostGroupRelList(groupId as number);
|
||||||
value.value = data.map(String);
|
value.value = data.map(String);
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
emits('loading', false);
|
emits('loading', false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,6 @@
|
|||||||
hostIdList: currentGroupHost.value
|
hostIdList: currentGroupHost.value
|
||||||
});
|
});
|
||||||
Message.success('保存成功');
|
Message.success('保存成功');
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,7 +221,6 @@
|
|||||||
Message.success('删除成功');
|
Message.success('删除成功');
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -254,7 +253,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,8 +182,6 @@
|
|||||||
}
|
}
|
||||||
// 清空
|
// 清空
|
||||||
handlerClear();
|
handlerClear();
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,7 +240,6 @@
|
|||||||
Message.success('删除成功');
|
Message.success('删除成功');
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -256,7 +255,6 @@
|
|||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -282,7 +280,6 @@
|
|||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
pagination.pageSize = request.limit;
|
pagination.pageSize = request.limit;
|
||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,6 @@
|
|||||||
Message.success('删除成功');
|
Message.success('删除成功');
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -160,7 +159,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,8 +232,6 @@
|
|||||||
}
|
}
|
||||||
// 清空
|
// 清空
|
||||||
handlerClear();
|
handlerClear();
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,7 +189,6 @@
|
|||||||
Message.success('删除成功');
|
Message.success('删除成功');
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -205,7 +204,6 @@
|
|||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -231,7 +229,6 @@
|
|||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
pagination.pageSize = request.limit;
|
pagination.pageSize = request.limit;
|
||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,7 +351,6 @@
|
|||||||
});
|
});
|
||||||
record.status = newStatus;
|
record.status = newStatus;
|
||||||
Message.success(`已${dict.label}`);
|
Message.success(`已${dict.label}`);
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -374,7 +373,6 @@
|
|||||||
Message.success('删除成功');
|
Message.success('删除成功');
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -408,7 +406,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,6 @@
|
|||||||
renderForm({ ...detail, tags });
|
renderForm({ ...detail, tags });
|
||||||
// 响应类型
|
// 响应类型
|
||||||
emits('changeType', data.types);
|
emits('changeType', data.types);
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -209,7 +208,6 @@
|
|||||||
emits('updated', formModel.value.id);
|
emits('updated', formModel.value.id);
|
||||||
}
|
}
|
||||||
emits('changeType', formModel.value.types);
|
emits('changeType', formModel.value.types);
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -307,7 +307,6 @@
|
|||||||
// 查询规格信息
|
// 查询规格信息
|
||||||
const { data } = await getHostExtraItem<HostSpecExtraModel>({ hostId: props.hostId, item: 'SPEC' });
|
const { data } = await getHostExtraItem<HostSpecExtraModel>({ hostId: props.hostId, item: 'SPEC' });
|
||||||
formModel.value = data;
|
formModel.value = data;
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -343,7 +342,6 @@
|
|||||||
});
|
});
|
||||||
toggleEditing();
|
toggleEditing();
|
||||||
emits('updated');
|
emits('updated');
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,7 +166,6 @@
|
|||||||
// 测试连接
|
// 测试连接
|
||||||
await testHostConnect({ id: props.hostId, type: HostType.SSH.value });
|
await testHostConnect({ id: props.hostId, type: HostType.SSH.value });
|
||||||
Message.success('连接成功');
|
Message.success('连接成功');
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -398,7 +398,6 @@
|
|||||||
});
|
});
|
||||||
record.status = newStatus;
|
record.status = newStatus;
|
||||||
Message.success(`已${dict.label}`);
|
Message.success(`已${dict.label}`);
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -421,7 +420,6 @@
|
|||||||
Message.success('删除成功');
|
Message.success('删除成功');
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -439,7 +437,6 @@
|
|||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -466,7 +463,6 @@
|
|||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
pagination.pageSize = request.limit;
|
pagination.pageSize = request.limit;
|
||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default function useHostConfigForm<T extends HostBaseConfig>(options: Use
|
|||||||
const { data } = await getHostConfig<T>({ hostId, type });
|
const { data } = await getHostConfig<T>({ hostId, type });
|
||||||
data.useNewPassword = !data.hasPassword;
|
data.useNewPassword = !data.hasPassword;
|
||||||
formModel.value = data;
|
formModel.value = data;
|
||||||
} catch (err: any) {
|
} catch (e) {
|
||||||
Message.error('配置加载失败');
|
Message.error('配置加载失败');
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -62,7 +62,6 @@ export default function useHostConfigForm<T extends HostBaseConfig>(options: Use
|
|||||||
config: JSON.stringify(data),
|
config: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
Message.success('修改成功');
|
Message.success('修改成功');
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user