Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions src/dispatch/static/dispatch/src/plugin/PluginInstanceCombobox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
:loading="loading"
:items="items"
item-title="plugin.slug"
item-value="plugin.slug"
@update:search="getFilteredData()"
v-model:search="search"
hide-selected
:label="label"
Expand Down Expand Up @@ -39,14 +41,14 @@

<script>
import { cloneDeep, debounce } from "lodash"

import SearchUtils from "@/search/utils"
import PluginApi from "@/plugin/api"

export default {
name: "PluginCombobox",
props: {
modelValue: {
type: [Object],
type: Object,
default: null,
},
type: {
Expand Down Expand Up @@ -78,7 +80,9 @@ export default {
},

created() {
this.plugin = cloneDeep(this.modelValue)
if (this.modelValue && this.modelValue.slug) {
this.plugin = cloneDeep(this.modelValue)
}
this.fetchData()
},

Expand Down Expand Up @@ -132,11 +136,21 @@ export default {

let filterOptions = {
q: this.search,
sortBy: ["slug"],
sortBy: ["Plugin.slug"],
itemsPerPage: this.numItems,
filter: JSON.stringify(filter),
}

if (this.project) {
filterOptions = {
...filterOptions,
filters: {
project: [this.project],
},
}
filterOptions = SearchUtils.createParametersFromTableOptions({ ...filterOptions })
}

PluginApi.getAllInstances(filterOptions).then((response) => {
this.items = response.data.items
this.total = response.data.total
Expand All @@ -150,8 +164,8 @@ export default {
this.loading = false
})
},
getFilteredData: debounce(function (options) {
this.fetchData(options)
getFilteredData: debounce(function () {
this.fetchData()
}, 500),
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default {
},
addItem(plugin_idx) {
if (!this.plugins[plugin_idx].metadata) {
this.$set(this.plugins[plugin_idx], "metadata", [])
this.plugins[plugin_idx].metadata = []
}
this.plugins[plugin_idx].metadata.push({ key: "", value: "" })
this.$emit("update:modelValue", this.plugins)
Expand All @@ -148,7 +148,7 @@ export default {
this.$emit("update:modelValue", this.plugins)
},
setPlugin(event) {
this.$set(this.plugins, event.idx, event.plugin)
this.plugins[event.idx] = event.plugin
this.plugins[event.idx].slug = event.plugin.plugin.slug
this.$emit("update:modelValue", this.plugins)
},
Expand Down