From ce7e90e0346307a7a8125d79d6d96b062d770816 Mon Sep 17 00:00:00 2001
From: TheLD <Lars@adonris.de>
Date: Tue, 26 May 2020 16:42:37 +0200
Subject: [PATCH] add tags to clients

---
 model/client.go               |  1 +
 ui/src/components/Clients.vue | 42 ++++++++++++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/model/client.go b/model/client.go
index 4a40b27..07711d7 100644
--- a/model/client.go
+++ b/model/client.go
@@ -16,6 +16,7 @@ type Client struct {
 	PresharedKey              string    `json:"presharedKey"`
 	AllowedIPs                []string  `json:"allowedIPs"`
 	Address                   []string  `json:"address"`
+	Tags											[]string  `json:"tags"`
 	PrivateKey                string    `json:"privateKey"`
 	PublicKey                 string    `json:"publicKey"`
 	CreatedBy                 string    `json:"createdBy"`
diff --git a/ui/src/components/Clients.vue b/ui/src/components/Clients.vue
index 16869bc..cfeaa8c 100644
--- a/ui/src/components/Clients.vue
+++ b/ui/src/components/Clients.vue
@@ -255,7 +255,26 @@
                                         </v-chip>
                                     </template>
                                 </v-combobox>
-
+                                <v-combobox
+                                        v-model="client.tags"
+                                        chips
+                                        hint="Write tag name and hit enter"
+                                        label="Tags"
+                                        multiple
+                                        dark
+                                >
+                                    <template v-slot:selection="{ attrs, item, select, selected }">
+                                        <v-chip
+                                                v-bind="attrs"
+                                                :input-value="selected"
+                                                close
+                                                @click="select"
+                                                @click:close="client.tags.splice(client.tags.indexOf(item), 1)"
+                                        >
+                                            <strong>{{ item }}</strong>&nbsp;
+                                        </v-chip>
+                                    </template>
+                                </v-combobox>
                                 <v-switch
                                         v-model="client.enable"
                                         color="red"
@@ -360,6 +379,26 @@
                                         </v-chip>
                                     </template>
                                 </v-combobox>
+                                <v-combobox
+                                        v-model="client.tags"
+                                        chips
+                                        hint="Write tag name and hit enter"
+                                        label="Tags"
+                                        multiple
+                                        dark
+                                >
+                                    <template v-slot:selection="{ attrs, item, select, selected }">
+                                        <v-chip
+                                                v-bind="attrs"
+                                                :input-value="selected"
+                                                close
+                                                @click="select"
+                                                @click:close="client.tags.splice(client.tags.indexOf(item), 1)"
+                                        >
+                                            <strong>{{ item }}</strong>&nbsp;
+                                        </v-chip>
+                                    </template>
+                                </v-combobox>
                                 <v-switch
                                         v-model="client.ignorePersistentKeepalive"
                                         color="red"
@@ -451,6 +490,7 @@
           enable: true,
           allowedIPs: this.server.allowedips,
           address: this.server.address,
+          tags: [],
         }
         this.dialogCreate = true;
       },
-- 
GitLab