add client group

This commit is contained in:
Alireza Ahmadi
2024-07-23 22:57:19 +02:00
parent 869c51885f
commit 0bb3a67f79
9 changed files with 18 additions and 2 deletions
+2 -1
View File
@@ -41,7 +41,8 @@ type Client struct {
Expiry int64 `json:"expiry" form:"expiry"` Expiry int64 `json:"expiry" form:"expiry"`
Down int64 `json:"down" form:"down"` Down int64 `json:"down" form:"down"`
Up int64 `json:"up" form:"up"` Up int64 `json:"up" form:"up"`
Desc string `json:"desc" from:"desc"` Desc string `json:"desc" form:"desc"`
Group string `json:"group" form:"group"`
} }
type Stats struct { type Stats struct {
+4 -1
View File
@@ -21,6 +21,9 @@
<v-col cols="12" sm="6" md="4"> <v-col cols="12" sm="6" md="4">
<v-switch color="primary" v-model="client.enable" :label="$t('enable')" hide-details></v-switch> <v-switch color="primary" v-model="client.enable" :label="$t('enable')" hide-details></v-switch>
</v-col> </v-col>
<v-col cols="12" sm="6" md="4">
<v-combobox v-model="client.group" :items="groups" :label="$t('client.group')" hide-details></v-combobox>
</v-col>
</v-row> </v-row>
<v-row> <v-row>
<v-col cols="12" sm="6" md="4"> <v-col cols="12" sm="6" md="4">
@@ -186,7 +189,7 @@ import DatePick from '@/components/DateTime.vue'
import { HumanReadable } from '@/plugins/utils' import { HumanReadable } from '@/plugins/utils'
export default { export default {
props: ['visible', 'data', 'index', 'inboundTags', 'stats'], props: ['visible', 'data', 'index', 'inboundTags', 'groups', 'stats'],
emits: ['close', 'save'], emits: ['close', 'save'],
data() { data() {
return { return {
+1
View File
@@ -157,6 +157,7 @@ export default {
client: { client: {
name: "Name", name: "Name",
desc: "Description", desc: "Description",
group: "Group",
inboundTags: "Inbound Tags", inboundTags: "Inbound Tags",
basics: "Basics", basics: "Basics",
config: "Config", config: "Config",
+1
View File
@@ -156,6 +156,7 @@ export default {
client: { client: {
name: "نام", name: "نام",
desc: "شرح", desc: "شرح",
group: "گروه",
inboundTags: "برچسب‌های ورودی", inboundTags: "برچسب‌های ورودی",
basics: "پایه", basics: "پایه",
config: "تنظیم", config: "تنظیم",
+1
View File
@@ -157,6 +157,7 @@ export default {
client: { client: {
name: "Tên", name: "Tên",
desc: "Mô tả", desc: "Mô tả",
group: "Nhóm",
inboundTags: "Thẻ đầu vào", inboundTags: "Thẻ đầu vào",
basics: "Cơ bản", basics: "Cơ bản",
config: "Cấu hình", config: "Cấu hình",
+1
View File
@@ -157,6 +157,7 @@ export default {
client: { client: {
name: "名称", name: "名称",
desc: "描述", desc: "描述",
group: "组",
inboundTags: "入站标签", inboundTags: "入站标签",
basics: "基础", basics: "基础",
config: "配置", config: "配置",
+1
View File
@@ -158,6 +158,7 @@ export default {
client: { client: {
name: "名稱", name: "名稱",
desc: "描述", desc: "描述",
group: "組",
inboundTags: "入站標簽", inboundTags: "入站標簽",
basics: "基礎", basics: "基礎",
config: "配置", config: "配置",
+2
View File
@@ -13,6 +13,7 @@ export interface Client {
up: number up: number
down: number down: number
desc: string desc: string
group: string
} }
const defaultClient: Client = { const defaultClient: Client = {
@@ -26,6 +27,7 @@ const defaultClient: Client = {
up: 0, up: 0,
down: 0, down: 0,
desc: "", desc: "",
group: "",
} }
type Config = { type Config = {
+5
View File
@@ -5,6 +5,7 @@
:visible="modal.visible" :visible="modal.visible"
:index="modal.index" :index="modal.index"
:data="modal.data" :data="modal.data"
:groups="groups"
:stats="modal.stats" :stats="modal.stats"
:inboundTags="inboundTags" :inboundTags="inboundTags"
@close="closeModal" @close="closeModal"
@@ -181,6 +182,10 @@ const inboundTags = computed((): string[] => {
return inbounds.value?.filter(i => i.tag != "" && Object.hasOwn(i,'users')).map(i => i.tag) return inbounds.value?.filter(i => i.tag != "" && Object.hasOwn(i,'users')).map(i => i.tag)
}) })
const groups = computed((): string[] => {
if (!clients.value) return []
return Array.from(new Set(clients.value?.map(c => c.group)))
})
const filter = ref("") const filter = ref("")
const filterItems = [ const filterItems = [