4da169e155
* Changelog and lintfix * Changelog removed * Forbidden state on individual variables * CanRead checked on variable path links * Mirage fixture with lesser secure variables access, temporary fix for * namespaces * Read flow acceptance tests * Unit tests for variable.canRead * lintfix * TODO squashed, thanks Jai * explicitly link mirage fixture vars to jobs via namespace * Typofix; delete to read * Linking the original alloc * Percy snapshots uniquely named * Guarantee that the alloc we depend on has tasks within it * Logging variables * Trying to skip delete * Now without create flow either * Dedicated cluster fixture for testing variables * Disambiguate percy calls
35 lines
894 B
JavaScript
35 lines
894 B
JavaScript
// @ts-check
|
|
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { inject as service } from '@ember/service';
|
|
import compactPath from '../utils/compact-path';
|
|
export default class VariablePathsComponent extends Component {
|
|
@service router;
|
|
@service can;
|
|
|
|
/**
|
|
* @returns {Array<Object.<string, Object>>}
|
|
*/
|
|
get folders() {
|
|
return Object.entries(this.args.branch.children).map(([name]) => {
|
|
return compactPath(this.args.branch.children[name], name);
|
|
});
|
|
}
|
|
|
|
get files() {
|
|
return this.args.branch.files;
|
|
}
|
|
|
|
@action
|
|
async handleFolderClick(path) {
|
|
this.router.transitionTo('variables.path', path);
|
|
}
|
|
|
|
@action
|
|
async handleFileClick({ path, variable: { namespace } }) {
|
|
if (this.can.can('read variable', null, { path, namespace })) {
|
|
this.router.transitionTo('variables.variable', path);
|
|
}
|
|
}
|
|
}
|