132 lines
3.8 KiB
Handlebars
132 lines
3.8 KiB
Handlebars
{{!
|
|
Copyright IBM Corp. 2021, 2026
|
|
SPDX-License-Identifier: BUSL-1.1
|
|
}}
|
|
|
|
<Rose::Form
|
|
class='full-width'
|
|
@onSubmit={{fn @submit this.grantStrings}}
|
|
@cancel={{@cancel}}
|
|
@disabled={{@model.isSaving}}
|
|
as |form|
|
|
>
|
|
<Hds::Layout::Grid
|
|
@columnWidth={{hash sm='100%' md='33.33%'}}
|
|
@gap='12'
|
|
as |LG|
|
|
>
|
|
<LG.Item @colspan={{hash sm=1 md=2}} @rowspan='2'>
|
|
<Hds::CodeEditor
|
|
class='grant-editor'
|
|
@hasFullScreenButton={{true}}
|
|
@ariaLabel={{t 'form.secret-editor.label'}}
|
|
@value={{this.grantStringsText}}
|
|
@onSetup={{this.onSetup}}
|
|
@customExtensions={{this.customExtensions}}
|
|
@cspNonce={{(csp-nonce)}}
|
|
data-test-code-editor
|
|
as |CE|
|
|
>
|
|
<CE.Title>
|
|
{{t 'resources.role.edit-grants.editor.title'}}
|
|
</CE.Title>
|
|
<CE.Description>
|
|
{{t 'resources.role.edit-grants.editor.description'}}
|
|
</CE.Description>
|
|
</Hds::CodeEditor>
|
|
<form.actions class='margin-top-l'>
|
|
<:actions>
|
|
<Hds::ButtonSet>
|
|
<Hds::Button type='submit' @text={{t 'actions.save'}} />
|
|
<Hds::Button
|
|
type='button'
|
|
@text={{t 'actions.cancel'}}
|
|
@color='secondary'
|
|
{{on 'click' @cancel}}
|
|
/>
|
|
{{#if this.grantStrings.length}}
|
|
<Hds::Button
|
|
@text={{t 'actions.export'}}
|
|
@color='tertiary'
|
|
@icon='upload'
|
|
data-test-export-grants-btn
|
|
{{on 'click' this.toggleExportOptionsFlyout}}
|
|
/>
|
|
{{/if}}
|
|
</Hds::ButtonSet>
|
|
</:actions>
|
|
</form.actions>
|
|
</LG.Item>
|
|
|
|
<Hds::Accordion @size='large' as |A|>
|
|
<A.Item>
|
|
<:toggle>{{t
|
|
'resources.role.edit-grants.string-formats.title_plural'
|
|
}}</:toggle>
|
|
<:content>
|
|
<GrantStringFormats />
|
|
</:content>
|
|
</A.Item>
|
|
<A.Item @isOpen={{true}} @isStatic={{true}} data-test-grant-actions>
|
|
<:toggle>{{t 'titles.actions'}}</:toggle>
|
|
<:content>
|
|
<div class='grant-actions-scroll-container' tabindex='0'>
|
|
<GrantActions
|
|
@grantsSchema={{@grantsSchema}}
|
|
@grantString={{this.currentLineText}}
|
|
/>
|
|
</div>
|
|
</:content>
|
|
</A.Item>
|
|
</Hds::Accordion>
|
|
</Hds::Layout::Grid>
|
|
|
|
{{#if this.showExportOptionsFlyout}}
|
|
<Hds::Flyout
|
|
id='export-options-flyout'
|
|
@size='large'
|
|
@onClose={{this.toggleExportOptionsFlyout}}
|
|
data-test-export-options-flyout
|
|
as |M|
|
|
>
|
|
<M.Header>{{t 'actions.export'}}</M.Header>
|
|
<M.Body>
|
|
<Hds::Form::Select::Field
|
|
name='export-format'
|
|
@width='100%'
|
|
{{on 'change' (set-from-event this 'selectedExportOption')}}
|
|
as |F|
|
|
>
|
|
<F.Label>{{t 'resources.role.edit-grants.export.format'}}</F.Label>
|
|
<F.Options>
|
|
{{#each this.exportOptions as |type|}}
|
|
<option
|
|
value={{type}}
|
|
selected={{eq type this.selectedExportOption}}
|
|
>
|
|
{{t (concat 'resources.role.edit-grants.export.options.' type)}}
|
|
</option>
|
|
{{/each}}
|
|
</F.Options>
|
|
</Hds::Form::Select::Field>
|
|
|
|
<Hds::CodeBlock
|
|
@ariaLabel={{t
|
|
'resources.role.edit-grants.export.formatted-export-aria-label'
|
|
}}
|
|
@hasCopyButton={{true}}
|
|
@language='hcl'
|
|
@value={{this.formattedExport}}
|
|
/>
|
|
|
|
<Hds::Button
|
|
class='margin-top-l'
|
|
@text={{t 'actions.download'}}
|
|
@icon='download'
|
|
@color='secondary'
|
|
{{on 'click' this.downloadFormattedExport}}
|
|
/>
|
|
</M.Body>
|
|
</Hds::Flyout>
|
|
{{/if}}
|
|
</Rose::Form> |