feat: 网元主机操作Hooks包
This commit is contained in:
@@ -21,7 +21,7 @@ import {
|
||||
nodeImageAnimateState,
|
||||
nodeRectAnimateState,
|
||||
} from '../topologyBuild/hooks/registerNode';
|
||||
import useNeOptions from './useNeOptions';
|
||||
import useNeOptions from '@/views/ne/neInfo/hooks/useNeOptions';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
||||
const { t } = useI18n();
|
||||
@@ -97,7 +97,7 @@ const graphNodeMenu = new Menu({
|
||||
> ${t('views.configManage.neManage.stop')}
|
||||
</div>
|
||||
<div id="log" style="cursor: pointer; margin-bottom: 4px;">
|
||||
> ${t('views.monitor.topology.viewLogFile')}
|
||||
> ${t('views.configManage.neManage.log')}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -450,7 +450,7 @@ function wsMessage(res: Record<string, any>) {
|
||||
);
|
||||
}
|
||||
if (neS && notNeNodes.includes(edgeTarget)) {
|
||||
graphG6.value.setItemState(edge.id, 'line-dash', neS.neState.online);
|
||||
graphG6.value.setItemState(edge.id, 'line-dash', neS.neState.online);
|
||||
}
|
||||
if (neT && notNeNodes.includes(edgeSource)) {
|
||||
graphG6.value.setItemState(edge.id, 'line-dash', neT.neState.online);
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
import { restartNf, stopNf } from '@/api/configManage/neManage';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { Modal, message } from 'ant-design-vue/lib';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
export default function useNeOptions() {
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
||||
/**
|
||||
* 网元重启
|
||||
* @param row {neName,neType,neId}
|
||||
*/
|
||||
function fnNeRestart(row: Record<string, any>) {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.configManage.neManage.totalSure', {
|
||||
msg: row.neName,
|
||||
oper: t('views.configManage.neManage.restart'),
|
||||
}),
|
||||
onOk() {
|
||||
const key = 'restartNf';
|
||||
message.loading({ content: t('common.loading'), key });
|
||||
restartNf(row).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.msgSuccess', {
|
||||
msg: t('views.configManage.neManage.restart'),
|
||||
}),
|
||||
key,
|
||||
duration: 3,
|
||||
});
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
key: key,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 网元停止
|
||||
* @param row {neName,neType,neId}
|
||||
*/
|
||||
function fnNeStop(row: Record<string, any>) {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.configManage.neManage.totalSure', {
|
||||
msg: row.neName,
|
||||
oper: t('views.configManage.neManage.stop'),
|
||||
}),
|
||||
onOk() {
|
||||
const key = 'restartNf';
|
||||
message.loading({ content: t('common.loading'), key });
|
||||
stopNf(row).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.msgSuccess', {
|
||||
msg: t('views.configManage.neManage.stop'),
|
||||
}),
|
||||
key: key,
|
||||
duration: 3,
|
||||
});
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
key: key,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转网元日志文件页面
|
||||
* @param row {neType,neId}
|
||||
*/
|
||||
function fnNeLogFile(row: Record<string, any>) {
|
||||
router.push(`/logManage/neFile?neType=${row.neType}&neId=${row.neId}`);
|
||||
}
|
||||
|
||||
return { fnNeRestart, fnNeStop, fnNeLogFile };
|
||||
}
|
||||
Reference in New Issue
Block a user