-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Revise user experience for history import and export. #11054
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<template> | ||
<b-form-input v-model="localValue" :placeholder="placeholder" @click="selectFile"> </b-form-input> | ||
</template> | ||
|
||
<script> | ||
import { BFormInput } from "bootstrap-vue"; | ||
import { filesDialog } from "utils/data"; | ||
export default { | ||
components: { BFormInput }, | ||
props: { | ||
value: { | ||
type: String, | ||
}, | ||
mode: { | ||
type: String, | ||
default: "file", | ||
}, | ||
requireWritable: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
localValue: this.value, | ||
}; | ||
}, | ||
computed: { | ||
placeholder() { | ||
return `Click to select ${this.mode}`; | ||
}, | ||
}, | ||
methods: { | ||
selectFile() { | ||
const props = { | ||
mode: this.mode, | ||
requireWritable: this.requireWritable, | ||
}; | ||
filesDialog((selected) => { | ||
this.localValue = selected?.url; | ||
}, props); | ||
}, | ||
}, | ||
watch: { | ||
localValue(newValue) { | ||
this.$emit("input", newValue); | ||
}, | ||
value(newValue) { | ||
this.localValue = newValue; | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<template> | ||
<span> | ||
<b | ||
><a :href="link">{{ link }}</a></b | ||
> | ||
<font-awesome-icon | ||
v-b-tooltip.hover | ||
title="Copy export URL to your clipboard" | ||
icon="link" | ||
style="cursor: pointer;" | ||
@click="copyUrl" | ||
/> | ||
<i | ||
title="Information about when the history export was generated is included in the job details. Additionally, if there are issues with export, the job details may help figure out the underlying problem or communicate issues to your Galaxy administrator." | ||
> | ||
(<a href="#" @click="showDetails">view job details</a>) | ||
</i> | ||
<b-modal v-model="details" scrollable ok-only> | ||
<job-information :job_id="historyExport.job_id" :include-times="true" /> | ||
</b-modal> | ||
</span> | ||
</template> | ||
|
||
<script> | ||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; | ||
import { library } from "@fortawesome/fontawesome-svg-core"; | ||
import { faLink } from "@fortawesome/free-solid-svg-icons"; | ||
import { BModal } from "bootstrap-vue"; | ||
import { copy } from "utils/clipboard"; | ||
import JobInformation from "components/JobInformation/JobInformation.vue"; | ||
|
||
library.add(faLink); | ||
|
||
export default { | ||
components: { BModal, JobInformation, FontAwesomeIcon }, | ||
props: { | ||
historyExport: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
details: false, | ||
}; | ||
}, | ||
computed: { | ||
link() { | ||
return this.historyExport.external_download_permanent_url; | ||
}, | ||
}, | ||
methods: { | ||
showDetails() { | ||
this.details = true; | ||
}, | ||
copyUrl() { | ||
copy(this.latestExportUrl, "Export URL copied to your clipboard"); | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { shallowMount } from "@vue/test-utils"; | ||
import Index from "./Index.vue"; | ||
import { getLocalVue } from "jest/helpers"; | ||
import axios from "axios"; | ||
import MockAdapter from "axios-mock-adapter"; | ||
|
||
const TEST_PLUGINS_URL = "/api/remote_files/plugins"; | ||
|
||
const localVue = getLocalVue(); | ||
|
||
describe("Index.vue", () => { | ||
let axiosMock; | ||
|
||
beforeEach(() => { | ||
axiosMock = new MockAdapter(axios); | ||
axiosMock.onGet(TEST_PLUGINS_URL).reply(200, [{ id: "foo", writable: false }]); | ||
}); | ||
|
||
it("should render tabs", () => { | ||
// just make sure the component renders to catch obvious big errors | ||
const wrapper = shallowMount(Index, { | ||
propsData: { | ||
historyId: "test_id", | ||
}, | ||
localVue, | ||
}); | ||
expect(wrapper.exists("b-tabs-stub")).toBeTruthy(); | ||
}); | ||
|
||
afterEach(() => { | ||
axiosMock.restore(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<template> | ||
<span> | ||
<h2>Export history archive</h2> | ||
<span v-if="initializing"> | ||
<loading-span message="Loading server configuration." /> | ||
</span> | ||
<span v-else-if="hasWritableFileSources"> | ||
<b-card no-body> | ||
<b-tabs pills card vertical> | ||
<b-tab title="to a link" active> | ||
<b-card-text> | ||
<ToLink :history-id="historyId" /> | ||
</b-card-text> | ||
</b-tab> | ||
<b-tab title="to a remote file"> | ||
<ToRemoteFile :history-id="historyId" /> | ||
</b-tab> | ||
</b-tabs> | ||
</b-card> | ||
</span> | ||
<span v-else> | ||
<ToLink :history-id="historyId" /> | ||
</span> | ||
</span> | ||
</template> | ||
|
||
<script> | ||
import Vue from "vue"; | ||
import BootstrapVue from "bootstrap-vue"; | ||
import ToLink from "./ToLink.vue"; | ||
import ToRemoteFile from "./ToRemoteFile.vue"; | ||
import { Services } from "components/FilesDialog/services"; | ||
import LoadingSpan from "components/LoadingSpan"; | ||
|
||
Vue.use(BootstrapVue); | ||
|
||
export default { | ||
components: { | ||
LoadingSpan, | ||
ToLink, | ||
ToRemoteFile, | ||
}, | ||
props: { | ||
historyId: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
initializing: true, | ||
hasWritableFileSources: false, | ||
}; | ||
}, | ||
async mounted() { | ||
await this.initialize(); | ||
}, | ||
methods: { | ||
async initialize() { | ||
const fileSources = await new Services().getFileSources(); | ||
this.hasWritableFileSources = fileSources.some((fs) => fs.writable); | ||
console.log(fileSources); | ||
this.initializing = false; | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { shallowMount } from "@vue/test-utils"; | ||
import { getLocalVue } from "jest/helpers"; | ||
import ToLink from "./ToLink.vue"; | ||
import flushPromises from "flush-promises"; | ||
import MockAdapter from "axios-mock-adapter"; | ||
import axios from "axios"; | ||
import { waitOnJob } from "components/JobStates/wait"; | ||
|
||
const localVue = getLocalVue(); | ||
const TEST_HISTORY_ID = "hist1235"; | ||
const TEST_EXPORTS_URL = `/api/histories/${TEST_HISTORY_ID}/exports`; | ||
const TEST_JOB_ID = "test1234job"; | ||
|
||
jest.mock("components/JobStates/wait"); | ||
|
||
describe("ToLink.vue", () => { | ||
let axiosMock; | ||
let wrapper; | ||
|
||
async function mountWithInitialExports(exports) { | ||
axiosMock.onGet(TEST_EXPORTS_URL).reply(200, exports); | ||
wrapper = shallowMount(ToLink, { | ||
propsData: { | ||
historyId: TEST_HISTORY_ID, | ||
}, | ||
localVue, | ||
}); | ||
await wrapper.vm.$nextTick(); | ||
expect(wrapper.find("loading-span-stub").exists()).toBeTruthy(); | ||
await flushPromises(); | ||
} | ||
|
||
beforeEach(async () => { | ||
axiosMock = new MockAdapter(axios); | ||
}); | ||
|
||
it("should display a link if no exports ever generated", async () => { | ||
await mountWithInitialExports([]); | ||
expect(wrapper.find(".export-link")).toBeTruthy(); | ||
expect(wrapper.find("loading-span-stub").exists()).toBeFalsy(); // loading span gone | ||
}); | ||
|
||
it("should start polling if latest export is preparing", async () => { | ||
let then = null; | ||
waitOnJob.mockReturnValue( | ||
new Promise((then_) => { | ||
then = then_; | ||
}) | ||
); | ||
await mountWithInitialExports([ | ||
{ | ||
preparing: true, | ||
job_id: TEST_JOB_ID, | ||
}, | ||
]); | ||
expect(then).toBeTruthy(); | ||
expect(wrapper.vm.waitingOnJob).toBeTruthy(); | ||
expect(wrapper.find("loading-span-stub").exists()).toBeTruthy(); | ||
}); | ||
|
||
afterEach(() => { | ||
axiosMock.restore(); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor issue, but the tag formatting seems inconsistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't do formatting, this is all prettier's doing I think.