@@ -39,6 +39,7 @@ const pageSize = ref(10)
39
39
const total = ref (0 )
40
40
const dataConfig = ref (' ' )
41
41
const dialogVisible = ref (false )
42
+ // const quickDialogVisible = ref(false)
42
43
const dialogTitle = ref (' ' )
43
44
const actionType = ref (' ' )
44
45
const editType = ref (' ' )
@@ -130,6 +131,10 @@ const AddFormAction = async () => {
130
131
const refreshAction = async () => {
131
132
await getConfigList ()
132
133
}
134
+ /* const quickAction = async () => {
135
+ dialogTitle.value = t('easytier.quickAction')
136
+ quickDialogVisible.value = true
137
+ } */
133
138
const checkConfigFileName = async () => {
134
139
const findItem = easyTierStore .configList .find (
135
140
(item ) => item .configFileName === configFileName .value
@@ -155,7 +160,7 @@ const addConfigAction = async () => {
155
160
}
156
161
if (editType .value === ' form' ) {
157
162
// 验证必填 formRef
158
- if (! (await formRef .value .validateForm ())) {
163
+ if (formRef . value && ! (await formRef .value .validateForm ())) {
159
164
return
160
165
}
161
166
saveLoading .value = true
@@ -503,6 +508,27 @@ const stopServiceHandle = async (row: any) => {
503
508
})
504
509
.finally (async () => await getConfigList ())
505
510
}
511
+ const createServerConfig = async () => {
512
+ formData .value = cloneDeep (DefaultData .defaultFormData )
513
+ const hostname = await getHostname ()
514
+ configFileName .value = hostname + ' _server'
515
+ if (await checkConfigFileName ()) {
516
+ configFileName .value = hostname + ' _server' + Math .floor (Math .random () * 100 )
517
+ }
518
+ editType .value = ' form'
519
+ formData .value .network_identity .network_name = ' default'
520
+ formData .value .hostname = hostname + ' _server'
521
+ formData .value .instance_name = hostname + ' _server'
522
+ formData .value .listeners = [
523
+ ' tcp://0.0.0.0:11010' ,
524
+ ' udp://0.0.0.0:11010' ,
525
+ ' wg://0.0.0.0:11011' ,
526
+ ' ws://0.0.0.0:11011/' ,
527
+ ' wss://0.0.0.0:11012/'
528
+ ]
529
+ await addConfigAction ()
530
+ // quickDialogVisible.value = false
531
+ }
506
532
watch (configFileName , (value ) => {
507
533
formData .value .file_logger .file = value
508
534
})
@@ -524,6 +550,10 @@ onMounted(async () => {
524
550
<BaseButton type =" primary" @click =" AddFormAction"
525
551
>{{ t('easytier.addNetConfigForm') }}
526
552
</BaseButton >
553
+ <el-button type =" info" @click =" createServerConfig" style =" margin-left : 10px " >
554
+ {{ t('easytier.createServerConfig') }}
555
+ </el-button >
556
+ <!-- <BaseButton type="info" @click="quickAction">{{ t('easytier.quickAction') }}</BaseButton> -->
527
557
<BaseButton type =" success" @click =" refreshAction" >{{ t('common.refresh') }}</BaseButton >
528
558
</div >
529
559
<el-text v-if =" noWMIC" type =" warning" effect =" dark"
@@ -682,6 +712,13 @@ onMounted(async () => {
682
712
<BaseButton @click =" dialogVisible = false" >{{ t('dialogDemo.close') }}</BaseButton >
683
713
</template >
684
714
</Dialog >
715
+ <!-- <Dialog v-model="quickDialogVisible" :title="dialogTitle">
716
+ <div class="flex justify-center items-center">
717
+ <el-button type="primary" size="large" @click="createServerConfig">{{
718
+ t('easytier.createServerConfig')
719
+ }}</el-button>
720
+ </div>
721
+ </Dialog> -->
685
722
</div >
686
723
</template >
687
724
<style lang="less">
0 commit comments