diff --git a/ui/core/app/components/form/auth-method/index.hbs b/ui/core/app/components/form/auth-method/index.hbs
new file mode 100644
index 000000000..158f80db2
--- /dev/null
+++ b/ui/core/app/components/form/auth-method/index.hbs
@@ -0,0 +1,47 @@
+
+
+ {{#if @model.errors.name}}
+
+ {{#each @model.errors.name as |error|}}
+ {{error.message}}
+ {{/each}}
+
+ {{/if}}
+
+
+
+ {{#if @model.errors.description}}
+
+ {{#each @model.errors.description as |error|}}
+ {{error.message}}
+ {{/each}}
+
+ {{/if}}
+
+
+
+
\ No newline at end of file
diff --git a/ui/core/app/router.js b/ui/core/app/router.js
index 1471216ea..e23fad074 100644
--- a/ui/core/app/router.js
+++ b/ui/core/app/router.js
@@ -35,7 +35,9 @@ Router.map(function () {
});
this.route('new');
});
- this.route('auth-methods', function() {});
+ this.route('auth-methods', function() {
+ this.route('auth-method', { path: ':auth_method_id' }, function() {});
+ });
});
});
});
diff --git a/ui/core/app/routes/scopes/scope/auth-methods.js b/ui/core/app/routes/scopes/scope/auth-methods.js
index 112c40248..9c747ba6f 100644
--- a/ui/core/app/routes/scopes/scope/auth-methods.js
+++ b/ui/core/app/routes/scopes/scope/auth-methods.js
@@ -1,6 +1,13 @@
import Route from '@ember/routing/route';
+import { inject as service } from '@ember/service';
+import { action } from '@ember/object';
export default class ScopesScopeAuthMethodsRoute extends Route {
+ // =services
+
+ @service intl;
+ @service notify;
+
// =methods
/**
@@ -11,4 +18,53 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
const { id: scopeID} = this.modelFor('scopes.scope');
return this.store.findAll('auth-method', { adapterOptions: { scopeID } });
}
+
+ // =actions
+ /**
+ * Rollback changes to an auth-method.
+ * @param {AuthMethodModel} authMethod
+ */
+ @action
+ cancel(authMethod) {
+ const { isNew } = authMethod;
+ authMethod.rollbackAttributes();
+ if (isNew) this.transitionTo('scopes.scope.auth-methods');
+ }
+
+ /**
+ * Save an auth-method in current scope.
+ * @param {AuthMethodModel} authMethod
+ */
+ @action
+ async save(authMethod) {
+ const { isNew } = authMethod;
+ try {
+ await authMethod.save();
+ this.refresh();
+ this.notify.success(
+ this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
+ );
+ this.transitionTo('scopes.scope.auth-methods.auth-method');
+ } catch (error) {
+ //TODO: replace with translated strings
+ this.notify.error(error.message, { closeAfter: null });
+ }
+ }
+
+ /**
+ * Delete an auth-method in current scope and redirect to auth-methods
+ * @param {AuthMethodModel} authMethod
+ */
+ @action
+ async delete(authMethod) {
+ try {
+ await authMethod.destroyRecord();
+ this.refresh();
+ this.notify.success(this.intl.t('notify.delete-success'));
+ this.transitionTo('scopes.scope.auth-methods');
+ } catch (error) {
+ //TODO: replace with translated strings
+ this.notify.error(error.message, { closeAfter: null });
+ }
+ }
}
diff --git a/ui/core/app/routes/scopes/scope/auth-methods/auth-method.js b/ui/core/app/routes/scopes/scope/auth-methods/auth-method.js
new file mode 100644
index 000000000..5cc752eac
--- /dev/null
+++ b/ui/core/app/routes/scopes/scope/auth-methods/auth-method.js
@@ -0,0 +1,16 @@
+import Route from '@ember/routing/route';
+
+export default class ScopesScopeAuthMethodsAuthMethodRoute extends Route {
+ // =methods
+
+ /**
+ * Load a single auth-method in current scope.
+ * @param {object} params
+ * @param {string} params.auth_method_id
+ * @return {authMethodModel}
+ */
+ async model({ auth_method_id}) {
+ const { id: scopeID } = this.modelFor('scopes.scope');
+ return this.store.findRecord('auth-method', auth_method_id, { adapterOptions: { scopeID }});
+ }
+}
diff --git a/ui/core/app/routes/scopes/scope/auth-methods/auth-method/index.js b/ui/core/app/routes/scopes/scope/auth-methods/auth-method/index.js
new file mode 100644
index 000000000..5cef508e0
--- /dev/null
+++ b/ui/core/app/routes/scopes/scope/auth-methods/auth-method/index.js
@@ -0,0 +1,4 @@
+import Route from '@ember/routing/route';
+
+export default class ScopesScopeAuthMethodsAuthMethodIndexRoute extends Route {
+}
diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method.hbs
new file mode 100644
index 000000000..c24cd6895
--- /dev/null
+++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method.hbs
@@ -0,0 +1 @@
+{{outlet}}
diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs
new file mode 100644
index 000000000..3fbc14eca
--- /dev/null
+++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs
@@ -0,0 +1,24 @@
+
+
+ {{t "resources.auth-method"}}
+
+
+
+
+
+ {{t 'titles.details'}}
+
+
+
+
+
+
+ {{@model.type}}
+
+
+
+
\ No newline at end of file
diff --git a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs
index 1b805f939..3286dff79 100644
--- a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs
+++ b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs
@@ -18,7 +18,12 @@
{{#each @model as |authMethod|}}
- {{authMethod.name}}
+
+ {{authMethod.name}}
+
{{authMethod.description}}
diff --git a/ui/core/tests/integration/components/form/auth-method/index-test.js b/ui/core/tests/integration/components/form/auth-method/index-test.js
new file mode 100644
index 000000000..df00881db
--- /dev/null
+++ b/ui/core/tests/integration/components/form/auth-method/index-test.js
@@ -0,0 +1,26 @@
+import { module, test } from 'qunit';
+import { setupRenderingTest } from 'ember-qunit';
+import { render } from '@ember/test-helpers';
+import { hbs } from 'ember-cli-htmlbars';
+
+module('Integration | Component | form/auth-method/index', function(hooks) {
+ setupRenderingTest(hooks);
+
+ test('it renders', async function(assert) {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.set('myAction', function(val) { ... });
+
+ await render(hbs``);
+
+ assert.equal(this.element.textContent.trim(), '');
+
+ // Template block usage:
+ await render(hbs`
+
+ template block text
+
+ `);
+
+ assert.equal(this.element.textContent.trim(), 'template block text');
+ });
+});
diff --git a/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method-test.js b/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method-test.js
new file mode 100644
index 000000000..36b2e2f2d
--- /dev/null
+++ b/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method-test.js
@@ -0,0 +1,11 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('Unit | Route | scopes/scope/auth-methods/auth-method', function(hooks) {
+ setupTest(hooks);
+
+ test('it exists', function(assert) {
+ let route = this.owner.lookup('route:scopes/scope/auth-methods/auth-method');
+ assert.ok(route);
+ });
+});
diff --git a/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method/index-test.js b/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method/index-test.js
new file mode 100644
index 000000000..5a51858df
--- /dev/null
+++ b/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method/index-test.js
@@ -0,0 +1,11 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('Unit | Route | scopes/scope/auth-methods/auth-method/index', function(hooks) {
+ setupTest(hooks);
+
+ test('it exists', function(assert) {
+ let route = this.owner.lookup('route:scopes/scope/auth-methods/auth-method/index');
+ assert.ok(route);
+ });
+});
diff --git a/ui/core/translations/en-us.yaml b/ui/core/translations/en-us.yaml
index 1002147e2..996073949 100644
--- a/ui/core/translations/en-us.yaml
+++ b/ui/core/translations/en-us.yaml
@@ -31,6 +31,7 @@ resources:
project: Project
host-catalog: Host Catalog
host-catalogs: Host Catalogs
+ auth-method: Auth Method
auth-methods: Auth Methods
titles:
iam: IAM