diff --git a/addons/api/addon/generated/models/auth-method.js b/addons/api/addon/generated/models/auth-method.js index 624663584..995e65efd 100644 --- a/addons/api/addon/generated/models/auth-method.js +++ b/addons/api/addon/generated/models/auth-method.js @@ -34,4 +34,9 @@ export default class GeneratedAuthMethodModel extends BaseModel { }) updated_time; + @attr('boolean', { + description: 'Whether the resource is disabled', + }) + disabled; + } diff --git a/ui/core/mirage/config.js b/ui/core/mirage/config.js index 0f714aba6..b81ef488f 100644 --- a/ui/core/mirage/config.js +++ b/ui/core/mirage/config.js @@ -32,6 +32,14 @@ export default function() { this.patch('/orgs/:org_id/projects/:id'); this.del('/orgs/:org_id/projects/:id'); + // Auth & IAM resources + + this.get('/orgs/:org_id/auth-methods'); + this.post('/orgs/:org_id/auth-methods'); + this.get('/orgs/:org_id/auth-methods/:id'); + this.patch('/orgs/:org_id/auth-methods/:id'); + this.del('/orgs/:org_id/auth-methods/:id'); + // Other resources // host-catalog diff --git a/ui/core/mirage/factories/auth-method.js b/ui/core/mirage/factories/auth-method.js new file mode 100644 index 000000000..aa15a1103 --- /dev/null +++ b/ui/core/mirage/factories/auth-method.js @@ -0,0 +1,3 @@ +import factory from '../generated/factories/auth-method'; + +export default factory.extend(); diff --git a/ui/core/mirage/generated/factories/auth-method.js b/ui/core/mirage/generated/factories/auth-method.js new file mode 100644 index 000000000..d76245946 --- /dev/null +++ b/ui/core/mirage/generated/factories/auth-method.js @@ -0,0 +1,16 @@ +import { Factory } from 'ember-cli-mirage'; +import { random, date } from 'faker'; + +/** + * GeneratedAuthMethodModelFactory + */ +export default Factory.extend({ + + type: 'password', + name: () => random.words(), + description: () => random.words(), + created_time: () => date.recent(), + updated_time: () => date.recent(), + disabled: () => random.boolean(), + +}); diff --git a/ui/core/mirage/scenarios/default.js b/ui/core/mirage/scenarios/default.js index 9255fc853..b8accbf8b 100644 --- a/ui/core/mirage/scenarios/default.js +++ b/ui/core/mirage/scenarios/default.js @@ -3,10 +3,17 @@ export default function(server) { // Scope resources server.createList('org', 3); - server.createList('project', 3); + server.createList('project', 6); + + // Auth + + // Auth methods exist both at the global scope and the org scope. + // For simplicity we don't scope our mock auth methods and just return the + // same items for request at all scopes. + server.createList('auth-method', 3); // Other resources - server.createList('host-catalog', 3); + server.createList('host-catalog', 6); } diff --git a/ui/core/mirage/serializers/auth-method.js b/ui/core/mirage/serializers/auth-method.js new file mode 100644 index 000000000..cabe9ee7b --- /dev/null +++ b/ui/core/mirage/serializers/auth-method.js @@ -0,0 +1,5 @@ +import ApplicationSerializer from './application'; + +export default ApplicationSerializer.extend({ + modelName: 'auth-method' +});