Skip to content

Commit

Permalink
Merge pull request louislam#3024 from chakflying/feat/edit-tag-multis…
Browse files Browse the repository at this point in the history
…elect

UI: Use vue-multiselect in Edit Tag & Styling Fixes
  • Loading branch information
louislam committed May 9, 2023
2 parents 33de7bd + 9975050 commit 253214a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/assets/multiselect.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
@import "vars.scss";
@import "node_modules/vue-multiselect/dist/vue-multiselect";

.multiselect {
.dark & {
color: $dark-font-color;
}
}

.multiselect__tags {
border-radius: 1.5rem;
border: 1px solid #ced4da;
Expand All @@ -14,10 +20,12 @@

.multiselect__option--highlight {
background: $primary !important;
color: $dark-font-color2 !important;
}

.multiselect__option--highlight::after {
background: $primary !important;
color: $dark-font-color2 !important;
}

.multiselect__tag {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'm-2': size == 'normal',
'px-2': size == 'sm',
'py-0': size == 'sm',
'm-1': size == 'sm',
'mx-1': size == 'sm',
}"
:style="{ backgroundColor: item.color, fontSize: size == 'sm' ? '0.7em' : '1em' }"
>
Expand Down
23 changes: 19 additions & 4 deletions src/components/TagEditDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,24 @@
</button>
</router-link>
</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>
<select v-model="selectedAddMonitor" class="form-control">
<option v-for="monitor in allMonitorList" :key="monitor.id" :value="monitor">{{ monitor.name }}</option>
</select>
<VueMultiselect
v-model="selectedAddMonitor"
: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>
Expand All @@ -107,6 +120,7 @@
<script>
import { Modal } from "bootstrap";
import Confirm from "./Confirm.vue";
import Tag from "./Tag.vue";
import VueMultiselect from "vue-multiselect";
import { colorOptions } from "../util-frontend";
import { useToast } from "vue-toastification";
Expand All @@ -117,6 +131,7 @@ export default {
components: {
VueMultiselect,
Confirm,
Tag,
},
props: {
updated: {
Expand Down
4 changes: 1 addition & 3 deletions src/pages/StatusPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,7 @@
class="mt-3"
>
<template #option="{ option }">
<div
class="d-inline-flex"
>
<div class="d-inline-flex">
<span>{{ option.name }} <Tag v-for="tag in option.tags" :key="tag" :item="tag" :size="'sm'" /></span>
</div>
</template>
Expand Down

0 comments on commit 253214a

Please sign in to comment.