chore: 🤖 migrate host catalog and host set list wrapper fields to key value (#3276)

This commit is contained in:
Dharini committed 2026-06-03 16:36:29 -07:00
1 parent 4e2b779d96
commit 0e223ded8f
26 files changed
+512 -388

No files matched your search

@@ -11,8 +11,5 @@
@removeItemByIndex={{@removeItemByIndex}}
@addStringItem={{@addStringItem}}
@addAccountMapItem={{@addAccountMapItem}}
@addRow={{this.addRow}}
@removeRow={{this.removeRow}}
@updateRow={{this.updateRow}}
/>
{{/if}}
@@ -5,7 +5,6 @@
import Component from '@glimmer/component';
import { assert } from '@ember/debug';
import { action } from '@ember/object';
import oidc from './oidc';
import ldap from './ldap';
import password from './password';
@@ -25,47 +24,4 @@ export default class FormAuthMethodIndex extends Component {
);
return component;
}
/**
* Adds a new empty row to the specified field
* @param {string} field - The field name to add a row to
* @param {Array<string>} properties - Array of property names for the empty row (e.g., ['value'] or ['key', 'value'])
*/
@action
addRow(field, properties) {
const emptyRow = Object.fromEntries(properties.map((prop) => [prop, '']));
this.args.model[field] = [...this.args.model[field], emptyRow];
}
/**
* Removes a row from the specified field
* @param {string} field - The field name to remove a row from
* @param {object} rowData - The row data to remove
*/
@action
removeRow(field, rowData) {
let rows = this.args.model[field].filter((item) => item !== rowData);
// Ensure at least one empty row exists for editing
if (rows.length === 0) {
const emptyRow = Object.fromEntries(
Object.keys(rowData).map((key) => [key, '']),
);
rows = [emptyRow];
}
this.args.model[field] = rows;
}
/**
* Updates a specific property in a row
* @param {string} field - The field name containing the row
* @param {object} rowData - The row object to update
* @param {string} property - The property name to update
* @param {object} event - The DOM event containing the new value
*/
@action
updateRow(field, rowData, property, { target: { value } }) {
rowData[property] = value;
this.args.model[field] = [...this.args.model[field]];
}
}
@@ -84,10 +84,9 @@
<Form::Field::KeyValue
@name='certificates'
@model={{@model}}
@properties={{array 'value'}}
@data={{@model.certificates}}
@onAdd={{fn @addRow 'certificates' (array 'value')}}
@onRemove={{fn @removeRow 'certificates'}}
@onUpdate={{fn @updateRow 'certificates'}}
@legend={{t 'resources.auth-method.form.certificates.label'}}
@helperText={{t 'resources.auth-method.form.certificates.help'}}
@errors={{@model.errors.certificates}}
@@ -402,10 +401,9 @@
<Form::field::KeyValue
@name='account_attribute_maps'
@model={{@model}}
@properties={{array 'key' 'value'}}
@data={{@model.account_attribute_maps}}
@onAdd={{fn @addRow 'account_attribute_maps' (array 'key' 'value')}}
@onRemove={{fn @removeRow 'account_attribute_maps'}}
@onUpdate={{fn @updateRow 'account_attribute_maps'}}
@legend={{t 'resources.auth-method.form.account_attribute_maps.label'}}
@helperText={{t 'resources.auth-method.form.account_attribute_maps.help'}}
@errors={{@model.errors.account_attribute_maps}}
@@ -149,10 +149,9 @@
{{! Signing algorithms }}
<Form::Field::KeyValue
@name='signing_algorithms'
@model={{@model}}
@properties={{array 'value'}}
@data={{@model.signing_algorithms}}
@onAdd={{fn @addRow 'signing_algorithms' (array 'value')}}
@onRemove={{fn @removeRow 'signing_algorithms'}}
@onUpdate={{fn @updateRow 'signing_algorithms'}}
@legend={{t 'form.signing_algorithms.label'}}
@helperText={{t 'form.signing_algorithms.help'}}
@errors={{@model.errors.signing_algorithms}}
@@ -187,10 +186,9 @@
{{! Allowed audiences }}
<Form::Field::KeyValue
@name='allowed_audiences'
@model={{@model}}
@properties={{array 'value'}}
@data={{@model.allowed_audiences}}
@onAdd={{fn @addRow 'allowed_audiences' (array 'value')}}
@onRemove={{fn @removeRow 'allowed_audiences'}}
@onUpdate={{fn @updateRow 'allowed_audiences'}}
@legend={{t 'form.allowed_audiences.label'}}
@helperText={{t 'form.allowed_audiences.help'}}
@errors={{@model.errors.allowed_audiences}}
@@ -214,10 +212,9 @@
{{! Claims Scopes }}
<Form::Field::KeyValue
@name='claims_scopes'
@model={{@model}}
@properties={{array 'value'}}
@data={{@model.claims_scopes}}
@onAdd={{fn @addRow 'claims_scopes' (array 'value')}}
@onRemove={{fn @removeRow 'claims_scopes'}}
@onUpdate={{fn @updateRow 'claims_scopes'}}
@legend={{t 'form.claims_scopes.label'}}
@helperText={{t 'form.claims_scopes.help'}}
@errors={{@model.errors.claims_scopes}}
@@ -241,10 +238,9 @@
{{! Account Claim Maps }}
<Form::Field::KeyValue
@name='account_claim_maps'
@model={{@model}}
@properties={{array 'key' 'value'}}
@data={{@model.account_claim_maps}}
@onAdd={{fn @addRow 'account_claim_maps' (array 'key' 'value')}}
@onRemove={{fn @removeRow 'account_claim_maps'}}
@onUpdate={{fn @updateRow 'account_claim_maps'}}
@legend={{t 'form.account_claim_maps.label'}}
@helperText={{t 'form.account_claim_maps.help'}}
@errors={{@model.errors.account_claim_maps}}
@@ -287,10 +283,9 @@
{{! Certificates }}
<Form::Field::KeyValue
@name='idp_ca_certs'
@model={{@model}}
@properties={{array 'value'}}
@data={{@model.idp_ca_certs}}
@onAdd={{fn @addRow 'idp_ca_certs' (array 'value')}}
@onRemove={{fn @removeRow 'idp_ca_certs'}}
@onUpdate={{fn @updateRow 'idp_ca_certs'}}
@legend={{t 'form.idp_ca_certs.label'}}
@helperText={{t 'form.idp_ca_certs.help'}}
@errors={{@model.errors.idp_ca_certs}}