mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Merge pull request #2747 from kialam/remove-md5
Remove MD5 usage and dependency from UI Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
commit
feeaa0bf5c
@ -31,7 +31,8 @@ module.exports = {
|
|||||||
$: true,
|
$: true,
|
||||||
_: true,
|
_: true,
|
||||||
codemirror: true,
|
codemirror: true,
|
||||||
jsyaml: true
|
jsyaml: true,
|
||||||
|
crypto: true
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'arrow-parens': 'off',
|
'arrow-parens': 'off',
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
"moment": false,
|
"moment": false,
|
||||||
"spyOn": false,
|
"spyOn": false,
|
||||||
"jasmine": false,
|
"jasmine": false,
|
||||||
"dagre": false
|
"dagre": false,
|
||||||
|
"crypto": false
|
||||||
},
|
},
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"quotmark": false,
|
"quotmark": false,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
- node.js 8.x LTS
|
- node.js 8.x LTS
|
||||||
- npm 5.x LTS
|
- npm >=5.10
|
||||||
- bzip2, gcc-c++, git, make
|
- bzip2, gcc-c++, git, make
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
@ -53,7 +53,6 @@ angular
|
|||||||
'angular-duration-format',
|
'angular-duration-format',
|
||||||
'angularMoment',
|
'angularMoment',
|
||||||
'AngularScheduler',
|
'AngularScheduler',
|
||||||
'angular-md5',
|
|
||||||
'dndLists',
|
'dndLists',
|
||||||
'ncy-angular-breadcrumb',
|
'ncy-angular-breadcrumb',
|
||||||
'ngSanitize',
|
'ngSanitize',
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
* | default | Default value to place in the field when the form is in 'add' mode. |
|
* | default | Default value to place in the field when the form is in 'add' mode. |
|
||||||
* | defaultText | Default value to put into a select input. |
|
* | defaultText | Default value to put into a select input. |
|
||||||
* | falseValue | For radio buttons and checkboxes. Value to set the model to when the checkbox or radio button is not selected. |
|
* | falseValue | For radio buttons and checkboxes. Value to set the model to when the checkbox or radio button is not selected. |
|
||||||
* | genMD5 | true or false. If true, places the field in an input group with a button that when clicked replaces the field contents with an MD5 has key. Used with host_config_key on the job templates detail page. |
|
* | genHash | true or false. If true, places the field in an input group with a button that when clicked replaces the field contents with a hash as key. Used with host_config_key on the job templates detail page. |
|
||||||
* | integer | Adds the integer directive to validate that the value entered is of type integer. Add min and max to supply lower and upper range bounds to the entered value. |
|
* | integer | Adds the integer directive to validate that the value entered is of type integer. Add min and max to supply lower and upper range bounds to the entered value. |
|
||||||
* | label | Text to use as <label> element for the field |
|
* | label | Text to use as <label> element for the field |
|
||||||
* | ngChange | Adds ng-change directive. Set to the JS expression to be evaluated by ng-change. |
|
* | ngChange | Adds ng-change directive. Set to the JS expression to be evaluated by ng-change. |
|
||||||
@ -802,7 +802,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += (horizontal) ? "class=\"" + getFieldWidth() + "\"" : "";
|
html += (horizontal) ? "class=\"" + getFieldWidth() + "\"" : "";
|
||||||
html += ">\n";
|
html += ">\n";
|
||||||
|
|
||||||
html += (field.clear || field.genMD5) ? "<div class=\"input-group Form-mixedInputGroup\">\n" : "";
|
html += (field.clear || field.genHash) ? "<div class=\"input-group Form-mixedInputGroup\">\n" : "";
|
||||||
|
|
||||||
if (field.control === null || field.control === undefined || field.control) {
|
if (field.control === null || field.control === undefined || field.control) {
|
||||||
html += "<input ";
|
html += "<input ";
|
||||||
@ -842,8 +842,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += "</span>\n</div>\n";
|
html += "</span>\n</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field.genMD5) {
|
if (field.genHash) {
|
||||||
html += "<span class=\"input-group-btn\"><button type=\"button\" class=\"btn Form-lookupButton\" ng-click=\"genMD5('" + fld + "')\" " +
|
html += "<span class=\"input-group-btn\"><button type=\"button\" class=\"btn Form-lookupButton\" ng-click=\"genHash('" + fld + "')\" " +
|
||||||
"aw-tool-tip=\"Generate " + field.label + "\" data-placement=\"top\" id=\"" + this.form.name + "_" + fld + "_gen_btn\">" +
|
"aw-tool-tip=\"Generate " + field.label + "\" data-placement=\"top\" id=\"" + this.form.name + "_" + fld + "_gen_btn\">" +
|
||||||
"<i class=\"fa fa-magic\"></i></button></span>\n</div>\n";
|
"<i class=\"fa fa-magic\"></i></button></span>\n</div>\n";
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
export default
|
export default
|
||||||
[ '$filter', '$scope',
|
[ '$filter', '$scope',
|
||||||
'$stateParams', 'JobTemplateForm', 'GenerateForm', 'Rest', 'Alert',
|
'$stateParams', 'JobTemplateForm', 'GenerateForm', 'Rest', 'Alert',
|
||||||
'ProcessErrors', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'Wait',
|
'ProcessErrors', 'GetBasePath', 'hashSetup', 'ParseTypeChange', 'Wait',
|
||||||
'Empty', 'ToJSON', 'CallbackHelpInit', 'GetChoices', '$state', 'availableLabels',
|
'Empty', 'ToJSON', 'CallbackHelpInit', 'GetChoices', '$state', 'availableLabels',
|
||||||
'CreateSelect2', '$q', 'i18n', 'Inventory', 'Project', 'InstanceGroupsService',
|
'CreateSelect2', '$q', 'i18n', 'Inventory', 'Project', 'InstanceGroupsService',
|
||||||
'MultiCredentialService', 'ConfigData', 'resolvedModels',
|
'MultiCredentialService', 'ConfigData', 'resolvedModels',
|
||||||
function(
|
function(
|
||||||
$filter, $scope,
|
$filter, $scope,
|
||||||
$stateParams, JobTemplateForm, GenerateForm, Rest, Alert,
|
$stateParams, JobTemplateForm, GenerateForm, Rest, Alert,
|
||||||
ProcessErrors, GetBasePath, md5Setup, ParseTypeChange, Wait,
|
ProcessErrors, GetBasePath, hashSetup, ParseTypeChange, Wait,
|
||||||
Empty, ToJSON, CallbackHelpInit, GetChoices,
|
Empty, ToJSON, CallbackHelpInit, GetChoices,
|
||||||
$state, availableLabels, CreateSelect2, $q, i18n, Inventory, Project, InstanceGroupsService,
|
$state, availableLabels, CreateSelect2, $q, i18n, Inventory, Project, InstanceGroupsService,
|
||||||
MultiCredentialService, ConfigData, resolvedModels
|
MultiCredentialService, ConfigData, resolvedModels
|
||||||
@ -43,7 +43,7 @@
|
|||||||
$scope.credentialNotPresent = false;
|
$scope.credentialNotPresent = false;
|
||||||
$scope.canGetAllRelatedResources = true;
|
$scope.canGetAllRelatedResources = true;
|
||||||
|
|
||||||
md5Setup({
|
hashSetup({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
master: master,
|
master: master,
|
||||||
check_field: 'allow_callbacks',
|
check_field: 'allow_callbacks',
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
export default
|
export default
|
||||||
[ '$filter', '$scope', '$rootScope',
|
[ '$filter', '$scope', '$rootScope',
|
||||||
'$location', '$stateParams', 'JobTemplateForm', 'GenerateForm',
|
'$location', '$stateParams', 'JobTemplateForm', 'GenerateForm',
|
||||||
'Rest', 'Alert', 'ProcessErrors', 'GetBasePath', 'md5Setup',
|
'Rest', 'Alert', 'ProcessErrors', 'GetBasePath', 'hashSetup',
|
||||||
'ParseTypeChange', 'Wait', 'selectedLabels', 'i18n',
|
'ParseTypeChange', 'Wait', 'selectedLabels', 'i18n',
|
||||||
'Empty', 'Prompt', 'ToJSON', 'GetChoices', 'CallbackHelpInit',
|
'Empty', 'Prompt', 'ToJSON', 'GetChoices', 'CallbackHelpInit',
|
||||||
'initSurvey', '$state', 'CreateSelect2',
|
'initSurvey', '$state', 'CreateSelect2',
|
||||||
@ -23,7 +23,7 @@ export default
|
|||||||
function(
|
function(
|
||||||
$filter, $scope, $rootScope,
|
$filter, $scope, $rootScope,
|
||||||
$location, $stateParams, JobTemplateForm, GenerateForm, Rest, Alert,
|
$location, $stateParams, JobTemplateForm, GenerateForm, Rest, Alert,
|
||||||
ProcessErrors, GetBasePath, md5Setup,
|
ProcessErrors, GetBasePath, hashSetup,
|
||||||
ParseTypeChange, Wait, selectedLabels, i18n,
|
ParseTypeChange, Wait, selectedLabels, i18n,
|
||||||
Empty, Prompt, ToJSON, GetChoices, CallbackHelpInit,
|
Empty, Prompt, ToJSON, GetChoices, CallbackHelpInit,
|
||||||
SurveyControllerInit, $state, CreateSelect2,
|
SurveyControllerInit, $state, CreateSelect2,
|
||||||
@ -245,7 +245,7 @@ export default
|
|||||||
master = masterObject;
|
master = masterObject;
|
||||||
|
|
||||||
dft = ($scope.host_config_key === "" || $scope.host_config_key === null) ? false : true;
|
dft = ($scope.host_config_key === "" || $scope.host_config_key === null) ? false : true;
|
||||||
md5Setup({
|
hashSetup({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
master: master,
|
master: master,
|
||||||
check_field: 'allow_callbacks',
|
check_field: 'allow_callbacks',
|
||||||
|
@ -18,11 +18,11 @@ export default
|
|||||||
"<p>Successful requests create an entry on the Jobs page, where results and history can be viewed.</p>";
|
"<p>Successful requests create an entry on the Jobs page, where results and history can be viewed.</p>";
|
||||||
};
|
};
|
||||||
|
|
||||||
// The md5 helper emits NewMD5Generated whenever a new key is available
|
// The hash helper emits NewHashGenerated whenever a new key is available
|
||||||
if (scope.removeNewMD5Generated) {
|
if (scope.removeNewHashGenerated) {
|
||||||
scope.removeNewMD5Generated();
|
scope.removeNewHashGenerated();
|
||||||
}
|
}
|
||||||
scope.removeNewMD5Generated = scope.$on('NewMD5Generated', function() {
|
scope.removeNewHashGenerated = scope.$on('NewHashGenerated', function() {
|
||||||
scope.configKeyChange();
|
scope.configKeyChange();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export default
|
export default
|
||||||
function md5Setup(md5) {
|
function hashSetup() {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
master = params.master,
|
master = params.master,
|
||||||
@ -9,10 +9,12 @@ export default
|
|||||||
scope[check_field] = default_val;
|
scope[check_field] = default_val;
|
||||||
master[check_field] = default_val;
|
master[check_field] = default_val;
|
||||||
|
|
||||||
scope.genMD5 = function (fld) {
|
// Original gist here: https://gist.github.com/jed/982883
|
||||||
var now = new Date();
|
scope.genHash = function (fld) {
|
||||||
scope[fld] = md5.createHash('AnsibleWorks' + now.getTime());
|
scope[fld] = ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
|
||||||
scope.$emit('NewMD5Generated');
|
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
||||||
|
);
|
||||||
|
scope.$emit('NewHashGenerated');
|
||||||
};
|
};
|
||||||
|
|
||||||
scope.toggleCallback = function (fld) {
|
scope.toggleCallback = function (fld) {
|
||||||
@ -26,5 +28,3 @@ export default
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
md5Setup.$inject = [ 'md5' ];
|
|
@ -353,7 +353,7 @@ function(NotificationsList, i18n) {
|
|||||||
type: 'text',
|
type: 'text',
|
||||||
ngShow: "allow_callbacks && allow_callbacks !== 'false'",
|
ngShow: "allow_callbacks && allow_callbacks !== 'false'",
|
||||||
ngChange: "configKeyChange()",
|
ngChange: "configKeyChange()",
|
||||||
genMD5: true,
|
genHash: true,
|
||||||
column: 2,
|
column: 2,
|
||||||
awPopOver: "callback_help",
|
awPopOver: "callback_help",
|
||||||
awPopOverWatch: "callback_help",
|
awPopOverWatch: "callback_help",
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import jobTemplateAdd from './add-job-template/main';
|
import jobTemplateAdd from './add-job-template/main';
|
||||||
import jobTemplateEdit from './edit-job-template/main';
|
import jobTemplateEdit from './edit-job-template/main';
|
||||||
import multiCredential from './multi-credential/main';
|
import multiCredential from './multi-credential/main';
|
||||||
import md5Setup from './factories/md-5-setup.factory';
|
import hashSetup from './factories/hash-setup.factory';
|
||||||
import CallbackHelpInit from './factories/callback-help-init.factory';
|
import CallbackHelpInit from './factories/callback-help-init.factory';
|
||||||
import JobTemplateForm from './job-template.form';
|
import JobTemplateForm from './job-template.form';
|
||||||
|
|
||||||
export default
|
export default
|
||||||
angular.module('jobTemplates', [jobTemplateAdd.name, jobTemplateEdit.name,
|
angular.module('jobTemplates', [jobTemplateAdd.name, jobTemplateEdit.name,
|
||||||
multiCredential.name])
|
multiCredential.name])
|
||||||
.factory('md5Setup', md5Setup)
|
.factory('hashSetup', hashSetup)
|
||||||
.factory('CallbackHelpInit', CallbackHelpInit)
|
.factory('CallbackHelpInit', CallbackHelpInit)
|
||||||
.factory('JobTemplateForm', JobTemplateForm);
|
.factory('JobTemplateForm', JobTemplateForm);
|
||||||
|
@ -53,7 +53,6 @@ require('angular-codemirror');
|
|||||||
require('angular-drag-and-drop-lists');
|
require('angular-drag-and-drop-lists');
|
||||||
require('angular-duration-format');
|
require('angular-duration-format');
|
||||||
require('angular-gettext');
|
require('angular-gettext');
|
||||||
require('angular-md5');
|
|
||||||
require('angular-moment');
|
require('angular-moment');
|
||||||
require('angular-scheduler');
|
require('angular-scheduler');
|
||||||
require('angular-tz-extensions');
|
require('angular-tz-extensions');
|
||||||
|
5
awx/ui/package-lock.json
generated
5
awx/ui/package-lock.json
generated
@ -220,11 +220,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"angular-md5": {
|
|
||||||
"version": "0.1.10",
|
|
||||||
"resolved": "https://registry.npmjs.org/angular-md5/-/angular-md5-0.1.10.tgz",
|
|
||||||
"integrity": "sha1-fLbH1cHQQB/+mHGhF4SfA8LMSGM="
|
|
||||||
},
|
|
||||||
"angular-mocks": {
|
"angular-mocks": {
|
||||||
"version": "1.6.10",
|
"version": "1.6.10",
|
||||||
"resolved": "https://registry.npmjs.org/angular-mocks/-/angular-mocks-1.6.10.tgz",
|
"resolved": "https://registry.npmjs.org/angular-mocks/-/angular-mocks-1.6.10.tgz",
|
||||||
|
@ -103,7 +103,6 @@
|
|||||||
"angular-drag-and-drop-lists": "git+https://git@github.com/ansible/angular-drag-and-drop-lists#v1.4.1",
|
"angular-drag-and-drop-lists": "git+https://git@github.com/ansible/angular-drag-and-drop-lists#v1.4.1",
|
||||||
"angular-duration-format": "^1.0.1",
|
"angular-duration-format": "^1.0.1",
|
||||||
"angular-gettext": "^2.3.5",
|
"angular-gettext": "^2.3.5",
|
||||||
"angular-md5": "^0.1.8",
|
|
||||||
"angular-moment": "^0.10.1",
|
"angular-moment": "^0.10.1",
|
||||||
"angular-mousewheel": "^1.0.5",
|
"angular-mousewheel": "^1.0.5",
|
||||||
"angular-sanitize": "~1.6.6",
|
"angular-sanitize": "~1.6.6",
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2014 PatrickJS
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
Loading…
Reference in New Issue
Block a user