Skip to content

Commit

Permalink
GCC2024 - Add UserJobsList
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhamidawan committed Jun 20, 2024
1 parent 25d6876 commit 57c4123
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 1 deletion.
63 changes: 63 additions & 0 deletions client/src/components/Job/UserJobsList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<script setup lang="ts">
import axios from "axios";
import { BTable } from "bootstrap-vue";
import { computed, onMounted, ref } from "vue";
import { getAppRoot } from "@/onload/loadConfig";
import SwitchToHistoryLink from "../History/SwitchToHistoryLink.vue";
import UtcDate from "../UtcDate.vue";
const jobs = ref<any[]>([]);
const jobCount = computed(() => jobs.value.length);
const fields = [
{ key: "id" },
{ key: "history_id" },
{ key: "state" },
{ key: "create_time", label: "Created" },
{ key: "update_time", label: "Updated" },
{ key: "invocation_id" },
];
onMounted(async () => {
const path = `${getAppRoot()}api/jobs?view=list`;
try {
const response = await axios.get(path);
console.log(`${response.data.length} jobs loaded.`);
jobs.value = response.data;
} catch (error) {
console.error(error);
}
});
function rowClass(row: any) {
return row.state === "error" ? "table-danger" : "";
}
</script>

<template>
<div>
<h1>Jobs</h1>
<p>{{ jobCount }} jobs loaded.</p>

<BTable striped :items="jobs" :fields="fields" :tbody-tr-class="rowClass">
<template v-slot:cell(id)="data">
<router-link :to="`/jobs/${data.value}/view`">{{ data.value }}</router-link>
</template>
<template v-slot:cell(history_id)="data">
<SwitchToHistoryLink :history-id="data.value" />
</template>
<template v-slot:cell(create_time)="data">
<UtcDate :date="data.value" mode="elapsed" />
</template>
<template v-slot:cell(update_time)="data">
{{ new Date(data.value).toLocaleString() }}
</template>
<template v-slot:cell(invocation_id)="data">
<router-link :to="`/workflows/invocations/${data.value}`">{{ data.value }}</router-link>
</template>
</BTable>
</div>
</template>
5 changes: 5 additions & 0 deletions client/src/entry/analysis/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import GridInvocation from "@/components/Grid/GridInvocation.vue";
import GridVisualization from "@/components/Grid/GridVisualization.vue";
import HistoryArchiveWizard from "@/components/History/Archiving/HistoryArchiveWizard.vue";
import HistoryDatasetPermissions from "@/components/History/HistoryDatasetPermissions.vue";
import UserJobsList from "@/components/Job/UserJobsList.vue";
import NotificationsList from "@/components/Notifications/NotificationsList.vue";
import EditObjectStoreInstance from "@/components/ObjectStore/Instances/EditInstance.vue";
import ManageObjectStoreIndex from "@/components/ObjectStore/Instances/ManageIndex.vue";
Expand Down Expand Up @@ -344,6 +345,10 @@ export function getRouter(Galaxy) {
path: "interactivetool_entry_points/list",
component: InteractiveTools,
},
{
path: "jobs/list",
component: UserJobsList,
},
{
path: "jobs/submission/success",
component: ToolSuccess,
Expand Down
4 changes: 3 additions & 1 deletion lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1975,13 +1975,15 @@ def requires_shareable_storage(self, security_agent):
return requires_sharing

def to_dict(self, view="collection", system_details=False):
if view == "admin_job_list":
if view == "admin_job_list" or view == "list":
rval = super().to_dict(view="collection")
else:
rval = super().to_dict(view=view)
rval["tool_id"] = self.tool_id
rval["tool_version"] = self.tool_version
rval["history_id"] = self.history_id
if view == "list":
rval["invocation_id"] = getattr(self.workflow_invocation_step, "workflow_invocation_id", None)
if system_details or view == "admin_job_list":
# System level details that only admins should have.
rval["external_id"] = self.job_runner_external_id
Expand Down
5 changes: 5 additions & 0 deletions lib/galaxy/schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2032,6 +2032,11 @@ class JobSummary(JobBaseModel):
"Only the owner of the job and administrators can see this value."
),
)
invocation_id: Optional[EncodedDatabaseIdField] = Field(
None,
title="Invocation ID",
description="The id of the workflow invocation associated with this job.",
)


class DatasetSourceIdBase(Model):
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/webapps/galaxy/buildapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def app_pair(global_conf, load_app_kwds=None, wsgi_preflight=True, **kwargs):
webapp.add_client_route("/datasets/{dataset_id}/preview")
webapp.add_client_route("/datasets/{dataset_id}/show_params")
webapp.add_client_route("/collection/{collection_id}/edit")
webapp.add_client_route("/jobs/list")
webapp.add_client_route("/jobs/submission/success")
webapp.add_client_route("/jobs/{job_id}/view")
webapp.add_client_route("/workflows/list")
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/webapps/galaxy/services/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
class JobIndexViewEnum(str, Enum):
collection = "collection"
admin_job_list = "admin_job_list"
list = "list"


class JobIndexPayload(JobIndexQueryPayload):
Expand Down

0 comments on commit 57c4123

Please sign in to comment.