Files
threshold-ui/ui/admin/app/templates/scopes/scope/edit.hbs
T
Cameron Perera eb9fe573b8 Icu 11937 foundation components retire rose typography styles (#2810)
* refactor: 💡 update _typography stylesheet

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 update header margin styles into single rule

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 add remove-header-margin class

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 remove 'header' class

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* test: 💍 fix failing tests for branded-card in desktop

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 update style rule to use :where()

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 rename remove-header-margin to remove-margin

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 update style comment

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937
2025-05-15 14:48:27 -05:00

206 lines
7.0 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.breadcrumbs>
<Breadcrumbs::Container />
</page.breadcrumbs>
<page.header>
{{#if @model.isGlobal}}
<Hds::Text::Display @tag='h2' @size='400' @weight='bold'>
{{t 'resources.global.title'}}
<DocLink @doc='global' />
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @size='300' class='p'>
{{t 'resources.global.description'}}
</Hds::Text::Body>
{{/if}}
{{#if @model.isOrg}}
<Hds::Text::Display @tag='h2' @size='400' @weight='bold'>
{{t 'resources.org.title'}}
<DocLink @doc='org' />
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @size='300' class='p'>
{{t 'resources.org.description'}}
</Hds::Text::Body>
{{/if}}
{{#if @model.isProject}}
<Hds::Text::Display @tag='h2' @size='400' @weight='bold'>
{{t 'resources.project.title'}}
<DocLink @doc='project' />
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @size='300' class='p'>
{{t 'resources.project.description'}}
</Hds::Text::Body>
{{/if}}
<Hds::Copy::Snippet @textToCopy={{@model.id}} @color='secondary' />
</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}}
{{#if (and (can 'delete model' @model) (not @model.isGlobal))}}
<page.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>
</page.actions>
{{/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='h3' 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>