Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Upload Provenance and Correctness #12912

Merged
merged 9 commits into from
Nov 17, 2021
16 changes: 16 additions & 0 deletions client/src/components/DatasetInformation/DatasetHash.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<template>
<li class="dataset-hash">
<i>{{ hash.hash_value }}</i>
</li>
</template>

<script>
export default {
props: {
hash: {
type: Object,
required: true,
},
},
};
</script>
30 changes: 30 additions & 0 deletions client/src/components/DatasetInformation/DatasetHashes.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<template>
<span class="dataset-hashes">
<ul class="dataset-hashes-list">
<DatasetHash v-for="(hash, index) in hashes" :key="index" :hash="hash" />
</ul>
</span>
</template>

<script>
import DatasetHash from "./DatasetHash";

export default {
components: {
DatasetHash,
},
props: {
hashes: {
type: Array,
required: true,
},
},
};
</script>

<style scoped>
.dataset-hashes-list {
padding-inline-start: 20px;
margin-bottom: 0px;
}
</style>
20 changes: 20 additions & 0 deletions client/src/components/DatasetInformation/DatasetInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@
<td>Full Path</td>
<td id="file_name">{{ dataset.file_name }}</td>
</tr>
<tr v-if="dataset.created_from_basename">
<td>Originally Created From a File Named</td>
<td id="created_from_basename">{{ dataset.created_from_basename }}</td>
</tr>
<tr v-if="dataset.sources && dataset.sources.length > 0">
<td>Sources</td>
<td>
<DatasetSources :sources="dataset.sources" />
</td>
</tr>
<tr v-if="dataset.hashes && dataset.hashes.length > 0">
<td>Hashes</td>
<td>
<DatasetHashes :hashes="dataset.hashes" />
</td>
</tr>
</tbody>
</table>
</div>
Expand All @@ -65,6 +81,8 @@ import Utils from "utils/utils";
import UtcDate from "components/UtcDate";
import DecodedId from "../DecodedId";
import { DatasetProvider } from "components/providers";
import DatasetSources from "./DatasetSources";
import DatasetHashes from "./DatasetHashes";

export default {
props: {
Expand All @@ -74,7 +92,9 @@ export default {
},
},
components: {
DatasetHashes,
DatasetProvider,
DatasetSources,
DecodedId,
UtcDate,
},
Expand Down
51 changes: 51 additions & 0 deletions client/src/components/DatasetInformation/DatasetSource.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<template>
<li class="dataset-source">
<a v-if="browserCompatUri" :href="sourceUri" target="_blank">
{{ source.source_uri }}
<font-awesome-icon v-b-tooltip.hover title="Dataset Source URL" icon="external-link-alt" />
</a>
<span v-else>
{{ source.source_uri }}
</span>
<font-awesome-icon v-b-tooltip.hover title="Copy URI" icon="copy" style="cursor: pointer" @click="copyLink" />
<br />
<DatasetSourceTransform :transform="source.transform" />
</li>
</template>

<script>
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { library } from "@fortawesome/fontawesome-svg-core";
import { faCopy, faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons";
import { copy } from "utils/clipboard";
import DatasetSourceTransform from "./DatasetSourceTransform";

library.add(faCopy, faExternalLinkAlt);

export default {
components: {
DatasetSourceTransform,
FontAwesomeIcon,
},
props: {
source: {
type: Object,
required: true,
},
},
computed: {
browserCompatUri() {
const sourceUri = this.sourceUri;
return sourceUri && (sourceUri.indexOf("http") == 0 || sourceUri.indexOf("ftp") == 0);
},
sourceUri() {
return this.source.source_uri;
},
},
methods: {
copyLink() {
copy(this.sourceUri, "Link copied to the clipboard.");
},
},
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<template>
<span class="dataset-source-transform-display">
<div v-if="transform && transform.length > 0">
Upon ingestion into the Galaxy, the following {{ actions }} were performed that modified the dataset
contents:
<ul>
<li v-for="(transformAction, index) in transform" :key="index">
<span
:title="actionLongDescription(transformAction)"
class="dataset-source-transform-element"
:data-transform-action="transformAction.action"
v-b-tooltip.hover.noninteractive.nofade.bottom
>
{{ actionShortDescription(transformAction) }}
</span>
</li>
</ul>
</div>
</span>
</template>

<script>
import Vue from "vue";
import BootstrapVue from "bootstrap-vue";

Vue.use(BootstrapVue);

const TRANSFORM_ACTION_DESCRIPTIONS = {
to_posix_lines: {
short: "Normalized new line characters",
long: "Many Galaxy tools expect data to contain 'posix' newline characters in text files and not the newline format used by the Windows operating system. Additionally, most tools expect a newline at the end of plain text files. This file was converted to use these line endings or add a newline to the end of the file.",
},
spaces_to_tabs: {
short: "Normalized spaces to tabs",
long: "In order to convert the referenced data source to tabular data, spaces in the file contents were converted to tab characters to indicate column separations.",
},
datatype_groom: {
short: "Datatype-specific grooming",
long: "The Galaxy datatype class indicated the source data required 'groooming' and Galaxy applied datatype specific cleaning of the supplied data.",
},
};

const DATATYPE_GROOMING_DESCRIPTIONS = {
bam: "The supplied BAM was coordinate-sorted using pysam.",
"qname_sorted.bam": "The supplied BAM was 'queryname' sorted using pysam.",
"qname_input_sorted.bam": "The supplied BAM was 'queryname' sorted using pysam.",
"isa-tab": "The supplied compressed file was converted to an ISA-TAB composite dataset.",
"isa-json": "The supplied compressed file was converted to an ISA-JSON composite dataset.",
};

const UNKNOWN_ACTION_DESCRIPTION = {
short: "Unknown action.",
long: "",
};

export default {
props: {
transform: {
type: Array,
required: false,
},
},
computed: {
actions() {
return this.transform.length > 1 ? "actions" : "action";
},
},
methods: {
actionShortDescription(transformAction) {
return this.actionDescription(transformAction).short || "Unknown action.";
},
actionLongDescription(transformAction) {
let longDescription = this.actionDescription(transformAction).long || "";
if (transformAction.action == "datatype_groom") {
const datatypeDescription = DATATYPE_GROOMING_DESCRIPTIONS[transformAction.datatype_ext];
if (datatypeDescription) {
longDescription += " " + datatypeDescription;
}
}
return longDescription;
},
actionDescription(transformAction) {
return TRANSFORM_ACTION_DESCRIPTIONS[transformAction.action] || UNKNOWN_ACTION_DESCRIPTION;
},
},
};
</script>

<style scoped>
.dataset-source-transform-element {
text-decoration: underline;
text-decoration-style: dashed;
}
</style>
30 changes: 30 additions & 0 deletions client/src/components/DatasetInformation/DatasetSources.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<template>
<span class="dataset-sources">
<ul class="dataset-sources-list">
<DatasetSource v-for="(source, index) in sources" :key="index" :source="source" />
</ul>
</span>
</template>

<script>
import DatasetSource from "./DatasetSource";

export default {
components: {
DatasetSource,
},
props: {
sources: {
type: Array,
required: true,
},
},
};
</script>

<style scoped>
.dataset-sources-list {
padding-inline-start: 20px;
margin-bottom: 0px;
}
</style>
2 changes: 1 addition & 1 deletion lib/galaxy/actions/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class LibraryActions:
Mixin for controllers that provide library functionality.
"""

def _upload_dataset(self, trans, library_id: str, folder_id: str, replace_dataset: Optional[LibraryDataset] = None, **kwd):
def _upload_dataset(self, trans, folder_id: str, replace_dataset: Optional[LibraryDataset] = None, **kwd):
# Set up the traditional tool state/params
cntrller = 'api'
tool_id = 'upload1'
Expand Down
Loading