Добавление настроек и их функциональности
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed
This commit is contained in:
parent
4257864b3d
commit
ee350c1852
23 changed files with 368 additions and 91 deletions
|
|
@ -1,4 +1,11 @@
|
|||
export const nodesSettings = [
|
||||
import {useIpStore} from "../../ipStore";
|
||||
import {NetworkService} from "../../../api/request";
|
||||
|
||||
|
||||
const createNodesSettings = () => {
|
||||
const { ipAddress } = useIpStore.getState();
|
||||
|
||||
return [
|
||||
{
|
||||
id: 'rescan-nodes',
|
||||
sectionId: 'Узлы подсети',
|
||||
|
|
@ -47,13 +54,67 @@ export const nodesSettings = [
|
|||
label: 'Очистить данные сессии',
|
||||
sectionId: 'Узлы подсети',
|
||||
defaultValue: 'Очистить',
|
||||
action: async ()=>{
|
||||
try {
|
||||
const res = await NetworkService.clearSubnet(ipAddress);
|
||||
console.log(res)
|
||||
}catch (e){
|
||||
console.error(e);
|
||||
alert('Данные не были удалены: '+ e)
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'export-nodes',
|
||||
type: 'button',
|
||||
label: 'Экспорт данных узлов',
|
||||
sectionId: 'Узлы подсети',
|
||||
defaultValue: 'Экспортировать',
|
||||
},
|
||||
] as const;
|
||||
{
|
||||
id: "export-nodes",
|
||||
type: "button",
|
||||
label: "Экспорт данных узлов",
|
||||
sectionId: "Узлы подсети",
|
||||
defaultValue: "Экспортировать",
|
||||
action: async () => {
|
||||
try {
|
||||
const response = await NetworkService.exportDevices(ipAddress);
|
||||
const { filePath } = await window.electronAPI.showSaveDialog({
|
||||
title: "Сохранить данные узлов",
|
||||
defaultPath: "nodes_export.json",
|
||||
filters: [{ name: "JSON", extensions: ["json"] }],
|
||||
});
|
||||
|
||||
if (filePath) {
|
||||
await window.electronAPI.writeFile(
|
||||
filePath,
|
||||
JSON.stringify(response.data, null, 2)
|
||||
);
|
||||
alert("Данные успешно экспортированы!");
|
||||
}
|
||||
} catch (e: any) {
|
||||
alert("Ошибка экспорта: " + e.message);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'table-columns-order',
|
||||
type: 'hidden',
|
||||
label: '',
|
||||
sectionId: 'Узлы подсети',
|
||||
defaultValue: [
|
||||
'Онлайн',
|
||||
'Имя',
|
||||
'Производитель',
|
||||
'IP адрес',
|
||||
'Открытые порты',
|
||||
'Последняя активность',
|
||||
'Заметка',
|
||||
'Действие'
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'table-columns-disabled',
|
||||
label: '',
|
||||
sectionId: 'Узлы подсети',
|
||||
type: 'hidden',
|
||||
defaultValue: []
|
||||
}
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const nodesSettings = createNodesSettings();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue