Icu 6680 UI code editor for secrets (#1499)
* feat: 🎸 initial secret editor * feat: 🎸 Create Secret Editor for JSON Credentials ✅ Closes: ICU-6680 * style: 💄 Fix sass lint errors * style: 💄 Appease sass-lint rule for using --size in stylesheet * refactor: 💡 Set Icon size via component attribute * refactor: 💡 remove computed decorators for Secret Editor * refactor: 💡 update editor styles to using sizing variables * refactor: 💡 update styles and add comments * refactor: 💡 clean up styling for secret editor * refactor: 💡 update class names to be more verbose * chore: 🤖 move jsonlint import to rose index.js * refactor: 💡 remove duplicate margin style for skeleton body * refactor: 💡 add comments to SecretEditor component class * refactor: 💡 large updates to secret json editor * refactor: 💡 Move JSON Secret to form/field/ directory * style: 💄 fix padding for Secret Editor line numbers * chore: 🤖 disable property-sort-oder in .sasslintrc * refactor: 💡 reorder app.scss styles * test: 💍 Add integration tests for JSON Secret and Skeleton
This commit is contained in:
1 parent
c3d9fd8fc5
commit
c62eb751e4
12 files changed
+380
-97
No files matched your search
@@ -0,0 +1,31 @@
|
||||
<div class='secret-editor'>
|
||||
{{#if this.isDisabled}}
|
||||
<Form::Field::JsonSecret::Skeleton>
|
||||
<Rose::Icon @name='flight-icons/svg/eye-off-16' @size='medium' />
|
||||
{{t 'form.secret-editor.details'}}
|
||||
</Form::Field::JsonSecret::Skeleton>
|
||||
{{else if this.isActionable}}
|
||||
<Form::Field::JsonSecret::Skeleton>
|
||||
<Rose::Button
|
||||
@iconLeft='flight-icons/svg/pencil-tool-16'
|
||||
@style='secret-editor-skeleton-button'
|
||||
{{on 'click' this.enableEditing}}
|
||||
>
|
||||
{{t 'form.secret-editor.edit'}}
|
||||
</Rose::Button>
|
||||
</Form::Field::JsonSecret::Skeleton>
|
||||
{{else}}
|
||||
<Rose::CodeEditor as |c|>
|
||||
<c.fieldEditor
|
||||
class='secret-editor-json'
|
||||
@onInput={{@onInput}}
|
||||
@value={{@value}}
|
||||
@options={{hash
|
||||
mode='application/json'
|
||||
gutters=(array 'CodeMirror-lint-markers')
|
||||
lint='true'
|
||||
}}
|
||||
/>
|
||||
</Rose::CodeEditor>
|
||||
{{/if}}
|
||||
</div>
|
||||
@@ -0,0 +1,44 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { action } from '@ember/object';
|
||||
|
||||
export default class FormFieldJsonSecretComponent extends Component {
|
||||
// =properties
|
||||
|
||||
/**
|
||||
* Tracks when editor should be displayed
|
||||
* @type {boolean}
|
||||
*/
|
||||
@tracked editing = false;
|
||||
|
||||
/**
|
||||
* True if viewing the resource after it has been created but not editing it
|
||||
* and displays as a read only state. Since this is a secret editor the secret
|
||||
* value is not displayed and a skeleton view is shown.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isDisabled() {
|
||||
return this.args.disabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if editing the resource after it has been created but not editing
|
||||
* the secret value in the Secret Editor. This will present the Secret
|
||||
* Editor as a read only state even when the form is editing the resource.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isActionable() {
|
||||
return this.args.showEditButton && !this.editing;
|
||||
}
|
||||
|
||||
// =actions
|
||||
|
||||
/**
|
||||
* Sets editing to true when Secret Editor
|
||||
* button is clicked in Actionable view
|
||||
*/
|
||||
@action
|
||||
enableEditing() {
|
||||
if (!this.args.disabled) this.editing = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<div class='secret-editor-skeleton-wrapper'>
|
||||
<div class='secret-editor-skeleton-gutter'></div>
|
||||
<div class='secret-editor-skeleton-body'>
|
||||
<div class='xl'></div>
|
||||
<div class='m'></div>
|
||||
<div class='l'></div>
|
||||
<div class='s'></div>
|
||||
<div class='xl'></div>
|
||||
<div class='l'></div>
|
||||
<div class='m'></div>
|
||||
<div class='xl'></div>
|
||||
<div class='m'></div>
|
||||
<div class='s'></div>
|
||||
</div>
|
||||
<div class='secret-editor-skeleton-message'>
|
||||
{{yield}}
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user