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
2 changes: 1 addition & 1 deletion client/src/api/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type JobMessage =

export const NON_TERMINAL_STATES = ["new", "queued", "running", "waiting", "paused", "resubmitted", "stop"];
export const ERROR_STATES = ["error", "deleted", "deleting"];
export const TERMINAL_STATES = ["ok", "skipped", "stop", "stopping", "skipped"].concat(ERROR_STATES);
export const TERMINAL_STATES = ["ok", "skipped", "stop", "stopping"].concat(ERROR_STATES);

interface JobDef {
tool_id: string;
Expand Down
11 changes: 11 additions & 0 deletions client/src/components/Dataset/DatasetDisplay.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<script setup lang="ts">
import { faExclamationTriangle, faSpinner } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BAlert } from "bootstrap-vue";
import { storeToRefs } from "pinia";
import { computed, ref, watch } from "vue";
import { useDatasetStore } from "@/stores/datasetStore";
import { useUserStore } from "@/stores/userStore";
import STATES from "@/utils/datasetStates";
import { withPrefix } from "@/utils/redirect";
import { errorMessageAsString } from "@/utils/simple-error";
import { bytesToString } from "@/utils/utils";
Expand Down Expand Up @@ -75,6 +78,14 @@ watch(
{{ errorMessage }}
</BAlert>
<LoadingSpan v-else-if="isLoading || !dataset" message="Loading dataset content" />
<BAlert v-else-if="STATES.PENDING_STATES.includes(dataset.state)" show variant="warning">
<FontAwesomeIcon :icon="faSpinner" spin />
<span>Waiting for dataset to become available. Please check the history panel for details.</span>
</BAlert>
<BAlert v-else-if="!STATES.OK_STATES.includes(dataset.state)" show variant="danger">
<FontAwesomeIcon :icon="faExclamationTriangle" />
<span>Dataset is unavailable. Please check the history panel for details.</span>
</BAlert>
<div v-else class="dataset-display h-100">
<Alert v-if="sanitizedMessage" :dismissible="true" variant="warning" data-description="sanitization warning">
{{ sanitizedMessage }}
Expand Down
26 changes: 15 additions & 11 deletions client/src/components/Dataset/DatasetView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { usePersistentToggle } from "@/composables/persistentToggle";
import { useDatasetStore } from "@/stores/datasetStore";
import { useDatatypesMapperStore } from "@/stores/datatypesMapperStore";
import { useDatatypeStore } from "@/stores/datatypeStore";
import STATES from "@/utils/datasetStates";
import { withPrefix } from "@/utils/redirect";
import { bytesToString } from "@/utils/utils";

Expand Down Expand Up @@ -41,6 +42,7 @@ const props = withDefaults(defineProps<Props>(), {
const iframeLoading = ref(true);

const dataset = computed(() => datasetStore.getDataset(props.datasetId));
const downloadUrl = computed(() => withPrefix(`/datasets/${props.datasetId}/display`));
const headerState = computed(() => (headerCollapsed.value ? "closed" : "open"));

// Track datatype loading state
Expand All @@ -51,23 +53,16 @@ const isLoading = computed(() => {
return datasetStore.isLoadingDataset(props.datasetId) || isDatatypeLoading.value || datatypesMapperStore.loading;
});

const showError = computed(
() => dataset.value && (dataset.value.state === "error" || dataset.value.state === "failed_metadata"),
);
// Match datatype variant
const isAutoDownloadType = computed(
() => dataset.value && datatypeStore.isDatatypeAutoDownload(dataset.value.file_ext),
);
const downloadUrl = computed(() => withPrefix(`/datasets/${props.datasetId}/display`));
const preferredVisualization = computed(
() => dataset.value && datatypeStore.getPreferredVisualization(dataset.value.file_ext),
);
const isBinaryDataset = computed(() => {
if (!dataset.value?.file_ext || !datatypesMapperStore.datatypesMapper) {
return false;
}
return datatypesMapperStore.datatypesMapper.isSubTypeOfAny(dataset.value.file_ext, ["galaxy.datatypes.binary"]);
});

const isImageDataset = computed(() => {
if (!dataset.value?.file_ext || !datatypesMapperStore.datatypesMapper) {
return false;
Expand All @@ -76,11 +71,19 @@ const isImageDataset = computed(() => {
"galaxy.datatypes.images.Image",
]);
});

const isPdfDataset = computed(() => {
return dataset.value?.file_ext === "pdf";
});

// Has a preferred visualization?
const preferredVisualization = computed(
() => dataset.value && datatypeStore.getPreferredVisualization(dataset.value.file_ext),
);

// Match dataset state
const showError = computed(() => dataset.value && STATES.ERROR === dataset.value.state);
const showOk = computed(() => dataset.value && STATES.OK_STATES.includes(dataset.value.state));

// Watch for changes to the dataset to fetch datatype info
watch(
() => dataset.value?.file_ext,
Expand Down Expand Up @@ -149,20 +152,21 @@ watch(
</header>
<BNav v-if="!displayOnly" pills class="my-2 p-2 bg-light border-bottom">
<BNavItem
v-if="showOk"
title="View a preview of the dataset contents"
:active="tab === 'preview'"
:to="`/datasets/${datasetId}/preview`">
<FontAwesomeIcon :icon="faEye" class="mr-1" /> Preview
</BNavItem>
<BNavItem
v-if="preferredVisualization"
v-if="showOk && preferredVisualization"
title="View raw dataset contents"
:active="tab === 'raw'"
:to="`/datasets/${datasetId}/raw`">
<FontAwesomeIcon :icon="faFileAlt" class="mr-1" /> Raw
</BNavItem>
<BNavItem
v-if="!showError"
v-if="showOk"
title="Explore available visualizations for this dataset"
:active="tab === 'visualize'"
:to="`/datasets/${datasetId}/visualize`">
Expand Down
3 changes: 3 additions & 0 deletions client/src/components/History/Content/ContentItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { getGalaxyInstance } from "@/app";
import type { ItemUrls } from "@/components/History/Content/Dataset/index";
import { updateContentFields } from "@/components/History/model/queries";
import { useEntryPointStore } from "@/stores/entryPointStore";
import DATASET_STATES from "@/utils/datasetStates";
import { clearDrag } from "@/utils/setDrag";

import { getContentItemState, type State, STATES } from "./model/states";
Expand Down Expand Up @@ -174,6 +175,8 @@ const itemUrls = computed<ItemUrls>(() => {
let display = `/datasets/${id}`;
if (props.item.extension == "tool_markdown") {
display = `/datasets/${id}/report`;
} else if (!DATASET_STATES.OK_STATES.includes(state.value)) {
display = `/datasets/${id}/details`;
}
return {
display: display,
Expand Down
107 changes: 58 additions & 49 deletions client/src/utils/datasetStates.ts
Original file line number Diff line number Diff line change
@@ -1,61 +1,70 @@
//==============================================================================
/** Map of possible HDA/collection/job states to their string equivalents.
* A port of galaxy.model.Dataset.states.
*/
const RAW_STATES = {
// NOT ready states
/** is uploading and not ready */
UPLOAD: "upload",
/** the job that will produce the dataset queued in the runner */
QUEUED: "queued",
/** the job that will produce the dataset is running */
RUNNING: "running",
/** metadata for the dataset is being discovered/set */
SETTING_METADATA: "setting_metadata",

// ready states
/** was created without a tool */
NEW: "new",
/** has no data */
EMPTY: "empty",
/** has successfully completed running */
OK: "ok",

/** the job that will produce the dataset paused */
PAUSED: "paused",
/** metadata discovery/setting failed or errored (but otherwise ok) */
FAILED_METADATA: "failed_metadata",
//TODO: not in trans.app.model.Dataset.states - is in database
/** not accessible to the current user (i.e. due to permissions) */
NOT_VIEWABLE: "noPermission",
const STATES = {
/** deleted while uploading */
DISCARDED: "discarded",
/** remote dataset not ingested yet */
DEFERRED: "deferred",
/** dataset has been deleted */
DELETED: "deleted",
/** dataset is being been deleted */
DELETING: "deleting",
/** has no data */
EMPTY: "empty",
/** the tool producing this dataset failed */
ERROR: "error",
/** metadata discovery/setting failed or errored (but otherwise ok) */
FAILED_METADATA: "failed_metadata",
/** was created without a tool */
NEW: "new",
/** not accessible to the current user (i.e. due to permissions) */
NOT_VIEWABLE: "noPermission",
/** has successfully completed running */
OK: "ok",
/** the job that will produce the dataset paused */
PAUSED: "paused",
/** the job that will produce the dataset queued in the runner */
QUEUED: "queued",
/** the job that will produce the dataset is running */
RUNNING: "running",
/** the job has been resubmitted */
RESUBMITTED: "resubmitted",
/** metadata for the dataset is being discovered/set */
SETTING_METADATA: "setting_metadata",
/** the job has been skipped */
SKIPPED: "skipped",
/** the job has been stopped */
STOP: "stop",
/** the job is stopping */
STOPPING: "stopping",
/** is uploading and not ready */
UPLOAD: "upload",
/** the job is waiting */
WAITING: "waiting",
};

const STATES = {
...RAW_STATES,
export default {
...STATES,
OK_STATES: [STATES.OK, STATES.DEFERRED, STATES.FAILED_METADATA],
READY_STATES: [
RAW_STATES.OK,
RAW_STATES.EMPTY,
RAW_STATES.PAUSED,
RAW_STATES.FAILED_METADATA,
RAW_STATES.NOT_VIEWABLE,
RAW_STATES.DEFERRED,
RAW_STATES.DISCARDED,
RAW_STATES.ERROR,
STATES.DEFERRED,
STATES.DISCARDED,
STATES.EMPTY,
STATES.ERROR,
STATES.FAILED_METADATA,
STATES.NOT_VIEWABLE,
STATES.OK,
STATES.PAUSED,
STATES.SKIPPED,
STATES.STOP,
STATES.STOPPING,
],
NOT_READY_STATES: [
RAW_STATES.UPLOAD,
RAW_STATES.QUEUED,
RAW_STATES.RUNNING,
RAW_STATES.SETTING_METADATA,
RAW_STATES.NEW,
PENDING_STATES: [
STATES.NEW,
STATES.QUEUED,
STATES.RESUBMITTED,
STATES.RUNNING,
STATES.SETTING_METADATA,
STATES.UPLOAD,
STATES.WAITING,
],
ERROR_STATES: [STATES.DELETED, STATES.DELETING, STATES.ERROR],
};

//==============================================================================
export default STATES;
1 change: 1 addition & 0 deletions lib/galaxy/webapps/galaxy/buildapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ def app_pair(global_conf, load_app_kwds=None, wsgi_preflight=True, **kwargs):
webapp.add_client_route("/datasets/{dataset_id}/error")
webapp.add_client_route("/datasets/{dataset_id}/details")
webapp.add_client_route("/datasets/{dataset_id}/preview")
webapp.add_client_route("/datasets/{dataset_id}/raw")
webapp.add_client_route("/datasets/{dataset_id}/report")
webapp.add_client_route("/datasets/{dataset_id}/show_params")
webapp.add_client_route("/datasets/{dataset_id}/visualize")
Expand Down
Loading