Skip to content

Commit

Permalink
change emptyCollection item state to failed_populated_state
Browse files Browse the repository at this point in the history
Instead of creating a new, non-ok visual state for empty collections,
create it for collections that have `populated_state: failed`.
Also, show the `populated_state_message` in the `CollectionPanel`
  • Loading branch information
ahmedhamidawan committed Nov 9, 2023
1 parent 05ceeba commit 6c1f409
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<span class="description mt-1 mb-1">
a {{ collectionLabel }} with {{ elementCount }}<b>{{ homogeneousDatatype }}</b> {{ pluralizedItem }}
a {{ collectionLabel }} with {{ elementCount || 0 }}<b>{{ homogeneousDatatype }}</b> {{ pluralizedItem }}
</span>
<CollectionProgress v-if="jobStateSummary.size != 0" :summary="jobStateSummary" />
</div>
Expand Down
7 changes: 5 additions & 2 deletions client/src/components/History/Content/ContentItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,11 @@ export default {
state() {
if (this.isPlaceholder) {
return "placeholder";
} else if (this.item.element_count !== undefined && this.item.element_count === 0) {
return "emptyCollection";
} else if (
this.item.history_content_type === "dataset_collection" &&
this.item.populated_state === "failed"
) {
return "failed_populated_state";
}
if (this.item.job_state_summary) {
for (const state of HIERARCHICAL_COLLECTION_JOB_STATES) {
Expand Down
7 changes: 6 additions & 1 deletion client/src/components/History/Content/model/StatesInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ function onFilter(value: string) {
<template>
<div>
<p>Here are all available item states in Galaxy:</p>
<p><i>(Note that the colors for each state correspond to content item state colors in the history)</i></p>
<p>
<i>
(Note that the colors for each state correspond to content item state colors in the history, and if it
exists, hovering over the icon on a history item will display the state message.)
</i>
</p>
<dl v-for="(state, key, index) in states" :key="index">
<div :class="['alert', 'content-item', 'alert-' + state.status]" :data-state="key">
<dt>
Expand Down
10 changes: 5 additions & 5 deletions client/src/components/History/Content/model/states.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { components } from "@/api/schema";

type DatasetState = components["schemas"]["DatasetState"];
// The 'failed' state is for the collection job state summary, not a dataset state.
type State = DatasetState | "failed" | "placeholder" | "emptyCollection";
type State = DatasetState | "failed" | "placeholder" | "failed_populated_state";

interface StateRepresentation {
status: "success" | "warning" | "info" | "danger" | "secondary";
Expand Down Expand Up @@ -106,10 +106,10 @@ export const STATES: StateMap = {
spin: true,
nonDb: true,
},
/** the collection is empty. This state is only visual and transitional, it does not exist in the database. */
emptyCollection: {
status: "secondary",
text: "This is an empty list/collection.",
/** the `populated_state: failed`. This state is only visual and transitional, it does not exist in the database. */
failed_populated_state: {
status: "danger",
text: "Failed to populate the list/collection.",
icon: "exclamation-triangle",
nonDb: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ const dsc = computed(() => {
const collectionElements = computed(() => collectionElementsStore.getCollectionElements(dsc.value, offset.value));
const loading = computed(() => collectionElementsStore.isLoadingCollectionElements(dsc.value));
const jobState = computed(() => ("job_state_summary" in dsc.value ? dsc.value.job_state_summary : undefined));
const populatedStateMsg = computed(() =>
"populated_state_message" in dsc.value ? dsc.value.populated_state_message : undefined
);
const rootCollection = computed(() => {
if (isHDCA(props.selectedCollections[0])) {
return props.selectedCollections[0];
Expand Down Expand Up @@ -115,8 +118,12 @@ watch(
</section>
<section class="position-relative flex-grow-1 scroller">
<div>
<b-alert v-if="collectionElements.length === 0" class="m-2" variant="info" show>
This is an empty list/collection.
<b-alert
v-if="collectionElements.length === 0"
class="m-2"
:variant="populatedStateMsg ? 'danger' : 'info'"
show>
{{ populatedStateMsg || "This is an empty list/collection." }}
</b-alert>
<ListingLayout
v-else
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/History/HistoryFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { STATES } from "components/History/Content/model/states";
import StatesInfo from "components/History/Content/model/StatesInfo";
import Filtering, { compare, contains, equals, expandNameTag, toBool, toDate } from "utils/filtering";

const excludeStates = ["empty", "failed", "upload", "placeholder", "emptyCollection"];
const excludeStates = ["empty", "failed", "upload", "placeholder", "failed_populated_state"];
const states = Object.keys(STATES).filter((state) => !excludeStates.includes(state));

const validFilters = {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/History/HistoryPublishedList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ async function load() {
onMounted(async () => {
if (props.fUsername) {
filterText.value = filters.getFilterText({ "user_eq:": props.fUsername });
filterText.value = filters.getFilterText({ user_eq: props.fUsername });
}
await load();
useInfiniteScroll(scrollableDiv.value, () => load());
Expand Down

0 comments on commit 6c1f409

Please sign in to comment.