Icu 13302 add filtering pagination support for scopes (#2216)

* feat: 🎸 add filtering and pagination to scopes

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13302
This commit is contained in:
Lisbet Alvarez authored and Zhihe Li committed 2024-04-12 14:55:34 -04:00
1 parent ece9c9b0c8
commit 1d7892230c
36 files changed
+521 -157

No files matched your search

+13 -14
View File
@@ -4,13 +4,15 @@
*/
import GeneratedScopeModel from '../generated/models/scope';
import { computed } from '@ember/object';
export const scopeTypes = {
global: 'global',
org: 'org',
project: 'project',
};
export const TYPE_SCOPE_GLOBAL = 'global';
export const TYPE_SCOPE_ORG = 'org';
export const TYPE_SCOPE_PROJECT = 'project';
export const TYPES_SCOPE = Object.freeze([
TYPE_SCOPE_GLOBAL,
TYPE_SCOPE_ORG,
TYPE_SCOPE_PROJECT,
]);
export default class ScopeModel extends GeneratedScopeModel {
// =attributes
@@ -18,9 +20,8 @@ export default class ScopeModel extends GeneratedScopeModel {
/**
* @type {boolean}
*/
@computed('type')
get isGlobal() {
return this.type === scopeTypes.global;
return this.type === TYPE_SCOPE_GLOBAL;
}
// There is only one global scope and it cannot be created by clients,
// thus no set.
@@ -28,23 +29,21 @@ export default class ScopeModel extends GeneratedScopeModel {
/**
* @type {boolean}
*/
@computed('type')
get isOrg() {
return this.type === scopeTypes.org;
return this.type === TYPE_SCOPE_ORG;
}
set isOrg(value) {
if (value) this.type = scopeTypes.org;
if (value) this.type = TYPE_SCOPE_ORG;
}
/**
* @type {boolean}
*/
@computed('type')
get isProject() {
return this.type === scopeTypes.project;
return this.type === TYPE_SCOPE_PROJECT;
}
set isProject(value) {
if (value) this.type = scopeTypes.project;
if (value) this.type = TYPE_SCOPE_PROJECT;
}
/**
+2
View File
@@ -16,6 +16,8 @@ export const modelIndexes = {
group:
'&id, attributes.created_time, attributes.name, attributes.description, attributes.scope.scope_id',
role: '&id, attributes.created_time, attributes.name, attributes.description, attributes.scope.scope_id',
scope:
'&id, attributes.created_time, attributes.type, attributes.name, attributes.description, attributes.scope.scope_id',
'credential-store':
'&id, attributes.created_time, attributes.name, attributes.description, attributes.type, attributes.scope.scope_id',
'host-catalog':