Skip to content

Commit

Permalink
Bugfix/plugin metadata not set (#4879)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 authored Jun 26, 2024
1 parent 824d055 commit 15b6d7d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
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

0 comments on commit 15b6d7d

Please sign in to comment.