Skip to content

Commit

Permalink
Merge pull request #6 from galaxyproject/dev
Browse files Browse the repository at this point in the history
update galaxy dev.
  • Loading branch information
沈维燕(Steven) authored Sep 29, 2019
2 parents 71ebcf7 + ccaf426 commit b03552f
Show file tree
Hide file tree
Showing 188 changed files with 3,886 additions and 2,677 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ jobs:
- run: cd client && yarn install --frozen-lockfile
- *save_yarn_cache
- run: cd client && yarn run eslint
- run: cd client && yarn run prettier-check
workflows:
version: 2
get_code_and_test:
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
lib/galaxy/datatypes/test/dosimzml eol=crlf
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ client-test: node-deps ## Run JS unit tests via Karma
client-eslint: node-deps ## Run client linting
cd client && yarn run eslint

client-format-check: node-deps # Run client formatting check
cd client && yarn run prettier-check

client-lint: client-eslint client-format-check # ES lint and check format of client

client-test-watch: client ## Watch and run qunit tests on changes via Karma
cd client && yarn run test-watch

Expand Down
5 changes: 4 additions & 1 deletion client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ module.exports = {
node: true,
mocha: true
},
parserOptions: { parser: "babel-eslint" },
parserOptions: {
parser: "babel-eslint",
sourceType: "module"
},
plugins: ["html"],
rules: {
"no-console": "off",
Expand Down
6 changes: 3 additions & 3 deletions client/galaxy/scripts/app/galaxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ GalaxyApp.prototype._processOptions = function _processOptions(options) {

this.options = {};
for (const k in defaults) {
if (defaults.hasOwnProperty(k)) {
this.options[k] = options.hasOwnProperty(k) ? options[k] : defaults[k];
if (Object.prototype.hasOwnProperty.call(defaults, k)) {
this.options[k] = Object.prototype.hasOwnProperty.call(options, k) ? options[k] : defaults[k];
}
}
return this;
Expand All @@ -126,7 +126,7 @@ GalaxyApp.prototype._patchGalaxy = function _patchGalaxy(patchWith) {
// ...(for now) monkey patch any added attributes that the previous Galaxy may have had
//TODO: move those attributes to more formal assignment in GalaxyApp
for (const k in patchWith) {
if (patchWith.hasOwnProperty(k)) {
if (Object.prototype.hasOwnProperty.call(patchWith, k)) {
// this.debug( '\t patching in ' + k + ' to Galaxy:', this[ k ] );
this[k] = patchWith[k];
}
Expand Down
70 changes: 31 additions & 39 deletions client/galaxy/scripts/components/DataDialog/DataDialog.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sinon from "sinon";
import { mount } from "@vue/test-utils";
import DataDialog from "./DataDialog.vue";
import { __RewireAPI__ as rewire } from "./DataDialog";
Expand All @@ -17,7 +16,7 @@ const mockOptions = {
describe("model.js", () => {
let result = null;
it("Model operations for single, no format", () => {
let model = new Model();
const model = new Model();
try {
model.add({ idx: 1 });
throw "Accepted invalid record.";
Expand All @@ -36,7 +35,7 @@ describe("model.js", () => {
expect(result.tag).to.equals("tag");
});
it("Model operations for multiple, with format", () => {
let model = new Model({ multiple: true, format: "tag" });
const model = new Model({ multiple: true, format: "tag" });
model.add({ id: 1, tag: "tag_1" });
expect(model.count()).to.equals(1);
model.add({ id: 2, tag: "tag_2" });
Expand All @@ -54,7 +53,7 @@ describe("model.js", () => {

describe("utilities.js/UrlTracker", () => {
it("Test url tracker", () => {
let urlTracker = new UrlTracker("url_initial");
const urlTracker = new UrlTracker("url_initial");
let url = urlTracker.getUrl();
expect(url).to.equals("url_initial");
expect(urlTracker.atRoot()).to.equals(true);
Expand All @@ -75,7 +74,7 @@ describe("utilities.js/UrlTracker", () => {

describe("services/Services:isDataset", () => {
it("Test dataset identifier", () => {
let services = new Services(mockOptions);
const services = new Services(mockOptions);
expect(services.isDataset({})).to.equals(false);
expect(services.isDataset({ history_content_type: "dataset" })).to.equals(true);
expect(services.isDataset({ history_content_type: "xyz" })).to.equals(false);
Expand All @@ -88,27 +87,25 @@ describe("services/Services:isDataset", () => {

describe("services.js/Services", () => {
it("Test data population from raw data", () => {
let rawData = {
const rawData = {
hid: 1,
id: 1,
history_id: 0,
name: "name_1"
};
let services = new Services(mockOptions);
let items = services.getItems(rawData);
const services = new Services(mockOptions);
const items = services.getItems(rawData);
expect(items.length).to.equals(1);
let first = items[0];
const first = items[0];
expect(first.label).to.equals("1: name_1");
expect(first.download).to.equals("host/api/histories/0/contents/1/display");
});
});

describe("DataDialog.vue", () => {
let stub;
let wrapper;
let emitted;

let rawData = [
const rawData = [
{
id: 1,
hid: 1,
Expand All @@ -128,10 +125,10 @@ describe("DataDialog.vue", () => {
}
];

let mockServices = class {
const mockServices = class {
get(url) {
let services = new Services(mockOptions);
let items = services.getItems(rawData);
const services = new Services(mockOptions);
const items = services.getItems(rawData);
return new Promise((resolve, reject) => {
resolve(items);
});
Expand All @@ -140,37 +137,32 @@ describe("DataDialog.vue", () => {

beforeEach(() => {
rewire.__Rewire__("Services", mockServices);
});

afterEach(() => {
if (stub) stub.restore();
});

it("loads correctly, shows alert", () => {
wrapper = mount(DataDialog, {
propsData: mockOptions
});
emitted = wrapper.emitted();
expect(wrapper.classes()).contain("data-dialog-modal");
expect(wrapper.find(".fa-spinner").text()).to.equals("");
expect(wrapper.contains(".fa-spinner")).to.equals(true);
return Vue.nextTick().then(() => {
expect(wrapper.findAll(".fa-folder").length).to.equals(2);
expect(wrapper.findAll(".fa-file-o").length).to.equals(2);
});

it("loads correctly, shows alert", () => {
wrapper.vm.$nextTick().then(() => {
expect(wrapper.classes()).contain("data-dialog-modal");
expect(wrapper.find(".fa-spinner").text()).to.equals("");
expect(wrapper.contains(".fa-spinner")).to.equals(true);
return Vue.nextTick().then(() => {
expect(wrapper.findAll(".fa-folder").length).to.equals(2);
expect(wrapper.findAll(".fa-file-o").length).to.equals(2);
});
});
});

it("loads correctly, shows datasets and folders", () => {
wrapper = mount(DataDialog, {
propsData: mockOptions
});
emitted = wrapper.emitted();
expect(wrapper.classes()).contain("data-dialog-modal");
expect(wrapper.find(".fa-spinner").text()).to.equals("");
expect(wrapper.contains(".fa-spinner")).to.equals(true);
return Vue.nextTick().then(() => {
expect(wrapper.findAll(".fa-folder").length).to.equals(2);
expect(wrapper.findAll(".fa-file-o").length).to.equals(2);
wrapper.vm.$nextTick().then(() => {
expect(wrapper.classes()).contain("data-dialog-modal");
expect(wrapper.find(".fa-spinner").text()).to.equals("");
expect(wrapper.contains(".fa-spinner")).to.equals(true);
return Vue.nextTick().then(() => {
expect(wrapper.findAll(".fa-folder").length).to.equals(2);
expect(wrapper.findAll(".fa-file-o").length).to.equals(2);
});
});
});
});
13 changes: 8 additions & 5 deletions client/galaxy/scripts/components/DataDialog/DataDialogTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,20 @@ export default {
data() {
return {
currentPage: 1,
fields: {
label: {
fields: [
{
key: "label",
sortable: true
},
details: {
{
key: "details",
sortable: true
},
time: {
{
key: "time",
sortable: true
}
},
],
nItems: 0,
perPage: 100
};
Expand Down
60 changes: 60 additions & 0 deletions client/galaxy/scripts/components/JobStates/CollectionJobStates.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<template>
<div v-if="!jobSourceType || jobSourceType == 'Job' || isTerminal">
{{ simpleDescription }}
</div>
<div v-else-if="!jobStatesSummary || !jobStatesSummary.hasDetails()">
<progress-bar :note="loadingNote" :loading="true" :infoProgress="1" />
</div>
<div v-else-if="isNew">
<progress-bar note="Creating jobs" :loading="true" :infoProgress="1" />
</div>
<div v-else-if="isErrored">
{{ errorDescription }}
</div>
<div v-else>
<progress-bar
:note="generatingNote"
:okProgress="okPercent"
:runningProgress="runningPercent"
:newProgress="otherPercent"
/>
</div>
</template>
<script>
import DC_VIEW from "mvc/collection/collection-view";
import mixin from "./mixin";
import ProgressBar from "components/ProgressBar";
export default {
props: {
collection: { type: Object, required: true }, // backbone model
jobStatesSummary: { required: true }
},
components: {
ProgressBar
},
mixins: [mixin],
computed: {
loadingNote() {
return `Loading job data for ${this.collectionTypeDescription}}`;
},
generatingNote() {
return `${this.jobsStr} generating a ${this.collectionTypeDescription}`;
},
jobSourceType() {
return this.collection.get("job_source_type");
},
collectionTypeDescription() {
return DC_VIEW.collectionTypeDescription(this.collection);
},
simpleDescription() {
return DC_VIEW.collectionDescription(this.collection);
},
errorDescription() {
var jobCount = this.jobCount;
var errorCount = this.jobStatesSummary.numInError();
return `a ${this.collectionTypeDescription} with ${errorCount} / ${jobCount} jobs in error`;
}
}
};
</script>
4 changes: 4 additions & 0 deletions client/galaxy/scripts/components/JobStates/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import CollectionJobStates from "./CollectionJobStates";
import { mountVueComponent } from "utils/mountVueComponent";

export const mountCollectionJobStates = mountVueComponent(CollectionJobStates);
53 changes: 53 additions & 0 deletions client/galaxy/scripts/components/JobStates/mixin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* VueJS mixin with computed properties from a base jobStatesSummary property for summarizing job states */
export default {
computed: {
isNew() {
return !this.jobStatesSummary || this.jobStatesSummary.new();
},
isErrored() {
return this.jobStatesSummary && this.jobStatesSummary.errored();
},
isTerminal() {
return this.jobStatesSummary && this.jobStatesSummary.terminal();
},
jobCount() {
return !this.jobStatesSummary ? null : this.jobStatesSummary.jobCount();
},
jobsStr() {
const jobCount = this.jobCount;
return jobCount && jobCount > 1 ? `${jobCount} jobs` : `a job`;
},
runningCount() {
return this.countStates(["running"]);
},
okCount() {
return this.countStates(["ok"]);
},
errorCount() {
return this.countStates(["error"]);
},
runningPercent() {
return this.runningCount / (this.jobCount * 1.0);
},
okPercent() {
return this.okCount / (this.jobCount * 1.0);
},
errorPercent() {
return this.errorCount / (this.jobCount * 1.0);
},
otherPercent() {
return 1.0 - this.okPercent - this.runningPercent - this.errorPercent;
}
},
methods: {
countStates(states) {
let count = 0;
if (this.jobStatesSummary && this.jobStatesSummary.hasDetails()) {
for (const state of states) {
count += this.jobStatesSummary.states()[state] || 0;
}
}
return count;
}
}
};
4 changes: 2 additions & 2 deletions client/galaxy/scripts/components/MaskedInput.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import BInput from "bootstrap-vue/es/components/form-input/form-input";
import { BFormInput } from "bootstrap-vue/src/components/form-input";
import { createMask } from "imask";

export default {
extends: BInput,
extends: BFormInput,
props: {
mask: {
type: String,
Expand Down
40 changes: 40 additions & 0 deletions client/galaxy/scripts/components/ProgressBar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<div class="progress state-progress">
<span class="note" v-if="note">
{{ note }}<span v-if="loading">.<span class="blinking">..</span> </span>
</span>
<div class="progress-bar info" v-bind:style="styleFromProgress(infoProgress)" :title="infoMessage"></div>
<div class="progress-bar ok" v-bind:style="styleFromProgress(okProgress)" :title="okMessage"></div>
<div
class="progress-bar running"
v-bind:style="styleFromProgress(runningProgress)"
:title="runningMessage"
></div>
<div class="progress-bar new" v-bind:style="styleFromProgress(newProgress)" :title="newMessage"></div>
<div class="progress-bar error" v-bind:style="styleFromProgress(errorProgress)" :title="errorMessage"></div>
</div>
</template>
<script>
// Not really a very generic ProgressBar - consider renaming to StateProgressBar.
export default {
props: {
note: { type: String, default: null },
loading: { type: Boolean, default: false },
infoProgress: { type: Number, default: 0.0 },
infoMessage: { type: String, default: null },
okProgress: { type: Number, default: 0.0 },
okMessage: { type: String, default: null },
runningProgress: { type: Number, default: 0.0 },
runningMessage: { type: String, default: null },
newProgress: { type: Number, default: 0.0 },
newMessage: { type: String, default: null },
errorProgress: { type: Number, default: 0.0 },
errorMessage: { type: String, default: null }
},
methods: {
styleFromProgress: function(progress) {
return { width: `${progress * 100}%` };
}
}
};
</script>
Loading

0 comments on commit b03552f

Please sign in to comment.