Jordan Reimer e18b0485f5
[UI] Ember Data Migration - Config UI Engine (#30238)
* WIP updating config-ui engine to use api service and form class

* updates form-field component to support false values for radio types

* updates api-error-message util to log out error in dev env

* fixes issues in custom messages create and edit workflows

* fixes issues in api service

* updates capabilities handling

* updates to custom messages form

* removes store from custom messages tests

* removes store as dependency from config-ui engine

* removes commented out code in messages route

* updates orderedKeys to displayFields in messages page component

* removes unneccesary method var from message create-and-edit component

* removes comment about model in message details page
2025-04-28 16:09:11 -06:00

60 lines
2.0 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
<Messages::TabPageHeader
@authenticated={{@message.authenticated}}
@pageTitle={{@message.title}}
@breadcrumbs={{@breadcrumbs}}
/>
<Toolbar>
<ToolbarActions aria-label="message delete and edit">
{{#if @capabilities.canDelete}}
<ConfirmAction
class="toolbar-button"
@buttonColor="secondary"
@onConfirmAction={{this.deleteMessage}}
@confirmTitle="Are you sure?"
@confirmMessage="This will delete this message permanently. You cannot undo this action."
@buttonText="Delete message"
data-test-confirm-action="Delete message"
/>
<div class="toolbar-separator"></div>
{{/if}}
{{#if @capabilities.canUpdate}}
<LinkTo class="toolbar-link" @route="messages.message.edit" @model={{@message.id}} data-test-link="edit">
Edit message
<Icon @name="chevron-right" />
</LinkTo>
{{/if}}
</ToolbarActions>
</Toolbar>
{{#each this.displayFields as |field|}}
{{#if (or (eq field "endTime") (eq field "startTime"))}}
{{! if the attr is an endTime and is falsy, we want to show a 'Never' text value }}
<InfoTableRow
@label={{capitalize (humanize (dasherize field))}}
@value={{if
(and (eq field "endTime") (not (get @message field)))
"Never"
(date-format (get @message field) "MMM d, yyyy hh:mm aaa" withTimeZone=true)
}}
/>
{{else if (eq field "link")}}
{{#if (is-empty-value @message.link)}}
<InfoTableRow @label="Link" @value="None" />
{{else}}
{{#each-in @message.link as |title href|}}
<InfoTableRow @label="Link" @value={{title}}>
<Hds::Link::Inline @icon="external-link" @href={{href}} data-test-link="message link">{{title}}</Hds::Link::Inline>
</InfoTableRow>
{{/each-in}}
{{/if}}
{{else}}
<InfoTableRow @label={{capitalize (humanize (dasherize field))}} @value={{get @message field}} />
{{/if}}
{{/each}}