Skip to content

Commit

Permalink
Merge branch 'dev' into toolbox_restructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhamidawan authored Sep 27, 2023
2 parents 5981b5e + 0781880 commit 4735cca
Show file tree
Hide file tree
Showing 79 changed files with 1,054 additions and 780 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Dataset/DatasetName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<b-link
id="dataset-dropdown"
class="workflow-dropdown font-weight-bold p-2"
class="workflow-dropdown p-2"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/History/Content/ContentItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@keydown="onKeyDown">
<div class="p-1 cursor-pointer" draggable @dragstart="onDragStart" @dragend="onDragEnd" @click.stop="onClick">
<div class="d-flex justify-content-between">
<span class="p-1 font-weight-bold" data-description="content item header info">
<span class="p-1" data-description="content item header info">
<b-button v-if="selectable" class="selector p-0" @click.stop="$emit('update:selected', !selected)">
<icon v-if="selected" fixed-width size="lg" :icon="['far', 'check-square']" />
<icon v-else fixed-width size="lg" :icon="['far', 'square']" />
Expand Down Expand Up @@ -46,7 +46,7 @@
<icon fixed-width :icon="contentState.icon" :spin="contentState.spin" />
</span>
<span class="id hid">{{ id }}:</span>
<span class="content-title name">{{ name }}</span>
<span class="content-title name font-weight-bold">{{ name }}</span>
</span>
<span v-if="item.purged" class="align-self-start btn-group p-1">
<b-badge variant="secondary" title="This dataset has been permanently deleted">
Expand Down
241 changes: 111 additions & 130 deletions client/src/components/History/CurrentCollection/CollectionPanel.vue
Original file line number Diff line number Diff line change
@@ -1,135 +1,116 @@
<!-- When a dataset collection is being viewed, this panel shows the contents of that collection -->

<template>
<CollectionElementsProvider
v-if="dsc"
:id="dsc.id"
ref="provider"
:key="dsc.id"
v-slot="{ loading, result: payload }"
:contents-url="contentsUrl"
:offset="offset">
<ExpandedItems v-slot="{ isExpanded, setExpanded }" :scope-key="dsc.id" :get-item-key="(item) => item.id">
<section class="dataset-collection-panel w-100 d-flex flex-column">
<section>
<CollectionNavigation
:history-name="history.name"
:selected-collections="selectedCollections"
v-on="$listeners" />
<CollectionDetails :dsc="dsc" :writeable="isRoot" @update:dsc="updateDsc(dsc, $event)" />
<CollectionOperations v-if="isRoot && showControls" :dsc="dsc" />
</section>
<section class="position-relative flex-grow-1 scroller">
<div>
<ListingLayout :items="payload" :loading="loading" @scroll="onScroll">
<template v-slot:item="{ item }">
<ContentItem
:id="item.element_index + 1"
:item="item.object"
:name="item.element_identifier"
:expand-dataset="isExpanded(item)"
:is-dataset="item.element_type == 'hda'"
:filterable="filterable"
@update:expand-dataset="setExpanded(item, $event)"
@view-collection="onViewSubCollection" />
</template>
</ListingLayout>
</div>
</section>
</section>
</ExpandedItems>
</CollectionElementsProvider>
</template>
<script setup lang="ts">
import { computed, ref, watch } from "vue";

<script>
import ContentItem from "components/History/Content/ContentItem";
import ExpandedItems from "components/History/Content/ExpandedItems";
import ListingLayout from "components/History/Layout/ListingLayout";
import { updateContentFields } from "components/History/model/queries";
import { CollectionElementsProvider } from "components/providers/storeProviders";

import CollectionDetails from "./CollectionDetails";
import CollectionNavigation from "./CollectionNavigation";
import CollectionOperations from "./CollectionOperations";

export default {
components: {
CollectionDetails,
CollectionElementsProvider,
CollectionNavigation,
CollectionOperations,
ContentItem,
ExpandedItems,
ListingLayout,
},
props: {
history: { type: Object, required: true },
selectedCollections: { type: Array, required: true },
showControls: { type: Boolean, default: true },
filterable: { type: Boolean, default: false },
},
data() {
return {
offset: 0,
};
},
computed: {
dsc() {
const arr = this.selectedCollections;
return arr[arr.length - 1];
},
jobState() {
return this.dsc["job_state_summary"];
},
isRoot() {
return this.dsc == this.rootCollection;
},
rootCollection() {
return this.selectedCollections[0];
},
contentsUrl() {
return this.dsc.contents_url.substring(1);
},
},
watch: {
history(newHistory, oldHistory) {
if (newHistory.id != oldHistory.id) {
// Send up event closing out selected collection on history change.
this.$emit("update:selected-collections", []);
}
},
jobState: {
handler() {
this.$refs.provider.load();
},
deep: true,
},
},
methods: {
updateDsc(collection, fields) {
updateContentFields(collection, fields).then((response) => {
Object.keys(response).forEach((key) => {
collection[key] = response[key];
});
});
},
onScroll(offset) {
this.offset = offset;
},
/**
* Passes a sub-collection i.e a collection element object containing another collection, into
* a populated object for drilldown without the need for a separate data request. This object
* is used for breadcrumbs in the navigation component and to render the collection details and
* description at the top of the collection panel. Details include the collection name, the
* collection type, and the element count.
*/
onViewSubCollection(itemObject, elementIdentifer) {
const collectionObject = {
name: elementIdentifer,
...itemObject,
};
this.$emit("view-collection", collectionObject);
},
import ExpandedItems from "@/components/History/Content/ExpandedItems";
import { updateContentFields } from "@/components/History/model/queries";
import { useCollectionElementsStore } from "@/stores/collectionElementsStore";
import { HistorySummary } from "@/stores/historyStore";
import { DCESummary, DCObject, HDCASummary } from "@/stores/services";

import CollectionDetails from "./CollectionDetails.vue";
import CollectionNavigation from "./CollectionNavigation.vue";
import CollectionOperations from "./CollectionOperations.vue";
import ContentItem from "@/components/History/Content/ContentItem.vue";
import ListingLayout from "@/components/History/Layout/ListingLayout.vue";

interface Props {
history: HistorySummary;
selectedCollections: HDCASummary[];
showControls?: boolean;
filterable?: boolean;
}

const props = withDefaults(defineProps<Props>(), {
showControls: true,
filterable: false,
});

const collectionElementsStore = useCollectionElementsStore();

const emit = defineEmits<{
(e: "view-collection", collection: HDCASummary): void;
(e: "update:selected-collections", collections: HDCASummary[]): void;
}>();

const offset = ref(0);

const dsc = computed(() => props.selectedCollections[props.selectedCollections.length - 1] as HDCASummary);
const collectionElements = computed(() => collectionElementsStore.getCollectionElements(dsc.value, offset.value));
const loading = computed(() => collectionElementsStore.isLoadingCollectionElements(dsc.value));
const jobState = computed(() => dsc.value?.job_state_summary);
const rootCollection = computed(() => props.selectedCollections[0]);
const isRoot = computed(() => dsc.value == rootCollection.value);

function updateDsc(collection: any, fields: Object | undefined) {
updateContentFields(collection, fields).then((response) => {
Object.keys(response).forEach((key) => {
collection[key] = response[key];
});
});
}

function getItemKey(item: DCESummary) {
return item.id;
}

function onScroll(newOffset: number) {
offset.value = newOffset;
}

async function onViewSubCollection(itemObject: DCObject) {
const collection = await collectionElementsStore.getCollection(itemObject.id);
emit("view-collection", collection);
}

watch(
() => props.history,
(newHistory, oldHistory) => {
if (newHistory.id != oldHistory.id) {
// Send up event closing out selected collection on history change.
emit("update:selected-collections", []);
}
}
);

watch(
jobState,
() => {
collectionElementsStore.loadCollectionElements(dsc.value);
},
};
{ deep: true }
);
</script>

<template>
<ExpandedItems v-slot="{ isExpanded, setExpanded }" :scope-key="dsc.id" :get-item-key="getItemKey">
<section class="dataset-collection-panel w-100 d-flex flex-column">
<section>
<CollectionNavigation
:history-name="history.name"
:selected-collections="selectedCollections"
v-on="$listeners" />
<CollectionDetails :dsc="dsc" :writeable="isRoot" @update:dsc="updateDsc(dsc, $event)" />
<CollectionOperations v-if="isRoot && showControls" :dsc="dsc" />
</section>
<section class="position-relative flex-grow-1 scroller">
<div>
<ListingLayout :items="collectionElements" :loading="loading" @scroll="onScroll">
<template v-slot:item="{ item }">
<ContentItem
:id="item.element_index + 1"
:item="item.object"
:name="item.element_identifier"
:expand-dataset="isExpanded(item)"
:is-dataset="item.element_type == 'hda'"
:filterable="filterable"
@update:expand-dataset="setExpanded(item, $event)"
@view-collection="onViewSubCollection" />
</template>
</ListingLayout>
</div>
</section>
</section>
</ExpandedItems>
</template>
4 changes: 2 additions & 2 deletions client/src/components/Workflow/InvocationsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
:title="getStoredWorkflowNameByInstanceId(data.item.workflow_id)"
class="truncate">
<b-link href="#" @click.stop="swapRowDetails(data)">
<b>{{ getStoredWorkflowNameByInstanceId(data.item.workflow_id) }}</b>
{{ getStoredWorkflowNameByInstanceId(data.item.workflow_id) }}
</b-link>
</div>
</template>
Expand All @@ -60,7 +60,7 @@
:title="`<b>Switch to</b><br>${getHistoryNameById(data.item.history_id)}`"
class="truncate">
<b-link id="switch-to-history" href="#" @click.stop="switchHistory(data.item.history_id)">
<b>{{ getHistoryNameById(data.item.history_id) }}</b>
{{ getHistoryNameById(data.item.history_id) }}
</b-link>
</div>
</template>
Expand Down
30 changes: 17 additions & 13 deletions client/src/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4807,10 +4807,11 @@ export interface components {
*/
hid: number;
/**
* Content Type
* @description The type of this item.
* History Content Type
* @description This is always `dataset` for datasets.
* @enum {string}
*/
history_content_type: components["schemas"]["HistoryContentType"];
history_content_type: "dataset";
/**
* History ID
* @description The encoded ID of the history associated with this item.
Expand Down Expand Up @@ -5021,10 +5022,11 @@ export interface components {
*/
hid: number;
/**
* Content Type
* @description The type of this item.
* History Content Type
* @description This is always `dataset` for datasets.
* @enum {string}
*/
history_content_type: components["schemas"]["HistoryContentType"];
history_content_type: "dataset";
/**
* History ID
* @description The encoded ID of the history associated with this item.
Expand Down Expand Up @@ -5136,10 +5138,11 @@ export interface components {
*/
hid: number;
/**
* Content Type
* @description The type of this item.
* History Content Type
* @description This is always `dataset_collection` for dataset collections.
* @enum {string}
*/
history_content_type: components["schemas"]["HistoryContentType"];
history_content_type: "dataset_collection";
/**
* History ID
* @description The encoded ID of the history associated with this item.
Expand Down Expand Up @@ -5270,10 +5273,11 @@ export interface components {
*/
hid: number;
/**
* Content Type
* @description The type of this item.
* History Content Type
* @description This is always `dataset_collection` for dataset collections.
* @enum {string}
*/
history_content_type: components["schemas"]["HistoryContentType"];
history_content_type: "dataset_collection";
/**
* History ID
* @description The encoded ID of the history associated with this item.
Expand Down Expand Up @@ -9959,7 +9963,7 @@ export interface operations {
/** @description Successful Response */
200: {
content: {
"application/json": components["schemas"]["HDCADetailed"] | components["schemas"]["HDCASummary"];
"application/json": components["schemas"]["HDCADetailed"];
};
};
/** @description Validation Error */
Expand Down
Loading

0 comments on commit 4735cca

Please sign in to comment.