open-nomad/ui/app/controllers/variables/new.js
Phil Renaud c8455d34d4 Edit Secure Variables as JSON (#13461)
* Toying with insert and update helpers before translation func

* Working prototype that lets you switch between json and tabular

* No longer add the bonus items row in json mode

* Trimmed the ivy from the codemirror (#13503)

* Trimmed the ivy from the codemirror

* editedJSONItems removal

* De-debugger

* Replaced other instances of IvyCodeMirror throughout the app (#13528)

* Replaced other instances of IvyCodeMirror throughout the app

* PR requests for codemirror modifier

* Screen reader setting as param

* Trying a simpler codemirror test helper

* Lint removal

* Screen Reader Label added for a11y

* JSONViewer cleanup

* JSON editor added to /new and all variables stringified before save or translate

* Give users a foothold when editing an empty item in JSON mode

* Copy the empty KV

* No duplicate keys in KV

* Better handling of cursor snapping in json edit field

* Catch formatting errors on the fly

* Basic tests for JSON to Table and Table to JSON in form
2022-07-11 13:34:06 -04:00

30 lines
596 B
JavaScript

// @ts-check
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
export default class VariablesNewController extends Controller {
@service store;
queryParams = ['path', 'view'];
get existingVariables() {
return this.store.peekAll('variable');
}
//#region Code View
/**
* @type {"table" | "json"}
*/
@tracked
view = 'table';
toggleView() {
if (this.view === 'table') {
this.view = 'json';
} else {
this.view = 'table';
}
}
//#endregion Code View
}