1 parent
6d88206491
commit
2dbcc1c0af
9 files changed
+454
-2
No files matched your search
@@ -0,0 +1,152 @@
|
||||
{{!
|
||||
Copyright (c) HashiCorp, Inc.
|
||||
SPDX-License-Identifier: MPL-2.0
|
||||
}}
|
||||
|
||||
<Rose::Form
|
||||
@onSubmit={{@submit}}
|
||||
@cancel={{@cancel}}
|
||||
@disabled={{@model.isSaving}}
|
||||
@showEditToggle={{if @model.isNew false true}}
|
||||
as |form|
|
||||
>
|
||||
<Hds::Form::TextInput::Field
|
||||
name='name'
|
||||
@isOptional={{true}}
|
||||
@value={{@model.name}}
|
||||
@isInvalid={{@model.errors.name}}
|
||||
disabled={{form.disabled}}
|
||||
{{on 'input' (set-from-event @model 'name')}}
|
||||
as |F|
|
||||
>
|
||||
<F.Label>{{t 'form.name.label'}}</F.Label>
|
||||
<F.HelperText>{{t 'form.name.help'}}</F.HelperText>
|
||||
{{#if @model.errors.name}}
|
||||
<F.Error as |E|>
|
||||
{{#each @model.errors.name as |error|}}
|
||||
<E.Message>{{error.message}}</E.Message>
|
||||
{{/each}}
|
||||
</F.Error>
|
||||
{{/if}}
|
||||
</Hds::Form::TextInput::Field>
|
||||
<Hds::Form::Textarea::Field
|
||||
name='description'
|
||||
@isOptional={{true}}
|
||||
@value={{@model.description}}
|
||||
@isInvalid={{@model.errors.description}}
|
||||
disabled={{form.disabled}}
|
||||
as |F|
|
||||
>
|
||||
<F.Label>{{t 'form.description.label'}}</F.Label>
|
||||
<F.HelperText>{{t 'form.description.help'}}</F.HelperText>
|
||||
{{#if @model.errors.description}}
|
||||
<F.Error as |E|>
|
||||
{{#each @model.errors.description as |error|}}
|
||||
<E.Message>{{error.message}}</E.Message>
|
||||
{{/each}}
|
||||
</F.Error>
|
||||
{{/if}}
|
||||
</Hds::Form::Textarea::Field>
|
||||
|
||||
<Hds::Form::Fieldset as |F|>
|
||||
<F.Legend>
|
||||
{{t 'resources.alias.form.options.label'}}
|
||||
</F.Legend>
|
||||
<F.HelperText>
|
||||
{{t 'resources.alias.description'}}
|
||||
</F.HelperText>
|
||||
<F.Control>
|
||||
<Hds::Form::RadioCard::Group @name='type' @alignment='center' as |G|>
|
||||
<G.Legend>{{t 'resources.target.form.type.label'}}</G.Legend>
|
||||
<G.RadioCard @maxWidth='15rem' @checked='true' @disabled='true' as |R|>
|
||||
<R.Label>{{t 'resources.alias.form.type.label'}}</R.Label>
|
||||
<R.Description>{{t 'resources.alias.form.type.help'}}</R.Description>
|
||||
<R.Icon @name='target' />
|
||||
</G.RadioCard>
|
||||
</Hds::Form::RadioCard::Group>
|
||||
</F.Control>
|
||||
</Hds::Form::Fieldset>
|
||||
|
||||
<Hds::Form::TextInput::Field
|
||||
name='destination_id'
|
||||
@isOptional={{true}}
|
||||
@value={{@model.destination_id}}
|
||||
@isInvalid={{@model.errors.destination_id}}
|
||||
disabled={{form.disabled}}
|
||||
{{on 'input' (set-from-event @model 'destination_id')}}
|
||||
as |F|
|
||||
>
|
||||
<F.Label>{{t 'resources.alias.form.destination_id.label'}}</F.Label>
|
||||
<F.HelperText>{{t
|
||||
'resources.alias.form.destination_id.help'
|
||||
}}</F.HelperText>
|
||||
{{#if @model.errors.destination_id}}
|
||||
<F.Error as |E|>
|
||||
{{#each @model.errors.destination_id as |error|}}
|
||||
<E.Message>{{error.message}}</E.Message>
|
||||
{{/each}}
|
||||
</F.Error>
|
||||
{{/if}}
|
||||
</Hds::Form::TextInput::Field>
|
||||
|
||||
<Hds::Form::TextInput::Field
|
||||
name='authorize_session_arguments'
|
||||
@isOptional={{true}}
|
||||
@value={{@model.authorize_session_arguments.host_id}}
|
||||
@isInvalid={{@model.errors.authorize_session_arguments.host_id}}
|
||||
disabled={{form.disabled}}
|
||||
{{on 'input' this.handleHostIdChange}}
|
||||
as |F|
|
||||
>
|
||||
<F.Label>{{t
|
||||
'resources.alias.form.authorize_session_arguments.label'
|
||||
}}</F.Label>
|
||||
<F.HelperText>{{t
|
||||
'resources.alias.form.authorize_session_arguments.help'
|
||||
}}</F.HelperText>
|
||||
{{#if @model.errors.authorize_session_arguments.host_id}}
|
||||
<F.Error as |E|>
|
||||
{{#each @model.errors.authorize_session_arguments.host_id as |error|}}
|
||||
<E.Message>{{error.message}}</E.Message>
|
||||
{{/each}}
|
||||
</F.Error>
|
||||
{{/if}}
|
||||
</Hds::Form::TextInput::Field>
|
||||
|
||||
<InfoField
|
||||
@value={{@model.scopeModel.displayName}}
|
||||
@icon='globe'
|
||||
disabled={{form.disabled}}
|
||||
as |F|
|
||||
>
|
||||
<F.Label>{{t 'resources.scope.title'}}</F.Label>
|
||||
</InfoField>
|
||||
|
||||
<Hds::Form::TextInput::Field
|
||||
name='value'
|
||||
@isRequired={{true}}
|
||||
@value={{@model.value}}
|
||||
@isInvalid={{@model.errors.value}}
|
||||
disabled={{form.disabled}}
|
||||
{{on 'input' (set-from-event @model 'value')}}
|
||||
as |F|
|
||||
>
|
||||
<F.Label>{{t 'resources.alias.form.value.label'}}</F.Label>
|
||||
<F.HelperText>{{t 'resources.alias.form.value.help'}}</F.HelperText>
|
||||
{{#if @model.errors.value}}
|
||||
<F.Error as |E|>
|
||||
{{#each @model.errors.value as |error|}}
|
||||
<E.Message>{{error.message}}</E.Message>
|
||||
{{/each}}
|
||||
</F.Error>
|
||||
{{/if}}
|
||||
</Hds::Form::TextInput::Field>
|
||||
|
||||
{{#if (can 'save model' @model)}}
|
||||
<form.actions
|
||||
@enableEditText={{t 'actions.edit-form'}}
|
||||
@submitText={{t 'actions.save'}}
|
||||
@cancelText={{t 'actions.cancel'}}
|
||||
/>
|
||||
{{/if}}
|
||||
</Rose::Form>
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Component from '@glimmer/component';
|
||||
import { action } from '@ember/object';
|
||||
|
||||
export default class FormAliasComponent extends Component {
|
||||
//actions
|
||||
/**
|
||||
* Handles input changes
|
||||
*/
|
||||
@action
|
||||
handleHostIdChange({ target: { value } }) {
|
||||
if (value) {
|
||||
this.args.model.authorize_session_arguments = {
|
||||
host_id: value,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user