diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..765f18aab --- /dev/null +++ b/.eslintignore @@ -0,0 +1,6 @@ +/node_modules/ +/bower_components/ +/build/ +/deployment/ +**/*.js +!/src/**/*.js \ No newline at end of file diff --git a/.eslintrc.yml b/.eslintrc.yml index e865bf6ec..b4d444274 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -24,3 +24,29 @@ rules: - allow: - warn - error + # stylistic + no-trailing-spaces: + - error + space-before-function-paren: + - error + - + anonymous: always + named: never + asyncArrow: always + space-in-parens: + - error + - never + func-call-spacing: + - error + - never + keyword-spacing: + - error + - + before: true + after: true + no-fallthrough: + - error + - + commentPattern: fallthrough + prefer-const: + - error \ No newline at end of file diff --git a/config/app/dev/plugins.yml b/config/app/dev/plugins.yml index 6ac0686da..7d32e664f 100644 --- a/config/app/dev/plugins.yml +++ b/config/app/dev/plugins.yml @@ -260,7 +260,7 @@ plugins: - name: narrative-info globalName: kbase-ui-plugin-narrative-info - version: 1.1.3 + version: 1.1.4 cwd: src/plugin source: bower: {} diff --git a/config/app/prod/plugins.yml b/config/app/prod/plugins.yml index 8eafe6c2b..50f911983 100644 --- a/config/app/prod/plugins.yml +++ b/config/app/prod/plugins.yml @@ -223,7 +223,7 @@ plugins: - name: narrative-info globalName: kbase-ui-plugin-narrative-info - version: 1.1.3 + version: 1.1.4 cwd: src/plugin source: bower: {} diff --git a/src/client/modules/app/App.js b/src/client/modules/app/App.js index e53ed2a3a..358b2827a 100644 --- a/src/client/modules/app/App.js +++ b/src/client/modules/app/App.js @@ -138,7 +138,7 @@ define([ } function checkCoreServices() { - let manager = new kbaseServiceManager.KBaseServiceManager({ + const manager = new kbaseServiceManager.KBaseServiceManager({ runtime: api }); return manager.check(); diff --git a/src/client/modules/app/runtime.js b/src/client/modules/app/runtime.js index d6a6533a1..99eaaeaca 100644 --- a/src/client/modules/app/runtime.js +++ b/src/client/modules/app/runtime.js @@ -8,7 +8,7 @@ define([ var messenger = config.messenger; var serviceManager = config.serviceManager; - // Access to ui config. + // Access to ui config. // This is simply a wrapping around the venerable Props module. function getConfig(prop, defaultValue) { return configProps.getItem(prop, defaultValue); @@ -23,8 +23,8 @@ define([ } // allow tag - // Returns true if the provided string 'tag' is found in - // the array of allowed tags, as defined in the config + // Returns true if the provided string 'tag' is found in + // the array of allowed tags, as defined in the config // property 'ui.allow'. function allow(tag) { var allowed = configProps.getItem('ui.allow', []); @@ -35,18 +35,18 @@ define([ } var featureSwitches = {}; - configProps.getItem('ui.featureSwitches.available').reduce((features, featureSwitch) => { + configProps.getItem('ui.featureSwitches.available', []).reduce((features, featureSwitch) => { featureSwitches[featureSwitch.id] = featureSwitch; - }); + }, {}); function featureEnabled(id) { - let featureSwitch = featureSwitches[id]; + const featureSwitch = featureSwitches[id]; if (!featureSwitch) { throw new Error('Feature switch "' + id + '" not defined'); } // look for the feature switch in the. - let enabledFeatureSwitches = configProps.getItem('ui.featureSwitches.enabled'); + const enabledFeatureSwitches = configProps.getItem('ui.featureSwitches.enabled'); // let disabledFeatureSwitches = configProps.getItem('ui.featureSwitches.disabled'); if (enabledFeatureSwitches.includes(id)) { @@ -56,13 +56,13 @@ define([ } function featureDisabled(id) { - let featureSwitch = featureSwitches[id]; + const featureSwitch = featureSwitches[id]; if (!featureSwitch) { throw new Error('Feature switch "' + id + '" not defined'); } // look for the feature switch in the. - let disabledFeatureSwitches = configProps.getItem('ui.featureSwitches.disabled'); + const disabledFeatureSwitches = configProps.getItem('ui.featureSwitches.disabled'); if (disabledFeatureSwitches.includes(id)) { return true; diff --git a/src/client/modules/app/services/connection.js b/src/client/modules/app/services/connection.js index a6c2b6e31..782759983 100644 --- a/src/client/modules/app/services/connection.js +++ b/src/client/modules/app/services/connection.js @@ -154,7 +154,7 @@ define([ // // show the disconnected dialog // // which starts listening back to home base to see if we are - // // connected yet. Allow the user to bail to a default "closer" + // // connected yet. Allow the user to bail to a default "closer" // // page which is just a simple view which destroys the current view // // and allows the user to just kill the tab. // }); @@ -164,7 +164,7 @@ define([ if (checking) { return; } - var now = new Date().getTime(); + const now = new Date().getTime(); if (now - lastCheckAt > interval) { checking = true; var httpClient = new HttpClient.HttpClient(); diff --git a/src/client/modules/app/services/coreService.js b/src/client/modules/app/services/coreService.js index 6f8929004..3b3c30361 100644 --- a/src/client/modules/app/services/coreService.js +++ b/src/client/modules/app/services/coreService.js @@ -5,15 +5,15 @@ define([ ) { 'use strict'; - class CoreService { - constructor({moduleName, minimumVersion, url, versionMethod, versionPath}) { - this.moduleName = moduleName; - this.minimumVersion = minimumVersion; - this.url = url; - this.versionMethod = versionMethod; - this.versionPath = versionPath; - } - } + // class CoreService { + // constructor({moduleName, minimumVersion, url, versionMethod, versionPath}) { + // this.moduleName = moduleName; + // this.minimumVersion = minimumVersion; + // this.url = url; + // this.versionMethod = versionMethod; + // this.versionPath = versionPath; + // } + // } class CoreServicesMonitor { constructor({runtime}) { @@ -22,22 +22,22 @@ define([ this.services = {}; } - start () { + start() { } - stop () { + stop() { } - pluginHandler(config) { + pluginHandler() { // console.log('plugin handler', config); } - addCoreServiceDepenency(dep) { - + addCoreServiceDepenency() { + } - } + } return {ServiceClass: CoreServicesMonitor}; diff --git a/src/client/modules/app/services/data.js b/src/client/modules/app/services/data.js index ef5c8d73e..23ba2d89d 100644 --- a/src/client/modules/app/services/data.js +++ b/src/client/modules/app/services/data.js @@ -25,8 +25,8 @@ define([ } function getJson(arg) { - let url = '/data/' + arg.path + '/' + arg.file + '.json'; - let http = new HttpClient.HttpClient(); + const url = '/data/' + arg.path + '/' + arg.file + '.json'; + const http = new HttpClient.HttpClient(); return http.request({ method: 'GET', url: url @@ -42,7 +42,6 @@ define([ throw new Error('Error fetching file: ' + result.status); } }); - } return { start: start, diff --git a/src/client/modules/app/services/dynamic-service.js b/src/client/modules/app/services/dynamic-service.js index f19fc5127..3b5da8931 100644 --- a/src/client/modules/app/services/dynamic-service.js +++ b/src/client/modules/app/services/dynamic-service.js @@ -1,15 +1,15 @@ define([ - 'kb_common/hotCache', - 'kb_common/jsonRpc/genericClient', - 'kb_common/jsonRpc/dynamicServiceClient' + 'kb_common/hotCache' + // 'kb_common/jsonRpc/genericClient', + // 'kb_common/jsonRpc/dynamicServiceClient' ], function ( - HotCache, - GenericClient, - DynamicServiceClient + HotCache + // GenericClient, + // DynamicServiceClient ) { 'use strict'; - function factory(config) { + function factory() { var cache = HotCache.make({ hardTtl: 3600000, // 1 min hotTtl: 18000000, // 5 min diff --git a/src/client/modules/app/services/heartbeat.js b/src/client/modules/app/services/heartbeat.js index d0c461ad4..45c8ae12d 100644 --- a/src/client/modules/app/services/heartbeat.js +++ b/src/client/modules/app/services/heartbeat.js @@ -1,6 +1,6 @@ /*global define */ /*jslint white: true, browser: true */ -define([], function() { +define([], function () { 'use strict'; function factory(config) { @@ -12,7 +12,7 @@ define([], function() { function start() { heartbeat = 0; - heartbeatTimer = window.setInterval(function() { + heartbeatTimer = window.setInterval(function () { heartbeat += 1; runtime.send('app', 'heartbeat', { heartbeat: heartbeat }); }, interval); @@ -30,7 +30,7 @@ define([], function() { } return { - make: function(config) { + make: function (config) { return factory(config); } }; diff --git a/src/client/modules/app/services/menu.js b/src/client/modules/app/services/menu.js index a04333f5c..867a7c65e 100644 --- a/src/client/modules/app/services/menu.js +++ b/src/client/modules/app/services/menu.js @@ -2,7 +2,7 @@ define([ 'bluebird', 'kb_common/observed' ], function ( - Promise, + Promise, observed ) { 'use strict'; @@ -43,7 +43,7 @@ define([ * Add a defined menu item to a menu, according to a menu entry definition. */ function addToMenu(menuEntry, menuItemSpec) { - var menu, section, position, + var menu, section, position, menuItems = state.getItem('menuItems'), menuItemDef = menuItems[menuItemSpec.id]; @@ -78,7 +78,7 @@ define([ allowRoles: menuItemSpec.allowRoles || null, authRequired: menuItemSpec.auth ? true : false }; - + menu = menuEntry.menu; section = menuEntry.section; position = menuEntry.position || 'bottom'; @@ -97,7 +97,6 @@ define([ }); } - // Get the function getCurrentMenu(menu) { menu = menu || 'hamburger'; var menus = state.getItem('menu.' + menu); diff --git a/src/client/modules/app/services/route.js b/src/client/modules/app/services/route.js index 89ecd3f86..5a70c6e7d 100644 --- a/src/client/modules/app/services/route.js +++ b/src/client/modules/app/services/route.js @@ -63,7 +63,7 @@ define([ handler = { params: { title: 'Access Error', - error: 'One or more required roles not available in your account: ' + handler.route.rolesRequired.join(', ') + error: 'One or more required roles not available in your account: ' + handler.route.rolesRequired.join(', ') }, route: { authorization: false, diff --git a/src/client/modules/app/services/rpc.js b/src/client/modules/app/services/rpc.js index e4cca8385..2b779c52f 100644 --- a/src/client/modules/app/services/rpc.js +++ b/src/client/modules/app/services/rpc.js @@ -2,7 +2,7 @@ define([ 'bluebird', 'lib/rpc' ], function ( - Promise, + Promise, rpc ) { 'use strict'; @@ -27,31 +27,20 @@ define([ function stop() { return true; } - function pluginHandler(widgetsConfig, pluginConfig) { + function pluginHandler() { return Promise.try(function () { - // widgetsConfig.forEach(function (widgetDef) { - // // If source modules are not specified, we are using module - // // paths. A full path will start with "plugins/" and a relative - // // path won't. Prefix a relative path with the plugin's module path. - // if (!pluginConfig.usingSourceModules) { - // if (!widgetDef.module.match(/^plugins\//)) { - // widgetDef.module = [pluginConfig.moduleRoot, widgetDef.module].join('/'); - // } - // } - // widgetManager.addWidget(widgetDef); - // }); }); } function makeClient(arg) { - let client = new rpc.RPCClient({ + const client = new rpc.RPCClient({ runtime: runtime, module: arg.module }); return client; } - return {start, stop, pluginHandler, makeClient}; + return {start, stop, pluginHandler, makeClient}; } return { make: function (config) { diff --git a/src/client/modules/app/services/widget.js b/src/client/modules/app/services/widget.js index b8a3b3dda..ff1162bd4 100644 --- a/src/client/modules/app/services/widget.js +++ b/src/client/modules/app/services/widget.js @@ -47,7 +47,7 @@ define([ stop: stop, // plugin interface pluginHandler: pluginHandler, - makeWidget: function () { + makeWidget: function () { return proxyMethod(widgetManager, 'makeWidget', arguments); }, getWidget: function () { diff --git a/src/client/modules/lib/kbaseServiceManager.js b/src/client/modules/lib/kbaseServiceManager.js index 447e2b672..d965510f9 100644 --- a/src/client/modules/lib/kbaseServiceManager.js +++ b/src/client/modules/lib/kbaseServiceManager.js @@ -22,8 +22,8 @@ define([ } checkREST(serviceConfig) { - let http = new httpClient.HttpClient(); - let header = new httpClient.HttpHeader(); + const http = new httpClient.HttpClient(); + const header = new httpClient.HttpHeader(); header.setHeader('accept', 'application/json'); return http.request({ method: 'GET', @@ -32,9 +32,9 @@ define([ timeout: this.timeout }) .then((result) => { - let contentType = result.header.getHeader('content-type'); + const contentType = result.header.getHeader('content-type'); if (contentType !== 'application/json') { - let errorMessage = 'Unexpected content type; expected "application/json", received "' + contentType + '"'; + const errorMessage = 'Unexpected content type; expected "application/json", received "' + contentType + '"'; if (this.throwErrors) { throw new Error(errorMessage); } else { @@ -44,7 +44,7 @@ define([ return JSON.parse(result.response); }) .catch((err) => { - let errorMessage = 'An error was encountered checking the service "' + serviceConfig.module + '": ' + err.message; + const errorMessage = 'An error was encountered checking the service "' + serviceConfig.module + '": ' + err.message; if (this.throwErrors) { throw new Error(errorMessage); } else { @@ -55,7 +55,7 @@ define([ } checkJSONRPC(serviceConfig) { - let client = new GenericClient({ + const client = new GenericClient({ module: serviceConfig.module, url: serviceConfig.url, timeout: this.timeout @@ -65,7 +65,7 @@ define([ return result; }) .catch((err) => { - let errorMessage = 'An error was encountered checking the service "' + serviceConfig.module + '": ' + err.message; + const errorMessage = 'An error was encountered checking the service "' + serviceConfig.module + '": ' + err.message; if (this.throwErrors) { throw new Error(errorMessage); } else { @@ -84,7 +84,7 @@ define([ return this.checkJSONRPC(serviceConfig); case 'rest': return this.checkREST(serviceConfig); - default: + default: var errorMessage = 'Unsupported core service type: ' + serviceConfig.type; if (this.throwErrors) { throw new Error(errorMessage); @@ -106,7 +106,7 @@ define([ } else { version = result; } - let semverResult = semver.semverIsAtLeast(version, serviceConfig.version.minimum); + const semverResult = semver.semverIsAtLeast(version, serviceConfig.version.minimum); if (semverResult === true) { return null; } else { @@ -115,18 +115,18 @@ define([ minimumVersion: serviceConfig.version.minimum, serviceVersion: version, code: semverResult - }; + }; } }); })) .then((result) => { - let mismatches = result .filter((result) => { + const mismatches = result .filter((result) => { return result === null ? false : true; }); if (mismatches.length > 0) { - let message = mismatches.map((mismatch) => { - return '(' + mismatch.code + ') ' + - mismatch.module + ' needs to be at least ' + + const message = mismatches.map((mismatch) => { + return '(' + mismatch.code + ') ' + + mismatch.module + ' needs to be at least ' + mismatch.minimumVersion + ' but is ' + mismatch.serviceVersion; }).join('; '); let prefix; @@ -135,7 +135,7 @@ define([ } else { prefix = 'Incompatible services'; } - let errorMessage = prefix + ': ' + message; + const errorMessage = prefix + ': ' + message; if (this.throwErrors) { throw new Error(errorMessage); } else { diff --git a/src/client/modules/lib/knockout-es6-collections.js b/src/client/modules/lib/knockout-es6-collections.js index e145bfea8..1a39270fa 100644 --- a/src/client/modules/lib/knockout-es6-collections.js +++ b/src/client/modules/lib/knockout-es6-collections.js @@ -1,7 +1,7 @@ /* eslint-env es6 */ /* This was snatched from https://github.com/brianmhunt/knockout-es6-collections/tree/7c538dc3581a9b3d470d7d9a7056b84b6e28f1f4 - which is 3.1.1 - It is not in a universal module format, so I just wrapped it in this amd module and fixed some linting issues. + which is 3.1.1 + It is not in a universal module format, so I just wrapped it in this amd module and fixed some linting issues. TODO: wrap in universl module format, fix linting issues, and PR back to the original repo ... maybe */ define([ 'knockout' @@ -28,7 +28,7 @@ define([ this[fn].peek = (...args) => this[SYMS.kc][fn](...args) ); } - + KeyCollection.prototype = { constructor: KeyCollection, [SYMS.tm]: function () { @@ -48,7 +48,7 @@ define([ return this[SYMS.kc].size; } }); - + function ctr(ObsClass, Es6, iter) { if (this instanceof ObsClass) { KeyCollection.call(this, Es6, iter); @@ -56,12 +56,12 @@ define([ return new ObsClass(iter); } } - + function KoMap(iter) { return ctr.call(this, KoMap, Map, iter); } function KoSet(iter) { return ctr.call(this, KoSet, Set, iter); } function KoWeakMap(iter) { return ctr.call(this, KoWeakMap, WeakMap, iter); } function KoWeakSet(iter) { return ctr.call(this, KoWeakSet, WeakSet, iter); } - + const kinds = { Map: { Ctr: KoMap, @@ -92,7 +92,7 @@ define([ const KeyClass = defn.Ctr; KeyClass['@@SYMS'] = SYMS; KeyClass.prototype = Object.create(KeyCollection.prototype); - + Object.assign(KeyClass.prototype, { subscribe(fn, thisArg) { return this[SYMS.trigger].subscribe(function () { @@ -106,27 +106,27 @@ define([ return this[SYMS.trigger].valueHasMutated(); } }); - + defn.mutators.forEach(function (fn) { KeyClass.prototype[fn] = function () { this[SYMS.tm](); return this[SYMS.kc][fn].apply(this[SYMS.kc], arguments); }; }); - - defn.observers.forEach(function(fn) { + + defn.observers.forEach(function (fn) { KeyClass.prototype[fn] = function () { this[SYMS.trigger](); // Create dependency. return this[SYMS.kc][fn].apply(this[SYMS.kc], arguments); }; }); - + if (defn.iterFn) { KeyClass.prototype[Symbol.iterator] = function () { return this[SYMS.kc][defn.iterFn](); }; } - + ko[name] = KeyClass; }); }); \ No newline at end of file diff --git a/src/client/modules/lib/knockout-plus.js b/src/client/modules/lib/knockout-plus.js index b881b6d42..46f130f88 100644 --- a/src/client/modules/lib/knockout-plus.js +++ b/src/client/modules/lib/knockout-plus.js @@ -72,7 +72,7 @@ define([ function stop() { vm.running(false); } - + return { vm: vm, node: node, diff --git a/src/client/modules/lib/pluginManager.js b/src/client/modules/lib/pluginManager.js index 50ef6d86c..6397f1c2c 100644 --- a/src/client/modules/lib/pluginManager.js +++ b/src/client/modules/lib/pluginManager.js @@ -5,7 +5,7 @@ define([ ) { 'use strict'; - // Note that we use the global require here because we need to + // Note that we use the global require here because we need to // update the global confirmation. var prequire = Promise.promisify(window.require); @@ -15,7 +15,7 @@ define([ services = {}; /* - * All of these installXXX installers return an array of + * All of these installXXX installers return an array of * promises. */ @@ -119,8 +119,8 @@ define([ // Create a dynamic module for the plugin to use. The current use // case is for code within the plugin to have access to the path // to the plugin for loading other files. - // - // NB: this implies that the plugin package name is unique in + // + // NB: this implies that the plugin package name is unique in // the system. To enforce or at least help developers with this // we should have a plugin registry. define('kb_plugin_' + pluginDef.package.name, [], function () { @@ -128,7 +128,7 @@ define([ plugin: { name: pluginDef.package.name, resources: { - // to be used for module loading, e.g. yaml, json, + // to be used for module loading, e.g. yaml, json, // css through requirejs modulePath: '/' + sourcePath + '/resources', // to be used for document references, e.g. img, css doc @@ -193,7 +193,7 @@ define([ } /** - * + * * @param {type} pluginDef * @returns {Promise} */ diff --git a/src/client/modules/lib/props.js b/src/client/modules/lib/props.js index f47795549..e20bcd9b1 100644 --- a/src/client/modules/lib/props.js +++ b/src/client/modules/lib/props.js @@ -59,7 +59,7 @@ define([], function () { temp[propKey] = []; } temp = temp[propKey]; - // Finally set the property. + // Finally set the property. if (typeof temp === 'object' && temp.push) { temp.push(value); @@ -126,7 +126,7 @@ define([], function () { timer, api; /* - * In enabled by setting an update handler via the onUpdate factory + * In enabled by setting an update handler via the onUpdate factory * configuration property, this function should be run whenever the * property is updated. It will then run the update handler callback. * This is a way to enable essentially synchronization of the props diff --git a/src/client/modules/lib/rpc.js b/src/client/modules/lib/rpc.js index 5f269e131..59e6aeb8a 100644 --- a/src/client/modules/lib/rpc.js +++ b/src/client/modules/lib/rpc.js @@ -28,8 +28,8 @@ define([ } call(moduleName, functionName, params) { - let serviceUrl = this.runtime.config(['services', moduleName, 'url'].join('.')); - let token = this.runtime.service('session').getAuthToken(); + const serviceUrl = this.runtime.config(['services', moduleName, 'url'].join('.')); + const token = this.runtime.service('session').getAuthToken(); let client; if (serviceUrl) { client = new GenericClient({ @@ -44,7 +44,7 @@ define([ module: moduleName }); } - let funcParams = params || []; + const funcParams = params || []; return client.callFunc(functionName, funcParams) .catch((err) => { if (err instanceof exceptions.AjaxError) { @@ -54,8 +54,8 @@ define([ }); } else if (err instanceof RPCError) { console.error('RPC Error', err); - let message = 'An error was encountered running an rpc method'; - let detail = 'The module is "' + err.module + '", the method "' + err.func + '", ' + + const message = 'An error was encountered running an rpc method'; + const detail = 'The module is "' + err.module + '", the method "' + err.func + '", ' + 'the error returned from the service is "' + (err.message || 'unknown') + '"'; throw new RPCError('service-call-error', err.name, message, detail , { originalError: err @@ -79,8 +79,8 @@ define([ } setup() { - let serviceUrl = this.runtime.config(['services', this.moduleName, 'url'].join('.')); - let token = this.runtime.service('session').getAuthToken(); + const serviceUrl = this.runtime.config(['services', this.moduleName, 'url'].join('.')); + const token = this.runtime.service('session').getAuthToken(); let client; if (serviceUrl) { client = new GenericClient({ @@ -98,8 +98,8 @@ define([ this.client = client; } - callFunc(functionName, params) { - let funcParams = params || []; + callFunc(functionName, params) { + const funcParams = params || []; return this.client.callFunc(functionName, funcParams) .catch((err) => { if (err instanceof exceptions.AjaxError) { @@ -109,8 +109,8 @@ define([ }); } else if (err instanceof RPCError) { console.error('RPC Error', err); - let message = 'An error was encountered running an rpc method'; - let detail = 'The module is "' + err.module + '", the method "' + err.func + '", ' + + const message = 'An error was encountered running an rpc method'; + const detail = 'The module is "' + err.module + '", the method "' + err.func + '", ' + 'the error returned from the service is "' + (err.message || 'unknown') + '"'; throw new RPCError('service-call-error', err.name, message, detail , { originalError: err diff --git a/src/client/modules/lib/userProfile.js b/src/client/modules/lib/userProfile.js index e9cdc0058..f950ecce4 100644 --- a/src/client/modules/lib/userProfile.js +++ b/src/client/modules/lib/userProfile.js @@ -45,7 +45,7 @@ define([ created: new Date().toISOString() }, // was globus info, no longer used - //account: {}, + //account: {}, preferences: {}, // This is where all user-visible and user-controlled information goes. // when auto-creating a profile, there is nothing to put here yet. diff --git a/src/client/modules/startup.js b/src/client/modules/startup.js index 66d1a1868..7c3604db2 100644 --- a/src/client/modules/startup.js +++ b/src/client/modules/startup.js @@ -4,7 +4,7 @@ switch (err.requireType) { case 'notloaded': if (/esprima/.test(err.message)) { - // ignore esprima for now. The loading is attempted within the + // ignore esprima for now. The loading is attempted within the // yaml library ... console.warn('esprima require test detected'); return; @@ -95,7 +95,7 @@ switch (err.requireType) { case 'notloaded': if (/xesprima/.test(err.message)) { - // ignore esprima for now. The loading is attempted within the + // ignore esprima for now. The loading is attempted within the // yaml library ... console.warn('esprima require test detected'); return; diff --git a/src/client/mustard.js b/src/client/mustard.js index ced80a6da..2dd14f856 100644 --- a/src/client/mustard.js +++ b/src/client/mustard.js @@ -7,7 +7,6 @@ return false; } - // ES6! // Prior to ES6, const is not a keyword, and in strict mode, // using it throws an execption. (works for Safari < 10) @@ -31,7 +30,7 @@ } else if (typeof window['addEventListener'] === 'undefined') { failed = 'a'; } else if (!supportsStrictMode()) { - // IE9 < + // IE9 < failed = 's'; } else if (typeof window['location']['origin'] === 'undefined') { // IE11 < diff --git a/src/client/require-config.js b/src/client/require-config.js index 9b290438d..d4c0faab3 100644 --- a/src/client/require-config.js +++ b/src/client/require-config.js @@ -84,7 +84,7 @@ text: 'bower_components/requirejs-text/text', underscore: 'bower_components/underscore/underscore', uuid: 'bower_components/pure-uuid/uuid', - yaml: 'bower_components/requirejs-yaml/yaml' + yaml: 'bower_components/requirejs-yaml/yaml' }, shim: { bootstrap: { diff --git a/src/plugins/about/modules/aboutServices.js b/src/plugins/about/modules/aboutServices.js index cfe7bd4d6..2cea5afd4 100644 --- a/src/plugins/about/modules/aboutServices.js +++ b/src/plugins/about/modules/aboutServices.js @@ -212,7 +212,7 @@ define([ }); info.push({ label: 'Perf avg (ms/call)', - value: perf.average + value: perf.average }); info.push({ label: 'Perf calls (ms/call)', @@ -242,7 +242,6 @@ define([ function renderAuth() { - // +++ var http = new HttpClient.HttpClient(); vm.auth.node.innerHTML = html.loading(); @@ -316,7 +315,7 @@ define([ } return Promise.all([ - ver(), + ver(), perf(ver) ]) .spread(function (version, perf) { @@ -328,7 +327,7 @@ define([ }); info.push({ label: 'Perf avg (ms/call)', - value: perf.average + value: perf.average }); info.push({ label: 'Perf calls (ms/call)', @@ -382,7 +381,7 @@ define([ }); info.push({ label: 'Perf avg (ms/call)', - value: perf.average + value: perf.average }); info.push({ label: 'Perf calls (ms/call)', @@ -420,7 +419,7 @@ define([ function version() { return client.callFunc('version', []).spread((result) => {return result;}); } - + vm.catalog.node.innerHTML = html.loading(); return Promise.all([ @@ -436,7 +435,7 @@ define([ }); info.push({ label: 'Perf avg (ms/call)', - value: perf.average + value: perf.average }); info.push({ label: 'Perf calls (ms/call)', @@ -488,7 +487,7 @@ define([ }); info.push({ label: 'Perf avg (ms/call)', - value: perf.average + value: perf.average }); info.push({ label: 'Perf calls (ms/call)', diff --git a/src/plugins/components/modules/clock.js b/src/plugins/components/modules/clock.js index 9b7eebb77..45a30f84a 100644 --- a/src/plugins/components/modules/clock.js +++ b/src/plugins/components/modules/clock.js @@ -37,7 +37,7 @@ define([], function () { if (!alarm.timer) { alarm.timer = window.setInterval(function () { - Object.keys(alarm.listeners).forEach(function(id) { + Object.keys(alarm.listeners).forEach(function (id) { var listener = alarm.listeners[id]; try { listener.callCount += 1; diff --git a/src/plugins/components/modules/components/dialog.js b/src/plugins/components/modules/components/dialog.js index d5b06739d..29c8dcac9 100644 --- a/src/plugins/components/modules/components/dialog.js +++ b/src/plugins/components/modules/components/dialog.js @@ -1,7 +1,7 @@ define([ 'knockout-plus', 'kb_common/html' -], function( +], function ( ko, html ) { diff --git a/src/plugins/components/modules/components/elapsedClock.js b/src/plugins/components/modules/components/elapsedClock.js index e0758fa9c..d8716cda1 100644 --- a/src/plugins/components/modules/components/elapsedClock.js +++ b/src/plugins/components/modules/components/elapsedClock.js @@ -2,7 +2,7 @@ define([ 'knockout-plus', 'kb_common/html', '../clock' -], function( +], function ( ko, html, Clock @@ -113,10 +113,10 @@ define([ if (startTime) { var e = currentTime() - startTime; return niceDuration(e); - } + } return 'n/a'; }); - + function dispose() { if (listener) { Clock.globalClock.forget(listener); @@ -129,7 +129,7 @@ define([ dispose: dispose }); } - + function template() { return div([ span({ diff --git a/src/plugins/components/modules/components/error.js b/src/plugins/components/modules/components/error.js index 2025a140a..1bbb1a6ad 100644 --- a/src/plugins/components/modules/components/error.js +++ b/src/plugins/components/modules/components/error.js @@ -13,7 +13,7 @@ define([ div = t('div'); // function validateViewModel(params) { - // var spec = { + // var spec = { // source: { // type: 'string', // observable: true, @@ -80,7 +80,7 @@ define([ '', BS.buildPanel({ name: 'source', - class: 'kb-panel-light', + class: 'kb-panel-light', title: 'Source', type: 'danger', body: div({ @@ -101,9 +101,9 @@ define([ text: 'code' } }) - }), + }), '', - '', + '', BS.buildCollapsiblePanel({ name: 'detail', title: 'Detail', @@ -159,7 +159,6 @@ define([ ]); } - function component() { return { viewModel: viewModel, diff --git a/src/plugins/components/modules/components/help.js b/src/plugins/components/modules/components/help.js index ad55ca9fe..d5796e7c1 100644 --- a/src/plugins/components/modules/components/help.js +++ b/src/plugins/components/modules/components/help.js @@ -71,19 +71,19 @@ define([ } }, indexList: { - css: { + css: { listStyle: 'none', padding: '0' } }, indexListItem: { - css: { + css: { display: 'block', padding: '4px' } }, indexListItemLink: { - css: { + css: { padding: '4px', display: 'block' }, @@ -118,7 +118,7 @@ define([ }, markdown: { css: { - + }, inner: { blockquote: { diff --git a/src/plugins/components/modules/components/overlayPanel.js b/src/plugins/components/modules/components/overlayPanel.js index bf30ba889..848ca43dc 100644 --- a/src/plugins/components/modules/components/overlayPanel.js +++ b/src/plugins/components/modules/components/overlayPanel.js @@ -17,7 +17,7 @@ define([ ) { 'use strict'; - var t = html.tag, + var t = html.tag, span = t('span'), div = t('div'); @@ -34,7 +34,7 @@ define([ openMessage = message.open; showPanel(false); } else { - showPanel(false); + showPanel(false); } }); bus.on('clear', function () { @@ -42,15 +42,15 @@ define([ embeddedComponentName(null); }); - bus.on('open', function(message) { + bus.on('open', function (message) { if (showPanel()) { bus.send('close', {open: message}); return; - } + } showPanel(true); embeddedComponentName(message.name); - + embeddedParams('{' + Object.keys(message.params || {}).map(function (key) { return key + ':' + message.params[key]; }).join(', ') + '}'); @@ -60,14 +60,14 @@ define([ return accum; }, {}); newVm.onClose = doClose; - embeddedViewModel(newVm); + embeddedViewModel(newVm); }); function doClose() { bus.send('close'); } - var panelStyle = ko.pureComputed(function() { + var panelStyle = ko.pureComputed(function () { if (showPanel() === undefined) { // the initial state; return; @@ -81,31 +81,31 @@ define([ // var type = ko.observable(params.type || 'info'); - var typeBackgroundColor = ko.pureComputed(function() { + var typeBackgroundColor = ko.pureComputed(function () { if (!params.component()) { return; } - switch (params.component().type) { + switch (params.component().type) { case 'error': return 'rgba(145, 91, 91, 0.8)'; case 'info': default: // return 'rgba(0, 0, 0, 0.8)'; - return 'rgba(64, 89, 140, 0.8)'; - } + return 'rgba(64, 89, 140, 0.8)'; + } }); var embeddedComponentName = ko.observable(); var embeddedParams = ko.observable(); var embeddedViewModel = ko.observable({}); - + embeddedParams.onClose = 'doClose'; // The viewmodel for the embedded component subscriptions.add(params.component.subscribe(function (newValue) { if (newValue) { - bus.send('open', newValue); + bus.send('open', newValue); } else { if (showPanel()) { bus.send('close'); @@ -116,7 +116,7 @@ define([ function onPanelAnimationEnd(data, ev) { if (ev.target.classList.contains(styles.classes.panelout)) { bus.send('clear'); - // HACK ALERT: since we are using knockout event listener, set + // HACK ALERT: since we are using knockout event listener, set // persistently on the node, we don't have any context for this // animation end ... so if this was a close with open, the // open message will have been set ... @@ -242,7 +242,7 @@ define([ } } } - }, + }, rules: { keyframes: { slidein: { @@ -293,7 +293,7 @@ define([ class: styles.classes.panelBody }, [ '', - '', + '', div({ dataBind: { component: { diff --git a/src/plugins/components/modules/components/overlayPanelBootstrappish.js b/src/plugins/components/modules/components/overlayPanelBootstrappish.js index 9af8c5df1..ad4637323 100644 --- a/src/plugins/components/modules/components/overlayPanelBootstrappish.js +++ b/src/plugins/components/modules/components/overlayPanelBootstrappish.js @@ -17,7 +17,7 @@ define([ ) { 'use strict'; - var t = html.tag, + var t = html.tag, span = t('span'), div = t('div'); @@ -34,7 +34,7 @@ define([ openMessage = message.open; showPanel(false); } else { - showPanel(false); + showPanel(false); } }); bus.on('clear', function () { @@ -42,15 +42,15 @@ define([ embeddedComponentName(null); }); - bus.on('open', function(message) { + bus.on('open', function (message) { if (showPanel()) { bus.send('close', {open: message}); return; - } + } showPanel(true); embeddedComponentName(message.name); - + embeddedParams('{' + Object.keys(message.params || {}).map(function (key) { return key + ':' + message.params[key]; }).join(', ') + '}'); @@ -60,14 +60,14 @@ define([ return accum; }, {}); newVm.onClose = doClose; - embeddedViewModel(newVm); + embeddedViewModel(newVm); }); function doClose() { bus.send('close'); } - var panelStyle = ko.pureComputed(function() { + var panelStyle = ko.pureComputed(function () { if (showPanel() === undefined) { // the initial state; return; @@ -81,31 +81,31 @@ define([ // var type = ko.observable(params.type || 'info'); - var typeBackgroundColor = ko.pureComputed(function() { + var typeBackgroundColor = ko.pureComputed(function () { if (!params.component()) { return; } - switch (params.component().type) { + switch (params.component().type) { case 'error': return 'rgba(145, 91, 91, 0.8)'; case 'info': default: // return 'rgba(0, 0, 0, 0.8)'; - return 'rgba(64, 89, 140, 0.8)'; - } + return 'rgba(64, 89, 140, 0.8)'; + } }); var embeddedComponentName = ko.observable(); var embeddedParams = ko.observable(); var embeddedViewModel = ko.observable({}); - + embeddedParams.onClose = 'doClose'; // The viewmodel for the embedded component subscriptions.add(params.component.subscribe(function (newValue) { if (newValue) { - bus.send('open', newValue); + bus.send('open', newValue); } else { if (showPanel()) { bus.send('close'); @@ -116,7 +116,7 @@ define([ function onPanelAnimationEnd(data, ev) { if (ev.target.classList.contains(styles.classes.panelout)) { bus.send('clear'); - // HACK ALERT: since we are using knockout event listener, set + // HACK ALERT: since we are using knockout event listener, set // persistently on the node, we don't have any context for this // animation end ... so if this was a close with open, the // open message will have been set ... @@ -242,7 +242,7 @@ define([ } } } - }, + }, rules: { keyframes: { slidein: { @@ -293,7 +293,7 @@ define([ class: styles.classes.panelBody }, [ '', - '', + '', div({ dataBind: { component: { diff --git a/src/plugins/components/modules/components/relativeClock.js b/src/plugins/components/modules/components/relativeClock.js index 6445e7ee6..cd010cd0f 100644 --- a/src/plugins/components/modules/components/relativeClock.js +++ b/src/plugins/components/modules/components/relativeClock.js @@ -2,7 +2,7 @@ define([ 'knockout-plus', 'kb_common/html', '../clock' -], function( +], function ( ko, html, Clock @@ -93,10 +93,10 @@ define([ var elapsed = ko.pureComputed(function () { if (startTime) { return niceElapsedTime(startTime, currentTime()); - } + } return 'n/a'; }); - + function dispose() { if (listener) { Clock.globalClock.forget(listener); @@ -109,7 +109,7 @@ define([ dispose: dispose }); } - + function template() { return div([ span({ diff --git a/src/plugins/components/modules/components/table.js b/src/plugins/components/modules/components/table.js index d7187041c..2a8533ef0 100644 --- a/src/plugins/components/modules/components/table.js +++ b/src/plugins/components/modules/components/table.js @@ -108,8 +108,8 @@ define([ textAlign: 'left', display: 'flex', alignItems: 'center' - } - }, + } + }, innerCell: { flex: '1 1 0px', overflow: 'hidden', @@ -175,7 +175,7 @@ define([ var subscriptions = ko.kb.SubscriptionManager.make(); var slowLoadingThreshold = 300; - + var table = params.table; var columns = table.columns; // calculate widths... @@ -201,10 +201,10 @@ define([ var sortDirection = ko.observable('descending'); /* - Sorting is managed here in the table, and we + Sorting is managed here in the table, and we communicate changes via the table.sortColumn() call. We don't know whether the implementation supports - single or multiple column sorts, etc. + single or multiple column sorts, etc. In turn, the sorted property may be set to asending, descending, or falsy. */ @@ -216,11 +216,11 @@ define([ // we hinge upon the height, which is updated when we start and when the ... var height = ko.observable(); - + function calcHeight() { return componentInfo.element.querySelector('.' + styles.classes.tableBody).clientHeight; } - + // A cheap delay to avoid excessive resizing. var resizerTimeout = 200; var resizerTimer = null; @@ -241,9 +241,9 @@ define([ subscriptions.add(height.subscribe(function (newValue) { if (!newValue) { table.pageSize(null); - } + } + - var rowCount = Math.floor(newValue / rowHeight); table.pageSize(rowCount); @@ -273,7 +273,7 @@ define([ doRowAction = null; } - + var isLoadingSlowly = ko.observable(false); @@ -293,7 +293,7 @@ define([ } isLoadingSlowly(false); } - + subscriptions.add(table.isLoading.subscribe(function (loading) { if (loading) { timeLoading(); @@ -369,7 +369,7 @@ define([ }, [ '', div({ - + class: [styles.classes.innerSortCell] }, [ // header label @@ -381,7 +381,7 @@ define([ text: 'column.label' }, style: { - + marginRight: '2px' }, }) @@ -460,9 +460,9 @@ define([ click: 'function () {$component.doOpenUrl(row[column.name]);}', clickBubble: 'false' } - }), + }), '', - + '', span({ dataBind: { @@ -477,7 +477,7 @@ define([ } }), '', - + '', ]; } @@ -694,7 +694,7 @@ define([ } }, class: styles.classes.itemRows - }, [ + }, [ div({ dataBind: { foreach: { @@ -760,8 +760,8 @@ define([ '', - '', - buildColValue(), + '', + buildColValue(), '', // '', @@ -774,7 +774,7 @@ define([ // } // }), '', - + '', // '', // span({ @@ -799,7 +799,7 @@ define([ right: '0', top: '0', bottom: '0', - backgroundColor: 'rgba(255, 255, 255, 0.5)', + backgroundColor: 'rgba(255, 255, 255, 0.5)', fontSize: '300%', display: 'flex', flexDirection: 'column', @@ -862,7 +862,7 @@ define([ class: styles.classes.tableBody }, [ // Handle case of a search having been run, but nothing found. - '', + '', '', div({ @@ -874,7 +874,7 @@ define([ }, buildNoResults()), '', - // Handle case of no active search. We don't want to confuse the user + // Handle case of no active search. We don't want to confuse the user // by indicating that nothing was found. '', div({ diff --git a/src/plugins/contact/source/javascript/panel.js b/src/plugins/contact/source/javascript/panel.js index 1e031bdb2..755bf15a1 100644 --- a/src/plugins/contact/source/javascript/panel.js +++ b/src/plugins/contact/source/javascript/panel.js @@ -105,7 +105,7 @@ define([ function ContactViewModel() { // NB by using the event handler first argument, we can avoid usage of - // the 'this', which would also work (being bound to the object the + // the 'this', which would also work (being bound to the object the // event handler is accessed.) function submitIt(contact) { var name = contact.name(); diff --git a/src/plugins/mainwindow/modules/buttonbarWidget.js b/src/plugins/mainwindow/modules/buttonbarWidget.js index 60b632d2c..31397475e 100644 --- a/src/plugins/mainwindow/modules/buttonbarWidget.js +++ b/src/plugins/mainwindow/modules/buttonbarWidget.js @@ -2,12 +2,12 @@ define([ 'kb_widget/bases/simpleWidget', 'kb_common/html' ], function ( - SimpleWidgetFactory, + SimpleWidgetFactory, html ) { 'use strict'; - let t = html.tag, + const t = html.tag, div = t('div'), span = t('span'), button = t('button'), @@ -24,7 +24,7 @@ define([ return this; } function addButton(w, buttonDef) { - let buttons = w.get('buttons'); + const buttons = w.get('buttons'); buttonDef.type = 'button'; if (buttonDef.external) { buttonDef.target = '_blank'; @@ -43,18 +43,19 @@ define([ w.set('buttons', buttons); } function renderButton(w, buttonDef) { - let label, - labelStyle = {}, + const labelStyle = {}, events = []; + let label; + if (buttonDef.label) { label = div({class: 'kb-nav-btn-txt'}, buttonDef.label); } else { label = ''; labelStyle.fontSize = '150%'; } - - let buttonAttribs = { + + const buttonAttribs = { dataButton: buttonDef.name, disabled: buttonDef.disabled, class: ['btn', 'btn-' + (buttonDef.style || 'default'), 'navbar-btn', 'kb-nav-btn'].join(' ') @@ -91,7 +92,7 @@ define([ return { content: button(buttonAttribs, [ div({ - class: 'fa fa-' + buttonDef.icon, + class: 'fa fa-' + buttonDef.icon, style: labelStyle }), label @@ -101,7 +102,7 @@ define([ } function renderButtonBar(w) { - let content = span({class: 'navbar-buttons kb-widget-buttonbar'}, [ + const content = span({class: 'navbar-buttons kb-widget-buttonbar'}, [ w.get('buttons').list.map(function (buttonDef) { switch (buttonDef.type) { case 'button': @@ -116,7 +117,7 @@ define([ } function enableButton(w, id) { - let buttons = w.get('buttons'); + const buttons = w.get('buttons'); if (buttons.map[id]) { buttons.map[id].disabled = false; } @@ -124,7 +125,7 @@ define([ } function disableButton(w, id) { - let buttons = w.get('buttons'); + const buttons = w.get('buttons'); if (buttons.map[id]) { buttons.map[id].disabled = true; } @@ -156,7 +157,7 @@ define([ // li = html.tag('li'), // a = html.tag('a'), // itemButton; - + // if (itemDef.icon) { // itemButton = li([ // div({class: 'navbar-icon'}, [ @@ -171,7 +172,7 @@ define([ // ]) // ]); // } - + // if (itemDef.url) { // // a link style button // return a({ @@ -180,7 +181,7 @@ define([ // href: itemDef.url, // target: itemDef.target // }, itemButton); - // } + // } // return a({ // href: '#', // dataMenuItem: itemDef.name, @@ -239,7 +240,7 @@ define([ // } // }) // ]); - + // var dropdown = div({class: 'dropdown', stlyle: {display: 'inline-block'}}, [ // button, // menu @@ -264,7 +265,7 @@ define([ }); }, start: function () { - let widget = this; + const widget = this; this.recv('ui', 'addButton', function (data) { addButton(widget, data); }); diff --git a/src/plugins/mainwindow/modules/components/countdownClock.js b/src/plugins/mainwindow/modules/components/countdownClock.js index fcd3fd982..3fb30e12c 100644 --- a/src/plugins/mainwindow/modules/components/countdownClock.js +++ b/src/plugins/mainwindow/modules/components/countdownClock.js @@ -11,7 +11,7 @@ define([ ) { 'use strict'; - let t = html.tag, + const t = html.tag, span = t('span'); class ViewModel { diff --git a/src/plugins/mainwindow/modules/components/hamburgerMenu.js b/src/plugins/mainwindow/modules/components/hamburgerMenu.js index a41d8ca52..b98e47989 100644 --- a/src/plugins/mainwindow/modules/components/hamburgerMenu.js +++ b/src/plugins/mainwindow/modules/components/hamburgerMenu.js @@ -27,7 +27,7 @@ define([ // TODO: swtich on type - li([ + li([ a({ dataBind: { attr: { @@ -61,9 +61,9 @@ define([ } function buildDivider() { - return li({ - role: 'presentation', - class: 'divider' + return li({ + role: 'presentation', + class: 'divider' }); } @@ -77,8 +77,8 @@ define([ dataToggle: 'dropdown', ariaHaspopup: 'true' }, [ - span({ - class: 'fa fa-navicon' + span({ + class: 'fa fa-navicon' }) ]), ul({ @@ -87,7 +87,7 @@ define([ ariaLabeledby: 'kb-nav-menu', dataBind: { with: 'menu' - } + } }, [ buildMenuItems('main'), '', diff --git a/src/plugins/mainwindow/modules/components/notification.js b/src/plugins/mainwindow/modules/components/notification.js index be2a335fb..fb9c0a477 100644 --- a/src/plugins/mainwindow/modules/components/notification.js +++ b/src/plugins/mainwindow/modules/components/notification.js @@ -21,8 +21,8 @@ define([ function viewModel(params) { - let runtime = params.runtime; - let sendingChannel = new Uuid(4).format(); + const runtime = params.runtime; + const sendingChannel = new Uuid(4).format(); var notificationQueue = ko.observableArray(); var notificationMap = {}; @@ -167,7 +167,7 @@ define([ autodismiss.subscribe(function (newVal) { if (newVal) { - // TODO: this + // TODO: this autodismiss.startedAt = new Date().getTime(); startAutoDismisser(); } diff --git a/src/plugins/mainwindow/modules/components/systemAlertBanner.js b/src/plugins/mainwindow/modules/components/systemAlertBanner.js index 220bbc5f0..a3fa3d2ac 100644 --- a/src/plugins/mainwindow/modules/components/systemAlertBanner.js +++ b/src/plugins/mainwindow/modules/components/systemAlertBanner.js @@ -17,20 +17,19 @@ define([ ) { 'use strict'; - let t = html.tag, - p = t('p'), + const t = html.tag, button = t('button'), span = t('span'), div = t('div'); - let styles = html.makeStyles({ + const styles = html.makeStyles({ component: { css: { } }, wrapper: { css: { - margin: '0 0px 10px 10px', + margin: '0 0px 10px 10px', } } }); @@ -49,9 +48,9 @@ define([ this.maintenanceNotifications = ko.pureComputed(() => { return this._maintenanceNotifications() .filter((notification) => { - let endTime = notification.endAt.getTime(); - let now = this.now(); - if ( (now - endTime) > 60000) { + const endTime = notification.endAt.getTime(); + const now = this.now(); + if ((now - endTime) > 60000) { return false; } return true; @@ -72,13 +71,13 @@ define([ if (!newValue) { return []; } - - let hashes = []; + + const hashes = []; newValue.upcomingMaintenanceWindows .forEach((notification) => { - let hash = md5.hash(JSON.stringify(notification)); + const hash = md5.hash(JSON.stringify(notification)); hashes.push(hash); - let existing = this._maintenanceNotifications().some((item) => { + const existing = this._maintenanceNotifications().some((item) => { return item.hash === hash; }); if (existing) { @@ -87,7 +86,7 @@ define([ } // add new ones. - let newNotification = { + const newNotification = { startAt: new Date(notification.startAt), endAt: new Date(notification.endAt), title: notification.title, @@ -97,7 +96,7 @@ define([ }; this._maintenanceNotifications.push(newNotification); }); - + this._maintenanceNotifications().forEach((item) => { if (hashes.indexOf(item.hash) === -1) { this._maintenanceNotifications.remove(item); @@ -155,7 +154,7 @@ define([ style: { fontWeight: 'bold' } - }), + }), button({ type: 'button', class: 'close', @@ -184,7 +183,7 @@ define([ width: '50%' } }, [ - + div({ dataBind: { text: 'message' @@ -266,7 +265,7 @@ define([ text: 'maintenanceNotifications().length' } }), - gen.plural('maintenanceNotifications().length', ' alert', ' alerts'), + gen.plural('maintenanceNotifications().length', ' alert', ' alerts'), gen.if('hiddenMaintenanceNotificationCount() > 0', [ ' (', @@ -286,7 +285,7 @@ define([ 'show', gen.plural('hiddenMaintenanceNotificationCount()', ' it', ' them') ])), - + ')' ]) ]) @@ -298,7 +297,7 @@ define([ return div({ class: styles.classes.component }, [ - gen.if('error()', + gen.if('error()', div({ class: styles.classes.wrapper }, buildError()), @@ -307,7 +306,7 @@ define([ class: styles.classes.wrapper }, [ buildHeader(), - gen.foreach('maintenanceNotifications()', + gen.foreach('maintenanceNotifications()', gen.ifnot('read', buildMaintenanceNotification())) ]))) ]); diff --git a/src/plugins/mainwindow/modules/loginWidget.js b/src/plugins/mainwindow/modules/loginWidget.js index 5985a1c99..3be7c81f3 100644 --- a/src/plugins/mainwindow/modules/loginWidget.js +++ b/src/plugins/mainwindow/modules/loginWidget.js @@ -67,14 +67,14 @@ define([ function renderLogin(events) { return Promise.try(function () { if (runtime.service('session').isLoggedIn()) { - /* TODO: fix dependencies like this -- realname is not available until, and unless, the - profile is loaded, which happens asynchronously. + /* TODO: fix dependencies like this -- realname is not available until, and unless, the + profile is loaded, which happens asynchronously. */ /// ar profile = widget.get('userProfile'), realname; return runtime.service('session').getAccount() .then(function (account) { if (!account) { - // Don't bother rendering yet if the profile is not ready + // Don't bother rendering yet if the profile is not ready // yet. return; } @@ -147,7 +147,7 @@ define([ }); } - function start(params) { + function start() { return Promise.try(function () { // this.set('loggedin', runtime.service('session').isLoggedIn()); // runtime.service('userprofile').onChange(function (data) { diff --git a/src/plugins/mainwindow/modules/logoWidget.js b/src/plugins/mainwindow/modules/logoWidget.js index a10687f29..d1611b9bd 100644 --- a/src/plugins/mainwindow/modules/logoWidget.js +++ b/src/plugins/mainwindow/modules/logoWidget.js @@ -21,7 +21,7 @@ define([ function start() { // var uiTarget = runtime.config('buildInfo.target'); - // var version; + // var version; // if (uiTarget === 'prod') { // version = runtime.config('release.version'); // } else { diff --git a/src/plugins/mainwindow/modules/mainWindow.js b/src/plugins/mainwindow/modules/mainWindow.js index 722a4690f..e14bb47fd 100644 --- a/src/plugins/mainwindow/modules/mainWindow.js +++ b/src/plugins/mainwindow/modules/mainWindow.js @@ -3,7 +3,7 @@ * The Main Window implements the widget interface, of course. It is controlled * by the main entry point program, probably main.js * The main window is the controller, manager, coordinator, whatever you want to - * call it, for the primary user interface widgets. These widget include, at + * call it, for the primary user interface widgets. These widget include, at * present: * - main (hamburger) menu * - logo @@ -13,9 +13,9 @@ * - user account * - console * - main content - * - * Each of these areas is implemented as a widget. As much as possible, the - * Main Window tries to keep out of the way, and just manage the widgets. + * + * Each of these areas is implemented as a widget. As much as possible, the + * Main Window tries to keep out of the way, and just manage the widgets. * Each of them may listen for messages from other parts of the user interface. */ define([ diff --git a/src/plugins/mainwindow/modules/menuWidget.js b/src/plugins/mainwindow/modules/menuWidget.js index edf2ed4d0..e498ecd11 100644 --- a/src/plugins/mainwindow/modules/menuWidget.js +++ b/src/plugins/mainwindow/modules/menuWidget.js @@ -21,7 +21,6 @@ define([ return a2.indexOf(a) >= 0; }); } - function attach(node) { hostNode = node; @@ -70,7 +69,7 @@ define([ } if (item.allowRoles) { return intersect(item.allowRoles, userRoles); - } + } return true; }), help: ko.observableArray(menu.help).filter(function (item) { @@ -82,7 +81,7 @@ define([ } if (item.allowRoles) { return intersect(item.allowRoles, userRoles); - } + } return true; }) }; @@ -94,7 +93,7 @@ define([ } var viewModel = ViewModel(); - + function start() { container.innerHTML = div({ dataBind: { diff --git a/src/plugins/mainwindow/modules/notificationWidget.1.js b/src/plugins/mainwindow/modules/notificationWidget.1.js index 1148ba948..495bf0be7 100644 --- a/src/plugins/mainwindow/modules/notificationWidget.1.js +++ b/src/plugins/mainwindow/modules/notificationWidget.1.js @@ -133,7 +133,7 @@ define([ }; } - function viewModel(params) { + function viewModel() { var notifications = { info: notification({ label: 'info' @@ -309,7 +309,7 @@ define([ container = node; } - function start(params) { + function start() { container.innerHTML = div({ dataBind: { component: { diff --git a/src/plugins/mainwindow/modules/notificationWidget.multiple-types.js b/src/plugins/mainwindow/modules/notificationWidget.multiple-types.js index c33fa32e2..32cf8e238 100644 --- a/src/plugins/mainwindow/modules/notificationWidget.multiple-types.js +++ b/src/plugins/mainwindow/modules/notificationWidget.multiple-types.js @@ -151,7 +151,7 @@ define([ } - function viewModel(params) { + function viewModel() { var notifications = { info: notificationSet({ label: 'info' @@ -212,8 +212,8 @@ define([ dataBind: { event: { click: 'doToggleNotification' - // mouseover: 'doMouseOver', - // mouseout: 'doMouseOut' + // mouseover: 'doMouseOver', + // mouseout: 'doMouseOut' }, // style: { // '"background-color"': 'backgroundColor' @@ -270,19 +270,19 @@ define([ } }, div({ class: '-notification' - // dataBind: { - // css: { - // '"-hover"': 'over' - // } - // } + // dataBind: { + // css: { + // '"-hover"': 'over' + // } + // } }, [ div({ dataBind: { text: 'message' - // event: { - // mouseover: 'doMouseOver', - // mouseout: 'doMouseOut' - // } + // event: { + // mouseover: 'doMouseOver', + // mouseout: 'doMouseOut' + // } }, style: { display: 'inline-block' @@ -343,7 +343,7 @@ define([ container = node; } - function start(params) { + function start() { container.innerHTML = div({ dataBind: { component: { diff --git a/src/plugins/mainwindow/modules/sidebarNav.js b/src/plugins/mainwindow/modules/sidebarNav.js index eaf2e702f..a3f447c70 100644 --- a/src/plugins/mainwindow/modules/sidebarNav.js +++ b/src/plugins/mainwindow/modules/sidebarNav.js @@ -9,8 +9,8 @@ define([ html, SidebarMenuComponent ) { - 'use strict'; - + 'use strict'; + var t = html.tag, div = t('div'); @@ -48,8 +48,8 @@ define([ var isLoggedIn = ko.observable(initiallyLoggedIn); // var username = ko.ovservable(runtime.service('session').getUsername()); - // A session state change may signal that the session has been logged - // out. + // A session state change may signal that the session has been logged + // out. runtime.recv('session', 'change', function () { isLoggedIn(runtime.service('session').isLoggedIn()); }); @@ -76,7 +76,7 @@ define([ buttonsPathMap[viewButton.path] = viewButton; }); - // weird, the filter doesn't work with elements added via push if the push is + // weird, the filter doesn't work with elements added via push if the push is // invoked after the filter is attached. // TODO: look for a fix, or switch to the Sanderson projections. var filteredButtons = buttons.filter(function (item) { @@ -98,7 +98,7 @@ define([ var path = routeToPath(route); var button = buttonsPathMap[path]; if (!button) { - return; + return; } button.active(true); } @@ -117,7 +117,7 @@ define([ return { buttons: filteredButtons, selecteButton: selectButton, - isAuthorized: isAuthorized + isAuthorized: isAuthorized }; } diff --git a/src/plugins/mainwindow/modules/systemAlertBanner.js b/src/plugins/mainwindow/modules/systemAlertBanner.js index b4b959fb9..e526f7f50 100644 --- a/src/plugins/mainwindow/modules/systemAlertBanner.js +++ b/src/plugins/mainwindow/modules/systemAlertBanner.js @@ -13,15 +13,16 @@ define([ 'use strict'; function factory(config) { - let t = html.tag, + const t = html.tag, div = t('div'), - runtime = config.runtime, - hostNode, container; + runtime = config.runtime; + + let hostNode, container; let newAlertsPoller; function getActiveAlerts() { - let client = new runtime.service('rpc').makeClient({ + const client = new runtime.service('rpc').makeClient({ module: 'UIService' }); @@ -34,11 +35,11 @@ define([ function attach(node) { hostNode = node; container = hostNode.appendChild(document.createElement('div')); - container.classList.add('widget-menu'); + container.classList.add('widget-menu'); } function start() { - let vm = { + const vm = { runtime: runtime, systemStatus: ko.observable(), error: ko.observable() @@ -52,7 +53,7 @@ define([ // }) return getActiveAlerts() .then((data) => { - let systemStatus = { + const systemStatus = { upcomingMaintenanceWindows: data }; vm.systemStatus(systemStatus); @@ -75,7 +76,7 @@ define([ // description: 'Load notifications', // interval: 10000 // }); - + // newAlertsPoller.start(); class LoadNotificationsJob extends poller.Job { constructor() { @@ -87,16 +88,16 @@ define([ return loadNotifications(); } } - let job = new LoadNotificationsJob(); + const job = new LoadNotificationsJob(); // let job = new poller.Job({ // run: () => { // return loadNotifications(); // }, // description: 'Load notifications' // }); - let task = new poller.Task({ + const task = new poller.Task({ interval: 10000, - runInitially: true + runInitially: true }); task.addJob(job); diff --git a/src/plugins/mainwindow/modules/titleWidget.js b/src/plugins/mainwindow/modules/titleWidget.js index e17bd0a4d..31db40e66 100644 --- a/src/plugins/mainwindow/modules/titleWidget.js +++ b/src/plugins/mainwindow/modules/titleWidget.js @@ -28,7 +28,7 @@ define([ function start() { // Listen for a setTitle message sent to the ui. - // We use the widget convenience function in order to + // We use the widget convenience function in order to // get automatic event listener cleanup. We could almost // as easily do this ourselves. runtime.recv('ui', 'setTitle', function (newTitle) { diff --git a/src/plugins/mainwindow/modules/widgets/alert.js b/src/plugins/mainwindow/modules/widgets/alert.js index 8e17d598e..32cb116c1 100644 --- a/src/plugins/mainwindow/modules/widgets/alert.js +++ b/src/plugins/mainwindow/modules/widgets/alert.js @@ -1,15 +1,12 @@ define([ 'knockout', - 'kb_common/html', - 'kb_plugin_mainWindow' + 'kb_common/html' ], function ( ko, - html, - Plugin + html ) { 'use strict'; var t = html.tag, - a = t('a'), span = t('span'), div = t('div'), button = t('button'), @@ -23,8 +20,6 @@ define([ width: '100%', padding: '0', margin: '0' - // border: '1px silver solid', - // borderCollapse: 'inherit' } }, [ // Title @@ -270,11 +265,11 @@ define([ viewModel: viewModel, // Required in order to make the alert component available within // the service api start semantics. - // Component loading is asynchronous, and there is no hook for + // Component loading is asynchronous, and there is no hook for // getting component loading completion, which we could use to build a // promise. // TODO: see if there are changes in progress, or otherwise research what - // would be required for this. At the least, the viewmodel building would + // would be required for this. At the least, the viewmodel building would // need async hooks, as well as applyBindings. synchronous: true }; @@ -285,8 +280,7 @@ define([ function factory(config) { var hostNode, container, runtime = config.runtime, - listeners = [], - timeouts = []; + listeners = []; // function updateAlert(node, alert) { // node.classList.forEach(function (klass) { @@ -391,7 +385,7 @@ define([ container = hostNode.appendChild(document.createElement('div')); } - function start(params) { + function start() { render(); // listeners.push(runtime.recv('ui', 'alert', function (alert) { // setAlert(alert); diff --git a/src/plugins/mainwindow/modules/widgets/buttonBar.js b/src/plugins/mainwindow/modules/widgets/buttonBar.js index a365168aa..f99f42f83 100644 --- a/src/plugins/mainwindow/modules/widgets/buttonBar.js +++ b/src/plugins/mainwindow/modules/widgets/buttonBar.js @@ -1,235 +1,241 @@ -define(['jquery'], - function ($) { - "use strict"; - return Object.create({}, { - init: { +define([ + 'jquery' +], +function ( + $ +) { + 'use strict'; + return Object.create({}, { + init: { value: function (cfg) { - if (typeof cfg.container === 'string') { - this.container = $(cfg.container); - } else { - this.container = cfg.container; - } - return this; + if (typeof cfg.container === 'string') { + this.container = $(cfg.container); + } else { + this.container = cfg.container; + } + return this; } - }, - version: { - value: "0.0.1" - }, - getVersion: { + }, + version: { + value: '0.0.1' + }, + getVersion: { value: function () { - return this.version; + return this.version; } - }, - loadCSS: { + }, + loadCSS: { value: function () { - // TODO: this shold only load once. - $('') - .appendTo('head') - .attr({ - type: 'text/css', - rel: 'stylesheet' - }) - .attr('href', '/src/widgets/Buttonbar/style.css'); - return this; + // TODO: this shold only load once. + $('') + .appendTo('head') + .attr({ + type: 'text/css', + rel: 'stylesheet' + }) + .attr('href', '/src/widgets/Buttonbar/style.css'); + return this; } - }, - - clear: { + }, + + clear: { value: function () { - this.container.empty(); - return this; + this.container.empty(); + return this; } - }, - makeButton: { + }, + makeButton: { value: function (cfg) { - var iconStyle = 'margin-right: 5px;'; - var label = ''; - if (cfg.label) { - label = '' + cfg.label + ''; - } else { - // iconStyle += 'font-size: 150%;'; - } - //if (cfg.color) { - // iconStyle += 'color: ' + cfg.color + ';'; - //} - - if (cfg.url) { - // a link style button - if (cfg.external) { - cfg.target = '_blank'; - } - if (cfg.target) { - var target = 'target="' + cfg.target + '"'; - } else { - var target = ''; - } - var button = $('' + - ' ' + label + '') + var iconStyle = 'margin-right: 5px;'; + var label = ''; + if (cfg.label) { + label = '' + cfg.label + ''; + } else { + // iconStyle += 'font-size: 150%;'; + } + //if (cfg.color) { + // iconStyle += 'color: ' + cfg.color + ';'; + //} + var button; + if (cfg.url) { + // a link style button + if (cfg.external) { + cfg.target = '_blank'; + } + var target; + if (cfg.target) { + target = 'target="' + cfg.target + '"'; + } else { + target = ''; + } + button = $('' + + ' ' + label + ''); - } else { - var button = $('') - .on('click', function (e) { - e.preventDefault(); - cfg.callback(); - }); - } - if (cfg.disabled) { - button.prop('disabled', true); - } - return button; + .on('click', function (e) { + e.preventDefault(); + cfg.callback(); + }); + } + if (cfg.disabled) { + button.prop('disabled', true); + } + return button; } - }, - addButton: { + }, + addButton: { value: function (cfg) { - var button = this.makeButton(cfg); - if (cfg.place === 'end') { - this.container.append(button); - } else { - this.container.prepend(button); - } - return this; + var button = this.makeButton(cfg); + if (cfg.place === 'end') { + this.container.append(button); + } else { + this.container.prepend(button); + } + return this; } - }, - findButton: { + }, + findButton: { value: function (name) { - return this.container.find('[data-button="' + name + '"]'); + return this.container.find('[data-button="' + name + '"]'); } - }, - - addRadioToggle: { + }, + + addRadioToggle: { value: function (cfg) { - var group = $('
'); - for (var i=0; i' + button.label + '') - .on('click', (function (cb) { - return function (e) { - e.preventDefault(); - cb(); - } - })(button.callback)); - group.append(toggle); - } - if (cfg.place === 'end') { - this.container.append(group); - } else { - this.container.prepend(group); - } - return this; + var group = $('
'); + for (var i=0; i' + button.label + '') + .on('click', (function (cb) { + return function (e) { + e.preventDefault(); + cb(); + }; + })(button.callback)); + group.append(toggle); + } + if (cfg.place === 'end') { + this.container.append(group); + } else { + this.container.prepend(group); + } + return this; } - }, - - addDropdown: { + }, + + addDropdown: { value: function (cfg) { - var iconStyle = ''; - var label = ''; - if (cfg.label) { - label = '
' + cfg.label + '
'; - } else { - label = cfg.label + ' '; - // iconStyle += 'font-size: 150%;'; - } - var button = $(''); - if (cfg.disabled) { - button.prop('disabled', true); - } + if (cfg.disabled) { + button.prop('disabled', true); + } - var menu = $(''); - for (var i = 0; i < cfg.items.length; i++) { - var item = cfg.items[i]; - if (item.type === 'divider') { - menu.append('
  • '); - } else { - var menuItem = $('
  • '); + var menu = $(''); + for (var i = 0; i < cfg.items.length; i++) { + var item = cfg.items[i]; + if (item.type === 'divider') { + menu.append('
  • '); + } else { + var menuItem = $('
  • '); + var link; + if (item.url) { + link = $('') + .attr('href', item.url) + .attr('data-menu-item', item.name); + } else if (item.callback) { + link = $('') + .attr('href', '#') + .attr('data-menu-item', item.name) + .on('click', item.callback); + } + if (item.external) { + link.attr('target', '_blank'); + } - if (item.url) { - var link = $('') - .attr('href', item.url) - .attr('data-menu-item', item.name); - } else if (item.callback) { - var link = $('') - .attr('href', '#') - .attr('data-menu-item', item.name) - .on('click', item.callback); - } - if (item.external) { - link.attr('target', '_blank'); - } - - var icon = $(''); - if (item.icon) { - icon.append($('')); - } + var icon = $(''); + if (item.icon) { + icon.append($('')); + } - menu.append(menuItem.append(link.append(icon).append(item.label))); - } - } + menu.append(menuItem.append(link.append(icon).append(item.label))); + } + } - var dropdown = $('').append(button).append(menu); + var dropdown = $('').append(button).append(menu); - if (cfg.place === 'end') { - this.container.append(dropdown); - } else { - this.container.prepend(dropdown); - } - return this; + if (cfg.place === 'end') { + this.container.append(dropdown); + } else { + this.container.prepend(dropdown); + } + return this; } - }, + }, - makeMenuItem: { + makeMenuItem: { value: function (cfg) { - if (cfg.type === 'divider') { - var item = $('').attr('data-menu-item', cfg.name); - } else { - var item = $('
  • '); - if (cfg.url) { - var link = $('') - .attr('href', cfg.url) - .attr('data-menu-item', cfg.name); - } else if (cfg.callback) { - var link = $('') - .attr('href', '#') - .attr('data-menu-item', cfg.name) - .on('click', cfg.callback); - } - if (item.external) { - link.attr('target', '_blank'); - } - var icon = $(''); - if (cfg.icon) { - icon.append($('')); - } - item.append(link.append(icon).append(cfg.label)); - } - return item; + var item, link; + if (cfg.type === 'divider') { + item = $('').attr('data-menu-item', cfg.name); + } else { + item = $('
  • '); + if (cfg.url) { + link = $('') + .attr('href', cfg.url) + .attr('data-menu-item', cfg.name); + } else if (cfg.callback) { + link = $('') + .attr('href', '#') + .attr('data-menu-item', cfg.name) + .on('click', cfg.callback); + } + if (item.external) { + link.attr('target', '_blank'); + } + var icon = $(''); + if (cfg.icon) { + icon.append($('')); + } + item.append(link.append(icon).append(cfg.label)); + } + return item; } - }, - - addInput: { + }, + + addInput: { value: function (cfg) { - // i made up navbar group to have the form be inline-block - var form = $(''); - form.append('
    '); - if (cfg.onkeyup) { - form.on('keyup', (function (cb) { - return function (e) { - cb(e); - } - })(cfg.onkeyup)); - } + // i made up navbar group to have the form be inline-block + var form = $(''); + form.append('
    '); + if (cfg.onkeyup) { + form.on('keyup', (function (cb) { + return function (e) { + cb(e); + }; + })(cfg.onkeyup)); + } if (cfg.place === 'end') { - this.container.append(form); - } else { - this.container.prepend(form); - } - return this; + this.container.append(form); + } else { + this.container.prepend(form); + } + return this; } - } + } + + + }); - - }); - - }); \ No newline at end of file +}); \ No newline at end of file diff --git a/src/plugins/mainwindow/modules/widgets/error.js b/src/plugins/mainwindow/modules/widgets/error.js index 3a9f69c19..6bfe725b3 100644 --- a/src/plugins/mainwindow/modules/widgets/error.js +++ b/src/plugins/mainwindow/modules/widgets/error.js @@ -103,9 +103,8 @@ define([ return compare(obj, shape); } - - function factory(config) { - var mount, container, runtime = config.runtime; + function factory() { + var mount, container; // IMPL @@ -151,16 +150,16 @@ define([ } // We need to always emit an error to the console. The original - // error catch may also emit the error to console.error. + // error catch may also emit the error to console.error. console.error(error); if (error.extra) { error.extended = html.makeObjTable([error.extra], { rotated: true }); } - return div({ - class: 'container-fluid', - dataWidget: 'error' + return div({ + class: 'container-fluid', + dataWidget: 'error' }, html.makePanel({ title: params.title, class: 'danger', diff --git a/src/plugins/mainwindow/modules/widgets/notFound.js b/src/plugins/mainwindow/modules/widgets/notFound.js index 24288526a..ce7a9b784 100644 --- a/src/plugins/mainwindow/modules/widgets/notFound.js +++ b/src/plugins/mainwindow/modules/widgets/notFound.js @@ -17,7 +17,7 @@ define([ td = t('td'); - function factory(config) { + function factory() { var hostNode, container; // IMPL @@ -35,11 +35,11 @@ define([ th({style: {fontWeight: 'normal'}}, 'Key'), th({style: {fontWeight: 'normal'}}, 'Value') ]), - Object.keys(params.request.query).map(function(key) { + Object.keys(params.request.query).map(function (key) { return tr([ td({style: {fontWeight: 'bold'}}, html.embeddableString(key)), td({style: {fontWeight: 'bold'}}, html.embeddableString(params.request.query[key])) - ]) + ]); }).join('\n') ]); } diff --git a/src/plugins/message/modules/panel.js b/src/plugins/message/modules/panel.js index 64778122b..8d8ac7ec1 100644 --- a/src/plugins/message/modules/panel.js +++ b/src/plugins/message/modules/panel.js @@ -2,7 +2,7 @@ define([ 'kb_common/html', 'kb_common/places' ], -function( +function ( html, Places ) { @@ -62,8 +62,7 @@ function( } function start(params) { - var id = params.messageId, - messageInfo = getInfo(params), + var messageInfo = getInfo(params), message = findMessage(params.id, messageInfo); runtime.send('ui', 'setTitle', message.title); places.setContent('title', message.title); @@ -84,7 +83,7 @@ function( } return { - make: function(config) { + make: function (config) { return widget(config); } }; diff --git a/src/plugins/narrativemanager/modules/createNewPanel.js b/src/plugins/narrativemanager/modules/createNewPanel.js index e7e23e6af..1909f4bf0 100644 --- a/src/plugins/narrativemanager/modules/createNewPanel.js +++ b/src/plugins/narrativemanager/modules/createNewPanel.js @@ -51,7 +51,7 @@ define([ } } - // Note that these are exclusive cell creation options. + // Note that these are exclusive cell creation options. if (params.app) { cells = [{ app: params.app }]; } else if (params.method) { diff --git a/src/plugins/narrativemanager/modules/startPanel.js b/src/plugins/narrativemanager/modules/startPanel.js index ac9894e12..18332199b 100644 --- a/src/plugins/narrativemanager/modules/startPanel.js +++ b/src/plugins/narrativemanager/modules/startPanel.js @@ -35,10 +35,10 @@ define([ } //we need to construct a new narrative- we have a first timer return narrativeManager.createTempNarrative({ - cells: [], - parameters: [], - importData: [] - }) + cells: [], + parameters: [], + importData: [] + }) .then(function (result) { return { redirect: { diff --git a/src/plugins/welcome/modules/goodbyePanelWidget.js b/src/plugins/welcome/modules/goodbyePanelWidget.js index 61ce9fc5b..ce3004cf1 100644 --- a/src/plugins/welcome/modules/goodbyePanelWidget.js +++ b/src/plugins/welcome/modules/goodbyePanelWidget.js @@ -14,7 +14,7 @@ function ( // VIEW - function render(params) { + function render() { return div({class: 'container-fluid'}, html.makePanel({ title: 'Signed Out', content: [ diff --git a/src/test/integration-tests/specs/runner.js b/src/test/integration-tests/specs/runner.js index afc0db009..cd857b4d5 100644 --- a/src/test/integration-tests/specs/runner.js +++ b/src/test/integration-tests/specs/runner.js @@ -55,10 +55,10 @@ function makeSelector(base, selector) { break; } return buildSelector(fullPath); - + } function info() { - let args = Array.prototype.slice.call(arguments); + const args = Array.prototype.slice.call(arguments); process.stdout.write(args.join(' ') + '\n'); } function interpValue(value, testData) { @@ -100,16 +100,16 @@ function doTask(spec, task, testData) { // only proceed with a further action if succeeded so far. if (task.text) { - let text = browser.getText(selector); + const text = browser.getText(selector); expect(text).toEqual(interpValue(task.text, testData)); } else if (task.match) { - let toMatch = browser.getText(selector); + const toMatch = browser.getText(selector); expect(toMatch).toMatch(new RegExp(task.text)); } else if (task.number) { - let toCompare = browser.getText(selector); + const toCompare = browser.getText(selector); expect(toCompare).toBeDefined(); - let theNumber = Number(toCompare.replace(/,/g, '')); - + const theNumber = Number(toCompare.replace(/,/g, '')); + Object.keys(task.number).forEach(function (comparison) { var comparisonValue = task.number[comparison]; switch (comparison) { @@ -118,23 +118,23 @@ function doTask(spec, task, testData) { break; case 'greaterThanOrEqual': expect(theNumber).toBeGreaterThanOrEqual(comparisonValue); - break; + break; case 'lessThan': expect(theNumber).toBeLessThan(comparisonValue); break; case 'lessThanOrEqual': expect(theNumber).toBeLessThanOrEqual(comparisonValue); - break; + break; case 'equal': expect(theNumber).toEqual(comparisonValue); - break; + break; } }); } else if (task.count) { // count the elements which matched this selector - let toCompare = browser.elements(selector).value.length; + const toCompare = browser.elements(selector).value.length; expect(toCompare).toBeDefined(); - + Object.keys(task.count).forEach(function (comparison) { var comparisonValue = task.count[comparison]; switch (comparison) { @@ -143,16 +143,16 @@ function doTask(spec, task, testData) { break; case 'greaterThanOrEqual': expect(toCompare).toBeGreaterThanOrEqual(comparisonValue); - break; + break; case 'lessThan': expect(toCompare).toBeLessThan(comparisonValue); break; case 'lessThanOrEqual': expect(toCompare).toBeLessThanOrEqual(comparisonValue); - break; + break; case 'equal': expect(toCompare).toEqual(comparisonValue); - break; + break; } }); } @@ -175,7 +175,7 @@ function doTask(spec, task, testData) { case 'delete-cookie': browser.deleteCookie(); expect(browser.getCookie('kbase_session')).toBeNull(); - break; + break; case 'navigate': browser.url(task.params.url); break;