feat 支持pusher分离
All checks were successful
Build image / build (push) Successful in 7m16s

This commit is contained in:
timerzz 2024-05-21 22:09:02 +08:00
parent 1cfc9e0841
commit a8b982f32c
4 changed files with 34 additions and 13 deletions

View File

@ -16,7 +16,7 @@ server {
location /api/v1/pushers {
resolver 10.43.0.10 valid=10s; # 6.6.6.6 为自建DNS
proxy_pass http://ht-watcher:8080;
proxy_pass http://pushers:8080;
}
location /api/v1/watchers {

View File

@ -118,6 +118,7 @@ const cleanAddModal=()=>{
remark:'',
option: {}
}
addModal.visible = false
addModal.formItems = []
formRef.value.clearValidate()
}

View File

@ -24,9 +24,9 @@
<template v-else-if="column.key === 'updatedAt'">
<span>{{moment(record.updatedAt).format('YYYY-MM-DD HH:mm:ss')}}</span>
</template>
<template v-else-if="column.key === 'pusherIds'">
<template v-if="record.pusherIds" v-for="id in record.pusherIds">
<a-tag :bordered="false" color="processing">{{pusher.list.find(p =>p.id === id)?.name}}</a-tag>
<template v-else-if="column.key === 'pushers'">
<template v-if="record.pushers.length>0" v-for="id in record.pushers">
<a-tag :bordered="false" color="processing" v-for="pusher in record.pushers">{{pusher.name}}</a-tag>
</template>
<span v-else>-</span>
</template>
@ -52,14 +52,15 @@
<a-form-item label="ID" name="pid" :rules="[{ required: true, message: '请填写商品id' }]">
<a-input v-model:value="addModal.data.pid" />
</a-form-item>
<a-form-item label="推送" name="pusherIds" :rules="[{ required: true, message: '请选择通知推送' }]">
<a-form-item label="推送" name="pushers" :rules="[{ required: true, message: '请选择通知推送' }]">
<a-select
v-model:value="addModal.data.pusherIds"
v-model:value="pushersComputed"
mode="multiple"
@dropdown-visible-change="getPushers"
placeholder="请选择通知推送" :fieldNames="{label:'name',value:'id'}"
:options="pusher.list"
></a-select>
placeholder="请选择通知推送"
>
<a-select-option v-for="p in pusher.list" :value="p.id">{{p.name}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="备注" name="remark">
<a-textarea v-model:value="addModal.data.remark" />
@ -70,7 +71,7 @@
</template>
<script setup>
import moment from "moment";
import {h, onMounted, reactive, ref} from "vue";
import {computed, h, onMounted, reactive, ref} from "vue";
import {ListWatchers, CreateWatcher, DeleteWatcher, StartWatcher, StopWatcher} from "@/api/watcher.js";
import { LoadingOutlined } from '@ant-design/icons-vue';
import {message, Modal} from 'ant-design-vue';
@ -127,17 +128,22 @@ const addModal = reactive({
data: {
pid:'',
remark:'',
pusherIds:[]
pushers:[]
},
loading: false
})
const pushersComputed = computed({
get:()=>addModal.data.pushers.map(p => p.id),
set:(val)=>{
addModal.data.pushers = val.map(id=>pusher.list.find(p=> p.id===id))
}
})
const closeAddModal = ()=>{
addModal.visible = false
addModal.data = {
pid:'',
remark:'',
pusherIds: []
pushers: []
}
}

View File

@ -43,6 +43,20 @@ export default defineConfig({
secure: false,
ws: true,
},
'/api/v1/watchers': {
target: 'https://ht-dev.timerzz.com:20443/',
// target: 'http://192.168.31.55:2280/',
changeOrigin: true,
secure: false,
ws: true,
},
'/api/v1/proxies': {
target: 'https://ht-dev.timerzz.com:20443/',
// target: 'http://192.168.31.55:2280/',
changeOrigin: true,
secure: false,
ws: true,
},
'/api/v1': {
target: 'https://ht.timerzz.com:20443/',
// target: 'http://192.168.31.55:2280/',