|
@@ -137,7 +137,7 @@ import {
|
|
|
toRefs,
|
|
|
unref
|
|
|
} from "vue";
|
|
|
-import {INode, NodeAddParam} from "/@/model/node";
|
|
|
+import {INode, NodeAddParam,NodeinfoParam} from "/@/model/node";
|
|
|
import {delNodeReqUse, editNodeReqUse, nodeAddReqUse, nodeReqUse} from "/@/apis/node";
|
|
|
import { ColumnProps } from "ant-design-vue/lib/table";
|
|
|
import {it} from "node:test";
|
|
@@ -248,10 +248,11 @@ export default defineComponent({
|
|
|
})
|
|
|
|
|
|
const rowSelection = {
|
|
|
- onChange: (selectedRowKeys: Key[], selectedRows) => {
|
|
|
+ onChange: (selectedRowKeys: Key[], selectedRows: INode[]) => {
|
|
|
state.selectedTableRow = selectedRows
|
|
|
console.log(state.selectedTableRow);
|
|
|
},
|
|
|
+ // @ts-ignore
|
|
|
getCheckboxProps: (record) => ({
|
|
|
disabled: record.releaseState === "ONLINE",
|
|
|
releaseState: record.releaseState,
|
|
@@ -260,46 +261,50 @@ export default defineComponent({
|
|
|
|
|
|
const getNodeList = async () => {
|
|
|
state.datalist = []
|
|
|
- const node_list = await nodeReqUse(null)
|
|
|
+ const node_list = await nodeReqUse({} as NodeinfoParam)
|
|
|
if (node_list.code == -1){
|
|
|
await router.push("/login")
|
|
|
}
|
|
|
|
|
|
- for (let dataKey in node_list.data.nodeList) {
|
|
|
- let data = <NodeInfo>{}
|
|
|
- data.Serverid = node_list.data.nodeList[dataKey].Node.id
|
|
|
- data.id = node_list.data.nodeList[dataKey].Node.id
|
|
|
- data.name = node_list.data.nodeList[dataKey].Node.name
|
|
|
- data.host = node_list.data.nodeList[dataKey].Node.host
|
|
|
- data.port = node_list.data.nodeList[dataKey].Node.port
|
|
|
- data.url = node_list.data.nodeList[dataKey].Node.url
|
|
|
- data.UrlRecover = node_list.data.nodeList[dataKey].Node.UrlRecover
|
|
|
- data.updateAt = node_list.data.nodeList[dataKey].Node.updateAt
|
|
|
- data.createAt = node_list.data.nodeList[dataKey].Node.createAt
|
|
|
- data.pingType = node_list.data.nodeList[dataKey].Node.pingType
|
|
|
- data.urlStatus = node_list.data.nodeList[dataKey].Node.urlStatus
|
|
|
- data.nodeMs = node_list.data.nodeList[dataKey].Node.nodeMs
|
|
|
- data.urlRet = node_list.data.nodeList[dataKey].Node.urlRet
|
|
|
- data.urlCount = node_list.data.nodeList[dataKey].Node.urlCount
|
|
|
- data.isNotice = node_list.data.nodeList[dataKey].Node.isNotice
|
|
|
- data.url1 = extractHostname(extractDomainAfterAmpersand(node_list.data.nodeList[dataKey].Node.url)) + ":" + extractIpFromUrl(node_list.data.nodeList[dataKey].Node.url)
|
|
|
- data.url2 = extractHostname(extractDomainAfterAmpersand(node_list.data.nodeList[dataKey].Node.UrlRecover)) + ":" + extractIpFromUrl(node_list.data.nodeList[dataKey].Node.UrlRecover)
|
|
|
- if (node_list.data.nodeList[dataKey].NodeConfig != null)
|
|
|
- {
|
|
|
+ const nodeListData = node_list.data?.nodeList ?? [];
|
|
|
+
|
|
|
+ for (let dataKey in nodeListData) {
|
|
|
+ const node = nodeListData[dataKey].Node;
|
|
|
+ let data = {} as NodeInfo;
|
|
|
+
|
|
|
+ data.Serverid = node.id;
|
|
|
+ data.id = node.id;
|
|
|
+ data.name = node.name;
|
|
|
+ data.host = node.host;
|
|
|
+ data.port = node.port;
|
|
|
+ data.url = node.url;
|
|
|
+ data.UrlRecover = node.UrlRecover;
|
|
|
+ data.updateAt = node.updateAt;
|
|
|
+ data.createAt = node.createAt;
|
|
|
+ data.pingType = node.pingType;
|
|
|
+ data.urlStatus = node.urlStatus;
|
|
|
+ data.nodeMs = node.nodeMs;
|
|
|
+ data.urlRet = node.urlRet;
|
|
|
+ data.urlCount = node.urlCount;
|
|
|
+ data.isNotice = node.isNotice;
|
|
|
+ data.url1 = extractHostname(extractDomainAfterAmpersand(node.url) ?? "") + ":" + extractIpFromUrl(node.url);
|
|
|
+ data.url2 = extractHostname(extractDomainAfterAmpersand(node.UrlRecover) ?? "") + ":" + extractIpFromUrl(node.UrlRecover);
|
|
|
+
|
|
|
+ if (node_list.data?.nodeList[dataKey].NodeConfig != null) {
|
|
|
for (let nodeConfig of node_list.data.nodeList[dataKey].NodeConfig) {
|
|
|
data.Sshpassword = nodeConfig.Sshpassword;
|
|
|
data.Sshcommand = nodeConfig.Sshcommand;
|
|
|
data.Sshusername = nodeConfig.Sshusername;
|
|
|
}
|
|
|
- state.datalist.push(data)
|
|
|
}
|
|
|
+ state.datalist.push(data);
|
|
|
}
|
|
|
|
|
|
formState.isedit = false
|
|
|
console.log(formState.isedit)
|
|
|
console.log(state.datalist);
|
|
|
}
|
|
|
-
|
|
|
+// @ts-ignore
|
|
|
const addNodeList = async (data) => {
|
|
|
let ret = await nodeAddReqUse(data)
|
|
|
if (ret.code == 0)
|
|
@@ -311,7 +316,7 @@ export default defineComponent({
|
|
|
state.Visible = true
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+// @ts-ignore
|
|
|
const editNode = async (data) => {
|
|
|
let ret = await editNodeReqUse(data)
|
|
|
if (ret.code == 0)
|
|
@@ -323,7 +328,7 @@ export default defineComponent({
|
|
|
state.Visible = true
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+// @ts-ignore
|
|
|
const delNodeById = async (data) => {
|
|
|
let ret = await delNodeReqUse(data)
|
|
|
if (ret.code == 0)
|
|
@@ -378,8 +383,8 @@ export default defineComponent({
|
|
|
const resetForm = () => {
|
|
|
formRef.value.resetFields();
|
|
|
};
|
|
|
-
|
|
|
- const onSubmit = (isedit) =>{
|
|
|
+
|
|
|
+ const onSubmit = (isedit:Boolean) =>{
|
|
|
const reqdata = {
|
|
|
"id" : toRaw(formState).id,
|
|
|
"name" : toRaw(formState).name,
|
|
@@ -400,7 +405,7 @@ export default defineComponent({
|
|
|
addNodeList(reqdata)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+// @ts-ignore
|
|
|
const onEditNode = (record) => {
|
|
|
formState.id = record.id
|
|
|
formState.name = record.name
|
|
@@ -442,14 +447,15 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
const { datalist ,selectedTableRow,loading,Visible } = toRefs(state)
|
|
|
-
|
|
|
+// @ts-ignore
|
|
|
const onDeleteALlNode = () => {
|
|
|
- const idsTmp = []
|
|
|
+ const idsTmp : any = []
|
|
|
+ var ids : string =""
|
|
|
selectedTableRow.value.forEach(item => idsTmp.push(item.id))
|
|
|
ids = idsTmp.join(",")
|
|
|
console.log(ids);
|
|
|
}
|
|
|
-
|
|
|
+// @ts-ignore
|
|
|
const onDeleteNode = ( record )=>{
|
|
|
console.log(record.id);
|
|
|
delNodeById({
|
|
@@ -473,7 +479,7 @@ export default defineComponent({
|
|
|
return hostname;
|
|
|
}
|
|
|
|
|
|
- function extractDomainAfterAmpersand(url: string | null | undefined): string | null {
|
|
|
+ function extractDomainAfterAmpersand(url: string): string | null {
|
|
|
if (!url) {
|
|
|
return null;
|
|
|
}
|