Sfoglia il codice sorgente

✨ feat(联盟帐号管理): 点击节点可以重置公网

dodo hold 1 anno fa
parent
commit
a18c5b75ba
4 ha cambiato i file con 58 aggiunte e 4 eliminazioni
  1. 21 0
      src/api/proxy.ts
  2. 3 3
      src/views/settings/aliyun.vue
  3. 34 1
      src/views/taobao/list.vue
  4. 0 0
      {{ -i

+ 21 - 0
src/api/proxy.ts

@@ -0,0 +1,21 @@
+import axios from 'axios';
+import type { FormRes } from './base';
+
+function ForwardAPI(url: string) {
+    return url;
+}
+
+export interface ProxyResponse extends FormRes {
+    // Add any specific fields that might be returned by the proxy API
+    success?: boolean;
+    msg?: string;
+}
+
+/**
+ * Change the public IP for a specific node
+ * @param nodeName The name of the node to change IP for
+ */
+export function changePublicIpByName(nodeName: string) {
+    const url = ForwardAPI(`/api/Proxy/ChangePublicIpByName?nodename=${nodeName}`);
+    return axios.get<ProxyResponse>(url);
+}

+ 3 - 3
src/views/settings/aliyun.vue

@@ -9,7 +9,7 @@
                         <a-row :gutter="16">
                             <a-col :span="8">
                                 <a-form-item field="name" label="账号名">
-                                    <a-input v-model="formModel.name" placeholder="输入关键词搜索" />
+                                    <a-input v-model="formModel.keyword" placeholder="输入关键词搜索" />
                                 </a-form-item>
                             </a-col>
                             <a-col :span="8">
@@ -199,7 +199,7 @@
                         >
                             <template #columns>
                                 <a-table-column title="实例ID" data-index="instance_id" :width="170" />
-                                <a-table-column title="主机名" data-index="host_name" :width="150" />
+                                <a-table-column title="实例名" data-index="instance_name" :width="150" />
                                 <a-table-column title="系统" data-index="os_name" :width="120" />
                                 <a-table-column title="配置" :width="100">
                                     <template #cell="{ record }">
@@ -302,7 +302,7 @@ type ExtendedAliyunAccountRecord = import('@/api/aliyun').AliyunAccountRecord &
 
 const generateFormModel = () => {
     return {
-        name: '',
+        keyword: '',
         lastTime: [],
         status: '',
         sort: 'status',

+ 34 - 1
src/views/taobao/list.vue

@@ -125,7 +125,7 @@
                 </template>
 
                 <template #nodeName="{ record }">
-                    <a-tag color="gray">{{ record.end_point }} - {{ record.nodeName }} </a-tag>
+                    <a-tag color="gray" @click="changePublicIp(record.nodeName)">{{ record.end_point }} - {{ record.nodeName }} </a-tag>
                 </template>
 
                 <template #suspended_endpoint="{ record }">
@@ -281,6 +281,7 @@ import { useI18n } from 'vue-i18n';
 import dayjs from 'dayjs';
 import useLoading from '@/hooks/loading';
 import { queryTkPool, TkPoolRecord, TkPoolParams, TkUpdateAccountModel, TkUpdateAccount } from '@/api/taobao';
+import { changePublicIpByName } from '@/api/proxy';
 import { Pagination } from '@/types/global';
 import { Modal, Message } from '@arco-design/web-vue';
 import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface';
@@ -568,6 +569,34 @@ const changeAttr = async (id: number, name: string, val: any) => {
 
 };
 
+const changePublicIp = async (nodeName: string) => {
+    Modal.confirm({
+        title: '确认提示',
+        content: `确定要更改节点 ${nodeName} 的公网IP吗?`,
+        okText: '确认',
+        cancelText: '取消',
+        async onOk() {
+            setLoading(true);
+            
+            try {
+                const { data } = await changePublicIpByName(nodeName);
+                console.log(data);
+                const msg = data.msg || '更新IP成功!';
+                if (data.success) {
+                    Message.success(msg);
+                    fetchData();
+                } else {
+                    Message.error(data.msg);
+                }
+            } catch (e) {
+                console.log(e);
+            } finally {
+                setLoading(false);
+            }
+        }
+    });
+};
+
 
 
 
@@ -699,3 +728,7 @@ export default {
     background-color: var(--color-warning-light-2) !important;
 }
 </style>
+
+
+
+

+ 0 - 0
{{ -i