From 3d5869eeb3f7fc816080caa642f76357a390919f Mon Sep 17 00:00:00 2001 From: Falk Date: Fri, 7 Jan 2022 16:27:41 +0100 Subject: [PATCH 1/3] feat(users): two column layout for user edit view --- addon/components/data-table.hbs | 57 +++-- .../users/{edit/index.js => edit.js} | 46 +++- addon/controllers/users/edit/acl.js | 48 ---- addon/routes/users/edit/acl.js | 7 - addon/routes/users/edit/index.js | 7 - addon/routes/users/new.js | 2 +- addon/templates/users/edit.hbs | 233 ++++++++++++++++-- addon/templates/users/edit/acl.hbs | 63 ----- addon/templates/users/edit/index.hbs | 143 ----------- app/controllers/users/edit.js | 1 + app/controllers/users/edit/acl.js | 1 - app/controllers/users/edit/index.js | 1 - tests/acceptance/users-test.js | 37 +-- tests/dummy/app/services/emeis-options.js | 4 +- tests/unit/controllers/users/edit-test.js | 80 ++++++ tests/unit/controllers/users/edit/acl-test.js | 49 ---- .../unit/controllers/users/edit/index-test.js | 36 --- 17 files changed, 390 insertions(+), 425 deletions(-) rename addon/controllers/users/{edit/index.js => edit.js} (52%) delete mode 100644 addon/controllers/users/edit/acl.js delete mode 100644 addon/routes/users/edit/acl.js delete mode 100644 addon/routes/users/edit/index.js delete mode 100644 addon/templates/users/edit/acl.hbs delete mode 100644 addon/templates/users/edit/index.hbs create mode 100644 app/controllers/users/edit.js delete mode 100644 app/controllers/users/edit/acl.js delete mode 100644 app/controllers/users/edit/index.js create mode 100644 tests/unit/controllers/users/edit-test.js delete mode 100644 tests/unit/controllers/users/edit/acl-test.js delete mode 100644 tests/unit/controllers/users/edit/index-test.js diff --git a/addon/components/data-table.hbs b/addon/components/data-table.hbs index 37ec67cb..f1039e6c 100644 --- a/addon/components/data-table.hbs +++ b/addon/components/data-table.hbs @@ -1,31 +1,34 @@ -
- key); } + get queryParamsfilter() { + return { user: this.model.id }; + } + @action updateModel(model, formElements) { model.firstName = formElements.firstName.value; @@ -53,4 +65,34 @@ export default class UsersEditIndexController extends Controller { return model; } + + @dropTask + @handleModelErrors({ errorMessage: "emeis.form.save-error" }) + *createAclEntry(aclProperties) { + const aclEntry = this.store.createRecord("acl", { ...aclProperties }); + + try { + yield aclEntry.save(); + this.notification.success(this.intl.t("emeis.form.save-success")); + this.showAclWizzard = false; + } catch (exception) { + if ( + exception.isAdapterError && + exception.errors[0].status === "400" && + exception.errors[0].code === "unique" + ) { + this.notification.danger(this.intl.t("emeis.acl-wizzard.duplicate")); + } else { + throw exception; + } + } + } + + @dropTask + @handleModelErrors({ errorMessage: "emeis.form.delete-error" }) + *deleteAclEntry(aclEntry, refreshDataTable) { + yield aclEntry.destroyRecord(); + this.notification.success(this.intl.t("emeis.form.delete-success")); + refreshDataTable(); + } } diff --git a/addon/controllers/users/edit/acl.js b/addon/controllers/users/edit/acl.js deleted file mode 100644 index 1c402ea3..00000000 --- a/addon/controllers/users/edit/acl.js +++ /dev/null @@ -1,48 +0,0 @@ -import { inject as service } from "@ember/service"; -import { tracked } from "@glimmer/tracking"; -import { dropTask } from "ember-concurrency"; - -import PaginationController from "ember-emeis/-private/controllers/pagination"; -import handleModelErrors from "ember-emeis/decorators/handle-model-errors"; - -export default class UsersEditAclController extends PaginationController { - @service intl; - @service notification; - @service store; - - get queryParamsfilter() { - return { user: this.model.id }; - } - - @tracked showAclWizzard = false; - - @dropTask - @handleModelErrors({ errorMessage: "emeis.form.save-error" }) - *createEntry(aclProperties) { - const aclEntry = this.store.createRecord("acl", { ...aclProperties }); - - try { - yield aclEntry.save(); - this.notification.success(this.intl.t("emeis.form.save-success")); - this.showAclWizzard = false; - } catch (exception) { - if ( - exception.isAdapterError && - exception.errors[0].status === "400" && - exception.errors[0].code === "unique" - ) { - this.notification.danger(this.intl.t("emeis.acl-wizzard.duplicate")); - } else { - throw exception; - } - } - } - - @dropTask - @handleModelErrors({ errorMessage: "emeis.form.delete-error" }) - *deleteEntry(aclEntry, refreshDataTable) { - yield aclEntry.destroyRecord(); - this.notification.success(this.intl.t("emeis.form.delete-success")); - refreshDataTable(); - } -} diff --git a/addon/routes/users/edit/acl.js b/addon/routes/users/edit/acl.js deleted file mode 100644 index 4463b857..00000000 --- a/addon/routes/users/edit/acl.js +++ /dev/null @@ -1,7 +0,0 @@ -import Route from "@ember/routing/route"; - -export default class UsersEditAclRoute extends Route { - model() { - return this.modelFor("users.edit"); - } -} diff --git a/addon/routes/users/edit/index.js b/addon/routes/users/edit/index.js deleted file mode 100644 index da964d2c..00000000 --- a/addon/routes/users/edit/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import Route from "@ember/routing/route"; - -export default class UsersEditIndexRoute extends Route { - async model() { - return this.modelFor("users.edit"); - } -} diff --git a/addon/routes/users/new.js b/addon/routes/users/new.js index 2ee2ca5f..f6e39266 100644 --- a/addon/routes/users/new.js +++ b/addon/routes/users/new.js @@ -1,7 +1,7 @@ import CreateRoute from "ember-emeis/-private/routes/create"; export default class UsersNewRoute extends CreateRoute { - detailView = "users.edit.index"; + detailView = "users.edit"; model() { return this.store.createRecord("user"); diff --git a/addon/templates/users/edit.hbs b/addon/templates/users/edit.hbs index 74fcde27..dbd67f22 100644 --- a/addon/templates/users/edit.hbs +++ b/addon/templates/users/edit.hbs @@ -1,14 +1,219 @@ - -{{outlet}} + + + {{t "emeis.form.back"}} + +
+
+

{{t "emeis.users.edit.edit-user"}}

+ + {{#unless this.emailAsUsername}} + + + + {{/unless}} + + + + + + + + + + + + + + {{#if (includes "phone" this.visibleFields)}} + + + + + {{t "emeis.form.phone-hint"}} + + + {{/if}} + + {{#if (includes "language" this.visibleFields)}} + + + + {{/if}} + + {{#if (includes "address" this.visibleFields)}} + + + + {{/if}} + + {{#if (includes "city" this.visibleFields)}} + + + + {{/if}} + + {{#if (includes "zip" this.visibleFields)}} + + + + {{/if}} + + + + + + + + + +
+
+ {{#if this.showAclWizzard}} + + + + {{t "emeis.form.back"}} + + + + {{else}} + + +
+ + + + + + {{#let body.model as |aclEntry|}} + + + + + + {{/let}} + + + + {{/if}} + + +{{!-- {{outlet}} --}} diff --git a/addon/templates/users/edit/acl.hbs b/addon/templates/users/edit/acl.hbs deleted file mode 100644 index 18cff601..00000000 --- a/addon/templates/users/edit/acl.hbs +++ /dev/null @@ -1,63 +0,0 @@ -{{#if this.showAclWizzard}} - - - - {{t "emeis.form.back"}} - - - -{{else}} - - - - - - - - - - {{#let body.model as |aclEntry|}} - - - - - - {{/let}} - - - -{{/if}} diff --git a/addon/templates/users/edit/index.hbs b/addon/templates/users/edit/index.hbs deleted file mode 100644 index 7509992a..00000000 --- a/addon/templates/users/edit/index.hbs +++ /dev/null @@ -1,143 +0,0 @@ - - {{#unless this.emailAsUsername}} - - - - {{/unless}} - - - - - - - - - - - - - - {{#if (includes "phone" this.visibleFields)}} - - - - - {{t "emeis.form.phone-hint"}} - - - {{/if}} - - {{#if (includes "language" this.visibleFields)}} - - - - {{/if}} - - {{#if (includes "address" this.visibleFields)}} - - - - {{/if}} - - {{#if (includes "city" this.visibleFields)}} - - - - {{/if}} - - {{#if (includes "zip" this.visibleFields)}} - - - - {{/if}} - - - - - - - - diff --git a/app/controllers/users/edit.js b/app/controllers/users/edit.js new file mode 100644 index 00000000..e700464c --- /dev/null +++ b/app/controllers/users/edit.js @@ -0,0 +1 @@ +export { default } from "ember-emeis/controllers/users/edit"; diff --git a/app/controllers/users/edit/acl.js b/app/controllers/users/edit/acl.js deleted file mode 100644 index ef9a3b8c..00000000 --- a/app/controllers/users/edit/acl.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from "ember-emeis/controllers/users/edit/acl"; diff --git a/app/controllers/users/edit/index.js b/app/controllers/users/edit/index.js deleted file mode 100644 index be36ad38..00000000 --- a/app/controllers/users/edit/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from "ember-emeis/controllers/users/edit/index"; diff --git a/tests/acceptance/users-test.js b/tests/acceptance/users-test.js index f7491bab..94cf6991 100644 --- a/tests/acceptance/users-test.js +++ b/tests/acceptance/users-test.js @@ -137,11 +137,12 @@ module("Acceptance | users", function (hooks) { await click("[data-test-save]"); await click("[data-test-back]"); - assert.strictEqual(currentURL(), "/users"); + + assert.strictEqual(currentURL(), `/users`); }); test("create view /users/new", async function (assert) { - assert.expect(28); + assert.expect(25); await visit("/users"); assert.strictEqual(currentURL(), "/users"); @@ -150,9 +151,6 @@ module("Acceptance | users", function (hooks) { await click("[data-test-new]"); assert.strictEqual(currentURL(), "/users/new"); - assert.dom("[data-test-edit-link]").doesNotExist(); - assert.dom("[data-test-acl-link]").doesNotExist(); - const username = "newusername", firstName = "John", lastName = "Doe", @@ -196,7 +194,7 @@ module("Acceptance | users", function (hooks) { await waitUntil(() => currentURL() !== "/users/new"); const user = this.server.schema.users.first(); - assert.strictEqual(currentURL(), `/users/${user.id}`); + assert.strictEqual(currentURL(), `/users/${user.id}?page=1`); assert.dom('[name="username"]').hasValue(user.username); assert.dom('[name="firstName"]').hasValue(user.firstName); @@ -210,12 +208,11 @@ module("Acceptance | users", function (hooks) { assert.dom('[name="isActive"]').isChecked(); - assert.dom("[data-test-edit-link]").exists(); - assert.dom("[data-test-acl-link]").exists(); + assert.dom("[data-test-user-back-link]").exists(); }); test("list view /users/:id/acl", async function (assert) { - assert.expect(12); + assert.expect(9); const user = this.server.create("user"); const acl = this.server.createList("acl", 3)[0]; @@ -229,14 +226,9 @@ module("Acceptance | users", function (hooks) { await click("[data-test-user-username] a"); assert.strictEqual(currentURL(), `/users/${user.id}`); - assert.dom("[data-test-edit-link]").exists(); - assert.dom("[data-test-acl-link]").exists(); - this.assertRequest("GET", `/api/v1/acls`, (request) => { assert.strictEqual(user.id, request.queryParams["filter[user]"]); }); - await click("[data-test-acl-link]"); - assert.strictEqual(currentURL(), `/users/${user.id}/acl`); // For some reason the await click is not actually waiting for the fetch task to finish. // Probably some runloop issue. @@ -260,17 +252,17 @@ module("Acceptance | users", function (hooks) { assert.dom("[data-test-acl-role]").exists({ count: 2 }); }); - test("create view /users/:id/acl", async function (assert) { + test("create view /users/:id for acl", async function (assert) { assert.expect(17); const user = this.server.create("user"); const role = this.server.createList("role", 2)[0]; const scope = this.server.createList("scope", 2)[0]; - await visit(`/users/${user.id}/acl`); + await visit(`/users/${user.id}`); // eslint-disable-next-line ember/no-settled-after-test-helper await settled(); - assert.strictEqual(currentURL(), `/users/${user.id}/acl`); + assert.strictEqual(currentURL(), `/users/${user.id}`); assert.dom("[data-test-acl-role]").doesNotExist(); assert.dom("[data-test-add-acl]").exists(); @@ -278,15 +270,12 @@ module("Acceptance | users", function (hooks) { await click("[data-test-add-acl]"); assert.dom("table").doesNotExist(); - assert.dom("[data-test-back]").exists(); + assert.dom("[data-test-acl-back]").exists(); // Test back button - await click("[data-test-back]"); + await click("[data-test-acl-back]"); assert.dom("[data-test-acl-role]").doesNotExist(); - assert.dom("[data-test-back]").doesNotExist(); - // For some reason the await click is not actually waiting for the fetch task to finish. - // Probably some runloop issue. - await waitUntil(() => this.element.querySelector("table thead")); + assert.dom("[data-test-acl-back]").doesNotExist(); assert.dom("[data-test-add-acl]").exists(); assert.dom("table").exists(); @@ -318,7 +307,7 @@ module("Acceptance | users", function (hooks) { await waitUntil(() => this.element.querySelector("table tbody:not([data-test-loading])") ); - assert.dom("[data-test-back]").doesNotExist(); + assert.dom("[data-test-acl-back]").doesNotExist(); assert.dom("[data-test-acl-scope]").hasText(scope.name.en); assert.dom("[data-test-acl-role]").hasText(role.name.en); }); diff --git a/tests/dummy/app/services/emeis-options.js b/tests/dummy/app/services/emeis-options.js index efa5c82b..609af3c5 100644 --- a/tests/dummy/app/services/emeis-options.js +++ b/tests/dummy/app/services/emeis-options.js @@ -57,8 +57,8 @@ export default class EmeisOptionsService extends Service { slug: "meta-example-2", label: "emeis.options.meta.scope.meta-example-2", type: "text", - visible: (model) => model.name === "First Level Scope", - readOnly: (model) => model.level === 0, + visible: (model) => model?.name === "First Level Scope", + readOnly: (model) => model?.level === 0, }, ], }; diff --git a/tests/unit/controllers/users/edit-test.js b/tests/unit/controllers/users/edit-test.js new file mode 100644 index 00000000..09f3f189 --- /dev/null +++ b/tests/unit/controllers/users/edit-test.js @@ -0,0 +1,80 @@ +import { setupMirage } from "ember-cli-mirage/test-support"; +import { setupIntl } from "ember-intl/test-support"; +import { setupTest } from "ember-qunit"; +import { module, test } from "qunit"; + +import setupRequestAssertions from "../../../helpers/assert-request"; + +module("Unit | Controller | users/edit", function (hooks) { + setupTest(hooks); + setupIntl(hooks); + setupMirage(hooks); + setupRequestAssertions(hooks); + + test("updateModel", function (assert) { + const controller = this.owner.lookup("controller:users/edit"); + assert.ok(controller); + + const model = {}; + controller.updateModel(model, { + username: { value: "username" }, + firstName: { value: "firstName" }, + lastName: { value: "lastName" }, + email: { value: "email" }, + phone: { value: "phone" }, + language: { selectedOptions: [{ value: "de" }] }, + address: { value: "address" }, + city: { value: "city" }, + zip: { value: "zip" }, + isActive: { checked: true }, + }); + + assert.strictEqual(model.username, "username"); + assert.strictEqual(model.firstName, "firstName"); + assert.strictEqual(model.lastName, "lastName"); + assert.strictEqual(model.email, "email"); + assert.strictEqual(model.phone, "phone"); + assert.strictEqual(model.language, "de"); + assert.strictEqual(model.address, "address"); + assert.strictEqual(model.city, "city"); + assert.strictEqual(model.zip, "zip"); + assert.true(model.isActive); + }); + + test("queryParamsfilter", function (assert) { + const controller = this.owner.lookup("controller:users/edit"); + assert.ok(controller); + + controller.model = { id: 1 }; + assert.deepEqual(controller.queryParamsfilter, { user: 1 }); + }); + + test("createEntry", async function (assert) { + assert.expect(3); + const controller = this.owner.lookup("controller:users/edit"); + assert.ok(controller); + + this.assertRequest("POST", "/api/v1/acls", (request) => { + const relationships = JSON.parse(request.requestBody).data.relationships; + assert.ok(relationships.role); + assert.ok(relationships.scope); + }); + await controller.createAclEntry.perform({ role: 1, scope: 2 }); + }); + + test("deleteEntry", async function (assert) { + assert.expect(3); + const controller = this.owner.lookup("controller:users/edit"); + assert.ok(controller); + const refresh = () => { + assert.ok(true); + }; + const model = { + destroyRecord() { + assert.ok(true); + }, + }; + + await controller.deleteAclEntry.perform(model, refresh); + }); +}); diff --git a/tests/unit/controllers/users/edit/acl-test.js b/tests/unit/controllers/users/edit/acl-test.js deleted file mode 100644 index aaa38c70..00000000 --- a/tests/unit/controllers/users/edit/acl-test.js +++ /dev/null @@ -1,49 +0,0 @@ -import { setupMirage } from "ember-cli-mirage/test-support"; -import { setupIntl } from "ember-intl/test-support"; -import { setupTest } from "ember-qunit"; -import { module, test } from "qunit"; - -import setupRequestAssertions from "./../../../../helpers/assert-request"; -module("Unit | Controller | users/edit/acl", function (hooks) { - setupTest(hooks); - setupIntl(hooks); - setupMirage(hooks); - setupRequestAssertions(hooks); - - test("queryParamsfilter", function (assert) { - const controller = this.owner.lookup("controller:users/edit/acl"); - assert.ok(controller); - - controller.model = { id: 1 }; - assert.deepEqual(controller.queryParamsfilter, { user: 1 }); - }); - - test("createEntry", async function (assert) { - assert.expect(3); - const controller = this.owner.lookup("controller:users/edit/acl"); - assert.ok(controller); - - this.assertRequest("POST", "/api/v1/acls", (request) => { - const relationships = JSON.parse(request.requestBody).data.relationships; - assert.ok(relationships.role); - assert.ok(relationships.scope); - }); - await controller.createEntry.perform({ role: 1, scope: 2 }); - }); - - test("deleteEntry", async function (assert) { - assert.expect(3); - const controller = this.owner.lookup("controller:users/edit/acl"); - assert.ok(controller); - const refresh = () => { - assert.ok(true); - }; - const model = { - destroyRecord() { - assert.ok(true); - }, - }; - - await controller.deleteEntry.perform(model, refresh); - }); -}); diff --git a/tests/unit/controllers/users/edit/index-test.js b/tests/unit/controllers/users/edit/index-test.js deleted file mode 100644 index 8caf6936..00000000 --- a/tests/unit/controllers/users/edit/index-test.js +++ /dev/null @@ -1,36 +0,0 @@ -import { setupTest } from "ember-qunit"; -import { module, test } from "qunit"; - -module("Unit | Controller | users/edit/index", function (hooks) { - setupTest(hooks); - - test("updateModel", function (assert) { - const controller = this.owner.lookup("controller:users/edit/index"); - assert.ok(controller); - - const model = {}; - controller.updateModel(model, { - username: { value: "username" }, - firstName: { value: "firstName" }, - lastName: { value: "lastName" }, - email: { value: "email" }, - phone: { value: "phone" }, - language: { selectedOptions: [{ value: "de" }] }, - address: { value: "address" }, - city: { value: "city" }, - zip: { value: "zip" }, - isActive: { checked: true }, - }); - - assert.strictEqual(model.username, "username"); - assert.strictEqual(model.firstName, "firstName"); - assert.strictEqual(model.lastName, "lastName"); - assert.strictEqual(model.email, "email"); - assert.strictEqual(model.phone, "phone"); - assert.strictEqual(model.language, "de"); - assert.strictEqual(model.address, "address"); - assert.strictEqual(model.city, "city"); - assert.strictEqual(model.zip, "zip"); - assert.true(model.isActive); - }); -}); From 94686954e333e5c9cb858009b9d37cc18f9e036c Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 10 Jan 2022 12:34:08 +0100 Subject: [PATCH 2/3] feat(scopes): two column layout for scopes view --- addon/components/data-table.hbs | 2 +- .../scopes/{edit/index.js => edit.js} | 9 +- addon/controllers/scopes/edit/acl.js | 7 -- addon/routes/scopes/edit/acl.js | 7 -- addon/routes/scopes/edit/index.js | 7 -- addon/routes/scopes/new.js | 2 +- addon/templates/scopes.hbs | 2 +- addon/templates/scopes/edit.hbs | 91 ++++++++++++++++++- addon/templates/scopes/edit/acl.hbs | 36 -------- addon/templates/scopes/edit/index.hbs | 42 --------- app/controllers/scopes/index.js | 1 - tests/acceptance/scopes-test.js | 21 +---- 12 files changed, 104 insertions(+), 123 deletions(-) rename addon/controllers/scopes/{edit/index.js => edit.js} (70%) delete mode 100644 addon/controllers/scopes/edit/acl.js delete mode 100644 addon/routes/scopes/edit/acl.js delete mode 100644 addon/routes/scopes/edit/index.js delete mode 100644 addon/templates/scopes/edit/acl.hbs delete mode 100644 addon/templates/scopes/edit/index.hbs delete mode 100644 app/controllers/scopes/index.js diff --git a/addon/components/data-table.hbs b/addon/components/data-table.hbs index f1039e6c..c5d2051a 100644 --- a/addon/components/data-table.hbs +++ b/addon/components/data-table.hbs @@ -2,7 +2,7 @@ {{#if @heading}}

{{@heading}}

{{/if}} diff --git a/addon/controllers/scopes/edit/index.js b/addon/controllers/scopes/edit.js similarity index 70% rename from addon/controllers/scopes/edit/index.js rename to addon/controllers/scopes/edit.js index 78e74a8e..c1165621 100644 --- a/addon/controllers/scopes/edit/index.js +++ b/addon/controllers/scopes/edit.js @@ -1,13 +1,18 @@ -import Controller from "@ember/controller"; import { action } from "@ember/object"; import { inject as service } from "@ember/service"; -export default class ScopesEditIndexController extends Controller { +import PaginationController from "ember-emeis/-private/controllers/pagination"; + +export default class ScopesEditIndexController extends PaginationController { @service emeisOptions; @service intl; @service router; @service store; + get queryParamsfilter() { + return { scope: this.model?.id }; + } + get metaFields() { return this.emeisOptions.metaFields?.scope; } diff --git a/addon/controllers/scopes/edit/acl.js b/addon/controllers/scopes/edit/acl.js deleted file mode 100644 index cf74b063..00000000 --- a/addon/controllers/scopes/edit/acl.js +++ /dev/null @@ -1,7 +0,0 @@ -import PaginationController from "ember-emeis/-private/controllers/pagination"; - -export default class ScopesEditACLController extends PaginationController { - get queryParamsfilter() { - return { scope: this.model.id }; - } -} diff --git a/addon/routes/scopes/edit/acl.js b/addon/routes/scopes/edit/acl.js deleted file mode 100644 index 0cf1e085..00000000 --- a/addon/routes/scopes/edit/acl.js +++ /dev/null @@ -1,7 +0,0 @@ -import Route from "@ember/routing/route"; - -export default class ScopesEditAclRoute extends Route { - model() { - return this.modelFor("scopes.edit"); - } -} diff --git a/addon/routes/scopes/edit/index.js b/addon/routes/scopes/edit/index.js deleted file mode 100644 index 0b01a114..00000000 --- a/addon/routes/scopes/edit/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import Route from "@ember/routing/route"; - -export default class ScopesEditIndexRoute extends Route { - model() { - return this.modelFor("scopes.edit"); - } -} diff --git a/addon/routes/scopes/new.js b/addon/routes/scopes/new.js index 3f0c8fe1..21af7d4c 100644 --- a/addon/routes/scopes/new.js +++ b/addon/routes/scopes/new.js @@ -1,7 +1,7 @@ import CreateRoute from "ember-emeis/-private/routes/create"; export default class ScopesNewRoute extends CreateRoute { - detailView = "scopes.edit.index"; + detailView = "scopes.edit"; model() { return this.store.createRecord("scope"); diff --git a/addon/templates/scopes.hbs b/addon/templates/scopes.hbs index 181fb441..1e26a16a 100644 --- a/addon/templates/scopes.hbs +++ b/addon/templates/scopes.hbs @@ -1,7 +1,7 @@
-
+
+{{!--
  • {{t "emeis.scopes.edit.edit-scope"}} @@ -11,4 +11,91 @@
-{{outlet}} +{{outlet}} --}} + +
+
+

{{t "emeis.scopes.edit.edit-scope"}}

+ + + + + + + + + + + + {{scope.name}} + + + + + +
+
+ + +
+ + + + + + {{#let body.model as |aclEntry|}} + + + + {{/let}} + + + + + \ No newline at end of file diff --git a/addon/templates/scopes/edit/acl.hbs b/addon/templates/scopes/edit/acl.hbs deleted file mode 100644 index 20899630..00000000 --- a/addon/templates/scopes/edit/acl.hbs +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - {{#let body.model as |aclEntry|}} - - - - {{/let}} - - - diff --git a/addon/templates/scopes/edit/index.hbs b/addon/templates/scopes/edit/index.hbs deleted file mode 100644 index 3c9085e7..00000000 --- a/addon/templates/scopes/edit/index.hbs +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - {{scope.name}} - - - - - \ No newline at end of file diff --git a/app/controllers/scopes/index.js b/app/controllers/scopes/index.js deleted file mode 100644 index 62bb9f20..00000000 --- a/app/controllers/scopes/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from "ember-emeis/controllers/scopes/index"; diff --git a/tests/acceptance/scopes-test.js b/tests/acceptance/scopes-test.js index beddcfb2..1a5923b7 100644 --- a/tests/acceptance/scopes-test.js +++ b/tests/acceptance/scopes-test.js @@ -34,7 +34,7 @@ module("Acceptance | scopes", function (hooks) { // eslint-disable-next-line ember/no-settled-after-test-helper await settled(); - assert.strictEqual(currentURL(), `/scopes/${root.id}`); + assert.strictEqual(currentURL(), `/scopes/${root.id}?page=1`); // only root and first level is shown by default assert.dom("[data-test-node-id]").exists({ count: 4 }); @@ -113,7 +113,7 @@ module("Acceptance | scopes", function (hooks) { await waitUntil(() => currentURL() !== "/scopes/new"); const scope = this.server.schema.scopes.first(); - assert.strictEqual(currentURL(), `/scopes/${scope.id}`); + assert.strictEqual(currentURL(), `/scopes/${scope.id}?page=1`); assert.dom('[name="name"]').hasValue(scope.name.en); assert.dom('[name="description"]').hasValue(scope.description.en); @@ -149,28 +149,17 @@ module("Acceptance | scopes", function (hooks) { assert.dom("[data-test-node-id]").doesNotExist(); }); - test("list view /scopes/:id/acl", async function (assert) { - assert.expect(8); + test("list view /scopes/:id/ shows acl info", async function (assert) { + assert.expect(5); const scope = this.server.create("scope"); const acl = this.server.createList("acl", 3, { scope })[0]; - await visit(`/scopes/${scope.id}`); - // eslint-disable-next-line ember/no-settled-after-test-helper - await settled(); - - assert.dom("[data-test-scopes-edit-index-link]").exists(); - assert.dom("[data-test-scopes-edit-acl-link]").exists(); - this.assertRequest("GET", `/api/v1/acls`, (request) => { assert.strictEqual(scope.id, request.queryParams["filter[scope]"]); }); - await click("[data-test-scopes-edit-acl-link]"); - assert.strictEqual(currentURL(), `/scopes/${scope.id}/acl`); - // For some reason the await click is not actually waiting for the fetch task to finish. - // Probably some runloop issue. - await waitUntil(() => this.element.querySelector("table thead")); + await visit(`/scopes/${scope.id}`); assert.dom("[data-test-acl-role]").exists({ count: 3 }); From db54d2655c6b98d9abb18aeec8f7b809371491c2 Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 10 Jan 2022 17:24:16 +0100 Subject: [PATCH 3/3] fix(two-column-layout): increase breakpoints --- addon/templates/scopes/edit.hbs | 4 ++-- addon/templates/users/edit.hbs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addon/templates/scopes/edit.hbs b/addon/templates/scopes/edit.hbs index ce8a1ce2..cbfa4492 100644 --- a/addon/templates/scopes/edit.hbs +++ b/addon/templates/scopes/edit.hbs @@ -14,7 +14,7 @@ {{outlet}} --}}
-
+

{{t "emeis.scopes.edit.edit-scope"}}

-
+
-
+

{{t "emeis.users.edit.edit-user"}}

-
+
{{#if this.showAclWizzard}}
+ {{t "emeis.acl-table.headings.role"}} + + {{t "emeis.acl-table.headings.scope"}} + + + {{t "emeis.acl-table.headings.add-entry"}} + + + {{aclEntry.role.name}} + + {{aclEntry.scope.name}} + + + + + - {{t "emeis.acl-table.headings.role"}} - - {{t "emeis.acl-table.headings.scope"}} - - - {{t "emeis.acl-table.headings.add-entry"}} - - - {{aclEntry.role.name}} - - {{aclEntry.scope.name}} - - - - - + {{t "emeis.acl-table.headings.name"}} + + {{t "emeis.acl-table.headings.user"}} + + {{t "emeis.acl-table.headings.role"}} + + {{concat aclEntry.user.firstName " " aclEntry.user.lastName}} + + {{aclEntry.user.username}} + + {{aclEntry.role.name}} + - {{t "emeis.acl-table.headings.name"}} - - {{t "emeis.acl-table.headings.user"}} - - {{t "emeis.acl-table.headings.role"}} - - {{concat aclEntry.user.firstName " " aclEntry.user.lastName}} - - {{aclEntry.user.username}} - - {{aclEntry.role.name}} -