feat: 网元主机操作Hooks包
This commit is contained in:
@@ -364,6 +364,7 @@ export default {
|
|||||||
totalSure:'Confirm the network element with {operator} network element name {msg}',
|
totalSure:'Confirm the network element with {operator} network element name {msg}',
|
||||||
stop: 'Stop',
|
stop: 'Stop',
|
||||||
start: 'Start',
|
start: 'Start',
|
||||||
|
log: 'Logs',
|
||||||
export: 'Export',
|
export: 'Export',
|
||||||
import: 'Import',
|
import: 'Import',
|
||||||
fileForm:'File Source',
|
fileForm:'File Source',
|
||||||
@@ -1219,7 +1220,6 @@ export default {
|
|||||||
serialNum: 'Serial Number',
|
serialNum: 'Serial Number',
|
||||||
expiryDate: 'Expiry Date',
|
expiryDate: 'Expiry Date',
|
||||||
switchLayout: "Switch Layout",
|
switchLayout: "Switch Layout",
|
||||||
viewLogFile: "Viewing Log Files",
|
|
||||||
noData: "Can't find the corresponding plot data",
|
noData: "Can't find the corresponding plot data",
|
||||||
},
|
},
|
||||||
topologyBuild: {
|
topologyBuild: {
|
||||||
|
|||||||
@@ -364,6 +364,7 @@ export default {
|
|||||||
totalSure:'确认{oper}网元名称为 {msg} 的网元',
|
totalSure:'确认{oper}网元名称为 {msg} 的网元',
|
||||||
stop: '停止',
|
stop: '停止',
|
||||||
start: '启动',
|
start: '启动',
|
||||||
|
log: '日志',
|
||||||
export: '导出',
|
export: '导出',
|
||||||
import: '导入',
|
import: '导入',
|
||||||
fileForm:'文件来源',
|
fileForm:'文件来源',
|
||||||
@@ -1219,7 +1220,6 @@ export default {
|
|||||||
serialNum: '序列号',
|
serialNum: '序列号',
|
||||||
expiryDate: '许可证到期日期',
|
expiryDate: '许可证到期日期',
|
||||||
switchLayout: "切换布局",
|
switchLayout: "切换布局",
|
||||||
viewLogFile: "查看日志文件",
|
|
||||||
noData: "找不到对应的图组数据",
|
noData: "找不到对应的图组数据",
|
||||||
},
|
},
|
||||||
topologyBuild: {
|
topologyBuild: {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import {
|
|||||||
nodeImageAnimateState,
|
nodeImageAnimateState,
|
||||||
nodeRectAnimateState,
|
nodeRectAnimateState,
|
||||||
} from '../topologyBuild/hooks/registerNode';
|
} from '../topologyBuild/hooks/registerNode';
|
||||||
import useNeOptions from './useNeOptions';
|
import useNeOptions from '@/views/ne/neInfo/hooks/useNeOptions';
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@@ -97,7 +97,7 @@ const graphNodeMenu = new Menu({
|
|||||||
> ${t('views.configManage.neManage.stop')}
|
> ${t('views.configManage.neManage.stop')}
|
||||||
</div>
|
</div>
|
||||||
<div id="log" style="cursor: pointer; margin-bottom: 4px;">
|
<div id="log" style="cursor: pointer; margin-bottom: 4px;">
|
||||||
> ${t('views.monitor.topology.viewLogFile')}
|
> ${t('views.configManage.neManage.log')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
@@ -450,7 +450,7 @@ function wsMessage(res: Record<string, any>) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (neS && notNeNodes.includes(edgeTarget)) {
|
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)) {
|
if (neT && notNeNodes.includes(edgeSource)) {
|
||||||
graphG6.value.setItemState(edge.id, 'line-dash', neT.neState.online);
|
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 };
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@ export default function useNeOptions() {
|
|||||||
* 网元启动
|
* 网元启动
|
||||||
* @param row {neName,neType,neId}
|
* @param row {neName,neType,neId}
|
||||||
*/
|
*/
|
||||||
function fnRecordStart(row: Record<string, any>) {
|
function fnNeStart(row: Record<string, any>) {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: t('common.tipTitle'),
|
title: t('common.tipTitle'),
|
||||||
content: t('views.configManage.neManage.totalSure', {
|
content: t('views.configManage.neManage.totalSure', {
|
||||||
@@ -154,8 +154,14 @@ export default function useNeOptions() {
|
|||||||
* @param row {neType,neId}
|
* @param row {neType,neId}
|
||||||
*/
|
*/
|
||||||
function fnNeLogFile(row: Record<string, any>) {
|
function fnNeLogFile(row: Record<string, any>) {
|
||||||
router.push(`/logManage/neFile?neType=${row.neType}&neId=${row.neId}`);
|
router.push({
|
||||||
|
name: 'NeFile_2123',
|
||||||
|
query: {
|
||||||
|
neType: row.neType,
|
||||||
|
neId: row.neId,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return { fnNeRestart, fnNeStop, fnNeLogFile };
|
return { fnNeStart, fnNeRestart, fnNeStop, fnNeReload, fnNeLogFile };
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,11 @@ import useNeInfoStore from '@/store/modules/neinfo';
|
|||||||
import { listNeInfo, delNeInfo } from '@/api/ne/neInfo';
|
import { listNeInfo, delNeInfo } from '@/api/ne/neInfo';
|
||||||
import { NE_TYPE_LIST } from '@/constants/ne-constants';
|
import { NE_TYPE_LIST } from '@/constants/ne-constants';
|
||||||
import useDictStore from '@/store/modules/dict';
|
import useDictStore from '@/store/modules/dict';
|
||||||
|
import useNeOptions from './hooks/useNeOptions';
|
||||||
const { getDict } = useDictStore();
|
const { getDict } = useDictStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const { fnNeStart, fnNeRestart, fnNeStop, fnNeReload, fnNeLogFile } =
|
||||||
|
useNeOptions();
|
||||||
|
|
||||||
/**字典数据 */
|
/**字典数据 */
|
||||||
let dict: {
|
let dict: {
|
||||||
@@ -271,29 +274,28 @@ function fnRecordDelete(id: string) {
|
|||||||
* 记录多项选择
|
* 记录多项选择
|
||||||
*/
|
*/
|
||||||
function fnRecordMore(type: string | number, row: Record<string, any>) {
|
function fnRecordMore(type: string | number, row: Record<string, any>) {
|
||||||
if (type === 'delete') {
|
switch (type) {
|
||||||
// fnRecordDelete(row);
|
case 'delete':
|
||||||
return;
|
fnRecordDelete(row.id);
|
||||||
}
|
break;
|
||||||
|
case 'start':
|
||||||
if (type === 'export') {
|
fnNeStart(row);
|
||||||
// fnRecordExport(row);
|
break;
|
||||||
}
|
case 'restart':
|
||||||
|
fnNeRestart(row);
|
||||||
if (type === 'start') {
|
break;
|
||||||
// fnRecordStart(row);
|
case 'stop':
|
||||||
}
|
fnNeStop(row);
|
||||||
|
break;
|
||||||
if (type === 'restart') {
|
case 'reload':
|
||||||
// fnRecordRestart(row);
|
fnNeReload(row);
|
||||||
}
|
break;
|
||||||
|
case 'log':
|
||||||
if (type === 'stop') {
|
fnNeLogFile(row);
|
||||||
// fnRecordStop(row);
|
break;
|
||||||
}
|
default:
|
||||||
|
console.warn(type);
|
||||||
if (type === 'reload') {
|
break;
|
||||||
// fnNeReload(row);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,17 +540,6 @@ onMounted(() => {
|
|||||||
<template #icon><FormOutlined /></template>
|
<template #icon><FormOutlined /></template>
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-tooltip>
|
|
||||||
<template #title>{{ t('common.deleteText') }}</template>
|
|
||||||
<a-button
|
|
||||||
type="link"
|
|
||||||
@click.prevent="fnRecordDelete(record.id)"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<DeleteOutlined />
|
|
||||||
</template>
|
|
||||||
</a-button>
|
|
||||||
</a-tooltip>
|
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title>
|
<template #title>
|
||||||
{{ t('views.configManage.neManage.restart') }}
|
{{ t('views.configManage.neManage.restart') }}
|
||||||
@@ -560,6 +551,17 @@ onMounted(() => {
|
|||||||
<template #icon><UndoOutlined /></template>
|
<template #icon><UndoOutlined /></template>
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>
|
||||||
|
{{ t('views.configManage.neManage.stop') }}
|
||||||
|
</template>
|
||||||
|
<a-button
|
||||||
|
type="link"
|
||||||
|
@click.prevent="fnRecordMore('stop', record)"
|
||||||
|
>
|
||||||
|
<template #icon><StopOutlined /> </template>
|
||||||
|
</a-button>
|
||||||
|
</a-tooltip>
|
||||||
<a-tooltip placement="left">
|
<a-tooltip placement="left">
|
||||||
<template #title>{{ t('common.moreText') }}</template>
|
<template #title>{{ t('common.moreText') }}</template>
|
||||||
<a-dropdown
|
<a-dropdown
|
||||||
@@ -571,22 +573,14 @@ onMounted(() => {
|
|||||||
</a-button>
|
</a-button>
|
||||||
<template #overlay>
|
<template #overlay>
|
||||||
<a-menu @click="({ key }:any) => fnRecordMore(key, record)">
|
<a-menu @click="({ key }:any) => fnRecordMore(key, record)">
|
||||||
<a-menu-item key="export">
|
<a-menu-item key="log">
|
||||||
<ExportOutlined />
|
<FileTextOutlined />
|
||||||
{{ t('views.configManage.neManage.export') }}
|
{{ t('views.configManage.neManage.log') }}
|
||||||
</a-menu-item>
|
|
||||||
<a-menu-item key="import">
|
|
||||||
<ImportOutlined />
|
|
||||||
{{ t('views.configManage.neManage.import') }}
|
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
<a-menu-item key="start">
|
<a-menu-item key="start">
|
||||||
<thunderbolt-outlined />
|
<ThunderboltOutlined />
|
||||||
{{ t('views.configManage.neManage.start') }}
|
{{ t('views.configManage.neManage.start') }}
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
<a-menu-item key="stop">
|
|
||||||
<pause-outlined />
|
|
||||||
{{ t('views.configManage.neManage.stop') }}
|
|
||||||
</a-menu-item>
|
|
||||||
<a-menu-item
|
<a-menu-item
|
||||||
key="reload"
|
key="reload"
|
||||||
v-if="
|
v-if="
|
||||||
@@ -721,3 +715,4 @@ onMounted(() => {
|
|||||||
padding: 0 24px;
|
padding: 0 24px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
./components/useNeOptions
|
||||||
|
|||||||
Reference in New Issue
Block a user