web/admin: migrate GroupForm to use TableModal instead of select multiple

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-10 20:19:23 +02:00
parent c44aa2a204
commit 182256c53e
7 changed files with 246 additions and 94 deletions

View File

@ -1,4 +1,4 @@
import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { CSSResult, customElement, html, LitElement, TemplateResult } from "lit-element";
import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css";
import PFChip from "@patternfly/patternfly/components/Chip/chip.css"; import PFChip from "@patternfly/patternfly/components/Chip/chip.css";
@ -14,7 +14,9 @@ export class ChipGroup extends LitElement {
return [PFBase, PFChip, PFChipGroup, PFButton, AKGlobal]; return [PFBase, PFChip, PFChipGroup, PFButton, AKGlobal];
} }
set value(v: (string | number | undefined)[]) {} set value(v: (string | number | undefined)[]) {
return;
}
get value(): (string | number | undefined)[] { get value(): (string | number | undefined)[] {
const values: (string | number | undefined)[] = []; const values: (string | number | undefined)[] = [];

View File

@ -246,6 +246,7 @@ export abstract class Table<T> extends LitElement {
</ak-table-search>&nbsp;`; </ak-table-search>&nbsp;`;
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
renderSelectedChip(item: T): TemplateResult { renderSelectedChip(item: T): TemplateResult {
return html``; return html``;
} }

View File

@ -74,11 +74,16 @@ msgstr "Access token URL"
msgid "Action" msgid "Action"
msgstr "Action" msgstr "Action"
#: src/pages/users/UserListPage.ts:50 #: src/pages/groups/MemberSelectModal.ts:45
#: src/pages/users/UserListPage.ts:51
#: src/pages/users/UserViewPage.ts:115 #: src/pages/users/UserViewPage.ts:115
msgid "Active" msgid "Active"
msgstr "Active" msgstr "Active"
#: src/pages/groups/MemberSelectModal.ts:82
msgid "Add"
msgstr "Add"
#: src/pages/sources/ldap/LDAPSourceForm.ts:202 #: src/pages/sources/ldap/LDAPSourceForm.ts:202
msgid "Addition Group DN" msgid "Addition Group DN"
msgstr "Addition Group DN" msgstr "Addition Group DN"
@ -249,7 +254,7 @@ msgstr "Attempted to log in as {0}"
msgid "Attribute name used for SAML Assertions. Can be a URN OID, a schema reference, or a any other string. If this property mapping is used for NameID Property, this field is discarded." msgid "Attribute name used for SAML Assertions. Can be a URN OID, a schema reference, or a any other string. If this property mapping is used for NameID Property, this field is discarded."
msgstr "Attribute name used for SAML Assertions. Can be a URN OID, a schema reference, or a any other string. If this property mapping is used for NameID Property, this field is discarded." msgstr "Attribute name used for SAML Assertions. Can be a URN OID, a schema reference, or a any other string. If this property mapping is used for NameID Property, this field is discarded."
#: src/pages/groups/GroupForm.ts:96 #: src/pages/groups/GroupForm.ts:134
#: src/pages/stages/invitation/InvitationForm.ts:51 #: src/pages/stages/invitation/InvitationForm.ts:51
#: src/pages/users/UserForm.ts:77 #: src/pages/users/UserForm.ts:77
msgid "Attributes" msgid "Attributes"
@ -406,6 +411,7 @@ msgstr "Can be in the format of 'unix://' when connecting to a local docker daem
#: src/elements/forms/ConfirmationForm.ts:75 #: src/elements/forms/ConfirmationForm.ts:75
#: src/elements/forms/DeleteForm.ts:86 #: src/elements/forms/DeleteForm.ts:86
#: src/elements/forms/ModalForm.ts:71 #: src/elements/forms/ModalForm.ts:71
#: src/pages/groups/MemberSelectModal.ts:89
#: src/pages/users/UserActiveForm.ts:73 #: src/pages/users/UserActiveForm.ts:73
msgid "Cancel" msgid "Cancel"
msgstr "Cancel" msgstr "Cancel"
@ -516,7 +522,7 @@ msgstr "Clear Policy cache"
msgid "Clear cache" msgid "Clear cache"
msgstr "Clear cache" msgstr "Clear cache"
#: src/elements/forms/HorizontalFormElement.ts:81 #: src/elements/forms/HorizontalFormElement.ts:82
msgid "Click to change value" msgid "Click to change value"
msgstr "Click to change value" msgstr "Click to change value"
@ -725,8 +731,8 @@ msgstr "Copy Key"
#: src/pages/stages/prompt/PromptStageForm.ts:98 #: src/pages/stages/prompt/PromptStageForm.ts:98
#: src/pages/user-settings/tokens/UserTokenList.ts:50 #: src/pages/user-settings/tokens/UserTokenList.ts:50
#: src/pages/user-settings/tokens/UserTokenList.ts:58 #: src/pages/user-settings/tokens/UserTokenList.ts:58
#: src/pages/users/UserListPage.ts:143 #: src/pages/users/UserListPage.ts:144
#: src/pages/users/UserListPage.ts:151 #: src/pages/users/UserListPage.ts:152
msgid "Create" msgid "Create"
msgstr "Create" msgstr "Create"
@ -796,7 +802,7 @@ msgstr "Create Stage binding"
msgid "Create Token" msgid "Create Token"
msgstr "Create Token" msgstr "Create Token"
#: src/pages/users/UserListPage.ts:146 #: src/pages/users/UserListPage.ts:147
msgid "Create User" msgid "Create User"
msgstr "Create User" msgstr "Create User"
@ -873,7 +879,7 @@ msgstr "Define how notifications are sent to users, like Email or Webhook."
#: src/pages/tokens/TokenListPage.ts:68 #: src/pages/tokens/TokenListPage.ts:68
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:36 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:36
#: src/pages/user-settings/tokens/UserTokenList.ts:125 #: src/pages/user-settings/tokens/UserTokenList.ts:125
#: src/pages/users/UserListPage.ts:114 #: src/pages/users/UserListPage.ts:115
msgid "Delete" msgid "Delete"
msgstr "Delete" msgstr "Delete"
@ -963,8 +969,8 @@ msgstr "Digest algorithm"
msgid "Digits" msgid "Digits"
msgstr "Digits" msgstr "Digits"
#: src/pages/users/UserListPage.ts:80 #: src/pages/users/UserListPage.ts:81
#: src/pages/users/UserListPage.ts:99 #: src/pages/users/UserListPage.ts:100
msgid "Disable" msgid "Disable"
msgstr "Disable" msgstr "Disable"
@ -1024,7 +1030,7 @@ msgstr "Each provider has a different issuer, based on the application slug."
#: src/pages/stages/StageListPage.ts:98 #: src/pages/stages/StageListPage.ts:98
#: src/pages/stages/prompt/PromptListPage.ts:75 #: src/pages/stages/prompt/PromptListPage.ts:75
#: src/pages/user-settings/tokens/UserTokenList.ts:113 #: src/pages/user-settings/tokens/UserTokenList.ts:113
#: src/pages/users/UserListPage.ts:75 #: src/pages/users/UserListPage.ts:76
#: src/pages/users/UserViewPage.ts:146 #: src/pages/users/UserViewPage.ts:146
msgid "Edit" msgid "Edit"
msgstr "Edit" msgstr "Edit"
@ -1074,8 +1080,8 @@ msgstr "Email or Username"
msgid "Email: Text field with Email type." msgid "Email: Text field with Email type."
msgstr "Email: Text field with Email type." msgstr "Email: Text field with Email type."
#: src/pages/users/UserListPage.ts:80 #: src/pages/users/UserListPage.ts:81
#: src/pages/users/UserListPage.ts:99 #: src/pages/users/UserListPage.ts:100
msgid "Enable" msgid "Enable"
msgstr "Enable" msgstr "Enable"
@ -1459,7 +1465,7 @@ msgid "Hide managed mappings"
msgstr "Hide managed mappings" msgstr "Hide managed mappings"
#: src/pages/events/RuleForm.ts:93 #: src/pages/events/RuleForm.ts:93
#: src/pages/groups/GroupForm.ts:93 #: src/pages/groups/GroupForm.ts:131
#: src/pages/outposts/OutpostForm.ts:98 #: src/pages/outposts/OutpostForm.ts:98
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts:169 #: src/pages/providers/oauth2/OAuth2ProviderForm.ts:169
#: src/pages/providers/saml/SAMLProviderForm.ts:171 #: src/pages/providers/saml/SAMLProviderForm.ts:171
@ -1514,7 +1520,7 @@ msgstr "If this flag is set, this Stage will jump to the next Stage when no Invi
msgid "If your authentik Instance is using a self-signed certificate, set this value." msgid "If your authentik Instance is using a self-signed certificate, set this value."
msgstr "If your authentik Instance is using a self-signed certificate, set this value." msgstr "If your authentik Instance is using a self-signed certificate, set this value."
#: src/pages/users/UserListPage.ts:135 #: src/pages/users/UserListPage.ts:136
msgid "Impersonate" msgid "Impersonate"
msgstr "Impersonate" msgstr "Impersonate"
@ -1572,7 +1578,7 @@ msgstr "Invitations"
msgid "Is active" msgid "Is active"
msgstr "Is active" msgstr "Is active"
#: src/pages/groups/GroupForm.ts:57 #: src/pages/groups/GroupForm.ts:60
msgid "Is superuser" msgid "Is superuser"
msgstr "Is superuser" msgstr "Is superuser"
@ -1616,7 +1622,8 @@ msgstr "Label"
msgid "Label shown next to/above the prompt." msgid "Label shown next to/above the prompt."
msgstr "Label shown next to/above the prompt." msgstr "Label shown next to/above the prompt."
#: src/pages/users/UserListPage.ts:51 #: src/pages/groups/MemberSelectModal.ts:46
#: src/pages/users/UserListPage.ts:52
#: src/pages/users/UserViewPage.ts:107 #: src/pages/users/UserViewPage.ts:107
msgid "Last login" msgid "Last login"
msgstr "Last login" msgstr "Last login"
@ -1646,7 +1653,7 @@ msgstr "Let the user identify themselves with their username or Email address."
msgid "Library" msgid "Library"
msgstr "Library" msgstr "Library"
#: src/elements/table/Table.ts:113 #: src/elements/table/Table.ts:120
#: src/flows/FlowExecutor.ts:164 #: src/flows/FlowExecutor.ts:164
#: src/flows/FlowExecutor.ts:210 #: src/flows/FlowExecutor.ts:210
#: src/flows/access_denied/FlowAccessDenied.ts:27 #: src/flows/access_denied/FlowAccessDenied.ts:27
@ -1674,8 +1681,8 @@ msgstr "Loading"
#: src/pages/events/RuleForm.ts:90 #: src/pages/events/RuleForm.ts:90
#: src/pages/flows/StageBindingForm.ts:89 #: src/pages/flows/StageBindingForm.ts:89
#: src/pages/flows/StageBindingForm.ts:106 #: src/pages/flows/StageBindingForm.ts:106
#: src/pages/groups/GroupForm.ts:73 #: src/pages/groups/GroupForm.ts:76
#: src/pages/groups/GroupForm.ts:91 #: src/pages/groups/GroupForm.ts:127
#: src/pages/outposts/OutpostForm.ts:74 #: src/pages/outposts/OutpostForm.ts:74
#: src/pages/outposts/OutpostForm.ts:96 #: src/pages/outposts/OutpostForm.ts:96
#: src/pages/outposts/ServiceConnectionDockerForm.ts:87 #: src/pages/outposts/ServiceConnectionDockerForm.ts:87
@ -1778,7 +1785,7 @@ msgstr "Matches an event against a set of criteria. If any of the configured val
msgid "Maximum age (in days)" msgid "Maximum age (in days)"
msgstr "Maximum age (in days)" msgstr "Maximum age (in days)"
#: src/pages/groups/GroupForm.ts:77 #: src/pages/groups/GroupForm.ts:80
#: src/pages/groups/GroupListPage.ts:47 #: src/pages/groups/GroupListPage.ts:47
msgid "Members" msgid "Members"
msgstr "Members" msgstr "Members"
@ -1838,8 +1845,9 @@ msgstr "Monitor"
#: src/pages/flows/BoundStagesList.ts:39 #: src/pages/flows/BoundStagesList.ts:39
#: src/pages/flows/FlowForm.ts:81 #: src/pages/flows/FlowForm.ts:81
#: src/pages/flows/FlowListPage.ts:47 #: src/pages/flows/FlowListPage.ts:47
#: src/pages/groups/GroupForm.ts:48 #: src/pages/groups/GroupForm.ts:51
#: src/pages/groups/GroupListPage.ts:45 #: src/pages/groups/GroupListPage.ts:45
#: src/pages/groups/MemberSelectModal.ts:44
#: src/pages/outposts/OutpostForm.ts:47 #: src/pages/outposts/OutpostForm.ts:47
#: src/pages/outposts/OutpostListPage.ts:49 #: src/pages/outposts/OutpostListPage.ts:49
#: src/pages/outposts/ServiceConnectionDockerForm.ts:53 #: src/pages/outposts/ServiceConnectionDockerForm.ts:53
@ -1892,7 +1900,7 @@ msgstr "Monitor"
#: src/pages/stages/user_write/UserWriteStageForm.ts:55 #: src/pages/stages/user_write/UserWriteStageForm.ts:55
#: src/pages/user-settings/UserDetailsPage.ts:64 #: src/pages/user-settings/UserDetailsPage.ts:64
#: src/pages/users/UserForm.ts:54 #: src/pages/users/UserForm.ts:54
#: src/pages/users/UserListPage.ts:49 #: src/pages/users/UserListPage.ts:50
#: src/pages/users/UserViewPage.ts:91 #: src/pages/users/UserViewPage.ts:91
msgid "Name" msgid "Name"
msgstr "Name" msgstr "Name"
@ -1920,13 +1928,14 @@ msgstr "New version available!"
#: src/pages/crypto/CertificateKeyPairListPage.ts:61 #: src/pages/crypto/CertificateKeyPairListPage.ts:61
#: src/pages/groups/GroupListPage.ts:58 #: src/pages/groups/GroupListPage.ts:58
#: src/pages/groups/MemberSelectModal.ts:56
#: src/pages/outposts/ServiceConnectionListPage.ts:64 #: src/pages/outposts/ServiceConnectionListPage.ts:64
#: src/pages/policies/BoundPoliciesList.ts:118 #: src/pages/policies/BoundPoliciesList.ts:118
#: src/pages/policies/PolicyTestForm.ts:38 #: src/pages/policies/PolicyTestForm.ts:38
#: src/pages/providers/proxy/ProxyProviderViewPage.ts:108 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:108
#: src/pages/tokens/TokenListPage.ts:56 #: src/pages/tokens/TokenListPage.ts:56
#: src/pages/user-settings/tokens/UserTokenList.ts:83 #: src/pages/user-settings/tokens/UserTokenList.ts:83
#: src/pages/users/UserListPage.ts:62 #: src/pages/users/UserListPage.ts:63
msgid "No" msgid "No"
msgstr "No" msgstr "No"
@ -1950,7 +1959,7 @@ msgstr "No Stages bound"
msgid "No additional data available." msgid "No additional data available."
msgstr "No additional data available." msgstr "No additional data available."
#: src/elements/table/Table.ts:124 #: src/elements/table/Table.ts:131
msgid "No elements found." msgid "No elements found."
msgstr "No elements found." msgstr "No elements found."
@ -2181,7 +2190,7 @@ msgstr "Overview"
msgid "PEM-encoded Certificate data." msgid "PEM-encoded Certificate data."
msgstr "PEM-encoded Certificate data." msgstr "PEM-encoded Certificate data."
#: src/pages/groups/GroupForm.ts:63 #: src/pages/groups/GroupForm.ts:66
#: src/pages/groups/GroupListPage.ts:46 #: src/pages/groups/GroupListPage.ts:46
msgid "Parent" msgid "Parent"
msgstr "Parent" msgstr "Parent"
@ -2463,7 +2472,7 @@ msgstr "Redirect URIs"
msgid "Redirect binding" msgid "Redirect binding"
msgstr "Redirect binding" msgstr "Redirect binding"
#: src/elements/table/Table.ts:183 #: src/elements/table/Table.ts:191
msgid "Refresh" msgid "Refresh"
msgstr "Refresh" msgstr "Refresh"
@ -2510,7 +2519,7 @@ msgstr "Required"
msgid "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only." msgid "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only."
msgstr "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only." msgstr "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only."
#: src/pages/users/UserListPage.ts:132 #: src/pages/users/UserListPage.ts:133
#: src/pages/users/UserViewPage.ts:164 #: src/pages/users/UserViewPage.ts:164
msgid "Reset Password" msgid "Reset Password"
msgstr "Reset Password" msgstr "Reset Password"
@ -2633,7 +2642,7 @@ msgstr "See documentation for a list of all variables."
msgid "Select a provider that this application should use. Alternatively, create a new provider." msgid "Select a provider that this application should use. Alternatively, create a new provider."
msgstr "Select a provider that this application should use. Alternatively, create a new provider." msgstr "Select a provider that this application should use. Alternatively, create a new provider."
#: src/elements/table/Table.ts:215 #: src/elements/table/Table.ts:242
msgid "Select all rows" msgid "Select all rows"
msgstr "Select all rows" msgstr "Select all rows"
@ -2641,6 +2650,10 @@ msgstr "Select all rows"
msgid "Select an identification method." msgid "Select an identification method."
msgstr "Select an identification method." msgstr "Select an identification method."
#: src/pages/groups/MemberSelectModal.ts:67
msgid "Select users to add"
msgstr "Select users to add"
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts:168 #: src/pages/providers/oauth2/OAuth2ProviderForm.ts:168
msgid "Select which scopes can be used by the client. The client stil has to specify the scope to access the data." msgid "Select which scopes can be used by the client. The client stil has to specify the scope to access the data."
msgstr "Select which scopes can be used by the client. The client stil has to specify the scope to access the data." msgstr "Select which scopes can be used by the client. The client stil has to specify the scope to access the data."
@ -2718,7 +2731,7 @@ msgstr "Set HTTP-Basic Authentication"
msgid "Set a custom HTTP-Basic Authentication header based on values from authentik." msgid "Set a custom HTTP-Basic Authentication header based on values from authentik."
msgstr "Set a custom HTTP-Basic Authentication header based on values from authentik." msgstr "Set a custom HTTP-Basic Authentication header based on values from authentik."
#: src/pages/groups/GroupForm.ts:100 #: src/pages/groups/GroupForm.ts:138
#: src/pages/outposts/OutpostForm.ts:109 #: src/pages/outposts/OutpostForm.ts:109
#: src/pages/outposts/ServiceConnectionKubernetesForm.ts:73 #: src/pages/outposts/ServiceConnectionKubernetesForm.ts:73
#: src/pages/policies/PolicyTestForm.ts:78 #: src/pages/policies/PolicyTestForm.ts:78
@ -2940,7 +2953,7 @@ msgstr "Successfully created certificate-key pair."
msgid "Successfully created flow." msgid "Successfully created flow."
msgstr "Successfully created flow." msgstr "Successfully created flow."
#: src/pages/groups/GroupForm.ts:41 #: src/pages/groups/GroupForm.ts:44
msgid "Successfully created group." msgid "Successfully created group."
msgstr "Successfully created group." msgstr "Successfully created group."
@ -3033,7 +3046,7 @@ msgstr "Successfully deleted {0} {1}"
msgid "Successfully generated certificate-key pair." msgid "Successfully generated certificate-key pair."
msgstr "Successfully generated certificate-key pair." msgstr "Successfully generated certificate-key pair."
#: src/pages/users/UserListPage.ts:127 #: src/pages/users/UserListPage.ts:128
#: src/pages/users/UserViewPage.ts:159 #: src/pages/users/UserViewPage.ts:159
msgid "Successfully generated recovery link" msgid "Successfully generated recovery link"
msgstr "Successfully generated recovery link" msgstr "Successfully generated recovery link"
@ -3076,7 +3089,7 @@ msgstr "Successfully updated device."
msgid "Successfully updated flow." msgid "Successfully updated flow."
msgstr "Successfully updated flow." msgstr "Successfully updated flow."
#: src/pages/groups/GroupForm.ts:38 #: src/pages/groups/GroupForm.ts:41
msgid "Successfully updated group." msgid "Successfully updated group."
msgstr "Successfully updated group." msgstr "Successfully updated group."
@ -3459,7 +3472,7 @@ msgstr "Up-to-date!"
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:67 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:67
#: src/pages/user-settings/tokens/UserTokenList.ts:105 #: src/pages/user-settings/tokens/UserTokenList.ts:105
#: src/pages/users/UserActiveForm.ts:66 #: src/pages/users/UserActiveForm.ts:66
#: src/pages/users/UserListPage.ts:67 #: src/pages/users/UserListPage.ts:68
#: src/pages/users/UserViewPage.ts:138 #: src/pages/users/UserViewPage.ts:138
msgid "Update" msgid "Update"
msgstr "Update" msgstr "Update"
@ -3535,7 +3548,7 @@ msgid "Update Token"
msgstr "Update Token" msgstr "Update Token"
#: src/pages/policies/BoundPoliciesList.ts:102 #: src/pages/policies/BoundPoliciesList.ts:102
#: src/pages/users/UserListPage.ts:70 #: src/pages/users/UserListPage.ts:71
#: src/pages/users/UserViewPage.ts:141 #: src/pages/users/UserViewPage.ts:141
msgid "Update User" msgid "Update User"
msgstr "Update User" msgstr "Update User"
@ -3585,8 +3598,8 @@ msgstr "Use global settings"
#: src/pages/property-mappings/PropertyMappingTestForm.ts:49 #: src/pages/property-mappings/PropertyMappingTestForm.ts:49
#: src/pages/tokens/TokenListPage.ts:45 #: src/pages/tokens/TokenListPage.ts:45
#: src/pages/user-settings/tokens/UserTokenList.ts:72 #: src/pages/user-settings/tokens/UserTokenList.ts:72
#: src/pages/users/UserListPage.ts:87 #: src/pages/users/UserListPage.ts:88
#: src/pages/users/UserListPage.ts:107 #: src/pages/users/UserListPage.ts:108
msgid "User" msgid "User"
msgstr "User" msgstr "User"
@ -3658,11 +3671,11 @@ msgstr "Username: Same as Text input, but checks for and prevents duplicate user
#: src/interfaces/AdminInterface.ts:32 #: src/interfaces/AdminInterface.ts:32
#: src/pages/admin-overview/AdminOverviewPage.ts:49 #: src/pages/admin-overview/AdminOverviewPage.ts:49
#: src/pages/users/UserListPage.ts:31 #: src/pages/users/UserListPage.ts:32
msgid "Users" msgid "Users"
msgstr "Users" msgstr "Users"
#: src/pages/groups/GroupForm.ts:60 #: src/pages/groups/GroupForm.ts:63
msgid "Users added to this group will be superusers." msgid "Users added to this group will be superusers."
msgstr "Users added to this group will be superusers." msgstr "Users added to this group will be superusers."
@ -3815,13 +3828,14 @@ msgstr "X509 Subject"
#: src/pages/crypto/CertificateKeyPairListPage.ts:61 #: src/pages/crypto/CertificateKeyPairListPage.ts:61
#: src/pages/groups/GroupListPage.ts:58 #: src/pages/groups/GroupListPage.ts:58
#: src/pages/groups/MemberSelectModal.ts:56
#: src/pages/outposts/ServiceConnectionListPage.ts:64 #: src/pages/outposts/ServiceConnectionListPage.ts:64
#: src/pages/policies/BoundPoliciesList.ts:118 #: src/pages/policies/BoundPoliciesList.ts:118
#: src/pages/policies/PolicyTestForm.ts:38 #: src/pages/policies/PolicyTestForm.ts:38
#: src/pages/providers/proxy/ProxyProviderViewPage.ts:105 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:105
#: src/pages/tokens/TokenListPage.ts:56 #: src/pages/tokens/TokenListPage.ts:56
#: src/pages/user-settings/tokens/UserTokenList.ts:83 #: src/pages/user-settings/tokens/UserTokenList.ts:83
#: src/pages/users/UserListPage.ts:62 #: src/pages/users/UserListPage.ts:63
msgid "Yes" msgid "Yes"
msgstr "Yes" msgstr "Yes"

View File

@ -74,11 +74,16 @@ msgstr ""
msgid "Action" msgid "Action"
msgstr "" msgstr ""
#: src/pages/users/UserListPage.ts:50 #: src/pages/groups/MemberSelectModal.ts:45
#: src/pages/users/UserListPage.ts:51
#: src/pages/users/UserViewPage.ts:115 #: src/pages/users/UserViewPage.ts:115
msgid "Active" msgid "Active"
msgstr "" msgstr ""
#: src/pages/groups/MemberSelectModal.ts:82
msgid "Add"
msgstr ""
#: src/pages/sources/ldap/LDAPSourceForm.ts:202 #: src/pages/sources/ldap/LDAPSourceForm.ts:202
msgid "Addition Group DN" msgid "Addition Group DN"
msgstr "" msgstr ""
@ -245,7 +250,7 @@ msgstr ""
msgid "Attribute name used for SAML Assertions. Can be a URN OID, a schema reference, or a any other string. If this property mapping is used for NameID Property, this field is discarded." msgid "Attribute name used for SAML Assertions. Can be a URN OID, a schema reference, or a any other string. If this property mapping is used for NameID Property, this field is discarded."
msgstr "" msgstr ""
#: src/pages/groups/GroupForm.ts:96 #: src/pages/groups/GroupForm.ts:134
#: src/pages/stages/invitation/InvitationForm.ts:51 #: src/pages/stages/invitation/InvitationForm.ts:51
#: src/pages/users/UserForm.ts:77 #: src/pages/users/UserForm.ts:77
msgid "Attributes" msgid "Attributes"
@ -402,6 +407,7 @@ msgstr ""
#: src/elements/forms/ConfirmationForm.ts:75 #: src/elements/forms/ConfirmationForm.ts:75
#: src/elements/forms/DeleteForm.ts:86 #: src/elements/forms/DeleteForm.ts:86
#: src/elements/forms/ModalForm.ts:71 #: src/elements/forms/ModalForm.ts:71
#: src/pages/groups/MemberSelectModal.ts:89
#: src/pages/users/UserActiveForm.ts:73 #: src/pages/users/UserActiveForm.ts:73
msgid "Cancel" msgid "Cancel"
msgstr "" msgstr ""
@ -510,7 +516,7 @@ msgstr ""
msgid "Clear cache" msgid "Clear cache"
msgstr "" msgstr ""
#: src/elements/forms/HorizontalFormElement.ts:81 #: src/elements/forms/HorizontalFormElement.ts:82
msgid "Click to change value" msgid "Click to change value"
msgstr "" msgstr ""
@ -719,8 +725,8 @@ msgstr ""
#: src/pages/stages/prompt/PromptStageForm.ts:98 #: src/pages/stages/prompt/PromptStageForm.ts:98
#: src/pages/user-settings/tokens/UserTokenList.ts:50 #: src/pages/user-settings/tokens/UserTokenList.ts:50
#: src/pages/user-settings/tokens/UserTokenList.ts:58 #: src/pages/user-settings/tokens/UserTokenList.ts:58
#: src/pages/users/UserListPage.ts:143 #: src/pages/users/UserListPage.ts:144
#: src/pages/users/UserListPage.ts:151 #: src/pages/users/UserListPage.ts:152
msgid "Create" msgid "Create"
msgstr "" msgstr ""
@ -790,7 +796,7 @@ msgstr ""
msgid "Create Token" msgid "Create Token"
msgstr "" msgstr ""
#: src/pages/users/UserListPage.ts:146 #: src/pages/users/UserListPage.ts:147
msgid "Create User" msgid "Create User"
msgstr "" msgstr ""
@ -867,7 +873,7 @@ msgstr ""
#: src/pages/tokens/TokenListPage.ts:68 #: src/pages/tokens/TokenListPage.ts:68
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:36 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:36
#: src/pages/user-settings/tokens/UserTokenList.ts:125 #: src/pages/user-settings/tokens/UserTokenList.ts:125
#: src/pages/users/UserListPage.ts:114 #: src/pages/users/UserListPage.ts:115
msgid "Delete" msgid "Delete"
msgstr "" msgstr ""
@ -955,8 +961,8 @@ msgstr ""
msgid "Digits" msgid "Digits"
msgstr "" msgstr ""
#: src/pages/users/UserListPage.ts:80 #: src/pages/users/UserListPage.ts:81
#: src/pages/users/UserListPage.ts:99 #: src/pages/users/UserListPage.ts:100
msgid "Disable" msgid "Disable"
msgstr "" msgstr ""
@ -1016,7 +1022,7 @@ msgstr ""
#: src/pages/stages/StageListPage.ts:98 #: src/pages/stages/StageListPage.ts:98
#: src/pages/stages/prompt/PromptListPage.ts:75 #: src/pages/stages/prompt/PromptListPage.ts:75
#: src/pages/user-settings/tokens/UserTokenList.ts:113 #: src/pages/user-settings/tokens/UserTokenList.ts:113
#: src/pages/users/UserListPage.ts:75 #: src/pages/users/UserListPage.ts:76
#: src/pages/users/UserViewPage.ts:146 #: src/pages/users/UserViewPage.ts:146
msgid "Edit" msgid "Edit"
msgstr "" msgstr ""
@ -1066,8 +1072,8 @@ msgstr ""
msgid "Email: Text field with Email type." msgid "Email: Text field with Email type."
msgstr "" msgstr ""
#: src/pages/users/UserListPage.ts:80 #: src/pages/users/UserListPage.ts:81
#: src/pages/users/UserListPage.ts:99 #: src/pages/users/UserListPage.ts:100
msgid "Enable" msgid "Enable"
msgstr "" msgstr ""
@ -1451,7 +1457,7 @@ msgid "Hide managed mappings"
msgstr "" msgstr ""
#: src/pages/events/RuleForm.ts:93 #: src/pages/events/RuleForm.ts:93
#: src/pages/groups/GroupForm.ts:93 #: src/pages/groups/GroupForm.ts:131
#: src/pages/outposts/OutpostForm.ts:98 #: src/pages/outposts/OutpostForm.ts:98
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts:169 #: src/pages/providers/oauth2/OAuth2ProviderForm.ts:169
#: src/pages/providers/saml/SAMLProviderForm.ts:171 #: src/pages/providers/saml/SAMLProviderForm.ts:171
@ -1506,7 +1512,7 @@ msgstr ""
msgid "If your authentik Instance is using a self-signed certificate, set this value." msgid "If your authentik Instance is using a self-signed certificate, set this value."
msgstr "" msgstr ""
#: src/pages/users/UserListPage.ts:135 #: src/pages/users/UserListPage.ts:136
msgid "Impersonate" msgid "Impersonate"
msgstr "" msgstr ""
@ -1564,7 +1570,7 @@ msgstr ""
msgid "Is active" msgid "Is active"
msgstr "" msgstr ""
#: src/pages/groups/GroupForm.ts:57 #: src/pages/groups/GroupForm.ts:60
msgid "Is superuser" msgid "Is superuser"
msgstr "" msgstr ""
@ -1608,7 +1614,8 @@ msgstr ""
msgid "Label shown next to/above the prompt." msgid "Label shown next to/above the prompt."
msgstr "" msgstr ""
#: src/pages/users/UserListPage.ts:51 #: src/pages/groups/MemberSelectModal.ts:46
#: src/pages/users/UserListPage.ts:52
#: src/pages/users/UserViewPage.ts:107 #: src/pages/users/UserViewPage.ts:107
msgid "Last login" msgid "Last login"
msgstr "" msgstr ""
@ -1638,7 +1645,7 @@ msgstr ""
msgid "Library" msgid "Library"
msgstr "" msgstr ""
#: src/elements/table/Table.ts:113 #: src/elements/table/Table.ts:120
#: src/flows/FlowExecutor.ts:164 #: src/flows/FlowExecutor.ts:164
#: src/flows/FlowExecutor.ts:210 #: src/flows/FlowExecutor.ts:210
#: src/flows/access_denied/FlowAccessDenied.ts:27 #: src/flows/access_denied/FlowAccessDenied.ts:27
@ -1666,8 +1673,8 @@ msgstr ""
#: src/pages/events/RuleForm.ts:90 #: src/pages/events/RuleForm.ts:90
#: src/pages/flows/StageBindingForm.ts:89 #: src/pages/flows/StageBindingForm.ts:89
#: src/pages/flows/StageBindingForm.ts:106 #: src/pages/flows/StageBindingForm.ts:106
#: src/pages/groups/GroupForm.ts:73 #: src/pages/groups/GroupForm.ts:76
#: src/pages/groups/GroupForm.ts:91 #: src/pages/groups/GroupForm.ts:127
#: src/pages/outposts/OutpostForm.ts:74 #: src/pages/outposts/OutpostForm.ts:74
#: src/pages/outposts/OutpostForm.ts:96 #: src/pages/outposts/OutpostForm.ts:96
#: src/pages/outposts/ServiceConnectionDockerForm.ts:87 #: src/pages/outposts/ServiceConnectionDockerForm.ts:87
@ -1770,7 +1777,7 @@ msgstr ""
msgid "Maximum age (in days)" msgid "Maximum age (in days)"
msgstr "" msgstr ""
#: src/pages/groups/GroupForm.ts:77 #: src/pages/groups/GroupForm.ts:80
#: src/pages/groups/GroupListPage.ts:47 #: src/pages/groups/GroupListPage.ts:47
msgid "Members" msgid "Members"
msgstr "" msgstr ""
@ -1830,8 +1837,9 @@ msgstr ""
#: src/pages/flows/BoundStagesList.ts:39 #: src/pages/flows/BoundStagesList.ts:39
#: src/pages/flows/FlowForm.ts:81 #: src/pages/flows/FlowForm.ts:81
#: src/pages/flows/FlowListPage.ts:47 #: src/pages/flows/FlowListPage.ts:47
#: src/pages/groups/GroupForm.ts:48 #: src/pages/groups/GroupForm.ts:51
#: src/pages/groups/GroupListPage.ts:45 #: src/pages/groups/GroupListPage.ts:45
#: src/pages/groups/MemberSelectModal.ts:44
#: src/pages/outposts/OutpostForm.ts:47 #: src/pages/outposts/OutpostForm.ts:47
#: src/pages/outposts/OutpostListPage.ts:49 #: src/pages/outposts/OutpostListPage.ts:49
#: src/pages/outposts/ServiceConnectionDockerForm.ts:53 #: src/pages/outposts/ServiceConnectionDockerForm.ts:53
@ -1884,7 +1892,7 @@ msgstr ""
#: src/pages/stages/user_write/UserWriteStageForm.ts:55 #: src/pages/stages/user_write/UserWriteStageForm.ts:55
#: src/pages/user-settings/UserDetailsPage.ts:64 #: src/pages/user-settings/UserDetailsPage.ts:64
#: src/pages/users/UserForm.ts:54 #: src/pages/users/UserForm.ts:54
#: src/pages/users/UserListPage.ts:49 #: src/pages/users/UserListPage.ts:50
#: src/pages/users/UserViewPage.ts:91 #: src/pages/users/UserViewPage.ts:91
msgid "Name" msgid "Name"
msgstr "" msgstr ""
@ -1912,13 +1920,14 @@ msgstr ""
#: src/pages/crypto/CertificateKeyPairListPage.ts:61 #: src/pages/crypto/CertificateKeyPairListPage.ts:61
#: src/pages/groups/GroupListPage.ts:58 #: src/pages/groups/GroupListPage.ts:58
#: src/pages/groups/MemberSelectModal.ts:56
#: src/pages/outposts/ServiceConnectionListPage.ts:64 #: src/pages/outposts/ServiceConnectionListPage.ts:64
#: src/pages/policies/BoundPoliciesList.ts:118 #: src/pages/policies/BoundPoliciesList.ts:118
#: src/pages/policies/PolicyTestForm.ts:38 #: src/pages/policies/PolicyTestForm.ts:38
#: src/pages/providers/proxy/ProxyProviderViewPage.ts:108 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:108
#: src/pages/tokens/TokenListPage.ts:56 #: src/pages/tokens/TokenListPage.ts:56
#: src/pages/user-settings/tokens/UserTokenList.ts:83 #: src/pages/user-settings/tokens/UserTokenList.ts:83
#: src/pages/users/UserListPage.ts:62 #: src/pages/users/UserListPage.ts:63
msgid "No" msgid "No"
msgstr "" msgstr ""
@ -1942,7 +1951,7 @@ msgstr ""
msgid "No additional data available." msgid "No additional data available."
msgstr "" msgstr ""
#: src/elements/table/Table.ts:124 #: src/elements/table/Table.ts:131
msgid "No elements found." msgid "No elements found."
msgstr "" msgstr ""
@ -2173,7 +2182,7 @@ msgstr ""
msgid "PEM-encoded Certificate data." msgid "PEM-encoded Certificate data."
msgstr "" msgstr ""
#: src/pages/groups/GroupForm.ts:63 #: src/pages/groups/GroupForm.ts:66
#: src/pages/groups/GroupListPage.ts:46 #: src/pages/groups/GroupListPage.ts:46
msgid "Parent" msgid "Parent"
msgstr "" msgstr ""
@ -2455,7 +2464,7 @@ msgstr ""
msgid "Redirect binding" msgid "Redirect binding"
msgstr "" msgstr ""
#: src/elements/table/Table.ts:183 #: src/elements/table/Table.ts:191
msgid "Refresh" msgid "Refresh"
msgstr "" msgstr ""
@ -2502,7 +2511,7 @@ msgstr ""
msgid "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only." msgid "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only."
msgstr "" msgstr ""
#: src/pages/users/UserListPage.ts:132 #: src/pages/users/UserListPage.ts:133
#: src/pages/users/UserViewPage.ts:164 #: src/pages/users/UserViewPage.ts:164
msgid "Reset Password" msgid "Reset Password"
msgstr "" msgstr ""
@ -2625,7 +2634,7 @@ msgstr ""
msgid "Select a provider that this application should use. Alternatively, create a new provider." msgid "Select a provider that this application should use. Alternatively, create a new provider."
msgstr "" msgstr ""
#: src/elements/table/Table.ts:215 #: src/elements/table/Table.ts:242
msgid "Select all rows" msgid "Select all rows"
msgstr "" msgstr ""
@ -2633,6 +2642,10 @@ msgstr ""
msgid "Select an identification method." msgid "Select an identification method."
msgstr "" msgstr ""
#: src/pages/groups/MemberSelectModal.ts:67
msgid "Select users to add"
msgstr ""
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts:168 #: src/pages/providers/oauth2/OAuth2ProviderForm.ts:168
msgid "Select which scopes can be used by the client. The client stil has to specify the scope to access the data." msgid "Select which scopes can be used by the client. The client stil has to specify the scope to access the data."
msgstr "" msgstr ""
@ -2710,7 +2723,7 @@ msgstr ""
msgid "Set a custom HTTP-Basic Authentication header based on values from authentik." msgid "Set a custom HTTP-Basic Authentication header based on values from authentik."
msgstr "" msgstr ""
#: src/pages/groups/GroupForm.ts:100 #: src/pages/groups/GroupForm.ts:138
#: src/pages/outposts/OutpostForm.ts:109 #: src/pages/outposts/OutpostForm.ts:109
#: src/pages/outposts/ServiceConnectionKubernetesForm.ts:73 #: src/pages/outposts/ServiceConnectionKubernetesForm.ts:73
#: src/pages/policies/PolicyTestForm.ts:78 #: src/pages/policies/PolicyTestForm.ts:78
@ -2932,7 +2945,7 @@ msgstr ""
msgid "Successfully created flow." msgid "Successfully created flow."
msgstr "" msgstr ""
#: src/pages/groups/GroupForm.ts:41 #: src/pages/groups/GroupForm.ts:44
msgid "Successfully created group." msgid "Successfully created group."
msgstr "" msgstr ""
@ -3025,7 +3038,7 @@ msgstr ""
msgid "Successfully generated certificate-key pair." msgid "Successfully generated certificate-key pair."
msgstr "" msgstr ""
#: src/pages/users/UserListPage.ts:127 #: src/pages/users/UserListPage.ts:128
#: src/pages/users/UserViewPage.ts:159 #: src/pages/users/UserViewPage.ts:159
msgid "Successfully generated recovery link" msgid "Successfully generated recovery link"
msgstr "" msgstr ""
@ -3068,7 +3081,7 @@ msgstr ""
msgid "Successfully updated flow." msgid "Successfully updated flow."
msgstr "" msgstr ""
#: src/pages/groups/GroupForm.ts:38 #: src/pages/groups/GroupForm.ts:41
msgid "Successfully updated group." msgid "Successfully updated group."
msgstr "" msgstr ""
@ -3449,7 +3462,7 @@ msgstr ""
#: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:67 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:67
#: src/pages/user-settings/tokens/UserTokenList.ts:105 #: src/pages/user-settings/tokens/UserTokenList.ts:105
#: src/pages/users/UserActiveForm.ts:66 #: src/pages/users/UserActiveForm.ts:66
#: src/pages/users/UserListPage.ts:67 #: src/pages/users/UserListPage.ts:68
#: src/pages/users/UserViewPage.ts:138 #: src/pages/users/UserViewPage.ts:138
msgid "Update" msgid "Update"
msgstr "" msgstr ""
@ -3525,7 +3538,7 @@ msgid "Update Token"
msgstr "" msgstr ""
#: src/pages/policies/BoundPoliciesList.ts:102 #: src/pages/policies/BoundPoliciesList.ts:102
#: src/pages/users/UserListPage.ts:70 #: src/pages/users/UserListPage.ts:71
#: src/pages/users/UserViewPage.ts:141 #: src/pages/users/UserViewPage.ts:141
msgid "Update User" msgid "Update User"
msgstr "" msgstr ""
@ -3575,8 +3588,8 @@ msgstr ""
#: src/pages/property-mappings/PropertyMappingTestForm.ts:49 #: src/pages/property-mappings/PropertyMappingTestForm.ts:49
#: src/pages/tokens/TokenListPage.ts:45 #: src/pages/tokens/TokenListPage.ts:45
#: src/pages/user-settings/tokens/UserTokenList.ts:72 #: src/pages/user-settings/tokens/UserTokenList.ts:72
#: src/pages/users/UserListPage.ts:87 #: src/pages/users/UserListPage.ts:88
#: src/pages/users/UserListPage.ts:107 #: src/pages/users/UserListPage.ts:108
msgid "User" msgid "User"
msgstr "" msgstr ""
@ -3648,11 +3661,11 @@ msgstr ""
#: src/interfaces/AdminInterface.ts:32 #: src/interfaces/AdminInterface.ts:32
#: src/pages/admin-overview/AdminOverviewPage.ts:49 #: src/pages/admin-overview/AdminOverviewPage.ts:49
#: src/pages/users/UserListPage.ts:31 #: src/pages/users/UserListPage.ts:32
msgid "Users" msgid "Users"
msgstr "" msgstr ""
#: src/pages/groups/GroupForm.ts:60 #: src/pages/groups/GroupForm.ts:63
msgid "Users added to this group will be superusers." msgid "Users added to this group will be superusers."
msgstr "" msgstr ""
@ -3803,13 +3816,14 @@ msgstr ""
#: src/pages/crypto/CertificateKeyPairListPage.ts:61 #: src/pages/crypto/CertificateKeyPairListPage.ts:61
#: src/pages/groups/GroupListPage.ts:58 #: src/pages/groups/GroupListPage.ts:58
#: src/pages/groups/MemberSelectModal.ts:56
#: src/pages/outposts/ServiceConnectionListPage.ts:64 #: src/pages/outposts/ServiceConnectionListPage.ts:64
#: src/pages/policies/BoundPoliciesList.ts:118 #: src/pages/policies/BoundPoliciesList.ts:118
#: src/pages/policies/PolicyTestForm.ts:38 #: src/pages/policies/PolicyTestForm.ts:38
#: src/pages/providers/proxy/ProxyProviderViewPage.ts:105 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:105
#: src/pages/tokens/TokenListPage.ts:56 #: src/pages/tokens/TokenListPage.ts:56
#: src/pages/user-settings/tokens/UserTokenList.ts:83 #: src/pages/user-settings/tokens/UserTokenList.ts:83
#: src/pages/users/UserListPage.ts:62 #: src/pages/users/UserListPage.ts:63
msgid "Yes" msgid "Yes"
msgstr "" msgstr ""

View File

@ -1,4 +1,4 @@
import { CoreApi, Group } from "authentik-api"; import { CoreApi, Group, User } from "authentik-api";
import { t } from "@lingui/macro"; import { t } from "@lingui/macro";
import { customElement, property } from "lit-element"; import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html"; import { html, TemplateResult } from "lit-html";
@ -8,6 +8,9 @@ import { until } from "lit-html/directives/until";
import { ifDefined } from "lit-html/directives/if-defined"; import { ifDefined } from "lit-html/directives/if-defined";
import "../../elements/forms/HorizontalFormElement"; import "../../elements/forms/HorizontalFormElement";
import "../../elements/CodeMirror"; import "../../elements/CodeMirror";
import "../../elements/chips/ChipGroup";
import "../../elements/chips/Chip";
import "./MemberSelectModal";
import YAML from "yaml"; import YAML from "yaml";
import { first } from "../../utils"; import { first } from "../../utils";
@ -72,18 +75,48 @@ export class GroupForm extends Form<Group> {
label=${t`Members`} label=${t`Members`}
?required=${true} ?required=${true}
name="users"> name="users">
<select class="pf-c-form-control" multiple> <div class="pf-c-input-group">
${until(new CoreApi(DEFAULT_CONFIG).coreUsersList({ <ak-group-member-select-table
ordering: "username", .confirm=${(items: User[]) => {
}).then(users => { // Because the model only has the IDs, map the user list to IDs
return users.results.map(user => { const ids = items.map(u => u.pk || 0);
const selected = Array.from(this.group?.users || []).some(su => { if (!this.group) return Promise.reject();
return su == user.pk; this.group.users = new Set(Array.from(this.group?.users || []).concat(ids));
}); this.requestUpdate();
return html`<option value=${ifDefined(user.pk)} ?selected=${selected}>${user.username} (${user.name})</option>`; return Promise.resolve();
}); }}>
}), html`<option>${t`Loading...`}</option>`)} <button slot="trigger" class="pf-c-button pf-m-control" type="button">
</select> <i class="fas fa-plus" aria-hidden="true"></i>
</button>
</ak-group-member-select-table>
<div class="pf-c-form-control">
<ak-chip-group>
${until(new CoreApi(DEFAULT_CONFIG).coreUsersList({
ordering: "username",
}).then(users => {
return users.results.map(user => {
const selected = Array.from(this.group?.users || []).some(su => {
return su == user.pk;
});
if (!selected) return;
return html`<ak-chip
.removable=${true}
value=${ifDefined(user.pk)}
@remove=${() => {
if (!this.group) return;
const users = Array.from(this.group?.users || []);
const idx = users.indexOf(user.pk || 0);
users.splice(idx, 1);
this.group.users = new Set(users);
this.requestUpdate();
}}>
${user.username}
</ak-chip>`;
});
}), html`<option>${t`Loading...`}</option>`)}
</ak-chip-group>
</div>
</div>
<p class="pf-c-form__helper-text">${t`Hold control/command to select multiple items.`}</p> <p class="pf-c-form__helper-text">${t`Hold control/command to select multiple items.`}</p>
</ak-form-element-horizontal> </ak-form-element-horizontal>
<ak-form-element-horizontal <ak-form-element-horizontal

View File

@ -0,0 +1,87 @@
import { t } from "@lingui/macro";
import { CoreApi, User } from "authentik-api";
import { customElement, property } from "lit-element";
import { TemplateResult, html } from "lit-html";
import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants";
import { TableColumn } from "../../elements/table/Table";
import { TableModal } from "../../elements/table/TableModal";
import "../../elements/buttons/SpinnerButton";
import { first } from "../../utils";
@customElement("ak-group-member-select-table")
export class MemberSelectTable extends TableModal<User> {
checkbox = true;
searchEnabled(): boolean {
return true;
}
@property()
confirm!: (selectedItems: User[]) => Promise<unknown>;
apiEndpoint(page: number): Promise<AKResponse<User>> {
return new CoreApi(DEFAULT_CONFIG).coreUsersList({
ordering: this.order,
page: page,
pageSize: PAGE_SIZE /2,
search: this.search || "",
});
}
columns(): TableColumn[] {
return [
new TableColumn(t`Name`, "username"),
new TableColumn(t`Active`, "active"),
new TableColumn(t`Last login`, "last_login"),
];
}
row(item: User): TemplateResult[] {
return [
html`<a href="#/identity/users/${item.pk}">
<div>${item.username}</div>
<small>${item.name}</small>
</a>`,
html`${item.isActive ? t`Yes` : t`No`}`,
html`${first(item.lastLogin?.toLocaleString(), "-")}`,
];
}
renderSelectedChip(item: User): TemplateResult {
return html`${item.username}`;
}
renderModalInner(): TemplateResult {
return html`<section class="pf-c-page__main-section pf-m-light">
<div class="pf-c-content">
<h1 class="pf-c-title pf-m-2xl">
${t`Select users to add`}
</h1>
</div>
</section>
<section class="pf-c-page__main-section pf-m-light">
${this.renderTable()}
</section>
<footer class="pf-c-modal-box__footer">
<ak-spinner-button
.callAction=${() => {
return this.confirm(this.selectedElements).then(() => {
this.open = false;
});
}}
class="pf-m-primary">
${t`Add`}
</ak-spinner-button>&nbsp;
<ak-spinner-button
.callAction=${async () => {
this.open = false;
}}
class="pf-m-secondary">
${t`Cancel`}
</ak-spinner-button>
</footer>`;
}
}

View File

@ -15,6 +15,7 @@ import "./UserActiveForm";
import "./UserForm"; import "./UserForm";
import { showMessage } from "../../elements/messages/MessageContainer"; import { showMessage } from "../../elements/messages/MessageContainer";
import { MessageLevel } from "../../elements/messages/Message"; import { MessageLevel } from "../../elements/messages/Message";
import { first } from "../../utils";
@customElement("ak-user-list") @customElement("ak-user-list")
export class UserListPage extends TablePage<User> { export class UserListPage extends TablePage<User> {
@ -59,7 +60,7 @@ export class UserListPage extends TablePage<User> {
<small>${item.name}</small> <small>${item.name}</small>
</a>`, </a>`,
html`${item.isActive ? t`Yes` : t`No`}`, html`${item.isActive ? t`Yes` : t`No`}`,
html`${item.lastLogin?.toLocaleString()}`, html`${first(item.lastLogin?.toLocaleString(), "-")}`,
html` html`
<ak-forms-modal> <ak-forms-modal>
<span slot="submit"> <span slot="submit">