chore: 🤖 style updates, incl var arg to make it read-write

This commit is contained in:
dharini committed 2023-03-22 16:34:31 +05:30
1 parent 96b2bcd6ff
commit b33efbd5c3
6 files changed
+103 -42

No files matched your search

@@ -4,14 +4,16 @@
}}
<div class='secret-input'>
{{#if (or this.isDisabled this.isActionable)}}
<span class='overlay'></span>
{{/if}}
<Hds::Form::TextInput::Field
@isRequired={{@isRequired}}
@isInvalid={{@isInvalid}}
@value={{this.secret}}
@value={{@value}}
@type={{@type}}
name={{@name}}
disabled={{not this.editing}}
placeholder=' '
disabled={{or @disabled (not this.editing)}}
...attributes
as |F|
>
@@ -14,7 +14,6 @@ export default class FormFieldSecretInputIndexComponent extends Component {
* @type {boolean}
*/
@tracked editing = false;
@tracked secret;
/**
* Returns true if the resource form is in read only mode
@@ -52,7 +51,7 @@ export default class FormFieldSecretInputIndexComponent extends Component {
*/
@action
cancelEdit() {
this.secret = null;
this.editing = false;
this.args.cancel();
}
}
@@ -5,7 +5,7 @@
<Rose::Form
@onSubmit={{@submit}}
@cancel={{@cancel}}
@cancel={{this.cancel}}
@disabled={{@model.isSaving}}
@showEditToggle={{if @model.isNew false true}}
as |form|
@@ -164,6 +164,59 @@
{{/if}}
</Hds::Form::TextInput::Field>
{{#if @model.isNew}}
<Hds::Form::TextInput::Field
@isRequired={{true}}
@value={{@model.access_key_id}}
@isInvalid={{@model.errors.access_key_id}}
@type='text'
name='access_key_id'
disabled={{form.disabled}}
{{on 'input' (set-from-event @model 'access_key_id')}}
as |F|
>
<F.Label>{{t
'resources.storage-bucket.form.access_key_id.label'
}}</F.Label>
<F.HelperText>{{t
'resources.storage-bucket.form.access_key_id.help'
}}</F.HelperText>
{{#if @model.errors.access_key_id}}
<F.Error as |E|>
{{#each @model.errors.access_key_id as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::TextInput::Field>
{{else}}
<Form::Field::SecretInput
@isRequired={{true}}
@isInvalid={{@model.errors.access_key_id}}
@value={{@model.access_key_id}}
@type='text'
@name='access_key_id'
@disabled={{form.disabled}}
@showEditButton={{true}}
@cancel={{this.cancel}}
{{on 'input' (set-from-event @model 'access_key_id')}}
as |F|
>
<F.Label>{{t
'resources.storage-bucket.form.access_key_id.label'
}}</F.Label>
<F.HelperText>{{t
'resources.storage-bucket.form.access_key_id.help'
}}</F.HelperText>
{{#if @model.errors.access_key_id}}
<F.Error as |E|>
{{#each @model.errors.access_key_id as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Form::Field::SecretInput>
{{/if}}
{{#if @model.isNew}}
<Hds::Form::TextInput::Field
@isRequired={{true}}
@@ -17,4 +17,13 @@ export default class FormStorageBucketComponent extends Component {
).model;
this.args.model.scopeModel = selectedScopeModel;
}
/**
* Call passed cancel function.
* Unset updated secrets
*/
@action
cancel() {
this.args.cancel();
}
}
@@ -50,7 +50,30 @@
</F.Error>
{{/if}}
</Hds::Form::Textarea::Field>
<Form::Field::SecretInput
@isRequired={{true}}
@isInvalid={{@model.errors.access_key_id}}
@value={{@model.access_key_id}}
@type='text'
@name='access_key_id'
@disabled={{form.disabled}}
@showEditButton={{true}}
@cancel={{this.cancel}}
{{on 'input' (set-from-event @model 'access_key_id')}}
as |F|
>
<F.Label>{{t 'resources.storage-bucket.form.access_key_id.label'}}</F.Label>
<F.HelperText>{{t
'resources.storage-bucket.form.access_key_id.help'
}}</F.HelperText>
{{#if @model.errors.access_key_id}}
<F.Error as |E|>
{{#each @model.errors.access_key_id as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Form::Field::SecretInput>
{{#if (and @model.isNew (feature-flag 'ssh-target'))}}
<Hds::Form::RadioCard::Group @name='type' @alignment='center' as |G|>
<G.Legend>{{t 'resources.target.form.type.label'}}</G.Legend>
@@ -84,31 +107,6 @@
</InfoField>
{{/if}}
{{#if (feature-flag 'target-network-address')}}
<Hds::Form::TextInput::Field
@isOptional={{true}}
@value={{@model.address}}
@isInvalid={{@model.errors.address}}
@type='text'
name='address'
disabled={{form.disabled}}
{{on 'input' (set-from-event @model 'address')}}
as |F|
>
<F.Label>{{t 'resources.target.form.target-address.label'}}</F.Label>
<F.HelperText>{{t
'resources.target.form.target-address.help'
}}</F.HelperText>
{{#if @model.errors.address}}
<F.Error as |E|>
{{#each @model.errors.address as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::TextInput::Field>
{{/if}}
<Hds::Form::TextInput::Field
@isRequired={{@model.isTCP}}
@isOptional={{not @model.isTCP}}
+10 -10
View File
@@ -692,21 +692,21 @@
display: flex;
align-items: flex-end;
column-gap: 0.5rem;
position: relative;
.hds-form-text-input {
&::placeholder {
content: '';
width: 80%;
height: 0.65rem;
background-color: var(--token-color-palette-neutral-200);
border-radius: 0.25rem;
vertical-align: middle;
}
.overlay {
width: 60%;
height: 1rem;
position: absolute;
bottom: 2.15rem;
left: 0.25rem;
border-radius: 0.25rem;
background-color: var(--token-color-palette-neutral-200);
}
.hds-button {
margin-bottom: 1.5rem;
width: 6rem;
flex-basis: 6rem;
}
}