From 910f9129d44f5d558cef8da504162202234c85ee Mon Sep 17 00:00:00 2001 From: Kelly Domico Date: Thu, 7 Jul 2016 12:39:08 -0700 Subject: [PATCH 1/2] Fix lint errors and warnings --- .../model/auth/checkers/base-access.js | 4 +-- .../cloud-foundry/model/auth/principal.js | 32 +++++++++---------- .../log-stream/log-stream.module.js | 11 ++++--- .../application/summary/summary.module.js | 7 ++-- .../variables/variables.module.spec.js | 25 +++++++-------- 5 files changed, 41 insertions(+), 38 deletions(-) diff --git a/src/plugins/cloud-foundry/model/auth/checkers/base-access.js b/src/plugins/cloud-foundry/model/auth/checkers/base-access.js index 21ac416e33..a48310614a 100644 --- a/src/plugins/cloud-foundry/model/auth/checkers/base-access.js +++ b/src/plugins/cloud-foundry/model/auth/checkers/base-access.js @@ -35,8 +35,8 @@ _doesContainGuid: function (array, guid) { return array.map(function (element) { - return element.metadata.guid; - }).indexOf(guid) > -1; + return element.metadata.guid; + }).indexOf(guid) > -1; } }; } diff --git a/src/plugins/cloud-foundry/model/auth/principal.js b/src/plugins/cloud-foundry/model/auth/principal.js index ce7f3de2d2..3825c0467f 100644 --- a/src/plugins/cloud-foundry/model/auth/principal.js +++ b/src/plugins/cloud-foundry/model/auth/principal.js @@ -31,13 +31,13 @@ /** * @name Principal * @description initialise a Principal object - * @param {String} username - * @param {String} authToken - * @param {String} refreshToken - * @param {String} expiresIn - * @param {String} tokenType - * @param {Object} scope - * @param {Object} userInfo + * @param {String} username - username + * @param {String} authToken - OAuth access token + * @param {String} refreshToken - OAuth refresh token + * @param {String} expiresIn - expires in + * @param {String} tokenType - token type + * @param {Object} scope - scope + * @param {Object} userInfo - user info * @constructor */ function Principal(username, authToken, refreshToken, expiresIn, tokenType, scope, userInfo) { @@ -55,8 +55,8 @@ /** * @name hasAccessTo * @description Does user have access to operation - * @param {String} operation operation name - * @param {Array} flags feature flags + * @param {String} operation - operation name + * @param {Array} flags - feature flags * @returns {*} */ hasAccessTo: function (operation, flags) { @@ -75,10 +75,10 @@ /** * @name isAllowed * @description Is user permitted to do the action - * @param {Object} context - * @param {String} resourceType ACL type - * @param {String} action action name - * @param {Array} flags feature flags + * @param {Object} context - context + * @param {String} resourceType - ACL type + * @param {String} action - action name + * @param {Array} flags - feature flags * @returns {*} */ isAllowed: function (context, resourceType, action, flags) { @@ -89,7 +89,7 @@ /** * @name_createAccessCheckerList * @description Internal method to create checker list - * @param {Array} flags feature flags + * @param {Array} flags - feature flags * @returns {Array} * @private */ @@ -142,8 +142,8 @@ /** * @name _getAccessChecker * @description Get Access checker for a given resource type - * @param resourceType - * @param flags + * @param {string} resourceType - resource type + * @param {array} flags - feature flags * @returns {*} * @private */ diff --git a/src/plugins/cloud-foundry/view/applications/application/log-stream/log-stream.module.js b/src/plugins/cloud-foundry/view/applications/application/log-stream/log-stream.module.js index d9e0e1934e..dc23b9508d 100644 --- a/src/plugins/cloud-foundry/view/applications/application/log-stream/log-stream.module.js +++ b/src/plugins/cloud-foundry/view/applications/application/log-stream/log-stream.module.js @@ -29,8 +29,11 @@ /** * @name ApplicationLogStreamController * @constructor + * @param {object} base64 - base64 service * @param {app.model.modelManager} modelManager - the Model management service * @param {object} $stateParams - the UI router $stateParams service + * @param {object} $location - the Angular $location service + * @param {object} $log - the Angular $log service * @property {object} model - the Cloud Foundry Applications Model * @property {string} id - the application GUID */ @@ -51,16 +54,16 @@ this.jsonFilter = function (jsonString) { try { - var messageObj = JSON.parse(jsonString); + var messageObj = angular.fromJson(jsonString); var messageString = base64.decode(messageObj.message) + '\n'; var colour; switch (messageObj.source_type) { case 'APP': - colour = 'green'; - break; + colour = 'green'; + break; default: - colour = 'red'; + colour = 'red'; } var messageSource = coloredLog('[' + messageObj.source_type + '.' + messageObj.source_instance + ']', colour); diff --git a/src/plugins/cloud-foundry/view/applications/application/summary/summary.module.js b/src/plugins/cloud-foundry/view/applications/application/summary/summary.module.js index 1a2c66b965..78b847ae3d 100644 --- a/src/plugins/cloud-foundry/view/applications/application/summary/summary.module.js +++ b/src/plugins/cloud-foundry/view/applications/application/summary/summary.module.js @@ -9,7 +9,7 @@ '$stateProvider' ]; - function registerRoute ($stateProvider) { + function registerRoute($stateProvider) { $stateProvider.state('cf.applications.application.summary', { url: '/summary', templateUrl: 'plugins/cloud-foundry/view/applications/application/summary/summary.html', @@ -31,13 +31,14 @@ * @param {app.model.modelManager} modelManager - the Model management service * @param {object} $stateParams - the UI router $stateParams service * @param {cloud-foundry.view.applications.application.summary.addRoutes} addRoutesService - add routes service - * @param confirmDialog + * @param {helion.framework.widgets.dialog.confirm} confirmDialog - the confirm dialog service * @property {cloud-foundry.model.application} model - the Cloud Foundry Applications Model * @property {app.model.serviceInstance.user} userCnsiModel - the user service instance model * @property {string} id - the application GUID * @property {cloud-foundry.view.applications.application.summary.addRoutes} addRoutesService - add routes service + * @property {helion.framework.widgets.dialog.confirm} confirmDialog - the confirm dialog service */ - function ApplicationSummaryController (modelManager, $stateParams, addRoutesService, confirmDialog) { + function ApplicationSummaryController(modelManager, $stateParams, addRoutesService, confirmDialog) { this.model = modelManager.retrieve('cloud-foundry.model.application'); this.userCnsiModel = modelManager.retrieve('app.model.serviceInstance.user'); this.routesModel = modelManager.retrieve('cloud-foundry.model.route'); diff --git a/src/plugins/cloud-foundry/view/applications/application/variables/variables.module.spec.js b/src/plugins/cloud-foundry/view/applications/application/variables/variables.module.spec.js index 0420673b03..6f724bd36a 100644 --- a/src/plugins/cloud-foundry/view/applications/application/variables/variables.module.spec.js +++ b/src/plugins/cloud-foundry/view/applications/application/variables/variables.module.spec.js @@ -46,20 +46,19 @@ describe("with variables checks", function () { beforeEach(inject(function ($injector) { - var modelManager = $injector.get('app.model.modelManager'); - //variables.environment_json - var model = modelManager.retrieve('cloud-foundry.model.application'); - model.application = { - variables: { - environment_json: { - ENV_1: 'TEST1', - env_2: 'test2', - test_3: 'value_3' - } + var modelManager = $injector.get('app.model.modelManager'); + //variables.environment_json + var model = modelManager.retrieve('cloud-foundry.model.application'); + model.application = { + variables: { + environment_json: { + ENV_1: 'TEST1', + env_2: 'test2', + test_3: 'value_3' } - }; - } - )); + } + }; + })); it("should have variables", function () { expect($controller.hasVariables()).toBe(true); From fee8562eda93371f580e402f55dbbaa49458afef Mon Sep 17 00:00:00 2001 From: Irfan Habib Date: Fri, 8 Jul 2016 11:48:02 +0100 Subject: [PATCH 2/2] Fixed fixme and todo annotations --- src/app/model/account/account.model.js | 6 +++++- .../endpoints/dashboard/tiles/service-tile.directive.js | 6 ++++++ src/app/view/endpoints/hce/endpoints-view.module.js | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/app/model/account/account.model.js b/src/app/model/account/account.model.js index da08250d0c..518416c3f0 100644 --- a/src/app/model/account/account.model.js +++ b/src/app/model/account/account.model.js @@ -39,7 +39,9 @@ this.loggedIn = false; this.data = {}; + /* eslint-disable no-warning-comments */ // TODO(irfan) Hook for development + /* eslint-enable no-warning-comments */ this.adminOverride = false; } @@ -115,7 +117,9 @@ */ isAdmin: function () { - //TODO(irfan) Hook for development + /* eslint-disable no-warning-comments */ + // TODO(irfan) Hook for development + /* eslint-enable no-warning-comments */ if (this.adminOverride) { return false; } diff --git a/src/app/view/endpoints/dashboard/tiles/service-tile.directive.js b/src/app/view/endpoints/dashboard/tiles/service-tile.directive.js index db377e5f1f..5cff507acf 100644 --- a/src/app/view/endpoints/dashboard/tiles/service-tile.directive.js +++ b/src/app/view/endpoints/dashboard/tiles/service-tile.directive.js @@ -51,7 +51,9 @@ this.hcfRegistration = hcfRegistration; this.$q = $q; this.serviceInstances = _.filter($scope.serviceInstances, {cnsi_type: this.serviceType}); + /* eslint-disable no-warning-comments */ // FIXME We should use ui-router/resolve for this, but can't currently + /* eslint-enable no-warning-comments */ this.resolvedPromise = false; var that = this; this._listServiceInstances() @@ -135,9 +137,11 @@ * @returns {Number} count */ getInstancesCountByStatus: function (status) { + /* eslint-disable no-warning-comments */ // TODO // If cnsi_type is HCE, then currently. // we don't have distinct states for it. + /* eslint-enable no-warning-comments */ var count = 0; var that = this; if (that.serviceType === 'hcf') { @@ -146,7 +150,9 @@ var isDisconnected = status.toLowerCase() === 'disconnected'; if (_.isUndefined(that.userServiceInstanceModel.serviceInstances[cnsiGuid])) { // disconnected state + /* eslint-disable no-warning-comments */ // TODO may not be true when disconnect from instance is implemented + /* eslint-enable no-warning-comments */ if (isDisconnected) { count += 1; } diff --git a/src/app/view/endpoints/hce/endpoints-view.module.js b/src/app/view/endpoints/hce/endpoints-view.module.js index fed4026dbf..3459b343bd 100644 --- a/src/app/view/endpoints/hce/endpoints-view.module.js +++ b/src/app/view/endpoints/hce/endpoints-view.module.js @@ -108,7 +108,9 @@ * @param {object} serviceInstance - Service instance */ connect: function (serviceInstance) { + /* eslint-disable no-warning-comments */ // TODO(irfan) Test once HCE authentication is implemented (TEAMFOUR-721) + /* eslint-enable no-warning-comments */ // Currently only implemented for HCF this.activeServiceInstance = serviceInstance; this.credentialsFormOpen = true; @@ -122,7 +124,9 @@ * @param {object} endpoint - endpoint */ disconnect: function (endpoint) { + /* eslint-disable no-warning-comments */ // TODO(irfan) Test once HCE authentication is implemented (TEAMFOUR-721) + /* eslint-enable no-warning-comments */ var that = this; var userServiceInstance = that.userServiceInstanceModel.serviceInstances[endpoint.guid]; if (angular.isUndefined(userServiceInstance)) { @@ -271,7 +275,9 @@ that.currentEndpoints = _.map(filteredInstances, function (c) { var endpoint = c.api_endpoint; + /* eslint-disable no-warning-comments */ // FIXME Once HCE auth is implement read connection status from userServiceInstanceModel (TEAMFOUR-721) + /* eslint-enable no-warning-comments */ var isConnected = true; if (that.isHcf()) { isConnected = that.userServiceInstanceModel.serviceInstances[c.guid].valid;