Merge pull request #3024 from chakflying/feat/edit-tag-multiselect

UI: Use vue-multiselect in Edit Tag & Styling Fixes
pull/3149/head
Louis Lam 2 years ago committed by GitHub
commit 253214ad2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,12 @@
@import "vars.scss"; @import "vars.scss";
@import "node_modules/vue-multiselect/dist/vue-multiselect"; @import "node_modules/vue-multiselect/dist/vue-multiselect";
.multiselect {
.dark & {
color: $dark-font-color;
}
}
.multiselect__tags { .multiselect__tags {
border-radius: 1.5rem; border-radius: 1.5rem;
border: 1px solid #ced4da; border: 1px solid #ced4da;
@ -14,10 +20,12 @@
.multiselect__option--highlight { .multiselect__option--highlight {
background: $primary !important; background: $primary !important;
color: $dark-font-color2 !important;
} }
.multiselect__option--highlight::after { .multiselect__option--highlight::after {
background: $primary !important; background: $primary !important;
color: $dark-font-color2 !important;
} }
.multiselect__tag { .multiselect__tag {

@ -6,7 +6,7 @@
'm-2': size == 'normal', 'm-2': size == 'normal',
'px-2': size == 'sm', 'px-2': size == 'sm',
'py-0': size == 'sm', 'py-0': size == 'sm',
'm-1': size == 'sm', 'mx-1': size == 'sm',
}" }"
:style="{ backgroundColor: item.color, fontSize: size == 'sm' ? '0.7em' : '1em' }" :style="{ backgroundColor: item.color, fontSize: size == 'sm' ? '0.7em' : '1em' }"
> >

@ -76,11 +76,24 @@
</button> </button>
</router-link> </router-link>
</div> </div>
<div v-if="allMonitorList.length > 0" class="pt-3 px-3"> <div v-if="allMonitorList.length > 0" class="pt-3">
<label class="form-label">{{ $t("Add a monitor") }}:</label> <label class="form-label">{{ $t("Add a monitor") }}:</label>
<select v-model="selectedAddMonitor" class="form-control"> <VueMultiselect
<option v-for="monitor in allMonitorList" :key="monitor.id" :value="monitor">{{ monitor.name }}</option> v-model="selectedAddMonitor"
</select> :options="allMonitorList"
:multiple="false"
:searchable="true"
:placeholder="$t('Add a monitor')"
label="name"
trackBy="name"
class="mt-1"
>
<template #option="{ option }">
<div class="d-inline-flex">
<span>{{ option.name }} <Tag v-for="monitorTag in option.tags" :key="monitorTag" :item="monitorTag" :size="'sm'" /></span>
</div>
</template>
</VueMultiselect>
</div> </div>
</div> </div>
</div> </div>
@ -107,6 +120,7 @@
<script> <script>
import { Modal } from "bootstrap"; import { Modal } from "bootstrap";
import Confirm from "./Confirm.vue"; import Confirm from "./Confirm.vue";
import Tag from "./Tag.vue";
import VueMultiselect from "vue-multiselect"; import VueMultiselect from "vue-multiselect";
import { colorOptions } from "../util-frontend"; import { colorOptions } from "../util-frontend";
import { useToast } from "vue-toastification"; import { useToast } from "vue-toastification";
@ -117,6 +131,7 @@ export default {
components: { components: {
VueMultiselect, VueMultiselect,
Confirm, Confirm,
Tag,
}, },
props: { props: {
updated: { updated: {

@ -291,9 +291,7 @@
class="mt-3" class="mt-3"
> >
<template #option="{ option }"> <template #option="{ option }">
<div <div class="d-inline-flex">
class="d-inline-flex"
>
<span>{{ option.name }} <Tag v-for="tag in option.tags" :key="tag" :item="tag" :size="'sm'" /></span> <span>{{ option.name }} <Tag v-for="tag in option.tags" :key="tag" :item="tag" :size="'sm'" /></span>
</div> </div>
</template> </template>

Loading…
Cancel
Save