b81adc6f69
* ui: inject router service into Variable ability to compute path * ui: test create secure variable ability * refact: update templates to properly check create ability * chore: update token factory to enable 1 path to have create ability * refact: remove router service injection for path variable * refact: update mirage factory for edit and delete perms on path for testing * ui: handle path matching (#13474) * test: write specifications for nearestPath computation * ui: write logic for getting all paths * ui: nearestPathMatching algorithm * test: nearestPathMatching algorithm test * ui: handle namespace filtering for capabilities check (#13475) * ui: add namespace handling * refact: add logical OR operator to handle unstructured object. * ui: acceptance test for create flow in secure variables (#13500) * test: write happy path test for creating variable * refact: add missing data-test attributes * test: sad path for disabled button * fix: move comment in file * test: acceptance test for editing a variable (#13529) * refact: add data-test variable * test: happy path and sad path for edit flow * refact: update test language to say disabled * ui: glob matching algorithm (#13533) * ui: compute length difference (#13542) * ui: compute length difference * refact: use glob matching and sorting algos in `nearestMatchingPath` (#13544) * refact: use const in compute * ui: smallest difference logic * refact: use glob matching and sorting algo in _nearestPathPath helper * ui: add can edit to variable capabilities (#13545) * ui: create edit capabilities getter * ui: add ember-can check for edit button * refact: update test to mock edit capabilities in policy * fix: remove unused var * Edit capabilities for variables depend on Create Co-authored-by: Phil Renaud <phil@riotindustries.com> Co-authored-by: Phil Renaud <phil@riotindustries.com> Co-authored-by: Phil Renaud <phil@riotindustries.com> * refact: update token factory (#13596) * refact: update rulesJSON in token factory to reflect schema update * refact: update capability names (#13597) * refact: update rules to match rulesJSON * refact: update create to write * ui: add `canDestroy` permissions (#13598) * refact: update rulesJSON in token factory to reflect schema update * refact: update rules to match rulesJSON * refact: update create to write * ui: add canDestroy capability * test: unit test for canDestroy * ui: add permission check to template * test: acceptance test for delete flow * refact: update test to use correct capability name * refact: update tests to reflect rulesJSON schema change * ui: update path matching logic to account for schema change (#13605) * refact: update path matching logic * refact: update tests to reflect rulesJSON change Co-authored-by: Phil Renaud <phil@riotindustries.com> Co-authored-by: Phil Renaud <phil@riotindustries.com>
98 lines
2.6 KiB
Handlebars
98 lines
2.6 KiB
Handlebars
{{#if this.error}}
|
|
<div data-test-inline-error class="notification is-danger">
|
|
<div class="columns">
|
|
<div class="column">
|
|
<h3 data-test-inline-error-title class="title is-4">
|
|
{{this.error.title}}
|
|
</h3>
|
|
<p data-test-inline-error-body>
|
|
{{this.error.description}}
|
|
</p>
|
|
</div>
|
|
<div class="column is-centered is-minimum">
|
|
<button
|
|
data-test-inline-error-close
|
|
class="button is-danger"
|
|
onclick={{action this.onDismissError}}
|
|
type="button"
|
|
>
|
|
Okay
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
|
|
<h1 class="variable-title title with-flex">
|
|
<div>
|
|
<FlightIcon @name="file-text" />
|
|
{{this.model.path}}
|
|
<Toggle
|
|
data-test-memory-toggle
|
|
@isActive={{eq this.view "json"}}
|
|
@onToggle={{action this.toggleView}}
|
|
title="JSON"
|
|
>JSON</Toggle>
|
|
</div>
|
|
<div>
|
|
{{#unless this.isDeleting}}
|
|
{{#if (can "write variable" path=this.model.absolutePath)}}
|
|
<div class="two-step-button">
|
|
<LinkTo
|
|
data-test-edit-button
|
|
class="button is-info is-inverted is-small"
|
|
@model={{this.model}}
|
|
@route="variables.variable.edit"
|
|
@query={{hash view=this.view}}
|
|
>
|
|
Edit
|
|
</LinkTo>
|
|
</div>
|
|
{{/if}}
|
|
{{/unless}}
|
|
{{#if (can "destroy variable" path=this.model.absolutePath)}}
|
|
<TwoStepButton
|
|
data-test-delete-button
|
|
@alignRight={{true}}
|
|
@idleText="Delete"
|
|
@cancelText="Cancel"
|
|
@confirmText="Yes, delete"
|
|
@confirmationMessage="Are you sure you want to delete this variable and all its items?"
|
|
@awaitingConfirmation={{this.deleteVariableFile.isRunning}}
|
|
@onConfirm={{perform this.deleteVariableFile}}
|
|
@onPrompt={{this.onDeletePrompt}}
|
|
@onCancel={{this.onDeleteCancel}}
|
|
/>
|
|
{{/if}}
|
|
</div>
|
|
</h1>
|
|
{{#if (eq this.view "json")}}
|
|
<div class="boxed-section">
|
|
<div class="boxed-section-head">
|
|
Key/Value Data
|
|
<CopyButton
|
|
class="pull-right"
|
|
@compact={{true}}
|
|
@border={{true}}
|
|
@clipboardText={{stringify-object this.model.items}}
|
|
/>
|
|
</div>
|
|
<div class="boxed-section-body is-full-bleed">
|
|
<JsonViewer @json={{this.model.items}} />
|
|
</div>
|
|
</div>
|
|
{{else}}
|
|
<ListTable data-test-eval-table @source={{this.model.keyValues}} as |t|>
|
|
<t.body as |row|>
|
|
<tr data-test-var={{row.model.key}}>
|
|
<td>
|
|
{{row.model.key}}
|
|
</td>
|
|
<td>
|
|
{{row.model.value}}
|
|
</td>
|
|
</tr>
|
|
</t.body>
|
|
</ListTable>
|
|
{{/if}}
|