Files
threshold-ui/ui/admin/app/templates/scopes/scope/edit.hbs
T
Priya Patel b06c396086 Refactor - Rose::Page::Layout (#2849)
* Refactor: Rose::Page::Layout - header, actions and breadcrumbs (#2813)

* refactor: 💡 page::layout- header,breadcrumb and actions

* refactor: 💡 added new class for the page layout, fixed a11y

* refactor: 💡 addressed comments

* refactor: 💡 moved copy snippet to PH.Generic

* refactor: 💡 addressed comments

* Refactor: Rose::Page::Layout - header, actions and breadcrumbs Part 2 (#2825)

* refactor: 💡 rose page layout header

* refactor: 💡 removed extra classes

* Refactor: Rose::Page::Layout - header, actions and breadcrumbs Final Part (#2840)

* refactor: 💡 rose page layout header

* Refactor: Rose::Page::Layout - header, actions and breadcrumbs (#2813)

* refactor: 💡 page::layout- header,breadcrumb and actions

* refactor: 💡 added new class for the page layout, fixed a11y

* refactor: 💡 addressed comments

* refactor: 💡 moved copy snippet to PH.Generic

* refactor: 💡 addressed comments

* Refactor: Rose::Page::Layout - header, actions and breadcrumbs Part 2 (#2825)

* refactor: 💡 rose page layout header

* refactor: 💡 removed extra classes

* refactor: 💡 fixed a11y heading, actions dropdown

* refactor: 💡 fixed page header

* refactor: 💡 fix heading margin and failing tests

* refactor: 💡 add back margin for hds header tags

* refactor: 💡 fix style
2025-06-02 16:20:50 -05:00

192 lines
6.5 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
{{#if @model.isGlobal}}
{{page-title (t 'resources.global.title')}}
<Breadcrumbs::Item
@text={{t 'resources.global.title'}}
@icon='globe'
@route='scopes.scope.edit'
@model={{@model.id}}
/>
{{/if}}
<Rose::Layout::Page as |page|>
<page.header>
<Hds::PageHeader as |PH|>
<PH.Breadcrumb>
<Breadcrumbs::Container />
</PH.Breadcrumb>
{{#each this.scopeTypes as |scope|}}
{{#if (get @model scope.key)}}
<PH.Title>
{{t scope.title}}
<DocLink @doc={{scope.doc}} />
</PH.Title>
<PH.Description>
{{t scope.description}}
</PH.Description>
{{/if}}
{{/each}}
{{#if (and (can 'delete model' @model) (not @model.isGlobal))}}
<PH.Actions>
<Hds::Dropdown data-test-manage-projects-dropdown as |dd|>
<dd.ToggleButton @text={{t 'actions.manage'}} @color='secondary' />
<dd.Interactive
@color='critical'
{{on 'click' (fn this.scopes.delete @model)}}
>{{t
(if
@model.isOrg
'resources.org.actions.delete'
'resources.project.actions.delete'
)
}}</dd.Interactive>
</Hds::Dropdown>
</PH.Actions>
{{/if}}
<PH.Generic>
<Hds::Copy::Snippet @textToCopy={{@model.id}} @color='secondary' />
</PH.Generic>
</Hds::PageHeader>
</page.header>
{{#if (can 'read model' @model)}}
<page.navigation>
<Rose::Nav::Tabs as |nav|>
<nav.link @route='scopes.scope'>
{{t 'titles.details'}}
</nav.link>
</Rose::Nav::Tabs>
</page.navigation>
{{/if}}
<page.body>
<Rose::Layout::BodyContent as |bc|>
<bc.Body>
{{#if (can 'read model' @model)}}
<Form::Scope
@model={{@model}}
@submit={{fn this.scopes.save @model}}
@cancel={{fn this.scopes.cancel @model}}
/>
{{else}}
<Rose::Layout::Centered>
<Hds::ApplicationState as |A|>
<A.Body @text={{t 'resources.scope.messages.cannot_read'}} />
</Hds::ApplicationState>
</Rose::Layout::Centered>
{{/if}}
</bc.Body>
{{#if (can 'attachStoragePolicy scope' @model)}}
<bc.Sidebar>
<div class='policy-sidebar'>
<Hds::Text::Display @tag='h2' class='remove-margin'>
{{t 'resources.policy.title'}}
</Hds::Text::Display>
{{#if @model.storage_policy_id}}
<Hds::Text::Body @tag='p' class='description'>
{{t 'resources.policy.titles.policy_description'}}
<Hds::Link::Inline
@color='secondary'
@href={{doc-url 'storage-policy.update'}}
>
{{t 'actions.read-more'}}
</Hds::Link::Inline>
</Hds::Text::Body>
{{else}}
<Hds::Text::Body @tag='p' class='description'>
{{t 'resources.policy.titles.create_policy_description'}}
<Hds::Link::Inline
@color='secondary'
@href={{doc-url 'storage-policy.update'}}
>
{{t 'actions.read-more'}}
</Hds::Link::Inline>
</Hds::Text::Body>
{{/if}}
{{#if @model.storage_policy_id}}
<LinkListPanel as |P|>
<P.Item
@icon='hourglass'
@color='boundary'
@text={{this.storage_policy.displayName}}
>
{{#if this.storage_policy.retain_for.days}}
<Hds::Text::Body
@tag='p'
@color='var(--ui-gray-subtler-1)'
@size='100'
>
{{t 'resources.policy.titles.retain_for'}}
{{#if (gte this.storage_policy.retain_for.days 1)}}
{{format-day-year this.storage_policy.retain_for.days}}
{{else if (eq this.storage_policy.retain_for.days -1)}}
{{t 'resources.policy.titles.forever'}}
{{/if}}
</Hds::Text::Body>
{{/if}}
{{#if (gt this.storage_policy.delete_after.days 0)}}
<Hds::Text::Body
@tag='p'
@color='var(--ui-gray-subtler-1)'
@size='100'
>
{{t 'resources.policy.titles.delete_after'}}
{{format-day-year this.storage_policy.delete_after.days}}
</Hds::Text::Body>
{{/if}}
</P.Item>
{{#if (can 'detachStoragePolicy scope' @model)}}
<P.Item>
<Hds::Dropdown as |dd|>
<dd.ToggleIcon
@icon='more-horizontal'
@text={{t 'actions.manage'}}
@hasChevron={{false}}
@size='small'
/>
<dd.Interactive
@route='scopes.scope.policies.policy'
@model={{this.storage_policy.id}}
>{{t 'actions.view'}}</dd.Interactive>
<dd.Separator />
<dd.Interactive
@color='critical'
{{on
'click'
(fn this.scopes.detachStoragePolicy @model)
}}
>{{t 'resources.policy.actions.detach'}}</dd.Interactive>
</Hds::Dropdown>
</P.Item>
{{/if}}
</LinkListPanel>
<Hds::Link::Standalone
@icon='arrow-right'
@iconPosition='trailing'
@text={{t 'resources.policy.actions.add'}}
@route='scopes.scope.add-storage-policy'
/>
{{else}}
<Hds::Button
@text={{t 'resources.policy.actions.add'}}
@color='secondary'
@route='scopes.scope.add-storage-policy'
/>
{{/if}}
</div>
</bc.Sidebar>
{{/if}}
</Rose::Layout::BodyContent>
</page.body>
</Rose::Layout::Page>