mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-28 04:10:44 -04:00
updates login settings api vars to snake_case (#31336)
This commit is contained in:
parent
8700becc45
commit
4a76fdce59
4 changed files with 10 additions and 10 deletions
|
|
@ -221,13 +221,13 @@ export default class ApiService extends Service {
|
|||
// accepts a list response as { keyInfo, keys } and returns a flat array of the keyInfo datum
|
||||
// to preserve the keys (unique identifiers) the value will be set on the datum as id
|
||||
keyInfoToArray(response: unknown = {}) {
|
||||
const { keyInfo, keys } = response as { keyInfo?: Record<string, unknown>; keys?: string[] };
|
||||
if (!keyInfo || !keys) {
|
||||
const { key_info, keys } = response as { key_info?: Record<string, unknown>; keys?: string[] };
|
||||
if (!key_info || !keys) {
|
||||
return [];
|
||||
}
|
||||
return keys.reduce(
|
||||
(arr, key) => {
|
||||
const datum = keyInfo[key];
|
||||
const datum = key_info[key];
|
||||
if (datum) {
|
||||
arr.push({ id: key, ...datum });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,16 +31,16 @@ export default class LoginSettingsRuleDetails extends Component {
|
|||
@tracked showConfirmModal = false;
|
||||
|
||||
displayFields = {
|
||||
defaultAuthType: 'Default method',
|
||||
backupAuthTypes: 'Backup methods',
|
||||
disableInheritance: 'Inheritance enabled',
|
||||
namespacePath: 'Namespace the rule applies to',
|
||||
default_auth_type: 'Default method',
|
||||
backup_auth_types: 'Backup methods',
|
||||
disable_inheritance: 'Inheritance enabled',
|
||||
namespace_path: 'Namespace the rule applies to',
|
||||
};
|
||||
|
||||
displayValue = (key) => {
|
||||
const value = this.args.rule[key];
|
||||
// flip boolean for disable inheritance so template reads "Inheritance enabled: Yes/No"
|
||||
return key === 'disableInheritance' ? !value : value;
|
||||
return key === 'disable_inheritance' ? !value : value;
|
||||
};
|
||||
|
||||
@action
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export default class LoginSettingsRoute extends Route {
|
|||
const { data } = await adapter.ajax('/v1/sys/config/ui/login/default-auth', 'GET', {
|
||||
data: { list: true },
|
||||
});
|
||||
const loginRules = this.api.keyInfoToArray({ keyInfo: data.key_info, keys: data.keys });
|
||||
const loginRules = this.api.keyInfoToArray(data);
|
||||
return { loginRules };
|
||||
} catch (e) {
|
||||
if (e.httpStatus === 404) {
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ module('Unit | Service | api', function (hooks) {
|
|||
|
||||
test('it should map list response to array', async function (assert) {
|
||||
const response = {
|
||||
keyInfo: {
|
||||
key_info: {
|
||||
key1: { title: 'Title 1' },
|
||||
key2: { title: 'Title 2' },
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue