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 be479f2453
commit 94ae52b576
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" msgstr "Actions over the last 24 hours"
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Activate" msgid "Activate"
msgstr "Activate" msgstr "Activate"
@ -1178,6 +1179,7 @@ msgid "Date Time"
msgstr "Date Time" msgstr "Date Time"
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
msgid "Deactivate" msgid "Deactivate"
msgstr "Deactivate" msgstr "Deactivate"
@ -5001,6 +5003,7 @@ msgstr "Use this tenant for each domain that doesn't have a dedicated tenant."
#: src/pages/tokens/TokenForm.ts #: src/pages/tokens/TokenForm.ts
#: src/pages/tokens/TokenListPage.ts #: src/pages/tokens/TokenListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
#: src/pages/users/UserViewPage.ts
#: src/user/user-settings/tokens/UserTokenList.ts #: src/user/user-settings/tokens/UserTokenList.ts
msgid "User" msgid "User"
msgstr "User" msgstr "User"

View File

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

View File

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

View File

@ -35,6 +35,7 @@ import "../../elements/oauth/UserCodeList";
import "../../elements/oauth/UserRefreshList"; import "../../elements/oauth/UserRefreshList";
import "../../elements/user/SessionList"; import "../../elements/user/SessionList";
import "../../elements/user/UserConsentList"; import "../../elements/user/UserConsentList";
import "./UserActiveForm";
import "./UserForm"; import "./UserForm";
@customElement("ak-user-view") @customElement("ak-user-view")
@ -132,7 +133,7 @@ export class UserViewPage extends LitElement {
</dt> </dt>
<dd class="pf-c-description-list__description"> <dd class="pf-c-description-list__description">
<div class="pf-c-description-list__text"> <div class="pf-c-description-list__text">
${this.user.email} ${this.user.email || "-"}
</div> </div>
</dd> </dd>
</div> </div>
@ -195,6 +196,24 @@ export class UserViewPage extends LitElement {
</button> </button>
</ak-forms-modal> </ak-forms-modal>
</div> </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"> <div class="pf-c-card__footer">
<ak-action-button <ak-action-button
class="pf-m-secondary" class="pf-m-secondary"