mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
working commit of passphrase disabling
This commit is contained in:
@@ -142,6 +142,8 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $r
|
|||||||
defaultUrl = GetBasePath('credentials'),
|
defaultUrl = GetBasePath('credentials'),
|
||||||
url;
|
url;
|
||||||
|
|
||||||
|
$scope.keyEntered = false;
|
||||||
|
|
||||||
generator.inject(form, { mode: 'add', related: false, scope: $scope });
|
generator.inject(form, { mode: 'add', related: false, scope: $scope });
|
||||||
generator.reset();
|
generator.reset();
|
||||||
|
|
||||||
@@ -213,6 +215,15 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $r
|
|||||||
OwnerChange({ scope: $scope });
|
OwnerChange({ scope: $scope });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.$watch("ssh_key_data", function(val) {
|
||||||
|
if (val === "" || val === null || val === undefined) {
|
||||||
|
$scope.keyEntered = false;
|
||||||
|
$scope.ssh_key_unlock_ask = false;
|
||||||
|
$scope.ssh_key_unlock = "";
|
||||||
|
} else {
|
||||||
|
$scope.keyEntered = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Handle Kind change
|
// Handle Kind change
|
||||||
$scope.kindChange = function () {
|
$scope.kindChange = function () {
|
||||||
@@ -357,6 +368,15 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $
|
|||||||
reset: false
|
reset: false
|
||||||
});
|
});
|
||||||
OwnerChange({ scope: $scope });
|
OwnerChange({ scope: $scope });
|
||||||
|
$scope.$watch("ssh_key_data", function(val) {
|
||||||
|
if (val === "" || val === null || val === undefined) {
|
||||||
|
$scope.keyEntered = false;
|
||||||
|
$scope.ssh_key_unlock_ask = false;
|
||||||
|
$scope.ssh_key_unlock = "";
|
||||||
|
} else {
|
||||||
|
$scope.keyEntered = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ export default
|
|||||||
ngShow: "kind.value == 'ssh' || kind.value == 'scm'",
|
ngShow: "kind.value == 'ssh' || kind.value == 'scm'",
|
||||||
addRequired: false,
|
addRequired: false,
|
||||||
editRequired: false,
|
editRequired: false,
|
||||||
|
ngDisabled: "keyEntered === false",
|
||||||
ask: true,
|
ask: true,
|
||||||
hasShowInputButton: true,
|
hasShowInputButton: true,
|
||||||
askShow: "kind.value == 'ssh'", // Only allow ask for machine credentials
|
askShow: "kind.value == 'ssh'", // Only allow ask for machine credentials
|
||||||
|
|||||||
@@ -896,7 +896,19 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += buildId(field, fld + "_show_input_button", this.form);
|
html += buildId(field, fld + "_show_input_button", this.form);
|
||||||
html += "aw-tool-tip='Toggle the display of plaintext.' aw-tip-placement='top' ";
|
html += "aw-tool-tip='Toggle the display of plaintext.' aw-tip-placement='top' ";
|
||||||
html += "ng-click='" + fld + "_field.toggleInput(\"#" + this.form.name + "_" + fld + "\")'";
|
html += "ng-click='" + fld + "_field.toggleInput(\"#" + this.form.name + "_" + fld + "\")'";
|
||||||
html += (field.ask) ? " ng-disabled='" + fld + "_ask'" : "";
|
if (field.ngDisabled || field.ask) {
|
||||||
|
var disabled = "";
|
||||||
|
if (field.ngDisabled) {
|
||||||
|
disabled += field.ngDisabled;
|
||||||
|
}
|
||||||
|
if (field.ngDisabled && field.ask) {
|
||||||
|
disabled += " || ";
|
||||||
|
}
|
||||||
|
if (field.ask) {
|
||||||
|
disabled += fld + "_ask";
|
||||||
|
}
|
||||||
|
html += "ng-disabled='" + disabled + "'";
|
||||||
|
}
|
||||||
html += ">\n" + field.showInputInnerHTML;
|
html += ">\n" + field.showInputInnerHTML;
|
||||||
html += "\n</button>\n";
|
html += "\n</button>\n";
|
||||||
html += "</span>\n";
|
html += "</span>\n";
|
||||||
@@ -931,12 +943,25 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += (field.awPassMatch) ? "awpassmatch='" + field.associated + "' " : "";
|
html += (field.awPassMatch) ? "awpassmatch='" + field.associated + "' " : "";
|
||||||
html += (field.capitalize) ? "capitalize " : "";
|
html += (field.capitalize) ? "capitalize " : "";
|
||||||
html += (field.awSurveyQuestion) ? "aw-survey-question" : "";
|
html += (field.awSurveyQuestion) ? "aw-survey-question" : "";
|
||||||
html += (field.ask) ? "ng-disabled='" + fld + "_ask' " : "";
|
|
||||||
|
if (field.ngDisabled || field.ask) {
|
||||||
|
var disabled = "";
|
||||||
|
if (field.ngDisabled) {
|
||||||
|
disabled += field.ngDisabled;
|
||||||
|
}
|
||||||
|
if (field.ngDisabled && field.ask) {
|
||||||
|
disabled += " || ";
|
||||||
|
}
|
||||||
|
if (field.ask) {
|
||||||
|
disabled += fld + "_ask";
|
||||||
|
}
|
||||||
|
html += "ng-disabled='" + disabled + "'";
|
||||||
|
}
|
||||||
html += (field.autocomplete !== undefined) ? this.attr(field, 'autocomplete') : "";
|
html += (field.autocomplete !== undefined) ? this.attr(field, 'autocomplete') : "";
|
||||||
html += (field.awRequiredWhen) ? "data-awrequired-init='" + field.awRequiredWhen.init + "' aw-required-when='" +
|
html += (field.awRequiredWhen) ? "data-awrequired-init='" + field.awRequiredWhen.init + "' aw-required-when='" +
|
||||||
field.awRequiredWhen.variable + "' " : "";
|
field.awRequiredWhen.variable + "' " : "";
|
||||||
html += (field.awValidUrl) ? "aw-valid-url " : "";
|
html += (field.awValidUrl) ? "aw-valid-url " : "";
|
||||||
html += (field.associated && this.form.fields[field.associated].ask) ? "ng-disabled='" + field.associated + "_ask' " : "";
|
html += (field.associated && this.form.fields[field.associated].ask) ? "ng-disabled='" + field.associated + "_foo' " : "";
|
||||||
html += ">\n";
|
html += ">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -960,6 +985,9 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += "<input type=\"checkbox\" ng-model=\"" +
|
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||||
fld + "_ask\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
fld + "_ask\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||||
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||||
|
if (field.ngDisabled) {
|
||||||
|
html += "ng-disabled='" + field.ngDisabled + "'";
|
||||||
|
}
|
||||||
html += "> Ask at runtime?</label>";
|
html += "> Ask at runtime?</label>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user