Added eslint config to ironic-ui
Set up package to use eslint-openstack-config for linting. Amended existing files to ensure they pass linting tests. Change-Id: I55dfe4cd9cdee99f19b80147df73f66951ca1372
This commit is contained in:
parent
429d56049f
commit
a4c47b80f7
|
@ -0,0 +1,2 @@
|
||||||
|
node_modules
|
||||||
|
dist
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Enable eslint-plugin-angular
|
||||||
|
plugins:
|
||||||
|
- angular
|
||||||
|
|
||||||
|
extends: openstack
|
||||||
|
|
||||||
|
# Set up globals
|
||||||
|
globals:
|
||||||
|
angular: false
|
||||||
|
module: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
browser: true
|
||||||
|
jasmine: true
|
||||||
|
|
||||||
|
rules:
|
||||||
|
angular/no-private-call: 0
|
||||||
|
angular/no-services:
|
||||||
|
- 2
|
||||||
|
- - $http
|
||||||
|
- $resource
|
||||||
|
- Restangular
|
||||||
|
angular/no-service-method: 0
|
|
@ -55,3 +55,8 @@ ChangeLog
|
||||||
|
|
||||||
.secret_key_store
|
.secret_key_store
|
||||||
*.lock
|
*.lock
|
||||||
|
|
||||||
|
# Node generated files
|
||||||
|
package/
|
||||||
|
node_modules/
|
||||||
|
npm-debug.log
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
return apiService.get('/api/ironic/nodes/')
|
return apiService.get('/api/ironic/nodes/')
|
||||||
.error(function() {
|
.error(function() {
|
||||||
toastService.add('error', gettext('Unable to retrieve Ironic nodes.'));
|
toastService.add('error', gettext('Unable to retrieve Ironic nodes.'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
|
|
||||||
function getPortsWithNode(uuid) {
|
function getPortsWithNode(uuid) {
|
||||||
var config = {
|
var config = {
|
||||||
'params' : {
|
params : {
|
||||||
node_id: uuid
|
node_id: uuid
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -103,14 +103,15 @@
|
||||||
* @name horizon.app.core.openstack-service-api.ironic.putNodeInMaintenanceMode
|
* @name horizon.app.core.openstack-service-api.ironic.putNodeInMaintenanceMode
|
||||||
* @description Put the node in maintenance mode.
|
* @description Put the node in maintenance mode.
|
||||||
*
|
*
|
||||||
* http://docs.openstack.org/developer/ironic/webapi/v1.html#put--v1-nodes-(node_ident)-maintenance
|
* \href{http://docs.openstack.org/developer/ironic/webapi/v1.html#
|
||||||
|
* put--v1-nodes-(node_ident)-maintenance}
|
||||||
*
|
*
|
||||||
* @param {string} uuid – UUID or logical name of a node.
|
* @param {string} uuid – UUID or logical name of a node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function putNodeInMaintenanceMode(uuid, reason) {
|
function putNodeInMaintenanceMode(uuid, reason) {
|
||||||
var data = {
|
var data = {
|
||||||
maint_reason: (reason ? reason : gettext("No maintenance reason given."))
|
maint_reason: reason ? reason : gettext("No maintenance reason given.")
|
||||||
};
|
};
|
||||||
return apiService.patch('/api/ironic/nodes/' + uuid + '/maintenance', data).error(function() {
|
return apiService.patch('/api/ironic/nodes/' + uuid + '/maintenance', data).error(function() {
|
||||||
toastService.add('error',
|
toastService.add('error',
|
||||||
|
@ -122,7 +123,8 @@
|
||||||
* @name horizon.app.core.openstack-service-api.ironic.removeNodeFromMaintenanceMode
|
* @name horizon.app.core.openstack-service-api.ironic.removeNodeFromMaintenanceMode
|
||||||
* @description Remove the node from maintenance mode.
|
* @description Remove the node from maintenance mode.
|
||||||
*
|
*
|
||||||
* http://docs.openstack.org/developer/ironic/webapi/v1.html#delete--v1-nodes-(node_ident)-maintenance
|
* \href{http://docs.openstack.org/developer/ironic/webapi/v1.html#
|
||||||
|
* delete--v1-nodes-(node_ident)-maintenance}
|
||||||
*
|
*
|
||||||
* @param {string} uuid – UUID or logical name of a node.
|
* @param {string} uuid – UUID or logical name of a node.
|
||||||
*/
|
*/
|
||||||
|
@ -138,7 +140,8 @@
|
||||||
* @name horizon.app.core.openstack-service-api.ironic.powerOnNode
|
* @name horizon.app.core.openstack-service-api.ironic.powerOnNode
|
||||||
* @description Set the power state of the node.
|
* @description Set the power state of the node.
|
||||||
*
|
*
|
||||||
* http://docs.openstack.org/developer/ironic/webapi/v1.html#put--v1-nodes-(node_ident)-states-power
|
* \href{http://docs.openstack.org/developer/ironic/webapi/v1.html#
|
||||||
|
* put--v1-nodes-(node_ident)-states-power}
|
||||||
*
|
*
|
||||||
* @param {string} uuid – UUID or logical name of a node.
|
* @param {string} uuid – UUID or logical name of a node.
|
||||||
*/
|
*/
|
||||||
|
@ -160,7 +163,8 @@
|
||||||
* @name horizon.app.core.openstack-service-api.ironic.powerOffNode
|
* @name horizon.app.core.openstack-service-api.ironic.powerOffNode
|
||||||
* @description Set the power state of the node.
|
* @description Set the power state of the node.
|
||||||
*
|
*
|
||||||
* http://docs.openstack.org/developer/ironic/webapi/v1.html#put--v1-nodes-(node_ident)-states-power
|
* \href{http://docs.openstack.org/developer/ironic/webapi/v1.html#
|
||||||
|
* put--v1-nodes-(node_ident)-states-power}
|
||||||
*
|
*
|
||||||
* @param {string} uuid – UUID or logical name of a node.
|
* @param {string} uuid – UUID or logical name of a node.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var POWER_STATE_ON ='power on';
|
var POWER_STATE_ON = 'power on';
|
||||||
var POWER_STATE_OFF = 'power off';
|
var POWER_STATE_OFF = 'power off';
|
||||||
|
|
||||||
angular
|
angular
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
return $q.reject(gettext("Node is not powered off."));
|
return $q.reject(gettext("Node is not powered off."));
|
||||||
}
|
}
|
||||||
return ironic.powerOnNode(node.uuid).then(
|
return ironic.powerOnNode(node.uuid).then(
|
||||||
function(response) {
|
function() {
|
||||||
// Set power state to be indeterminate
|
// Set power state to be indeterminate
|
||||||
node.power_state = null;
|
node.power_state = null;
|
||||||
},
|
},
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
return $q.reject(gettext("Node is not powered on."));
|
return $q.reject(gettext("Node is not powered on."));
|
||||||
}
|
}
|
||||||
return ironic.powerOffNode(node.uuid).then(
|
return ironic.powerOffNode(node.uuid).then(
|
||||||
function(response) {
|
function() {
|
||||||
// Set power state to be indeterminate
|
// Set power state to be indeterminate
|
||||||
node.power_state = null;
|
node.power_state = null;
|
||||||
},
|
},
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
ctrl.getVifPortId = getVifPortId;
|
ctrl.getVifPortId = getVifPortId;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name horizon.dashboard.admin.ironic.NodeDetailsController.init
|
* @name horizon.dashboard.admin.ironic.NodeDetailsController.init
|
||||||
* @description Initialize the controller instance based on the current page url.
|
* @description Initialize the controller instance based on the current page url.
|
||||||
|
@ -88,11 +88,11 @@
|
||||||
* @description Retrieve the ports associated with a specified node, and store
|
* @description Retrieve the ports associated with a specified node, and store
|
||||||
* them in the controller instance.
|
* them in the controller instance.
|
||||||
*
|
*
|
||||||
* @param {string} node_id – Node name or UUID
|
* @param {string} nodeId – Node name or UUID
|
||||||
* @return {void}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
function retrievePorts(node_id) {
|
function retrievePorts(nodeId) {
|
||||||
ironic.getPortsWithNode(node_id).then(function (response) {
|
ironic.getPortsWithNode(nodeId).then(function (response) {
|
||||||
ctrl.ports = response.data.items;
|
ctrl.ports = response.data.items;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
* @return {boolean} True if the string is an OpenStack UUID, otherwise false
|
* @return {boolean} True if the string is an OpenStack UUID, otherwise false
|
||||||
*/
|
*/
|
||||||
function isUuid(str) {
|
function isUuid(str) {
|
||||||
return str.match(ctrl.re_uuid) ? true : false;
|
return !!str.match(ctrl.re_uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,9 +116,9 @@
|
||||||
* @return {string} Value of vif_port_id property or "" if the property does not exist
|
* @return {string} Value of vif_port_id property or "" if the property does not exist
|
||||||
*/
|
*/
|
||||||
function getVifPortId(port) {
|
function getVifPortId(port) {
|
||||||
return (angular.isDefined(port.extra) &&
|
return angular.isDefined(port.extra) &&
|
||||||
angular.isDefined(port.extra.vif_port_id)) ?
|
angular.isDefined(port.extra.vif_port_id)
|
||||||
port.extra.vif_port_id : "";
|
? port.extra.vif_port_id : "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,5 +118,5 @@
|
||||||
expect(ctrl.getVifPortId(createPort(ctrl.node.uuid, 1, extra))).
|
expect(ctrl.getVifPortId(createPort(ctrl.node.uuid, 1, extra))).
|
||||||
toEqual("port_uuid");
|
toEqual("port_uuid");
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -42,34 +42,34 @@
|
||||||
*/
|
*/
|
||||||
ctrl.nodeFacets = [
|
ctrl.nodeFacets = [
|
||||||
{
|
{
|
||||||
'label': gettext('Name'),
|
label: gettext('Name'),
|
||||||
'name': 'name',
|
name: 'name',
|
||||||
'singleton': true
|
singleton: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': gettext('UUID'),
|
label: gettext('UUID'),
|
||||||
'name': 'uuid',
|
name: 'uuid',
|
||||||
'singleton': true
|
singleton: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': gettext('Power State'),
|
label: gettext('Power State'),
|
||||||
'name': 'power_state',
|
name: 'power_state',
|
||||||
'singleton': true
|
singleton: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': gettext('Provisioning State'),
|
label: gettext('Provisioning State'),
|
||||||
'name': 'provision_state',
|
name: 'provision_state',
|
||||||
'singleton': true
|
singleton: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': gettext('Maintenance'),
|
label: gettext('Maintenance'),
|
||||||
'name': 'maintenance',
|
name: 'maintenance',
|
||||||
'singleton': true
|
singleton: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': gettext('Driver'),
|
label: gettext('Driver'),
|
||||||
'name': 'driver',
|
name: 'driver',
|
||||||
'singleton': true
|
singleton: true
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -103,4 +103,3 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
"name": "ironic-ui",
|
"name": "ironic-ui",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Horizon plugin for OpenStack Ironic.",
|
"description": "Horizon plugin for OpenStack Ironic.",
|
||||||
"main": "index.html",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint ./"
|
"lint": "eslint ./"
|
||||||
},
|
},
|
||||||
|
@ -13,8 +12,8 @@
|
||||||
"author": "Openstack <openstack-dev@lists.openstack.org>",
|
"author": "Openstack <openstack-dev@lists.openstack.org>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "1.9.0",
|
"eslint": "^1.10.3",
|
||||||
"eslint-config-openstack": "1.2.3",
|
"eslint-config-openstack": "^1.2.4",
|
||||||
"eslint-plugin-angular": "0.4.0"
|
"eslint-plugin-angular": "1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue