Skip to content

Commit

Permalink
Merge pull request #369 from datalad/js
Browse files Browse the repository at this point in the history
ENH: UI/UX
  • Loading branch information
jsheunis authored Oct 1, 2023
2 parents a75c06b + 498c278 commit 4f86716
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
9 changes: 6 additions & 3 deletions datalad_catalog/catalog/assets/app_component_dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ const datasetView = () =>
sorted_metadata_sources = dataset.metadata_sources.sources.sort(
(a, b) => b.source_time - a.source_time
);
disp_dataset.last_updated = this.getDateFromUTCseconds(
sorted_metadata_sources[0].source_time
);
disp_dataset.last_updated = sorted_metadata_sources[0].source_time
if (disp_dataset.last_updated) {
disp_dataset.last_updated = this.getDateFromUTCseconds(
disp_dataset.last_updated
);
}
// ID, version and location
disp_dataset.file_path =
"metadata/" +
Expand Down
6 changes: 5 additions & 1 deletion datalad_catalog/catalog/assets/app_component_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ Vue.component('tree-item', function (resolve, reject) {
return this.item["name"];
},
byteText: function () {
return this.formatBytes(this.item["contentbytesize"]);
if (this.item["contentbytesize"]) {
return this.formatBytes(this.item["contentbytesize"]);
} else {
return ""
}
},
downloadURL: function () {
return this.getDownloadURL(this.item["url"]);
Expand Down
5 changes: 4 additions & 1 deletion datalad_catalog/catalog/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ a:hover {
}

.item {
cursor: pointer;
font-family: Menlo, Consolas, monospace;
}

.showpointer {
cursor: pointer;
}

.bold {
font-weight: bold;
}
Expand Down
3 changes: 2 additions & 1 deletion datalad_catalog/catalog/templates/dataset-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
<!-- DATASET VERSION ETC -->
<b-card-text>
<strong>Version:</strong> {{selectedDataset.dataset_version.substring(0,7)}}&nbsp;
<strong>Last updated:</strong> {{displayData.last_updated}}&nbsp;
<strong>Last updated:</strong> <span v-if="displayData.last_updated">{{displayData.last_updated}}&nbsp;</span>
<span v-else><em>unknown</em></span>&nbsp;
<strong>DOI:</strong> <span v-if="selectedDataset.doi"><a :href="selectedDataset.doi" target="_blank"> {{selectedDataset.doi.replace("https://doi.org/", "")}}</a></span>
<span v-else><em>unknown</em></span>&nbsp;
<strong>License:</strong> <span v-if="selectedDataset.license && selectedDataset.license.name"><a :href="selectedDataset.license.url" target="_blank"> {{selectedDataset.license.name}}</a></span>
Expand Down
10 changes: 8 additions & 2 deletions datalad_catalog/catalog/templates/item-template.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<li>
<div :class="{bold: isFolder}" @click="toggle">
<div :class="{bold: isFolder, showpointer: isFolder}" @click="toggle">
<!-- Open folder -->
<span v-if="isFolder && isOpen"> <i class="far fa-folder-open"></i> {{ displayText }}</span>
<!-- Closed folder -->
<span v-else-if="isFolder && !isOpen"> <i class="far fa-folder"></i> {{ displayText }} <span v-if="spinner_on"><b-spinner small label="Loading..."></b-spinner></span></span>
<!-- Dataset -->
<span v-else-if="isDataset"><span v-if="item.state == 'disabled'" class="subdataset-disabled"> <i class="fas fa-database"></i> {{ displayText }}</span><span v-else> <i class="fas fa-database"></i> <a class="subdataset" @click="selectDataset($event, item, item.id)">{{ displayText }}</a></span></span>
<!-- File -->
<span v-else> <i class="far fa-file-alt"></i> {{ displayText }} <span class="filesize"><span v-show="downloadURL"><a class="xsm-dl-button" :href="downloadURL" :download="displayText"><i class="fas fa-cloud-download" aria-hidden="true"></i></a></span>{{byteText}}</span> </span>
<span v-else> <i class="far fa-file-alt"></i>
<span v-if="downloadURL.includes('http')">
<a :href="downloadURL" :download="displayText">{{ displayText }}</a>
</span>
<span v-else>{{ displayText }}</span>
<span class="filesize">{{byteText}}</span>
</span>
</div>
<!-- Children of an open folder -->
<ul v-show="isOpen" v-if="isFolder">
Expand Down

0 comments on commit 4f86716

Please sign in to comment.