-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
metadata.js
32 lines (28 loc) · 888 Bytes
/
metadata.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class MetadataShow extends Route {
@service store;
noReadAccess = false;
beforeModel() {
const { backend } = this.paramsFor('vault.cluster.secrets.backend');
this.backend = backend;
}
model(params) {
let { secret } = params;
return this.store
.queryRecord('secret-v2', {
backend: this.backend,
id: secret,
})
.catch(() => {
// there was an error likely in read metadata.
// still load the page and handle what you show by filtering for this property
this.noReadAccess = true;
});
}
setupController(controller, model) {
controller.set('backend', this.backend); // for backendCrumb
controller.set('model', model);
controller.set('noReadAccess', this.noReadAccess);
}
}