Fix linting issues, use object.id for collections drilldown requests, rename to hideSelection to avoid confusion with actually hidden datasets

This commit is contained in:
guerler
2022-03-05 01:03:30 -05:00
parent 885fe156c2
commit 07a731b3b1
12 changed files with 28 additions and 37 deletions
@@ -136,6 +136,7 @@ export default {
if (stateIcon) {
return `fa fa-${stateIcon}`;
}
return null;
},
isUnavailable() {
return this.item.purged || ["upload", "new"].includes(this.state);
@@ -9,7 +9,6 @@
<script>
import { DatasetProvider, DatasetCollectionProvider } from "components/providers";
import { STATES } from "components/History/model";
import LoadingSpan from "components/LoadingSpan";
export default {
@@ -28,11 +27,8 @@ export default {
return null; // { hdca: "DatasetCollectionUIWrapper" }[this.data_item.src];
},
providerComponent() {
return null; // { hda: "DatasetProvider", hdca: "DatasetCollectionProvider" }[this.data_item.src];
return { hda: "DatasetProvider", hdca: "DatasetCollectionProvider" }[this.data_item.src];
},
},
provide: {
STATES,
},
};
</script>
@@ -18,7 +18,6 @@
</template>
<script>
import { DatasetCollection } from "components/History/model";
import Details from "components/History/Layout/Details";
export default {
@@ -21,6 +21,7 @@ export default {
const last = this.selectedCollections[length - 2];
return last.name || last.element_identifier;
}
return null;
},
},
methods: {
@@ -2,10 +2,7 @@
<template>
<UrlDataProvider v-if="dsc" :key="dsc.id" :url="url" v-slot="{ result: payload }">
<ExpandedItems
:scope-key="dsc.id"
:get-item-key="(item) => item.element_index"
v-slot="{ isExpanded, setExpanded }">
<ExpandedItems :scope-key="dsc.id" :get-item-key="(item) => item.id" v-slot="{ isExpanded, setExpanded }">
<Layout class="dataset-collection-panel">
<template v-slot:navigation>
<CollectionNavigation
@@ -24,7 +21,7 @@
<template v-slot:listing>
<Listing item-key="element_index" :page-size="pageSize" :payload="payload" @scroll="onScroll">
<template v-slot:history-item="{ item, index }">
<template v-slot:history-item="{ item }">
<ContentItem
:item="item"
:id="item.element_index"
@@ -45,7 +42,7 @@
<script>
import { UrlDataProvider } from "components/providers/UrlDataProvider";
import { DatasetCollection, History } from "components/History/model";
import { History } from "components/History/model";
import { updateContentFields } from "components/History/model/queries";
import ContentItem from "components/History/Content/ContentItem";
import ExpandedItems from "components/History/Content/ExpandedItems";
@@ -90,7 +87,8 @@ export default {
return this.selectedCollections[0];
},
url() {
return `api/dataset_collections/${this.rootCollection.id}/contents/${this.dsc.id}`;
const collectionId = this.dsc.object ? this.dsc.object.id : this.dsc.id;
return `api/dataset_collections/${this.rootCollection.id}/contents/${collectionId}`;
},
},
methods: {
@@ -41,7 +41,7 @@
@update:content-selection="selectItems"
@update:show-selection="setShowSelection"
@reset-selection="resetSelection"
@hide-selection="onHiddenItems"
@hide-selection="onhideSelection"
@select-all="selectItems(payload)"
@collapse-all="collapseAll" />
</template>
@@ -59,7 +59,7 @@
@scroll="onScroll">
<template v-slot:history-item="{ item }">
<ContentItem
v-if="!hiddenItems[item.hid]"
v-if="!hideSelection[item.hid]"
:item="item"
:id="item.hid"
:name="item.name"
@@ -125,7 +125,7 @@ export default {
},
data() {
return {
hiddenItems: {},
hideSelection: {},
topIndex: 0,
pageSize: 2000,
params: {},
@@ -133,7 +133,7 @@ export default {
},
watch: {
queryKey() {
this.hiddenItems = {};
this.hideSelection = {};
this.topIndex = 0;
},
},
@@ -160,21 +160,21 @@ export default {
onScroll(newHid) {
this.topIndex = newHid;
},
onHiddenItems(selectedItems) {
onhideSelection(selectedItems) {
selectedItems.forEach((item) => {
this.hiddenItems[item.hid] = true;
this.hideSelection[item.hid] = true;
});
},
onDelete(item) {
this.hiddenItems[item.hid] = true;
this.hideSelection[item.hid] = true;
deleteContent(item);
},
onUndelete(item) {
this.hiddenItems[item.hid] = true;
this.hideSelection[item.hid] = true;
updateContentFields(item, { deleted: false });
},
onUnhide(item) {
this.hiddenItems[item.hid] = true;
this.hideSelection[item.hid] = true;
updateContentFields(item, { visible: true });
},
},
-1
View File
@@ -34,7 +34,6 @@
<script>
import CurrentUser from "components/providers/CurrentUser";
import UserHistories from "components/providers/UserHistories";
import { History } from "./model";
import HistoryNavigation from "./CurrentHistory/HistoryNavigation";
import CurrentHistory from "./CurrentHistory/HistoryPanel";
import CurrentCollection from "./CurrentCollection/CollectionPanel";
@@ -16,7 +16,7 @@
<!-- display annotation, tags -->
<div v-if="!editing">
<div v-if="annotation" class="mt-2">{{ annotation }}</div>
<StatelessTags class="tags mt-3" :value="tags" :disabled="true" />
<StatelessTags v-if="tags" class="tags mt-3" :value="tags" :disabled="true" />
</div>
<!-- edit form, change title, annotation, or tags -->
@@ -36,7 +36,7 @@
trim
max-rows="4"
data-description="annotation input" />
<StatelessTags class="mb-3 tags" v-model="localProps.tags" />
<StatelessTags v-if="localProps.tags" class="mb-3 tags" v-model="localProps.tags" />
</div>
<nav class="edit-controls">
<template v-if="editing">
@@ -10,11 +10,9 @@
<script>
import VirtualList from "vue-virtual-scroll-list";
import { reverse, throttle } from "lodash";
import LoadingSpan from "components/LoadingSpan";
export default {
components: {
LoadingSpan,
VirtualList,
},
props: {
+7 -8
View File
@@ -4,18 +4,17 @@ to interact with each other.
```html static
<Index :history="history">
<!-- for the right-hand side history we show some
optional nav elements, can be ommitted for histories
shown in multi-history view -->
<slot:nav>
<HistorySelector />
<HistoryMenu />
</slot:nav>
<!-- if main history selected -->
<CurrentHistory :history="history">
<!-- for the right-hand side history we show some
optional nav elements -->
<slot:nav>
<HistorySelector />
<HistoryMenu />
</slot:nav>
<!-- Data providers do the heavy-lifting of mixing params, history, and
scroll position to deliver the content for the scroller -->
<UrlDataProvider>
+1 -1
View File
@@ -49,7 +49,7 @@ export default {
},
data() {
// initialize toggle value
const isClosed = this.useToggleLink && this.value.length > this.maxVisibleTags;
const isClosed = this.useToggleLink && this.value && this.length > this.maxVisibleTags;
return {
tagText: "",
+1 -1
View File
@@ -9,8 +9,8 @@ from typing import (
Dict,
List,
Optional,
Union,
Set,
Union,
)
from pydantic import (