Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lint errors and warnings #439

Merged
merged 2 commits into from
Jul 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/app/model/account/account.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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') {
Expand All @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions src/app/view/endpoints/hce/endpoints-view.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)) {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/cloud-foundry/model/auth/checkers/base-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
}
Expand Down
32 changes: 16 additions & 16 deletions src/plugins/cloud-foundry/model/auth/principal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down