* refactor: 💡 use hds::applicationstate instead of rose::message ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-15639
200 lines
6.6 KiB
Handlebars
200 lines
6.6 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}}
|
|
<h2>
|
|
{{t 'resources.global.title'}}
|
|
<DocLink @doc='global' @iconSize='large' />
|
|
</h2>
|
|
<p>{{t 'resources.global.description'}}</p>
|
|
{{/if}}
|
|
{{#if @model.isOrg}}
|
|
<h2>
|
|
{{t 'resources.org.title'}}
|
|
<DocLink @doc='org' @iconSize='large' />
|
|
</h2>
|
|
<p>{{t 'resources.org.description'}}</p>
|
|
{{/if}}
|
|
{{#if @model.isProject}}
|
|
<h2>
|
|
{{t 'resources.project.title'}}
|
|
<DocLink @doc='project' @iconSize='large' />
|
|
</h2>
|
|
<p>{{t 'resources.project.description'}}</p>
|
|
{{/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'>
|
|
{{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> |