Merge pull request #15432 from ahmedhamidawan/workflow_toolbox_pointer

[23.0] ToolBoxWorkflow fix tool compatibility and search
This commit is contained in:
Dannon
2023-01-30 11:25:50 -05:00
committed by GitHub
3 changed files with 25 additions and 5 deletions
+2 -2
View File
@@ -59,9 +59,9 @@ export default {
computed: {
targetClass() {
if (this.toolKey) {
return `tool-menu-item-${this.tool[this.toolKey]} title-link`;
return `tool-menu-item-${this.tool[this.toolKey]} title-link cursor-pointer`;
} else {
return `title-link`;
return `title-link cursor-pointer`;
}
},
},
@@ -18,7 +18,7 @@
<tool-search
:current-panel-view="currentPanelView"
placeholder="search tools"
:toolbox="toolbox"
:toolbox="workflowTools"
:query="query"
@onQuery="onQuery"
@onResults="onResults" />
@@ -74,7 +74,7 @@
import _l from "utils/localization";
import ToolSection from "./Common/ToolSection";
import ToolSearch from "./Common/ToolSearch";
import { filterToolSections } from "./utilities";
import { filterToolSections, removeDisabledTools } from "./utilities";
import PanelViewButton from "./Buttons/PanelViewButton";
export default {
@@ -140,12 +140,13 @@ export default {
};
},
sections() {
return filterToolSections(this.toolsLayout, this.results);
return filterToolSections(this.workflowTools, this.results);
},
toolsLayout() {
return this.toolbox.map((section) => {
return {
...section,
disabled: !section.elems && !section.is_workflow_compatible,
elems:
section.elems &&
section.elems.map((el) => {
@@ -155,6 +156,9 @@ export default {
};
});
},
workflowTools() {
return removeDisabledTools(this.toolsLayout);
},
},
methods: {
onQuery(query) {
+16
View File
@@ -109,6 +109,22 @@ export function normalizeTools(tools) {
return tools;
}
export function removeDisabledTools(tools) {
return tools.filter((section) => {
if (section.model_class === "ToolSectionLabel") {
return true;
} else if (!section.elems && section.disabled) {
return false;
} else if (section.elems) {
section.elems = section.elems.filter((el) => !el.disabled);
if (!section.elems.length) {
return false;
}
}
return true;
});
}
function flattenToolsSection(section) {
const flattenTools = [];
if (section.elems) {