2020-07-09 09:08:47 +00:00
<DataForm
@dc= {{ dc }}
@nspace= {{ nspace }}
@type="intention"
@autofill= {{ autofill }}
@item= {{ item }}
@src= {{ src }}
@onchange= {{ action "change" }}
@onsubmit= {{ action onsubmit }}
as |api|
>
<BlockSlot @name="error" as |Notification|>
<Notification>
<p data-notification role="alert" class="error notification-update">
{{ # if ( starts-with 'duplicate intention found:' api .error .detail ) }}
<strong>Intention exists</strong>
An intention already exists for this Source-Destination pair. Please enter a different combination of Services, or search the intentions to edit an existing intention.
{{ else }}
<strong>Error!</strong>
There was an error saving your intention.
{{ # if ( and api .error .status api .error .detail ) }}
<br /> {{ api .error .status }} : {{ api .error .detail }}
{{ / if }}
{{ / if }}
</p>
</Notification>
</BlockSlot>
2018-05-22 15:03:45 +00:00
2020-07-09 09:08:47 +00:00
<BlockSlot @name="form">
2020-09-18 10:14:06 +00:00
{{ # let api .data as | item | }}
{{ # if item .IsEditable }}
2020-07-09 09:08:47 +00:00
<DataSource
@src= {{ concat '/' nspace '/' dc '/services' }}
2020-09-18 10:14:06 +00:00
@onchange= {{ action "createServices" item }}
2020-07-09 09:08:47 +00:00
/>
{{ # if ( env 'CONSUL_NSPACES_ENABLED' ) }}
<DataSource
@src="/*/*/namespaces"
2020-09-18 10:14:06 +00:00
@onchange= {{ action "createNspaces" item }}
2020-07-09 09:08:47 +00:00
/>
{{ / if }}
<form onsubmit= {{ action api .submit }} >
2020-09-18 10:14:06 +00:00
<ConsulIntentionForm::Fieldsets
@nspaces= {{ nspaces }}
@services= {{ services }}
@SourceName= {{ SourceName }}
@SourceNS= {{ SourceNS }}
@DestinationName= {{ DestinationName }}
@DestinationNS= {{ DestinationNS }}
@item= {{ item }}
@disabled= {{ api .disabled }}
2020-09-24 15:07:13 +00:00
@create= {{ api .isCreate }}
2020-09-18 10:14:06 +00:00
@onchange= {{ api .change }}
/>
2020-07-09 09:08:47 +00:00
<div>
2020-09-18 10:14:06 +00:00
<button type="submit" disabled= {{ or item .isInvalid api .disabled }} >Save</button>
<button type="reset" onclick= {{ action oncancel item }} disabled= {{ api .disabled }} >Cancel</button>
{{ # if ( not api .isCreate ) }}
{{ # if ( not-eq item .ID 'anonymous' ) }}
2020-07-09 09:08:47 +00:00
<ConfirmationDialog @message="Are you sure you want to delete this Intention?">
<BlockSlot @name="action" as |confirm|>
<button data-test-delete type="button" class="type-delete" {{ action confirm api .delete }} disabled= {{ api .disabled }} >Delete</button>
</BlockSlot>
<BlockSlot @name="dialog" as |execute cancel message|>
<DeleteConfirmation @message= {{ message }} @execute= {{ execute }} @cancel= {{ cancel }} />
</BlockSlot>
</ConfirmationDialog>
2020-09-18 10:14:06 +00:00
{{ / if }}
{{ / if }}
2020-07-09 09:08:47 +00:00
</div>
2020-09-18 10:14:06 +00:00
</form>
{{ else }}
<ConsulIntentionView
@item= {{ item }}
/>
{{ / if }}
{{ / let }}
2020-07-09 09:08:47 +00:00
</BlockSlot>
</DataForm>