mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 02:45:42 +03:00
* variables.new initialized * Hacky but savey * Variable wildcard route and multiple creatable at a time * multiple KVs per variable * PR Prep cleanup and lintfix * Delog * Data mocking in mirage for variables * Linting fixes * Re-implement absent params * Adapter and model tests * Moves the path-as-id logic to a serializer instead of adapter * Classic to serializer and lint cleanup * Pluralized save button (#13140) * Autofocus modifier and better Add More button UX (#13145) * Secure Variables: show/hide functionality when adding new values (#13137) * Flight Icons added and show hide functionality * PR cleanup * Linting cleanup * Position of icon moved to the right of input * PR feedback addressed * Delete button and stylistic changes to show hide * Hmm, eslint doesnt like jsdoc-usage as only reason for import * More closely match the button styles and delete test * Simplified new.js model * Secure Variables: /variables/*path/edit route and functionality (#13170) * Variable edit page init * Significant change to where we house model methods * Lintfix * Edit a variable tests * Remove redundant tests * Asserts expected * Mirage factory updated to reflect model state
49 lines
1.0 KiB
JavaScript
49 lines
1.0 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { tracked } from '@glimmer/tracking';
|
|
import { inject as service } from '@ember/service';
|
|
export default class SecureVariableFormComponent extends Component {
|
|
@service router;
|
|
|
|
@tracked
|
|
shouldHideValues = true;
|
|
|
|
get valueFieldType() {
|
|
return this.shouldHideValues ? 'password' : 'text';
|
|
}
|
|
|
|
get shouldDisableSave() {
|
|
return !this.args.model?.path;
|
|
}
|
|
|
|
@action
|
|
toggleShowHide() {
|
|
this.shouldHideValues = !this.shouldHideValues;
|
|
}
|
|
|
|
@action appendRow() {
|
|
this.args.model.keyValues.pushObject({
|
|
key: '',
|
|
value: '',
|
|
});
|
|
}
|
|
|
|
@action deleteRow(row) {
|
|
this.args.model.keyValues.removeObject(row);
|
|
}
|
|
|
|
@action
|
|
async save(e) {
|
|
e.preventDefault();
|
|
|
|
this.args.model.id = this.args.model.path;
|
|
|
|
const transitionTarget = this.args.model.isNew
|
|
? 'variables'
|
|
: 'variables.variable';
|
|
|
|
await this.args.model.save();
|
|
this.router.transitionTo(transitionTarget);
|
|
}
|
|
}
|