web/admin: don't require username nor name for activate/deactivate toggles

closes #1491

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-29 09:42:59 +02:00
parent c19afa4f16
commit c9c177d8f9
4 changed files with 26 additions and 3 deletions

View File

@ -155,6 +155,7 @@ msgid "Actions over the last 24 hours"
msgstr "Actions over the last 24 hours"
#: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Activate"
msgstr "Activate"
@ -1174,6 +1175,7 @@ msgid "Date Time"
msgstr "Date Time"
#: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Deactivate"
msgstr "Deactivate"
@ -4946,6 +4948,7 @@ msgstr "Use this tenant for each domain that doesn't have a dedicated tenant."
#: src/pages/tokens/TokenForm.ts
#: src/pages/tokens/TokenListPage.ts
#: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/user/user-settings/tokens/UserTokenList.ts
msgid "User"
msgstr "User"

View File

@ -155,6 +155,7 @@ msgid "Actions over the last 24 hours"
msgstr ""
#: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Activate"
msgstr ""
@ -1168,6 +1169,7 @@ msgid "Date Time"
msgstr ""
#: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Deactivate"
msgstr ""
@ -4931,6 +4933,7 @@ msgstr ""
#: src/pages/tokens/TokenForm.ts
#: src/pages/tokens/TokenListPage.ts
#: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/user/user-settings/tokens/UserTokenList.ts
msgid "User"
msgstr ""

View File

@ -157,8 +157,6 @@ export class UserListPage extends TablePage<User> {
).coreUsersPartialUpdate({
id: item.pk || 0,
patchedUserRequest: {
username: item.username,
name: item.name,
isActive: !item.isActive,
},
});

View File

@ -35,6 +35,7 @@ import "../../elements/oauth/UserCodeList";
import "../../elements/oauth/UserRefreshList";
import "../../elements/user/SessionList";
import "../../elements/user/UserConsentList";
import "./UserActiveForm";
import "./UserForm";
@customElement("ak-user-view")
@ -132,7 +133,7 @@ export class UserViewPage extends LitElement {
</dt>
<dd class="pf-c-description-list__description">
<div class="pf-c-description-list__text">
${this.user.email}
${this.user.email || "-"}
</div>
</dd>
</div>
@ -195,6 +196,24 @@ export class UserViewPage extends LitElement {
</button>
</ak-forms-modal>
</div>
<div class="pf-c-card__footer">
<ak-user-active-form
.obj=${this.user}
objectLabel=${t`User`}
.delete=${() => {
return new CoreApi(DEFAULT_CONFIG).coreUsersPartialUpdate({
id: this.user?.pk || 0,
patchedUserRequest: {
isActive: !this.user?.isActive,
},
});
}}
>
<button slot="trigger" class="pf-c-button pf-m-warning">
${this.user.isActive ? t`Deactivate` : t`Activate`}
</button>
</ak-user-active-form>
</div>
<div class="pf-c-card__footer">
<ak-action-button
class="pf-m-secondary"