From 182256c53e45ddb883098b6545f9bf625c6d9dda Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 10 Apr 2021 20:19:23 +0200 Subject: [PATCH] web/admin: migrate GroupForm to use TableModal instead of select multiple Signed-off-by: Jens Langhammer --- web/src/elements/chips/ChipGroup.ts | 6 +- web/src/elements/table/Table.ts | 1 + web/src/locales/en.po | 92 +++++++++++++---------- web/src/locales/pseudo-LOCALE.po | 92 +++++++++++++---------- web/src/pages/groups/GroupForm.ts | 59 +++++++++++---- web/src/pages/groups/MemberSelectModal.ts | 87 +++++++++++++++++++++ web/src/pages/users/UserListPage.ts | 3 +- 7 files changed, 246 insertions(+), 94 deletions(-) create mode 100644 web/src/pages/groups/MemberSelectModal.ts diff --git a/web/src/elements/chips/ChipGroup.ts b/web/src/elements/chips/ChipGroup.ts index cf16d3715..dd6b131bd 100644 --- a/web/src/elements/chips/ChipGroup.ts +++ b/web/src/elements/chips/ChipGroup.ts @@ -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 PFChip from "@patternfly/patternfly/components/Chip/chip.css"; @@ -14,7 +14,9 @@ export class ChipGroup extends LitElement { return [PFBase, PFChip, PFChipGroup, PFButton, AKGlobal]; } - set value(v: (string | number | undefined)[]) {} + set value(v: (string | number | undefined)[]) { + return; + } get value(): (string | number | undefined)[] { const values: (string | number | undefined)[] = []; diff --git a/web/src/elements/table/Table.ts b/web/src/elements/table/Table.ts index 44a5e78b4..af59253a0 100644 --- a/web/src/elements/table/Table.ts +++ b/web/src/elements/table/Table.ts @@ -246,6 +246,7 @@ export abstract class Table extends LitElement {  `; } + // eslint-disable-next-line @typescript-eslint/no-unused-vars renderSelectedChip(item: T): TemplateResult { return html``; } diff --git a/web/src/locales/en.po b/web/src/locales/en.po index 3b23e37b8..c61f102dd 100644 --- a/web/src/locales/en.po +++ b/web/src/locales/en.po @@ -74,11 +74,16 @@ msgstr "Access token URL" msgid "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 msgid "Active" msgstr "Active" +#: src/pages/groups/MemberSelectModal.ts:82 +msgid "Add" +msgstr "Add" + #: src/pages/sources/ldap/LDAPSourceForm.ts:202 msgid "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." 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/users/UserForm.ts:77 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/DeleteForm.ts:86 #: src/elements/forms/ModalForm.ts:71 +#: src/pages/groups/MemberSelectModal.ts:89 #: src/pages/users/UserActiveForm.ts:73 msgid "Cancel" msgstr "Cancel" @@ -516,7 +522,7 @@ msgstr "Clear Policy cache" msgid "Clear cache" msgstr "Clear cache" -#: src/elements/forms/HorizontalFormElement.ts:81 +#: src/elements/forms/HorizontalFormElement.ts:82 msgid "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/user-settings/tokens/UserTokenList.ts:50 #: src/pages/user-settings/tokens/UserTokenList.ts:58 -#: src/pages/users/UserListPage.ts:143 -#: src/pages/users/UserListPage.ts:151 +#: src/pages/users/UserListPage.ts:144 +#: src/pages/users/UserListPage.ts:152 msgid "Create" msgstr "Create" @@ -796,7 +802,7 @@ msgstr "Create Stage binding" msgid "Create Token" msgstr "Create Token" -#: src/pages/users/UserListPage.ts:146 +#: src/pages/users/UserListPage.ts:147 msgid "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/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:36 #: src/pages/user-settings/tokens/UserTokenList.ts:125 -#: src/pages/users/UserListPage.ts:114 +#: src/pages/users/UserListPage.ts:115 msgid "Delete" msgstr "Delete" @@ -963,8 +969,8 @@ msgstr "Digest algorithm" msgid "Digits" msgstr "Digits" -#: src/pages/users/UserListPage.ts:80 -#: src/pages/users/UserListPage.ts:99 +#: src/pages/users/UserListPage.ts:81 +#: src/pages/users/UserListPage.ts:100 msgid "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/prompt/PromptListPage.ts:75 #: 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 msgid "Edit" msgstr "Edit" @@ -1074,8 +1080,8 @@ msgstr "Email or Username" msgid "Email: Text field with Email type." msgstr "Email: Text field with Email type." -#: src/pages/users/UserListPage.ts:80 -#: src/pages/users/UserListPage.ts:99 +#: src/pages/users/UserListPage.ts:81 +#: src/pages/users/UserListPage.ts:100 msgid "Enable" msgstr "Enable" @@ -1459,7 +1465,7 @@ msgid "Hide managed mappings" msgstr "Hide managed mappings" #: 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/providers/oauth2/OAuth2ProviderForm.ts:169 #: 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." 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" msgstr "Impersonate" @@ -1572,7 +1578,7 @@ msgstr "Invitations" msgid "Is active" msgstr "Is active" -#: src/pages/groups/GroupForm.ts:57 +#: src/pages/groups/GroupForm.ts:60 msgid "Is superuser" msgstr "Is superuser" @@ -1616,7 +1622,8 @@ msgstr "Label" msgid "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 msgid "Last login" msgstr "Last login" @@ -1646,7 +1653,7 @@ msgstr "Let the user identify themselves with their username or Email address." msgid "Library" msgstr "Library" -#: src/elements/table/Table.ts:113 +#: src/elements/table/Table.ts:120 #: src/flows/FlowExecutor.ts:164 #: src/flows/FlowExecutor.ts:210 #: src/flows/access_denied/FlowAccessDenied.ts:27 @@ -1674,8 +1681,8 @@ msgstr "Loading" #: src/pages/events/RuleForm.ts:90 #: src/pages/flows/StageBindingForm.ts:89 #: src/pages/flows/StageBindingForm.ts:106 -#: src/pages/groups/GroupForm.ts:73 -#: src/pages/groups/GroupForm.ts:91 +#: src/pages/groups/GroupForm.ts:76 +#: src/pages/groups/GroupForm.ts:127 #: src/pages/outposts/OutpostForm.ts:74 #: src/pages/outposts/OutpostForm.ts:96 #: 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)" msgstr "Maximum age (in days)" -#: src/pages/groups/GroupForm.ts:77 +#: src/pages/groups/GroupForm.ts:80 #: src/pages/groups/GroupListPage.ts:47 msgid "Members" msgstr "Members" @@ -1838,8 +1845,9 @@ msgstr "Monitor" #: src/pages/flows/BoundStagesList.ts:39 #: src/pages/flows/FlowForm.ts:81 #: 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/MemberSelectModal.ts:44 #: src/pages/outposts/OutpostForm.ts:47 #: src/pages/outposts/OutpostListPage.ts:49 #: src/pages/outposts/ServiceConnectionDockerForm.ts:53 @@ -1892,7 +1900,7 @@ msgstr "Monitor" #: src/pages/stages/user_write/UserWriteStageForm.ts:55 #: src/pages/user-settings/UserDetailsPage.ts:64 #: src/pages/users/UserForm.ts:54 -#: src/pages/users/UserListPage.ts:49 +#: src/pages/users/UserListPage.ts:50 #: src/pages/users/UserViewPage.ts:91 msgid "Name" msgstr "Name" @@ -1920,13 +1928,14 @@ msgstr "New version available!" #: src/pages/crypto/CertificateKeyPairListPage.ts:61 #: src/pages/groups/GroupListPage.ts:58 +#: src/pages/groups/MemberSelectModal.ts:56 #: src/pages/outposts/ServiceConnectionListPage.ts:64 #: src/pages/policies/BoundPoliciesList.ts:118 #: src/pages/policies/PolicyTestForm.ts:38 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:108 #: src/pages/tokens/TokenListPage.ts:56 #: src/pages/user-settings/tokens/UserTokenList.ts:83 -#: src/pages/users/UserListPage.ts:62 +#: src/pages/users/UserListPage.ts:63 msgid "No" msgstr "No" @@ -1950,7 +1959,7 @@ msgstr "No Stages bound" msgid "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." msgstr "No elements found." @@ -2181,7 +2190,7 @@ msgstr "Overview" msgid "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 msgid "Parent" msgstr "Parent" @@ -2463,7 +2472,7 @@ msgstr "Redirect URIs" msgid "Redirect binding" msgstr "Redirect binding" -#: src/elements/table/Table.ts:183 +#: src/elements/table/Table.ts:191 msgid "Refresh" msgstr "Refresh" @@ -2510,7 +2519,7 @@ msgstr "Required" msgid "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 msgid "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." 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" msgstr "Select all rows" @@ -2641,6 +2650,10 @@ msgstr "Select all rows" msgid "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 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." @@ -2718,7 +2731,7 @@ msgstr "Set HTTP-Basic Authentication" 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." -#: src/pages/groups/GroupForm.ts:100 +#: src/pages/groups/GroupForm.ts:138 #: src/pages/outposts/OutpostForm.ts:109 #: src/pages/outposts/ServiceConnectionKubernetesForm.ts:73 #: src/pages/policies/PolicyTestForm.ts:78 @@ -2940,7 +2953,7 @@ msgstr "Successfully created certificate-key pair." msgid "Successfully created flow." msgstr "Successfully created flow." -#: src/pages/groups/GroupForm.ts:41 +#: src/pages/groups/GroupForm.ts:44 msgid "Successfully created group." msgstr "Successfully created group." @@ -3033,7 +3046,7 @@ msgstr "Successfully deleted {0} {1}" msgid "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 msgid "Successfully generated recovery link" msgstr "Successfully generated recovery link" @@ -3076,7 +3089,7 @@ msgstr "Successfully updated device." msgid "Successfully updated flow." msgstr "Successfully updated flow." -#: src/pages/groups/GroupForm.ts:38 +#: src/pages/groups/GroupForm.ts:41 msgid "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/tokens/UserTokenList.ts:105 #: src/pages/users/UserActiveForm.ts:66 -#: src/pages/users/UserListPage.ts:67 +#: src/pages/users/UserListPage.ts:68 #: src/pages/users/UserViewPage.ts:138 msgid "Update" msgstr "Update" @@ -3535,7 +3548,7 @@ msgid "Update Token" msgstr "Update Token" #: src/pages/policies/BoundPoliciesList.ts:102 -#: src/pages/users/UserListPage.ts:70 +#: src/pages/users/UserListPage.ts:71 #: src/pages/users/UserViewPage.ts:141 msgid "Update User" msgstr "Update User" @@ -3585,8 +3598,8 @@ msgstr "Use global settings" #: src/pages/property-mappings/PropertyMappingTestForm.ts:49 #: src/pages/tokens/TokenListPage.ts:45 #: src/pages/user-settings/tokens/UserTokenList.ts:72 -#: src/pages/users/UserListPage.ts:87 -#: src/pages/users/UserListPage.ts:107 +#: src/pages/users/UserListPage.ts:88 +#: src/pages/users/UserListPage.ts:108 msgid "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/pages/admin-overview/AdminOverviewPage.ts:49 -#: src/pages/users/UserListPage.ts:31 +#: src/pages/users/UserListPage.ts:32 msgid "Users" msgstr "Users" -#: src/pages/groups/GroupForm.ts:60 +#: src/pages/groups/GroupForm.ts:63 msgid "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/groups/GroupListPage.ts:58 +#: src/pages/groups/MemberSelectModal.ts:56 #: src/pages/outposts/ServiceConnectionListPage.ts:64 #: src/pages/policies/BoundPoliciesList.ts:118 #: src/pages/policies/PolicyTestForm.ts:38 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:105 #: src/pages/tokens/TokenListPage.ts:56 #: src/pages/user-settings/tokens/UserTokenList.ts:83 -#: src/pages/users/UserListPage.ts:62 +#: src/pages/users/UserListPage.ts:63 msgid "Yes" msgstr "Yes" diff --git a/web/src/locales/pseudo-LOCALE.po b/web/src/locales/pseudo-LOCALE.po index f67b492a1..471939bfb 100644 --- a/web/src/locales/pseudo-LOCALE.po +++ b/web/src/locales/pseudo-LOCALE.po @@ -74,11 +74,16 @@ msgstr "" msgid "Action" 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 msgid "Active" msgstr "" +#: src/pages/groups/MemberSelectModal.ts:82 +msgid "Add" +msgstr "" + #: src/pages/sources/ldap/LDAPSourceForm.ts:202 msgid "Addition Group DN" 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." msgstr "" -#: src/pages/groups/GroupForm.ts:96 +#: src/pages/groups/GroupForm.ts:134 #: src/pages/stages/invitation/InvitationForm.ts:51 #: src/pages/users/UserForm.ts:77 msgid "Attributes" @@ -402,6 +407,7 @@ msgstr "" #: src/elements/forms/ConfirmationForm.ts:75 #: src/elements/forms/DeleteForm.ts:86 #: src/elements/forms/ModalForm.ts:71 +#: src/pages/groups/MemberSelectModal.ts:89 #: src/pages/users/UserActiveForm.ts:73 msgid "Cancel" msgstr "" @@ -510,7 +516,7 @@ msgstr "" msgid "Clear cache" msgstr "" -#: src/elements/forms/HorizontalFormElement.ts:81 +#: src/elements/forms/HorizontalFormElement.ts:82 msgid "Click to change value" msgstr "" @@ -719,8 +725,8 @@ msgstr "" #: src/pages/stages/prompt/PromptStageForm.ts:98 #: src/pages/user-settings/tokens/UserTokenList.ts:50 #: src/pages/user-settings/tokens/UserTokenList.ts:58 -#: src/pages/users/UserListPage.ts:143 -#: src/pages/users/UserListPage.ts:151 +#: src/pages/users/UserListPage.ts:144 +#: src/pages/users/UserListPage.ts:152 msgid "Create" msgstr "" @@ -790,7 +796,7 @@ msgstr "" msgid "Create Token" msgstr "" -#: src/pages/users/UserListPage.ts:146 +#: src/pages/users/UserListPage.ts:147 msgid "Create User" msgstr "" @@ -867,7 +873,7 @@ msgstr "" #: src/pages/tokens/TokenListPage.ts:68 #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:36 #: src/pages/user-settings/tokens/UserTokenList.ts:125 -#: src/pages/users/UserListPage.ts:114 +#: src/pages/users/UserListPage.ts:115 msgid "Delete" msgstr "" @@ -955,8 +961,8 @@ msgstr "" msgid "Digits" msgstr "" -#: src/pages/users/UserListPage.ts:80 -#: src/pages/users/UserListPage.ts:99 +#: src/pages/users/UserListPage.ts:81 +#: src/pages/users/UserListPage.ts:100 msgid "Disable" msgstr "" @@ -1016,7 +1022,7 @@ msgstr "" #: src/pages/stages/StageListPage.ts:98 #: src/pages/stages/prompt/PromptListPage.ts:75 #: 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 msgid "Edit" msgstr "" @@ -1066,8 +1072,8 @@ msgstr "" msgid "Email: Text field with Email type." msgstr "" -#: src/pages/users/UserListPage.ts:80 -#: src/pages/users/UserListPage.ts:99 +#: src/pages/users/UserListPage.ts:81 +#: src/pages/users/UserListPage.ts:100 msgid "Enable" msgstr "" @@ -1451,7 +1457,7 @@ msgid "Hide managed mappings" msgstr "" #: 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/providers/oauth2/OAuth2ProviderForm.ts:169 #: 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." msgstr "" -#: src/pages/users/UserListPage.ts:135 +#: src/pages/users/UserListPage.ts:136 msgid "Impersonate" msgstr "" @@ -1564,7 +1570,7 @@ msgstr "" msgid "Is active" msgstr "" -#: src/pages/groups/GroupForm.ts:57 +#: src/pages/groups/GroupForm.ts:60 msgid "Is superuser" msgstr "" @@ -1608,7 +1614,8 @@ msgstr "" msgid "Label shown next to/above the prompt." 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 msgid "Last login" msgstr "" @@ -1638,7 +1645,7 @@ msgstr "" msgid "Library" msgstr "" -#: src/elements/table/Table.ts:113 +#: src/elements/table/Table.ts:120 #: src/flows/FlowExecutor.ts:164 #: src/flows/FlowExecutor.ts:210 #: src/flows/access_denied/FlowAccessDenied.ts:27 @@ -1666,8 +1673,8 @@ msgstr "" #: src/pages/events/RuleForm.ts:90 #: src/pages/flows/StageBindingForm.ts:89 #: src/pages/flows/StageBindingForm.ts:106 -#: src/pages/groups/GroupForm.ts:73 -#: src/pages/groups/GroupForm.ts:91 +#: src/pages/groups/GroupForm.ts:76 +#: src/pages/groups/GroupForm.ts:127 #: src/pages/outposts/OutpostForm.ts:74 #: src/pages/outposts/OutpostForm.ts:96 #: src/pages/outposts/ServiceConnectionDockerForm.ts:87 @@ -1770,7 +1777,7 @@ msgstr "" msgid "Maximum age (in days)" msgstr "" -#: src/pages/groups/GroupForm.ts:77 +#: src/pages/groups/GroupForm.ts:80 #: src/pages/groups/GroupListPage.ts:47 msgid "Members" msgstr "" @@ -1830,8 +1837,9 @@ msgstr "" #: src/pages/flows/BoundStagesList.ts:39 #: src/pages/flows/FlowForm.ts:81 #: 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/MemberSelectModal.ts:44 #: src/pages/outposts/OutpostForm.ts:47 #: src/pages/outposts/OutpostListPage.ts:49 #: src/pages/outposts/ServiceConnectionDockerForm.ts:53 @@ -1884,7 +1892,7 @@ msgstr "" #: src/pages/stages/user_write/UserWriteStageForm.ts:55 #: src/pages/user-settings/UserDetailsPage.ts:64 #: src/pages/users/UserForm.ts:54 -#: src/pages/users/UserListPage.ts:49 +#: src/pages/users/UserListPage.ts:50 #: src/pages/users/UserViewPage.ts:91 msgid "Name" msgstr "" @@ -1912,13 +1920,14 @@ msgstr "" #: src/pages/crypto/CertificateKeyPairListPage.ts:61 #: src/pages/groups/GroupListPage.ts:58 +#: src/pages/groups/MemberSelectModal.ts:56 #: src/pages/outposts/ServiceConnectionListPage.ts:64 #: src/pages/policies/BoundPoliciesList.ts:118 #: src/pages/policies/PolicyTestForm.ts:38 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:108 #: src/pages/tokens/TokenListPage.ts:56 #: src/pages/user-settings/tokens/UserTokenList.ts:83 -#: src/pages/users/UserListPage.ts:62 +#: src/pages/users/UserListPage.ts:63 msgid "No" msgstr "" @@ -1942,7 +1951,7 @@ msgstr "" msgid "No additional data available." msgstr "" -#: src/elements/table/Table.ts:124 +#: src/elements/table/Table.ts:131 msgid "No elements found." msgstr "" @@ -2173,7 +2182,7 @@ msgstr "" msgid "PEM-encoded Certificate data." msgstr "" -#: src/pages/groups/GroupForm.ts:63 +#: src/pages/groups/GroupForm.ts:66 #: src/pages/groups/GroupListPage.ts:46 msgid "Parent" msgstr "" @@ -2455,7 +2464,7 @@ msgstr "" msgid "Redirect binding" msgstr "" -#: src/elements/table/Table.ts:183 +#: src/elements/table/Table.ts:191 msgid "Refresh" msgstr "" @@ -2502,7 +2511,7 @@ msgstr "" msgid "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only." msgstr "" -#: src/pages/users/UserListPage.ts:132 +#: src/pages/users/UserListPage.ts:133 #: src/pages/users/UserViewPage.ts:164 msgid "Reset Password" msgstr "" @@ -2625,7 +2634,7 @@ msgstr "" msgid "Select a provider that this application should use. Alternatively, create a new provider." msgstr "" -#: src/elements/table/Table.ts:215 +#: src/elements/table/Table.ts:242 msgid "Select all rows" msgstr "" @@ -2633,6 +2642,10 @@ msgstr "" msgid "Select an identification method." msgstr "" +#: src/pages/groups/MemberSelectModal.ts:67 +msgid "Select users to add" +msgstr "" + #: 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." msgstr "" @@ -2710,7 +2723,7 @@ msgstr "" msgid "Set a custom HTTP-Basic Authentication header based on values from authentik." msgstr "" -#: src/pages/groups/GroupForm.ts:100 +#: src/pages/groups/GroupForm.ts:138 #: src/pages/outposts/OutpostForm.ts:109 #: src/pages/outposts/ServiceConnectionKubernetesForm.ts:73 #: src/pages/policies/PolicyTestForm.ts:78 @@ -2932,7 +2945,7 @@ msgstr "" msgid "Successfully created flow." msgstr "" -#: src/pages/groups/GroupForm.ts:41 +#: src/pages/groups/GroupForm.ts:44 msgid "Successfully created group." msgstr "" @@ -3025,7 +3038,7 @@ msgstr "" msgid "Successfully generated certificate-key pair." msgstr "" -#: src/pages/users/UserListPage.ts:127 +#: src/pages/users/UserListPage.ts:128 #: src/pages/users/UserViewPage.ts:159 msgid "Successfully generated recovery link" msgstr "" @@ -3068,7 +3081,7 @@ msgstr "" msgid "Successfully updated flow." msgstr "" -#: src/pages/groups/GroupForm.ts:38 +#: src/pages/groups/GroupForm.ts:41 msgid "Successfully updated group." msgstr "" @@ -3449,7 +3462,7 @@ msgstr "" #: src/pages/user-settings/settings/UserSettingsAuthenticatorWebAuthn.ts:67 #: src/pages/user-settings/tokens/UserTokenList.ts:105 #: src/pages/users/UserActiveForm.ts:66 -#: src/pages/users/UserListPage.ts:67 +#: src/pages/users/UserListPage.ts:68 #: src/pages/users/UserViewPage.ts:138 msgid "Update" msgstr "" @@ -3525,7 +3538,7 @@ msgid "Update Token" msgstr "" #: src/pages/policies/BoundPoliciesList.ts:102 -#: src/pages/users/UserListPage.ts:70 +#: src/pages/users/UserListPage.ts:71 #: src/pages/users/UserViewPage.ts:141 msgid "Update User" msgstr "" @@ -3575,8 +3588,8 @@ msgstr "" #: src/pages/property-mappings/PropertyMappingTestForm.ts:49 #: src/pages/tokens/TokenListPage.ts:45 #: src/pages/user-settings/tokens/UserTokenList.ts:72 -#: src/pages/users/UserListPage.ts:87 -#: src/pages/users/UserListPage.ts:107 +#: src/pages/users/UserListPage.ts:88 +#: src/pages/users/UserListPage.ts:108 msgid "User" msgstr "" @@ -3648,11 +3661,11 @@ msgstr "" #: src/interfaces/AdminInterface.ts:32 #: src/pages/admin-overview/AdminOverviewPage.ts:49 -#: src/pages/users/UserListPage.ts:31 +#: src/pages/users/UserListPage.ts:32 msgid "Users" msgstr "" -#: src/pages/groups/GroupForm.ts:60 +#: src/pages/groups/GroupForm.ts:63 msgid "Users added to this group will be superusers." msgstr "" @@ -3803,13 +3816,14 @@ msgstr "" #: src/pages/crypto/CertificateKeyPairListPage.ts:61 #: src/pages/groups/GroupListPage.ts:58 +#: src/pages/groups/MemberSelectModal.ts:56 #: src/pages/outposts/ServiceConnectionListPage.ts:64 #: src/pages/policies/BoundPoliciesList.ts:118 #: src/pages/policies/PolicyTestForm.ts:38 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:105 #: src/pages/tokens/TokenListPage.ts:56 #: src/pages/user-settings/tokens/UserTokenList.ts:83 -#: src/pages/users/UserListPage.ts:62 +#: src/pages/users/UserListPage.ts:63 msgid "Yes" msgstr "" diff --git a/web/src/pages/groups/GroupForm.ts b/web/src/pages/groups/GroupForm.ts index ee68f46ab..e12bbb6f9 100644 --- a/web/src/pages/groups/GroupForm.ts +++ b/web/src/pages/groups/GroupForm.ts @@ -1,4 +1,4 @@ -import { CoreApi, Group } from "authentik-api"; +import { CoreApi, Group, User } from "authentik-api"; import { t } from "@lingui/macro"; import { customElement, property } from "lit-element"; 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 "../../elements/forms/HorizontalFormElement"; import "../../elements/CodeMirror"; +import "../../elements/chips/ChipGroup"; +import "../../elements/chips/Chip"; +import "./MemberSelectModal"; import YAML from "yaml"; import { first } from "../../utils"; @@ -72,18 +75,48 @@ export class GroupForm extends Form { label=${t`Members`} ?required=${true} name="users"> - +
+ { + // Because the model only has the IDs, map the user list to IDs + const ids = items.map(u => u.pk || 0); + if (!this.group) return Promise.reject(); + this.group.users = new Set(Array.from(this.group?.users || []).concat(ids)); + this.requestUpdate(); + return Promise.resolve(); + }}> + + +
+ + ${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` { + 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} + `; + }); + }), html``)} + +
+

${t`Hold control/command to select multiple items.`}

{ + checkbox = true; + + searchEnabled(): boolean { + return true; + } + + @property() + confirm!: (selectedItems: User[]) => Promise; + + apiEndpoint(page: number): Promise> { + 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` +
${item.username}
+ ${item.name} +
`, + html`${item.isActive ? t`Yes` : t`No`}`, + html`${first(item.lastLogin?.toLocaleString(), "-")}`, + ]; + } + + renderSelectedChip(item: User): TemplateResult { + return html`${item.username}`; + } + + renderModalInner(): TemplateResult { + return html`
+
+

+ ${t`Select users to add`} +

+
+
+
+ ${this.renderTable()} +
+
+ { + return this.confirm(this.selectedElements).then(() => { + this.open = false; + }); + }} + class="pf-m-primary"> + ${t`Add`} +   + { + this.open = false; + }} + class="pf-m-secondary"> + ${t`Cancel`} + +
`; + } + +} diff --git a/web/src/pages/users/UserListPage.ts b/web/src/pages/users/UserListPage.ts index 5e168aade..43b060ea0 100644 --- a/web/src/pages/users/UserListPage.ts +++ b/web/src/pages/users/UserListPage.ts @@ -15,6 +15,7 @@ import "./UserActiveForm"; import "./UserForm"; import { showMessage } from "../../elements/messages/MessageContainer"; import { MessageLevel } from "../../elements/messages/Message"; +import { first } from "../../utils"; @customElement("ak-user-list") export class UserListPage extends TablePage { @@ -59,7 +60,7 @@ export class UserListPage extends TablePage { ${item.name} `, html`${item.isActive ? t`Yes` : t`No`}`, - html`${item.lastLogin?.toLocaleString()}`, + html`${first(item.lastLogin?.toLocaleString(), "-")}`, html`