mirror of
https://github.com/gurucomputing/headscale-ui.git
synced 2026-07-17 16:39:45 +00:00
headscale api changes tags in node object for version 0.28 (#216)
This commit is contained in:
parent
a7f79824bf
commit
878027b9ad
4 changed files with 7 additions and 7 deletions
|
|
@ -4,9 +4,7 @@ export class Device {
|
||||||
public givenName: string = '';
|
public givenName: string = '';
|
||||||
public lastSeen: string = '';
|
public lastSeen: string = '';
|
||||||
public ipAddresses: string[] = [];
|
public ipAddresses: string[] = [];
|
||||||
public forcedTags: string[] = [];
|
public tags: string[] = [];
|
||||||
public validTags: string[] = [];
|
|
||||||
public invalidTags: string[] = [];
|
|
||||||
public approvedRoutes: string[] = [];
|
public approvedRoutes: string[] = [];
|
||||||
public availableRoutes: string[] = [];
|
public availableRoutes: string[] = [];
|
||||||
public subnetRoutes: string[] = [];
|
public subnetRoutes: string[] = [];
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
// only run if we have search contents set
|
// only run if we have search contents set
|
||||||
if (get(deviceSearchStore)) {
|
if (get(deviceSearchStore)) {
|
||||||
let searcher = new Fuse(get(deviceStore), {
|
let searcher = new Fuse(get(deviceStore), {
|
||||||
keys: ['id', 'givenName', 'name', 'forcedTags', 'validTags', 'user.name']
|
keys: ['id', 'givenName', 'name', 'tags', 'user.name']
|
||||||
});
|
});
|
||||||
|
|
||||||
// search using the searchstore term, and take the resultant array contents and set it to userFilterStore
|
// search using the searchstore term, and take the resultant array contents and set it to userFilterStore
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
export let device = new Device();
|
export let device = new Device();
|
||||||
|
|
||||||
function updateTagsAction(tag: String) {
|
function updateTagsAction(tag: String) {
|
||||||
let tagList = device.forcedTags;
|
let tagList = device.tags;
|
||||||
// remove tag we're trying to remove
|
// remove tag we're trying to remove
|
||||||
tagList = tagList.filter(element => element !== tag);
|
tagList = tagList.filter(element => element !== tag);
|
||||||
|
|
||||||
|
|
@ -18,12 +18,14 @@
|
||||||
$alertStore = error;
|
$alertStore = error;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex gap-1">
|
<div class="flex gap-1">
|
||||||
<span><NewDeviceTag {device}/></span>
|
<span><NewDeviceTag {device}/></span>
|
||||||
|
|
||||||
{#each device.forcedTags as tag}
|
{#each device.tags as tag}
|
||||||
<span class="btn btn-xs btn-primary normal-case">{tag.replace("tag:","")}
|
<span class="btn btn-xs btn-primary normal-case">{tag.replace("tag:","")}
|
||||||
<!-- Cancel symbol -->
|
<!-- Cancel symbol -->
|
||||||
<button on:click|stopPropagation={() => {updateTagsAction(tag)}}
|
<button on:click|stopPropagation={() => {updateTagsAction(tag)}}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
export let device = new Device();
|
export let device = new Device();
|
||||||
|
|
||||||
function updateTagsAction() {
|
function updateTagsAction() {
|
||||||
let tagList = device.forcedTags;
|
let tagList = device.tags;
|
||||||
tagList.push(`tag:${newTag}`);
|
tagList.push(`tag:${newTag}`);
|
||||||
// remove duplicates
|
// remove duplicates
|
||||||
tagList = [...new Set(tagList)];
|
tagList = [...new Set(tagList)];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue