diff --git a/client/galaxy/scripts/components/MaskedInput.js b/client/galaxy/scripts/components/MaskedInput.js index 67f652e18a7..3440800f2ab 100644 --- a/client/galaxy/scripts/components/MaskedInput.js +++ b/client/galaxy/scripts/components/MaskedInput.js @@ -4,15 +4,15 @@ import { createMask } from "imask"; export default { extends: BInput, props: { - mask: { - type: String, - required: false, + mask: { + type: String, + required: false, default: "" } }, computed: { masker() { - return createMask({ + return createMask({ mask: this.mask }); } @@ -26,4 +26,4 @@ export default { return result; } } -} +}; diff --git a/client/galaxy/scripts/components/User/CloudAuth/CloudAuth.test.js b/client/galaxy/scripts/components/User/CloudAuth/CloudAuth.test.js index 71a6f867bed..7d930f4e2e8 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/CloudAuth.test.js +++ b/client/galaxy/scripts/components/User/CloudAuth/CloudAuth.test.js @@ -17,15 +17,14 @@ localVue.use(BootstrapVue); localVue.filter("localize", value => _l(value)); describe("CloudAuth component", () => { - let stub, wrapper; let mockSvc = { - listCredentials: async () => null, + listCredentials: async () => null }; - + rewire.__Rewire__("svc", mockSvc); - + beforeEach(async () => { let creds = listCredentials.map(Credential.create); stub = sinon.stub(mockSvc, "listCredentials").resolves(creds); @@ -38,54 +37,51 @@ describe("CloudAuth component", () => { stub.restore(); } }); - + describe("initialization", () => { it("should render the initial list", () => { assert(wrapper); assert(wrapper.contains(CloudAuthItem)); assert(wrapper.vm.items.length == 2); assert(wrapper.vm.filteredItems.length == 2); - }) - }) + }); + }); describe("text filter", () => { it("should show filter result by text match", () => { - let results; wrapper.vm.filter = "aws"; results = wrapper.vm.filteredItems; assert(wrapper.contains(CloudAuthItem)); assert(results.length == 1, `Wrong number of items: ${results.length}`); - + wrapper.vm.filter = "azure"; results = wrapper.vm.filteredItems; assert(results.length == 1, `Wrong number of items: ${results.length}`); - + wrapper.vm.filter = ""; results = wrapper.vm.filteredItems; - assert(results.length == 2, `Wrong number of items: ${results.length}`); - }) - }) + assert(results.length == 2, `Wrong number of items: ${results.length}`); + }); + }); describe("create button", () => { it("clicking create button should add a blank key", () => { - let results = wrapper.vm.filteredItems; assert(wrapper.contains(CloudAuthItem)); assert(results.length == 2, `Wrong number of items: ${results.length}`); - - let button = wrapper.find('button[name=createNewKey]'); + + let button = wrapper.find("button[name=createNewKey]"); assert(button); - button.trigger('click'); + button.trigger("click"); results = wrapper.vm.filteredItems; assert(results.length == 3, `Wrong number of items: ${results.length}`); - + let blank = results.find(i => i.id == null); assert(blank, "missing blank key"); assert(blank.id == null); - }) - }) - -}) \ No newline at end of file + }); + }); +}); diff --git a/client/galaxy/scripts/components/User/CloudAuth/CloudAuth.vue b/client/galaxy/scripts/components/User/CloudAuth/CloudAuth.vue index 43685ccee8c..c714725e9b7 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/CloudAuth.vue +++ b/client/galaxy/scripts/components/User/CloudAuth/CloudAuth.vue @@ -1,10 +1,7 @@ diff --git a/client/galaxy/scripts/components/User/CloudAuth/CloudAuthItem.vue b/client/galaxy/scripts/components/User/CloudAuth/CloudAuthItem.vue index 2feac30b6eb..1ef42987b7b 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/CloudAuthItem.vue +++ b/client/galaxy/scripts/components/User/CloudAuth/CloudAuthItem.vue @@ -1,9 +1,5 @@ diff --git a/client/galaxy/scripts/components/User/CloudAuth/CredentialConfig.vue b/client/galaxy/scripts/components/User/CloudAuth/CredentialConfig.vue index f27fda57fa9..8314cb93bb8 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/CredentialConfig.vue +++ b/client/galaxy/scripts/components/User/CloudAuth/CredentialConfig.vue @@ -1,28 +1,28 @@ - diff --git a/client/galaxy/scripts/components/User/CloudAuth/CredentialForm.vue b/client/galaxy/scripts/components/User/CloudAuth/CredentialForm.vue index 9adc20ac1ec..0dd4d16a332 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/CredentialForm.vue +++ b/client/galaxy/scripts/components/User/CloudAuth/CredentialForm.vue @@ -1,64 +1,60 @@ diff --git a/client/galaxy/scripts/components/User/CloudAuth/model/AwsConfig.js b/client/galaxy/scripts/components/User/CloudAuth/model/AwsConfig.js index 11004e28e62..cdadc265184 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/model/AwsConfig.js +++ b/client/galaxy/scripts/components/User/CloudAuth/model/AwsConfig.js @@ -19,9 +19,9 @@ AwsConfig.setValidator(function(model) { }); AwsConfig.fields = { - "role_arn": { + role_arn: { label: "Role ARN", description: "The Amazon resource name (ARN) of the role to be assumed by Galaxy.", placeholder: "arn:aws:iam::XXXXXXXXXXXX:role/XXXXXXXXXXX" } -} +}; diff --git a/client/galaxy/scripts/components/User/CloudAuth/model/AwsConfig.test.js b/client/galaxy/scripts/components/User/CloudAuth/model/AwsConfig.test.js index b8509531b6a..462683198e2 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/model/AwsConfig.test.js +++ b/client/galaxy/scripts/components/User/CloudAuth/model/AwsConfig.test.js @@ -1,24 +1,22 @@ import { AwsConfig } from "./AwsConfig"; describe("AwsConfig", () => { - it("should instantiate", () => { let instance = new AwsConfig(); assert(instance); assert(!instance.dirty); assert(!instance.valid); - }) + }); it("should validate role_arn", () => { let instance = new AwsConfig(); instance.role_arn = "abc"; assert(instance.fieldValid("role_arn")); - }) + }); it("should invalidate role_arn", () => { let instance = new AwsConfig(); instance.role_arn = ""; assert(!instance.fieldValid("role_arn")); - }) - -}) + }); +}); diff --git a/client/galaxy/scripts/components/User/CloudAuth/model/AzureConfig.js b/client/galaxy/scripts/components/User/CloudAuth/model/AzureConfig.js index 296a31a5a42..12db1775276 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/model/AzureConfig.js +++ b/client/galaxy/scripts/components/User/CloudAuth/model/AzureConfig.js @@ -37,24 +37,25 @@ AzureConfig.setValidator(function(model) { }); AzureConfig.fields = { - "tenant_id": { + tenant_id: { label: "Tenant ID", mask: "********-****-****-****-************", placeholder: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", maxlength: 36, description: "Your Tenant ID (or Directory ID) on Azure." }, - "client_id": { + client_id: { label: "Client ID", mask: "********-****-****-****-************", placeholder: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", maxlength: 36, description: "The Client ID (or Application ID) you defined for Galaxy on your Azure directory." }, - "client_secret": { + client_secret: { label: "Client Secret", mask: "", placeholder: "Client Secret", - description: "A secret string you obtained from Azure portal that Galaxy can use to prove its identity when requesting tokens to access your resources." + description: + "A secret string you obtained from Azure portal that Galaxy can use to prove its identity when requesting tokens to access your resources." } -} +}; diff --git a/client/galaxy/scripts/components/User/CloudAuth/model/AzureConfig.test.js b/client/galaxy/scripts/components/User/CloudAuth/model/AzureConfig.test.js index 52f942e687a..cc90a205bd6 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/model/AzureConfig.test.js +++ b/client/galaxy/scripts/components/User/CloudAuth/model/AzureConfig.test.js @@ -1,70 +1,58 @@ import { AzureConfig } from "./AzureConfig"; describe("AzureConfig", () => { - it("should instantiate", () => { let instance = new AzureConfig(); assert(instance); assert(!instance.dirty); assert(!instance.valid); - }) - + }); describe("client_secret", () => { - it("should validate client_secret", () => { let instance = new AzureConfig(); instance.client_secret = "abc"; assert(instance.fieldValid("client_secret")); - }) - + }); + it("should invalidate client_secret", () => { let instance = new AzureConfig(); instance.client_secret = ""; assert(!instance.fieldValid("client_secret")); - }) - - }) - + }); + }); describe("tenant_id", () => { - it("should validate tenant_id", () => { let validTenantId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; let instance = new AzureConfig(); instance.tenant_id = validTenantId; assert(instance.fieldValid("tenant_id")); - }) - + }); + it("should invalidate tenant_id", () => { let instance = new AzureConfig(); instance.tenant_id = ""; assert(!instance.fieldValid("tenant_id")); instance.tenant_id = "asdfa"; assert(!instance.fieldValid("tenant_id")); - }) - - }) - + }); + }); describe("client_id", () => { - it("should validate client_id", () => { let validClientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; let instance = new AzureConfig(); instance.client_id = validClientId; assert(instance.fieldValid("client_id")); - }) - + }); + it("should invalidate client_id", () => { let instance = new AzureConfig(); instance.client_id = ""; assert(!instance.fieldValid("client_id")); instance.client_id = "asdf"; assert(!instance.fieldValid("client_id")); - }) - - }) - - -}) + }); + }); +}); diff --git a/client/galaxy/scripts/components/User/CloudAuth/model/BaseModel.js b/client/galaxy/scripts/components/User/CloudAuth/model/BaseModel.js index ed8d0cdd2f3..0f6301ab05a 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/model/BaseModel.js +++ b/client/galaxy/scripts/components/User/CloudAuth/model/BaseModel.js @@ -7,19 +7,16 @@ const counter = new WeakMap(); let instanceCounter = 0; export class BaseModel { - constructor() { counter.set(this, instanceCounter++); } - /* object ID */ get counter() { return counter.get(this); } - /* Dirty state tracking */ get dirty() { @@ -52,7 +49,7 @@ export class BaseModel { } return transients.get(key); } - + updateState() { lastState.set(this, this.state); } @@ -60,19 +57,16 @@ export class BaseModel { // Setting a property name as transient for a class means its // state will be caclulated without regard to that propety static setTransient(...fieldNames) { - let klass = this; // this will be a class if (!transients.has(klass)) { transients.set(klass, new Set()); } let fields = transients.get(klass); - fieldNames.forEach(fieldName => fields.add(fieldName)) + fieldNames.forEach(fieldName => fields.add(fieldName)); transients.set(klass, fields); } - - /* Validation */ get valid() { @@ -105,5 +99,4 @@ export class BaseModel { static setValidator(validationFunction) { validators.set(this, validationFunction); } - } diff --git a/client/galaxy/scripts/components/User/CloudAuth/model/Credential.js b/client/galaxy/scripts/components/User/CloudAuth/model/Credential.js index f3614fb664f..c318e9e1bdc 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/model/Credential.js +++ b/client/galaxy/scripts/components/User/CloudAuth/model/Credential.js @@ -3,7 +3,6 @@ import { ResourceProviders } from "./ResourceProviders"; import { BaseModel } from "./BaseModel"; export class Credential extends BaseModel { - constructor(props = {}) { super(); @@ -11,7 +10,7 @@ export class Credential extends BaseModel { this.description = ""; this.authn_id = null; // identity provider this.provider = null; // resource provider - + // transient props, exclude from state this.expanded = false; this.loading = false; @@ -21,7 +20,7 @@ export class Credential extends BaseModel { safeAssign(this, options); // init nested config - this.config = new this.configClass(options.config); + this.config = new this.configClass(options.config); // initialize state this.updateState(); @@ -35,7 +34,6 @@ export class Credential extends BaseModel { return super.valid && this.config.valid; } - // Alias for provider also changes config object when updated // Set this when updating in the UI @@ -48,28 +46,25 @@ export class Credential extends BaseModel { this.config = new this.configClass({}); } - // Polymorphic config class get configClass() { return ResourceProviders.get(this.provider).klass; } - // Methods - + match(searchText = "") { // TODO: more robust object matching? return searchText.length ? this.title.includes(searchText) : true; } - // Statics static get defaults() { return { authn_id: null, - provider: 'aws', + provider: "aws", expanded: false }; } @@ -91,7 +86,6 @@ Credential.setTransient("expanded", "loading"); * error messages. */ Credential.setValidator(function(model) { - let errors = {}; if (!model.provider) { @@ -107,4 +101,4 @@ Credential.setValidator(function(model) { } return errors; -}) +}); diff --git a/client/galaxy/scripts/components/User/CloudAuth/model/Credential.test.js b/client/galaxy/scripts/components/User/CloudAuth/model/Credential.test.js index 10a4add6a39..ee2be51b315 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/model/Credential.test.js +++ b/client/galaxy/scripts/components/User/CloudAuth/model/Credential.test.js @@ -1,113 +1,106 @@ import { Credential } from "./Credential"; describe("Credential model", () => { - describe("basic model props", () => { - it("should exist", () => { assert(Credential); - }) - + }); + it("should build with defaults", () => { let instance = new Credential(); assert(instance); - }) - + }); + it("should build with props", () => { let description = "i am the test description"; let props = { description }; let instance = new Credential(props); assert(instance); assert(instance.description == description); - }) - + }); + it("default config object should be AWS", () => { let instance = new Credential(); - assert('role_arn' in instance.config, "Missing role_arn prop"); + assert("role_arn" in instance.config, "Missing role_arn prop"); assert(instance.config.constructor.name == "AwsConfig"); - }) - + }); + it("should load a different config object given the right provider", () => { - let provider = 'azure'; + let provider = "azure"; let props = { provider }; let instance = new Credential(props); assert(instance.provider == provider); assert(instance.config.constructor.name == "AzureConfig"); - }) - + }); + it("should dynamically switch config objects as resourceProvider is changed", () => { let instance = new Credential(); - assert(instance.provider == 'aws', "Should default to AWS config' "); - instance.resourceProvider = 'azure'; + assert(instance.provider == "aws", "Should default to AWS config' "); + instance.resourceProvider = "azure"; assert(instance.config.constructor.name == "AzureConfig", "Should have been AzureConfig"); - instance.resourceProvider = 'aws'; + instance.resourceProvider = "aws"; assert(instance.config.constructor.name == "AwsConfig", "Should be AWS Config again"); - }) - }) + }); + }); describe("dirty state", () => { - it("should flag as dirty when a prop is changed", () => { let instance = new Credential(); instance.description = "foo"; assert(instance.dirty); - }) + }); it("should flag as clean when a prop is restored", () => { let instance = new Credential(); - instance.description = 'foo'; + instance.description = "foo"; assert(instance.dirty); instance.description = ""; assert(!instance.dirty); - }) + }); it("should not flag as dirty when a transient prop is changed", () => { let instance = new Credential(); instance.loading = true; assert(!instance.dirty); - }) - - }) + }); + }); describe("validation", () => { - it("a new object should be invalid", () => { let instance = new Credential(); assert(!instance.valid); - }) + }); it("it should become valid when props are assigned", () => { let instance = new Credential(); instance.authn_id = "floob"; - instance.resourceProvider = 'aws'; + instance.resourceProvider = "aws"; instance.config.role_arn = "abc"; assert(instance.valid); - }) + }); it("it should be valid when initialized with correct props", () => { let props = { authn_id: "asdfasdf", - provider: 'aws', + provider: "aws", config: { role_arn: "floobar" } - } + }; let instance = new Credential(props); assert(instance.valid); - }) + }); it("should be invalid when bad props assigned", () => { let props = { authn_id: "asdfasdf", - provider: 'aws', + provider: "aws", config: { role_arn: "" } - } + }; let instance = new Credential(props); assert(!instance.valid); - }) - - }) - -}) + }); + }); +}); diff --git a/client/galaxy/scripts/components/User/CloudAuth/model/IdentityProvider.js b/client/galaxy/scripts/components/User/CloudAuth/model/IdentityProvider.js index b78538bdb82..7c0974fc50b 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/model/IdentityProvider.js +++ b/client/galaxy/scripts/components/User/CloudAuth/model/IdentityProvider.js @@ -1,7 +1,6 @@ import { safeAssign } from "utils/safeAssign"; export class IdentityProvider { - constructor(props = {}) { this.id = ""; this.provider = ""; diff --git a/client/galaxy/scripts/components/User/CloudAuth/model/index.js b/client/galaxy/scripts/components/User/CloudAuth/model/index.js index 9f9f76db4a7..24f019b67c5 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/model/index.js +++ b/client/galaxy/scripts/components/User/CloudAuth/model/index.js @@ -1,3 +1,3 @@ export { Credential } from "./Credential"; export { IdentityProvider } from "./IdentityProvider"; -export { ResourceProviders } from "./ResourceProviders"; \ No newline at end of file +export { ResourceProviders } from "./ResourceProviders"; diff --git a/client/galaxy/scripts/components/User/CloudAuth/model/service.js b/client/galaxy/scripts/components/User/CloudAuth/model/service.js index 4e8306e2bf3..b28deef07dd 100644 --- a/client/galaxy/scripts/components/User/CloudAuth/model/service.js +++ b/client/galaxy/scripts/components/User/CloudAuth/model/service.js @@ -37,7 +37,7 @@ export async function saveCredential(newItem) { async function saveOrUpdate(model) { return model.id - ? axios.put(getUrl(`api/cloud/authz/${model.id}`), model) + ? axios.put(getUrl(`api/cloud/authz/${model.id}`), model) : axios.post(getUrl("api/cloud/authz"), model); } @@ -69,10 +69,10 @@ export async function getIdentityProviders() { return identityProviders; } -export default { +export default { listCredentials, getCredential, saveCredential, deleteCredential, getIdentityProviders -} +}; diff --git a/client/galaxy/scripts/entry/panels/tool-panel.js b/client/galaxy/scripts/entry/panels/tool-panel.js index 4edba0fd48a..35953f419d8 100644 --- a/client/galaxy/scripts/entry/panels/tool-panel.js +++ b/client/galaxy/scripts/entry/panels/tool-panel.js @@ -46,7 +46,7 @@ var ToolPanel = Backbone.View.extend({ const panel_buttons = [this.upload_button]; // add favorite filter button - if (Galaxy.user && Galaxy.user.id){ + if (Galaxy.user && Galaxy.user.id) { this.favorite_button = new Buttons.ButtonLink({ cls: "panel-header-button", title: _l("Show favorites"), diff --git a/client/galaxy/scripts/mvc/upload/composite/composite-view.js b/client/galaxy/scripts/mvc/upload/composite/composite-view.js index 5430625aec9..dbae23f2cd4 100644 --- a/client/galaxy/scripts/mvc/upload/composite/composite-view.js +++ b/client/galaxy/scripts/mvc/upload/composite/composite-view.js @@ -29,7 +29,7 @@ export default Backbone.View.extend({ onclick: function() { self._eventReset(); } - }) + }); this.btnStart = new Ui.Button({ title: _l("Start"), onclick: function() { @@ -63,7 +63,7 @@ export default Backbone.View.extend({ self.collection.add({ id: self.collection.size(), file_desc: item.description || item.name, - optional: item.optional, + optional: item.optional }); }); } @@ -113,7 +113,11 @@ export default Backbone.View.extend({ this.select_genome.enable(); this.select_extension.enable(); } - if (this.collection.where({ status: "ready" }).length + this.collection.where({ optional: true }).length == this.collection.length && this.collection.length > 0) { + if ( + this.collection.where({ status: "ready" }).length + this.collection.where({ optional: true }).length == + this.collection.length && + this.collection.length > 0 + ) { this.btnStart.enable(); this.btnStart.$el.addClass("btn-primary"); } else { diff --git a/client/galaxy/scripts/mvc/user/user-preferences.js b/client/galaxy/scripts/mvc/user/user-preferences.js index 287836ec53a..6efdc17bb59 100644 --- a/client/galaxy/scripts/mvc/user/user-preferences.js +++ b/client/galaxy/scripts/mvc/user/user-preferences.js @@ -92,7 +92,9 @@ var Model = Backbone.Model.extend({ }, cloud_auth: { title: _l("Manage Cloud Authorization"), - description: _l("Add or modify the configuration that grants Galaxy to access your cloud-based resources."), + description: _l( + "Add or modify the configuration that grants Galaxy to access your cloud-based resources." + ), icon: "fa-cloud", submit_title: "Create a new key", submit_icon: "fa-check" diff --git a/client/galaxy/scripts/utils/safeAssign.js b/client/galaxy/scripts/utils/safeAssign.js index 4f1db0bae4a..b10591e7fbf 100644 --- a/client/galaxy/scripts/utils/safeAssign.js +++ b/client/galaxy/scripts/utils/safeAssign.js @@ -7,5 +7,5 @@ export function safeAssign(target, source = {}) { } Object.keys(source) .filter(prop => target.hasOwnProperty(prop)) - .forEach(prop => target[prop] = source[prop]); + .forEach(prop => (target[prop] = source[prop])); } diff --git a/client/galaxy/style/scss/mixins.scss b/client/galaxy/style/scss/mixins.scss index 81eb9c38141..81f7b907670 100644 --- a/client/galaxy/style/scss/mixins.scss +++ b/client/galaxy/style/scss/mixins.scss @@ -2,7 +2,6 @@ $fa-font-path: "~font-awesome/fonts/"; @import "~font-awesome/scss/font-awesome.scss"; @import "~font-awesome/scss/_mixins"; - // Utility mixin expands to container edges @mixin fill() { position: relative; @@ -38,8 +37,8 @@ $fa-font-path: "~font-awesome/fonts/"; @mixin scrollMe() { overflow-x: hidden; overflow-y: scroll; - &::-webkit-scrollbar { - display: none; + &::-webkit-scrollbar { + display: none; } } @@ -53,14 +52,13 @@ $fa-font-path: "~font-awesome/fonts/"; #{$fixedTop} { flex-grow: 0; } - + #{$listRegion} { flex-grow: 1; - @include scrollMe(); + @include scrollMe(); } } - // Removes browser formatting of lists @mixin list_reset() { @@ -69,13 +67,12 @@ $fa-font-path: "~font-awesome/fonts/"; margin: 0 0 0 0; } - // font awesome as a mixin // icon variables come from ~font-awesome/scss/_variables.scss @mixin fontawesome($icon) { @include fa-icon(); - &:before { + &:before { content: $icon; } span {