mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 06:49:40 +02:00
chore(project): add prettier for code format (#3645)
* chore(project): install prettier and lint-staged * chore(project): apply prettier to html too * chore(project): git ignore eslintcache * chore(project): add a comment about format script * chore(prettier): update printWidth * chore(prettier): remove useTabs option * chore(prettier): add HTML validation * refactor(prettier): fix closing tags * feat(prettier): define angular parser for html templates * style(prettier): run prettier on codebase Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
parent
6663073be1
commit
cf5056d9c0
714 changed files with 31228 additions and 28305 deletions
|
@ -12,18 +12,16 @@ var patterns = {
|
|||
nodeHostname: 'node.hostname',
|
||||
nodeRole: 'node.role',
|
||||
nodeLabels: 'node.labels.',
|
||||
engineLabels: 'engine.labels.'
|
||||
engineLabels: 'engine.labels.',
|
||||
},
|
||||
op: {
|
||||
eq: '==',
|
||||
neq: '!='
|
||||
}
|
||||
neq: '!=',
|
||||
},
|
||||
};
|
||||
|
||||
function matchesConstraint(value, constraint) {
|
||||
if (!constraint ||
|
||||
(constraint.op === patterns.op.eq && value === constraint.value) ||
|
||||
(constraint.op === patterns.op.neq && value !== constraint.value)) {
|
||||
if (!constraint || (constraint.op === patterns.op.eq && value === constraint.value) || (constraint.op === patterns.op.neq && value !== constraint.value)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -47,8 +45,8 @@ function extractCustomLabelKey(constraint, op, baseLabelKey) {
|
|||
return constraint.split(op).shift().trim().replace(baseLabelKey, '');
|
||||
}
|
||||
|
||||
angular.module('portainer.docker')
|
||||
.factory('ConstraintsHelper', [function ConstraintsHelperFactory() {
|
||||
angular.module('portainer.docker').factory('ConstraintsHelper', [
|
||||
function ConstraintsHelperFactory() {
|
||||
'use strict';
|
||||
return {
|
||||
transformConstraints: function (constraints) {
|
||||
|
@ -94,7 +92,8 @@ angular.module('portainer.docker')
|
|||
return true;
|
||||
}
|
||||
var constraints = this.transformConstraints(angular.copy(service.Constraints));
|
||||
if (matchesConstraint(node.Id, constraints.nodeId) &&
|
||||
if (
|
||||
matchesConstraint(node.Id, constraints.nodeId) &&
|
||||
matchesConstraint(node.Hostname, constraints.nodeHostname) &&
|
||||
matchesConstraint(node.Role, constraints.nodeRole) &&
|
||||
matchesLabel(node.Labels, constraints.nodeLabels) &&
|
||||
|
@ -103,6 +102,7 @@ angular.module('portainer.docker')
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
};
|
||||
}]);
|
||||
},
|
||||
]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue