Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a "get more workflows" button to the bottom of the workflow list #16794

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
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
47 changes: 30 additions & 17 deletions client/src/components/Workflow/Import/TrsSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ import TrsServerSelection from "./TrsServerSelection.vue";
import TrsTool from "./TrsTool.vue";
import LoadingSpan from "@/components/LoadingSpan.vue";

const props = defineProps({
search: {
type: String,
default: null,
},
});

type TrsSearchData = {
id: string;
name: string;
Expand All @@ -27,7 +34,7 @@ const fields = [
{ key: "organization", label: "Organization" },
];

const query = ref("");
const query = ref(props.search ?? "");
const results: Ref<TrsSearchData[]> = ref([]);
const trsServer = ref("");
const loading = ref(false);
Expand All @@ -49,29 +56,37 @@ const searchHelp = computed(() => {

const services = new Services();

const router = useRouter();

watch(query, async () => {
if (query.value == "") {
results.value = [];
} else {
loading.value = true;

try {
const response = await axios.get(
withPrefix(`/api/trs_search?query=${query.value}&trs_server=${trsServer.value}`)
);
results.value = response.data;
} catch (e) {
errorMessage.value = e as string;
}

loading.value = false;
await searchWorkflows();
}
});

function onTrsSelection(selection: TrsSelection) {
async function searchWorkflows() {
loading.value = true;

try {
const response = await axios.get(
withPrefix(`/api/trs_search?query=${query.value}&trs_server=${trsServer.value}`)
);
results.value = response.data;
} catch (e) {
errorMessage.value = e as string;
}

loading.value = false;
}

async function onTrsSelection(selection: TrsSelection) {
trsSelection.value = selection;
trsServer.value = selection.id;
query.value = "";
if (query.value) {
await searchWorkflows();
}
}

function onTrsSelectionError(message: string) {
Expand All @@ -96,8 +111,6 @@ function computeItems(items: TrsSearchData[]) {
});
}

const router = useRouter();

async function importVersion(trsId?: string, toolIdToImport?: string, version?: string, isRunFormRedirect = false) {
if (!trsId || !toolIdToImport) {
errorMessage.value = "Import Failed. Unknown Id";
Expand Down
17 changes: 17 additions & 0 deletions client/src/components/Workflow/WorkflowList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@
</b-card>
</template>
</b-table>
<b-alert class="search-more-workflows" variant="info" show>
<div>
<b-button
class="px-1"
title="Search workflows from other sources"
variant="link"
@click.prevent.stop="onSearchMore">
Get more workflows
</b-button>
</div>
</b-alert>
<b-pagination
v-show="rows >= perPage"
v-model="currentPage"
Expand Down Expand Up @@ -304,6 +315,12 @@ export default {
normalizeTag: function (tag) {
return tag.replace(/(tag:')#/g, "$1name:");
},
onSearchMore: function () {
const query = this.filter;
const path = "/workflows/trs_search";
const routerParams = query ? { path, query: { query } } : { path };
this.$router.push(routerParams);
},
},
};
</script>
3 changes: 3 additions & 0 deletions client/src/entry/analysis/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ export function getRouter(Galaxy) {
{
path: "workflows/trs_search",
component: TrsSearch,
props: (route) => ({
search: route.query.query,
}),
},
{
path: "workflows/:storedWorkflowId/invocations",
Expand Down