Skip to content
Open
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
16 changes: 16 additions & 0 deletions client/src/components/Panels/Common/ToolSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import axios from "axios";
import { getAppRoot } from "onload/loadConfig";
import { getGalaxyInstance } from "app";
import DelayedInput from "components/Common/DelayedInput";
import MockAdapter from "axios-mock-adapter";
import testToolsSearchResponse from "./../../ToolsView/testData/toolsSearch";

export default {
name: "ToolSearch",
Expand Down Expand Up @@ -48,12 +50,26 @@ export default {
this.$emit("onResults", this.favoritesResults);
} else {
this.loading = true;

let axiosMock;
axiosMock = new MockAdapter(axios);
axiosMock.onGet(`${getAppRoot()}api/tools`).reply(200, testToolsSearchResponse);

axios
.get(`${getAppRoot()}api/tools`, {
params: { q, view: this.currentPanelView },
})
.then((response) => {
this.loading = false;

if (axiosMock) {
let toolID = [];
(response.data).forEach(function(tool) {
toolID.push(tool.id);
});
response.data = toolID;
}

this.$emit("onResults", response.data);
})
.catch((err) => {
Expand Down
Loading