Add kind column to credential list

* Populate kind column with credential_type name
* Fix replace/revert input group button sizing
This commit is contained in:
gconsidine
2017-07-18 14:39:56 -04:00
parent 415c80a279
commit 6fa3872c86
7 changed files with 28 additions and 11 deletions

View File

@@ -35,7 +35,10 @@ function LegacyCredentialsService (pathService) {
let path = GetBasePath(list.basePath) || GetBasePath(list.name); let path = GetBasePath(list.basePath) || GetBasePath(list.name);
return qs.search(path, $stateParams[`${list.iterator}_search`]); return qs.search(path, $stateParams[`${list.iterator}_search`]);
} }
] ],
credentialType: ['CredentialTypeModel', CredentialType => {
return new CredentialType('get');
}]
} }
}; };

View File

@@ -47,12 +47,18 @@
.at-mixin-InputButton(); .at-mixin-InputButton();
} }
.at-Input-button--fixed-sm { .at-Input-button--fixed-xs {
.at-mixin-InputButton(); .at-mixin-InputButton();
min-width: @at-width-input-button-sm; min-width: @at-width-input-button-sm;
height: @at-height-input; height: @at-height-input;
} }
.at-Input-button--fixed-sm {
.at-mixin-InputButton();
min-width: @at-width-input-button-md;
height: @at-height-input;
}
.at-Input-button--fixed-md { .at-Input-button--fixed-md {
.at-mixin-InputButton(); .at-mixin-InputButton();
display: inherit; display: inherit;

View File

@@ -20,11 +20,13 @@ function AtInputSecretController (baseInputController) {
scope = _scope_; scope = _scope_;
if (!scope.state._value || scope.state._promptOnLaunch) { if (!scope.state._value || scope.state._promptOnLaunch) {
scope.mode = 'input';
scope.state._buttonText = vm.strings.get('SHOW'); scope.state._buttonText = vm.strings.get('SHOW');
scope.type = 'password'; scope.type = 'password';
vm.toggle = vm.toggleShowHide; vm.toggle = vm.toggleShowHide;
} else { } else {
scope.mode = 'encrypted';
scope.state._buttonText = vm.strings.get('REPLACE'); scope.state._buttonText = vm.strings.get('REPLACE');
scope.state._placeholder = vm.strings.get('ENCRYPTED'); scope.state._placeholder = vm.strings.get('ENCRYPTED');
vm.toggle = vm.toggleRevertReplace; vm.toggle = vm.toggleRevertReplace;

View File

@@ -4,7 +4,11 @@
<div class="input-group"> <div class="input-group">
<span class="input-group-btn at-InputGroup-button"> <span class="input-group-btn at-InputGroup-button">
<button class="btn at-ButtonHollow--white at-Input-button--fixed-sm" <button class="btn at-ButtonHollow--white"
ng-class="{
'at-Input-button--fixed-xs': mode === 'input',
'at-Input-button--fixed-sm': mode === 'encrypted'
}"
ng-disabled="!state._enableToggle && (state._disabled || form.disabled)" ng-disabled="!state._enableToggle && (state._disabled || form.disabled)"
ng-click="vm.toggle()"> ng-click="vm.toggle()">
{{ state._buttonText }} {{ state._buttonText }}

View File

@@ -28,9 +28,8 @@
} }
.at-mixin-InputButton () { .at-mixin-InputButton () {
display: block;
height: @at-height-button; height: @at-height-button;
line-height: 1; padding: 0 @at-padding-button-horizontal;
&, &:active, &:hover, &:focus { &, &:active, &:hover, &:focus {
color: @at-color-button-text-default; color: @at-color-button-text-default;

View File

@@ -9,7 +9,6 @@
export default ['i18n', function(i18n) { export default ['i18n', function(i18n) {
return { return {
name: 'credentials', name: 'credentials',
iterator: 'credential', iterator: 'credential',
selectTitle: i18n._('Add Credentials'), selectTitle: i18n._('Add Credentials'),
@@ -31,8 +30,8 @@ export default ['i18n', function(i18n) {
dataPlacement: 'top' dataPlacement: 'top'
}, },
kind: { kind: {
label: i18n._('Type'), label: i18n._('Kind'),
ngBind: 'credential.kind_label', ngBind: 'credential.kind',
excludeModal: true, excludeModal: true,
nosort: true, nosort: true,
columnClass: 'col-md-2 hidden-sm hidden-xs' columnClass: 'col-md-2 hidden-sm hidden-xs'

View File

@@ -4,11 +4,11 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
export default ['$scope', 'Rest', 'CredentialList', 'Prompt', export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', 'GetBasePath',
'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', 'i18n', 'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', 'credentialType', 'i18n',
function($scope, Rest, CredentialList, Prompt, function($scope, Rest, CredentialList, Prompt,
ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset, ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset,
i18n) { credentialType, i18n) {
var list = CredentialList, var list = CredentialList,
defaultUrl = GetBasePath('credentials'); defaultUrl = GetBasePath('credentials');
@@ -27,6 +27,10 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt',
$scope[list.name] = $scope[`${list.iterator}_dataset`].results; $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
$scope.selected = []; $scope.selected = [];
$scope[list.name].forEach(credential => {
credential.kind = credentialType.getById(credential.credential_type).name;
});
} }
$scope.$on(`${list.iterator}_options`, function(event, data){ $scope.$on(`${list.iterator}_options`, function(event, data){