avoid duplicate data
This commit is contained in:
@@ -22,6 +22,9 @@ export default {
|
||||
online: "Online",
|
||||
version: "Version",
|
||||
commaSeparated: "(comma separated)",
|
||||
error: {
|
||||
dplData: "Duplicate Data",
|
||||
},
|
||||
pages: {
|
||||
login: "Login",
|
||||
home: "Home",
|
||||
|
||||
@@ -22,6 +22,9 @@ export default {
|
||||
online: "آنلاین",
|
||||
version: "نسخه",
|
||||
commaSeparated: "(جداشده با کاما)",
|
||||
error: {
|
||||
dplData: "داده تکراری",
|
||||
},
|
||||
pages: {
|
||||
login: "ورود",
|
||||
home: "خانه",
|
||||
|
||||
@@ -22,6 +22,9 @@ export default {
|
||||
online: "Trực tuyến",
|
||||
version: "Phiên bản",
|
||||
commaSeparated: "(được phân tách bằng dấu phẩy)",
|
||||
error: {
|
||||
dplData: "Dữ liệu trùng lặp",
|
||||
},
|
||||
pages: {
|
||||
login: "Đăng nhập",
|
||||
home: "Trang chủ",
|
||||
|
||||
@@ -22,6 +22,9 @@ export default {
|
||||
online: "在线",
|
||||
version: "版本",
|
||||
commaSeparated: "(逗号分隔)",
|
||||
error: {
|
||||
dplData: "重复数据",
|
||||
},
|
||||
pages: {
|
||||
login: "登录",
|
||||
home: "主页",
|
||||
|
||||
@@ -23,6 +23,9 @@ export default {
|
||||
online: "在線",
|
||||
version: "版本",
|
||||
commaSeparated: "(逗號分隔)",
|
||||
error: {
|
||||
dplData: "重複數據",
|
||||
},
|
||||
pages: {
|
||||
login: "登錄",
|
||||
home: "主頁",
|
||||
|
||||
@@ -132,6 +132,8 @@ import { Config, V2rayApiStats } from '@/types/config'
|
||||
import { InTypes, Inbound,InboundWithUser, ShadowTLS, VLESS } from '@/types/inbounds'
|
||||
import { Link, LinkUtil } from '@/plugins/link'
|
||||
import { HumanReadable } from '@/plugins/utils'
|
||||
import Message from '@/store/modules/message'
|
||||
import { i18n } from '@/locales'
|
||||
|
||||
const clients = computed((): any[] => {
|
||||
return Data().clients
|
||||
@@ -177,6 +179,11 @@ const closeModal = () => {
|
||||
modal.value.visible = false
|
||||
}
|
||||
const saveModal = (data:any, stats:boolean) => {
|
||||
if (clients.value.findIndex(c => c.name == data.name) != modal.value.index) {
|
||||
const sb = Message()
|
||||
sb.showMessage(i18n.global.t('error.dplData') + ': ' + i18n.global.t('client.name') ,'error', 5000)
|
||||
return
|
||||
}
|
||||
const inboundTags: string[] = data.inbounds.split(',')?? []
|
||||
let oldName:string = ""
|
||||
if(modal.value.index == -1) {
|
||||
|
||||
@@ -108,6 +108,8 @@ import { computed, ref } from 'vue'
|
||||
import { InTypes, Inbound, InboundWithUser, ShadowTLS, VLESS } from '@/types/inbounds'
|
||||
import { Client } from '@/types/clients'
|
||||
import { Link, LinkUtil } from '@/plugins/link'
|
||||
import Message from '@/store/modules/message'
|
||||
import { i18n } from '@/locales'
|
||||
|
||||
const appConfig = computed((): Config => {
|
||||
return <Config> Data().config
|
||||
@@ -156,6 +158,11 @@ const closeModal = () => {
|
||||
modal.value.visible = false
|
||||
}
|
||||
const saveModal = (data:Inbound, stats: boolean) => {
|
||||
if (inbounds.value.findIndex(c => c.tag == data.tag) != modal.value.id) {
|
||||
const sb = Message()
|
||||
sb.showMessage(i18n.global.t('error.dplData') + ': ' + i18n.global.t('objects.tag') ,'error', 5000)
|
||||
return
|
||||
}
|
||||
// New or Edit
|
||||
if (modal.value.id == -1) {
|
||||
inbounds.value.push(data)
|
||||
|
||||
@@ -96,6 +96,8 @@ import Stats from '@/layouts/modals/Stats.vue'
|
||||
import { Config, V2rayApiStats } from '@/types/config';
|
||||
import { Outbound } from '@/types/outbounds';
|
||||
import { computed, ref } from 'vue'
|
||||
import Message from '@/store/modules/message';
|
||||
import { i18n } from '@/locales';
|
||||
|
||||
const appConfig = computed((): Config => {
|
||||
return <Config> Data().config
|
||||
@@ -137,6 +139,11 @@ const closeModal = () => {
|
||||
modal.value.visible = false
|
||||
}
|
||||
const saveModal = (data:Outbound, stats: boolean) => {
|
||||
if (outbounds.value.findIndex(c => c.tag == data.tag) != modal.value.id) {
|
||||
const sb = Message()
|
||||
sb.showMessage(i18n.global.t('error.dplData') + ': ' + i18n.global.t('objects.tag') ,'error', 5000)
|
||||
return
|
||||
}
|
||||
// New or Edit
|
||||
if (modal.value.id == -1) {
|
||||
outbounds.value.push(data)
|
||||
|
||||
Reference in New Issue
Block a user