From 1a17ce24f98ce0b768665b189ff6c61b9f84543c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 5 Aug 2021 12:30:43 +0200 Subject: [PATCH] web: use single delete button with checkbox and icon-based action buttons Signed-off-by: Jens Langhammer --- web/.babelrc | 8 +- web/src/elements/oauth/UserCodeList.ts | 43 +++---- web/src/elements/oauth/UserRefreshList.ts | 44 ++++---- web/src/elements/table/Table.ts | 32 +++--- web/src/elements/user/SessionList.ts | 41 ++++--- web/src/elements/user/UserConsentList.ts | 46 ++++---- web/src/locales/en.po | 106 +++++++++++------- web/src/locales/pseudo-LOCALE.po | 104 ++++++++++------- .../pages/applications/ApplicationListPage.ts | 51 +++++---- .../crypto/CertificateKeyPairListPage.ts | 56 +++++---- web/src/pages/events/EventListPage.ts | 2 +- web/src/pages/events/RuleListPage.ts | 54 +++++---- web/src/pages/events/TransportListPage.ts | 49 ++++---- web/src/pages/flows/BoundStagesList.ts | 46 ++++---- web/src/pages/flows/FlowListPage.ts | 55 +++++---- web/src/pages/groups/GroupListPage.ts | 54 +++++---- web/src/pages/outposts/OutpostListPage.ts | 51 +++++---- .../outposts/ServiceConnectionListPage.ts | 69 +++++++----- web/src/pages/policies/BoundPoliciesList.ts | 47 ++++---- web/src/pages/policies/PolicyListPage.ts | 3 +- .../reputation/IPReputationListPage.ts | 48 ++++---- .../reputation/UserReputationListPage.ts | 52 ++++----- .../PropertyMappingListPage.ts | 51 +++++---- web/src/pages/providers/ProviderListPage.ts | 65 ++++++----- web/src/pages/sources/SourcesListPage.ts | 63 ++++++----- web/src/pages/stages/StageListPage.ts | 69 +++++++----- .../stages/invitation/InvitationListPage.ts | 42 ++++--- web/src/pages/stages/prompt/PromptListPage.ts | 55 +++++---- .../pages/system-tasks/SystemTaskListPage.ts | 2 +- web/src/pages/tenants/TenantListPage.ts | 55 +++++---- web/src/pages/tokens/TokenListPage.ts | 43 ++++--- .../user-settings/tokens/UserTokenList.ts | 34 ++++-- web/src/pages/users/UserListPage.ts | 2 +- 33 files changed, 911 insertions(+), 631 deletions(-) diff --git a/web/.babelrc b/web/.babelrc index 6da7e1428..fb2039996 100644 --- a/web/.babelrc +++ b/web/.babelrc @@ -20,6 +20,12 @@ "regenerator": true } ], - "macros" + "macros", + [ + "@babel/plugin-proposal-private-property-in-object", + { + "loose": true + } + ] ] } diff --git a/web/src/elements/oauth/UserCodeList.ts b/web/src/elements/oauth/UserCodeList.ts index b732b19ac..e56b73c84 100644 --- a/web/src/elements/oauth/UserCodeList.ts +++ b/web/src/elements/oauth/UserCodeList.ts @@ -22,6 +22,7 @@ export class UserOAuthCodeList extends Table { }); } + checkbox = true; order = "-expires"; columns(): TableColumn[] { @@ -29,33 +30,37 @@ export class UserOAuthCodeList extends Table { new TableColumn(t`Provider`, "provider"), new TableColumn(t`Expires`, "expires"), new TableColumn(t`Scopes`, "scope"), - new TableColumn("Actions"), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesUsedByList({ + id: item.pk, + }); + }} + .delete=${() => { + return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesDestroy({ + id: item.pk, + }); + }} + > + + `; + } + row(item: ExpiringBaseGrantModel): TemplateResult[] { return [ html` ${item.provider?.name} `, html`${item.expires?.toLocaleString()}`, html`${item.scope.join(", ")}`, - html` { - return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesUsedByList({ - id: item.pk, - }); - }} - .delete=${() => { - return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesDestroy({ - id: item.pk, - }); - }} - > - - `, ]; } } diff --git a/web/src/elements/oauth/UserRefreshList.ts b/web/src/elements/oauth/UserRefreshList.ts index 432f3f917..7e47b58b6 100644 --- a/web/src/elements/oauth/UserRefreshList.ts +++ b/web/src/elements/oauth/UserRefreshList.ts @@ -29,6 +29,7 @@ export class UserOAuthRefreshList extends Table { }); } + checkbox = true; order = "-expires"; columns(): TableColumn[] { @@ -37,7 +38,6 @@ export class UserOAuthRefreshList extends Table { new TableColumn(t`Revoked?`, "revoked"), new TableColumn(t`Expires`, "expires"), new TableColumn(t`Scopes`, "scope"), - new TableColumn("Actions"), ]; } @@ -53,34 +53,38 @@ export class UserOAuthRefreshList extends Table { - `; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensUsedByList({ + id: item.pk, + }); + }} + .delete=${() => { + return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensDestroy({ + id: item.pk, + }); + }} + > + + `; + } + row(item: RefreshTokenModel): TemplateResult[] { return [ html` ${item.provider?.name} `, html`${item.revoked ? t`Yes` : t`No`}`, html`${item.expires?.toLocaleString()}`, html`${item.scope.join(", ")}`, - html` { - return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensUsedByList({ - id: item.pk, - }); - }} - .delete=${() => { - return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensDestroy({ - id: item.pk, - }); - }} - > - - `, ]; } } diff --git a/web/src/elements/table/Table.ts b/web/src/elements/table/Table.ts index 2afe4a859..ed5e10076 100644 --- a/web/src/elements/table/Table.ts +++ b/web/src/elements/table/Table.ts @@ -273,7 +273,7 @@ export abstract class Table extends LitElement { }), ); }} - class="pf-c-button pf-m-primary" + class="pf-c-button pf-m-secondary" > ${t`Refresh`} `; @@ -292,19 +292,18 @@ export abstract class Table extends LitElement { return html``; } return html` { - this.search = value; - this.dispatchEvent( - new CustomEvent(EVENT_REFRESH, { - bubbles: true, - composed: true, - }), - ); - }} - > -  `; + value=${ifDefined(this.search)} + .onSearch=${(value: string) => { + this.search = value; + this.dispatchEvent( + new CustomEvent(EVENT_REFRESH, { + bubbles: true, + composed: true, + }), + ); + }} + > + `; } // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -326,9 +325,10 @@ export abstract class Table extends LitElement { : html``}
- ${this.renderToolbarSelected()}   ${this.renderSearch()} +
${this.renderSearch()}
${this.renderToolbar()}
- ${this.renderToolbarAfter()} +
${this.renderToolbarAfter()}
+
${this.renderToolbarSelected()}
{ }); } + checkbox = true; order = "-expires"; columns(): TableColumn[] { @@ -30,32 +31,38 @@ export class AuthenticatedSessionList extends Table { new TableColumn(t`Browser`, "user_agent"), new TableColumn(t`Device`, "user_agent"), new TableColumn(t`Expires`, "expires"), - new TableColumn("Actions"), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new CoreApi(DEFAULT_CONFIG).coreAuthenticatedSessionsUsedByList({ + uuid: item.uuid || "", + }); + }} + .delete=${() => { + return new CoreApi(DEFAULT_CONFIG).coreAuthenticatedSessionsDestroy({ + uuid: item.uuid || "", + }); + }} + > + + `; + } + row(item: AuthenticatedSession): TemplateResult[] { return [ html`${item.lastIp}`, html`${item.userAgent.userAgent?.family}`, html`${item.userAgent.os?.family}`, html`${item.expires?.toLocaleString()}`, - html` { - return new CoreApi(DEFAULT_CONFIG).coreAuthenticatedSessionsUsedByList({ - uuid: item.uuid || "", - }); - }} - .delete=${() => { - return new CoreApi(DEFAULT_CONFIG).coreAuthenticatedSessionsDestroy({ - uuid: item.uuid || "", - }); - }} - > - - `, ]; } } diff --git a/web/src/elements/user/UserConsentList.ts b/web/src/elements/user/UserConsentList.ts index 4302026d5..82b624915 100644 --- a/web/src/elements/user/UserConsentList.ts +++ b/web/src/elements/user/UserConsentList.ts @@ -22,36 +22,40 @@ export class UserConsentList extends Table { }); } + checkbox = true; order = "-expires"; columns(): TableColumn[] { return [ new TableColumn(t`Application`, "application"), new TableColumn(t`Expires`, "expires"), - new TableColumn("Actions"), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new CoreApi(DEFAULT_CONFIG).coreUserConsentUsedByList({ + id: item.pk, + }); + }} + .delete=${() => { + return new CoreApi(DEFAULT_CONFIG).coreUserConsentDestroy({ + id: item.pk, + }); + }} + > + + `; + } + row(item: UserConsent): TemplateResult[] { - return [ - html`${item.application.name}`, - html`${item.expires?.toLocaleString()}`, - html` { - return new CoreApi(DEFAULT_CONFIG).coreUserConsentUsedByList({ - id: item.pk, - }); - }} - .delete=${() => { - return new CoreApi(DEFAULT_CONFIG).coreUserConsentDestroy({ - id: item.pk, - }); - }} - > - - `, - ]; + return [html`${item.application.name}`, html`${item.expires?.toLocaleString()}`]; } } diff --git a/web/src/locales/en.po b/web/src/locales/en.po index 79c13afcb..42828c05e 100644 --- a/web/src/locales/en.po +++ b/web/src/locales/en.po @@ -94,6 +94,30 @@ msgstr "Access token URL" msgid "Action" msgstr "Action" +#: src/pages/applications/ApplicationListPage.ts +#: src/pages/crypto/CertificateKeyPairListPage.ts +#: src/pages/events/EventListPage.ts +#: src/pages/events/RuleListPage.ts +#: src/pages/events/TransportListPage.ts +#: src/pages/flows/BoundStagesList.ts +#: src/pages/flows/FlowListPage.ts +#: src/pages/groups/GroupListPage.ts +#: src/pages/outposts/OutpostListPage.ts +#: src/pages/outposts/ServiceConnectionListPage.ts +#: src/pages/policies/BoundPoliciesList.ts +#: src/pages/policies/PolicyListPage.ts +#: src/pages/policies/reputation/IPReputationListPage.ts +#: src/pages/property-mappings/PropertyMappingListPage.ts +#: src/pages/providers/ProviderListPage.ts +#: src/pages/stages/StageListPage.ts +#: src/pages/stages/prompt/PromptListPage.ts +#: src/pages/system-tasks/SystemTaskListPage.ts +#: src/pages/tenants/TenantListPage.ts +#: src/pages/tokens/TokenListPage.ts +#: src/pages/users/UserListPage.ts +msgid "Actions" +msgstr "Actions" + #: src/pages/groups/MemberSelectModal.ts #: src/pages/users/UserListPage.ts #: src/pages/users/UserViewPage.ts @@ -1031,6 +1055,8 @@ msgid "Define how notifications are sent to users, like Email or Webhook." msgstr "Define how notifications are sent to users, like Email or Webhook." #: src/elements/forms/DeleteForm.ts +#: src/elements/oauth/UserCodeList.ts +#: src/elements/oauth/UserRefreshList.ts #: src/pages/applications/ApplicationListPage.ts #: src/pages/crypto/CertificateKeyPairListPage.ts #: src/pages/events/RuleListPage.ts @@ -1056,9 +1082,9 @@ msgstr "Define how notifications are sent to users, like Email or Webhook." msgid "Delete" msgstr "Delete" -#: src/elements/oauth/UserCodeList.ts -msgid "Delete Authorization Code" -msgstr "Delete Authorization Code" +#: +#~ msgid "Delete Authorization Code" +#~ msgstr "Delete Authorization Code" #: src/pages/flows/BoundStagesList.ts #: src/pages/policies/BoundPoliciesList.ts @@ -1069,9 +1095,9 @@ msgstr "Delete Binding" msgid "Delete Consent" msgstr "Delete Consent" -#: src/elements/oauth/UserRefreshList.ts -msgid "Delete Refresh Code" -msgstr "Delete Refresh Code" +#: +#~ msgid "Delete Refresh Code" +#~ msgstr "Delete Refresh Code" #: src/elements/user/SessionList.ts msgid "Delete Session" @@ -1238,33 +1264,16 @@ msgstr "Duration after which events will be deleted from the database." msgid "Each provider has a different issuer, based on the application slug." msgstr "Each provider has a different issuer, based on the application slug." -#: src/pages/applications/ApplicationListPage.ts #: src/pages/applications/ApplicationViewPage.ts #: src/pages/applications/ApplicationViewPage.ts -#: src/pages/crypto/CertificateKeyPairListPage.ts -#: src/pages/events/RuleListPage.ts -#: src/pages/events/TransportListPage.ts -#: src/pages/flows/FlowListPage.ts -#: src/pages/groups/GroupListPage.ts -#: src/pages/outposts/OutpostListPage.ts -#: src/pages/outposts/OutpostListPage.ts -#: src/pages/outposts/ServiceConnectionListPage.ts -#: src/pages/policies/PolicyListPage.ts -#: src/pages/property-mappings/PropertyMappingListPage.ts -#: src/pages/providers/ProviderListPage.ts #: src/pages/providers/ldap/LDAPProviderViewPage.ts #: src/pages/providers/oauth2/OAuth2ProviderViewPage.ts #: src/pages/providers/proxy/ProxyProviderViewPage.ts #: src/pages/providers/saml/SAMLProviderViewPage.ts -#: src/pages/sources/SourcesListPage.ts #: src/pages/sources/ldap/LDAPSourceViewPage.ts #: src/pages/sources/oauth/OAuthSourceViewPage.ts #: src/pages/sources/plex/PlexSourceViewPage.ts #: src/pages/sources/saml/SAMLSourceViewPage.ts -#: src/pages/stages/StageListPage.ts -#: src/pages/stages/prompt/PromptListPage.ts -#: src/pages/tenants/TenantListPage.ts -#: src/pages/user-settings/tokens/UserTokenList.ts #: src/pages/users/UserListPage.ts #: src/pages/users/UserViewPage.ts msgid "Edit" @@ -1940,6 +1949,10 @@ msgstr "Integration" msgid "Integration key" msgstr "Integration key" +#: src/interfaces/AdminInterface.ts +msgid "Integrations" +msgstr "Integrations" + #: src/pages/providers/proxy/ProxyProviderViewPage.ts msgid "Internal Host" msgstr "Internal Host" @@ -2618,9 +2631,9 @@ msgstr "Only fail the policy, don't invalidate user's password." msgid "Only send notification once, for example when sending a webhook into a chat channel." msgstr "Only send notification once, for example when sending a webhook into a chat channel." -#: src/pages/applications/ApplicationListPage.ts -msgid "Open application" -msgstr "Open application" +#: +#~ msgid "Open application" +#~ msgstr "Open application" #: src/pages/events/EventInfo.ts msgid "Open issue on GitHub..." @@ -2695,9 +2708,13 @@ msgstr "Outpost" msgid "Outpost Deployment Info" msgstr "Outpost Deployment Info" +#: +#~ msgid "Outpost Service-connection" +#~ msgstr "Outpost Service-connection" + #: src/pages/outposts/ServiceConnectionListPage.ts -msgid "Outpost Service-connection" -msgstr "Outpost Service-connection" +msgid "Outpost integration" +msgstr "Outpost integration" #: src/pages/admin-overview/AdminOverviewPage.ts msgid "Outpost status" @@ -3368,9 +3385,9 @@ msgstr "Server name for which this provider's certificate is valid for." msgid "Server validation of credential failed: {err}" msgstr "Server validation of credential failed: {err}" -#: src/interfaces/AdminInterface.ts -msgid "Service Connections" -msgstr "Service Connections" +#: +#~ msgid "Service Connections" +#~ msgstr "Service Connections" #: src/pages/providers/saml/SAMLProviderForm.ts msgid "Service Provider Binding" @@ -3652,6 +3669,11 @@ msgstr "Successfully created flow." msgid "Successfully created group." msgstr "Successfully created group." +#: src/pages/outposts/ServiceConnectionDockerForm.ts +#: src/pages/outposts/ServiceConnectionKubernetesForm.ts +msgid "Successfully created integration." +msgstr "Successfully created integration." + #: src/pages/stages/invitation/InvitationForm.ts msgid "Successfully created invitation." msgstr "Successfully created invitation." @@ -3691,10 +3713,10 @@ msgstr "Successfully created provider." msgid "Successfully created rule." msgstr "Successfully created rule." -#: src/pages/outposts/ServiceConnectionDockerForm.ts -#: src/pages/outposts/ServiceConnectionKubernetesForm.ts -msgid "Successfully created service-connection." -msgstr "Successfully created service-connection." +#: +#: +#~ msgid "Successfully created service-connection." +#~ msgstr "Successfully created service-connection." #: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/oauth/OAuthSourceForm.ts @@ -3796,6 +3818,11 @@ msgstr "Successfully updated flow." msgid "Successfully updated group." msgstr "Successfully updated group." +#: src/pages/outposts/ServiceConnectionDockerForm.ts +#: src/pages/outposts/ServiceConnectionKubernetesForm.ts +msgid "Successfully updated integration." +msgstr "Successfully updated integration." + #: src/pages/stages/invitation/InvitationForm.ts msgid "Successfully updated invitation." msgstr "Successfully updated invitation." @@ -3835,10 +3862,10 @@ msgstr "Successfully updated provider." msgid "Successfully updated rule." msgstr "Successfully updated rule." -#: src/pages/outposts/ServiceConnectionDockerForm.ts -#: src/pages/outposts/ServiceConnectionKubernetesForm.ts -msgid "Successfully updated service-connection." -msgstr "Successfully updated service-connection." +#: +#: +#~ msgid "Successfully updated service-connection." +#~ msgstr "Successfully updated service-connection." #: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/oauth/OAuthSourceForm.ts @@ -3994,7 +4021,6 @@ msgstr "Tenants" #: src/pages/applications/ApplicationViewPage.ts #: src/pages/events/TransportListPage.ts #: src/pages/policies/PolicyListPage.ts -#: src/pages/policies/PolicyListPage.ts #: src/pages/property-mappings/PropertyMappingListPage.ts #: src/pages/property-mappings/PropertyMappingListPage.ts msgid "Test" diff --git a/web/src/locales/pseudo-LOCALE.po b/web/src/locales/pseudo-LOCALE.po index c565a68cf..519456087 100644 --- a/web/src/locales/pseudo-LOCALE.po +++ b/web/src/locales/pseudo-LOCALE.po @@ -94,6 +94,30 @@ msgstr "" msgid "Action" msgstr "" +#: src/pages/applications/ApplicationListPage.ts +#: src/pages/crypto/CertificateKeyPairListPage.ts +#: src/pages/events/EventListPage.ts +#: src/pages/events/RuleListPage.ts +#: src/pages/events/TransportListPage.ts +#: src/pages/flows/BoundStagesList.ts +#: src/pages/flows/FlowListPage.ts +#: src/pages/groups/GroupListPage.ts +#: src/pages/outposts/OutpostListPage.ts +#: src/pages/outposts/ServiceConnectionListPage.ts +#: src/pages/policies/BoundPoliciesList.ts +#: src/pages/policies/PolicyListPage.ts +#: src/pages/policies/reputation/IPReputationListPage.ts +#: src/pages/property-mappings/PropertyMappingListPage.ts +#: src/pages/providers/ProviderListPage.ts +#: src/pages/stages/StageListPage.ts +#: src/pages/stages/prompt/PromptListPage.ts +#: src/pages/system-tasks/SystemTaskListPage.ts +#: src/pages/tenants/TenantListPage.ts +#: src/pages/tokens/TokenListPage.ts +#: src/pages/users/UserListPage.ts +msgid "Actions" +msgstr "" + #: src/pages/groups/MemberSelectModal.ts #: src/pages/users/UserListPage.ts #: src/pages/users/UserViewPage.ts @@ -1025,6 +1049,8 @@ msgid "Define how notifications are sent to users, like Email or Webhook." msgstr "" #: src/elements/forms/DeleteForm.ts +#: src/elements/oauth/UserCodeList.ts +#: src/elements/oauth/UserRefreshList.ts #: src/pages/applications/ApplicationListPage.ts #: src/pages/crypto/CertificateKeyPairListPage.ts #: src/pages/events/RuleListPage.ts @@ -1050,9 +1076,9 @@ msgstr "" msgid "Delete" msgstr "" -#: src/elements/oauth/UserCodeList.ts -msgid "Delete Authorization Code" -msgstr "" +#: +#~ msgid "Delete Authorization Code" +#~ msgstr "" #: src/pages/flows/BoundStagesList.ts #: src/pages/policies/BoundPoliciesList.ts @@ -1063,9 +1089,9 @@ msgstr "" msgid "Delete Consent" msgstr "" -#: src/elements/oauth/UserRefreshList.ts -msgid "Delete Refresh Code" -msgstr "" +#: +#~ msgid "Delete Refresh Code" +#~ msgstr "" #: src/elements/user/SessionList.ts msgid "Delete Session" @@ -1230,33 +1256,16 @@ msgstr "" msgid "Each provider has a different issuer, based on the application slug." msgstr "" -#: src/pages/applications/ApplicationListPage.ts #: src/pages/applications/ApplicationViewPage.ts #: src/pages/applications/ApplicationViewPage.ts -#: src/pages/crypto/CertificateKeyPairListPage.ts -#: src/pages/events/RuleListPage.ts -#: src/pages/events/TransportListPage.ts -#: src/pages/flows/FlowListPage.ts -#: src/pages/groups/GroupListPage.ts -#: src/pages/outposts/OutpostListPage.ts -#: src/pages/outposts/OutpostListPage.ts -#: src/pages/outposts/ServiceConnectionListPage.ts -#: src/pages/policies/PolicyListPage.ts -#: src/pages/property-mappings/PropertyMappingListPage.ts -#: src/pages/providers/ProviderListPage.ts #: src/pages/providers/ldap/LDAPProviderViewPage.ts #: src/pages/providers/oauth2/OAuth2ProviderViewPage.ts #: src/pages/providers/proxy/ProxyProviderViewPage.ts #: src/pages/providers/saml/SAMLProviderViewPage.ts -#: src/pages/sources/SourcesListPage.ts #: src/pages/sources/ldap/LDAPSourceViewPage.ts #: src/pages/sources/oauth/OAuthSourceViewPage.ts #: src/pages/sources/plex/PlexSourceViewPage.ts #: src/pages/sources/saml/SAMLSourceViewPage.ts -#: src/pages/stages/StageListPage.ts -#: src/pages/stages/prompt/PromptListPage.ts -#: src/pages/tenants/TenantListPage.ts -#: src/pages/user-settings/tokens/UserTokenList.ts #: src/pages/users/UserListPage.ts #: src/pages/users/UserViewPage.ts msgid "Edit" @@ -1932,6 +1941,10 @@ msgstr "" msgid "Integration key" msgstr "" +#: src/interfaces/AdminInterface.ts +msgid "Integrations" +msgstr "" + #: src/pages/providers/proxy/ProxyProviderViewPage.ts msgid "Internal Host" msgstr "" @@ -2610,9 +2623,9 @@ msgstr "" msgid "Only send notification once, for example when sending a webhook into a chat channel." msgstr "" -#: src/pages/applications/ApplicationListPage.ts -msgid "Open application" -msgstr "" +#: +#~ msgid "Open application" +#~ msgstr "" #: src/pages/events/EventInfo.ts msgid "Open issue on GitHub..." @@ -2687,8 +2700,12 @@ msgstr "" msgid "Outpost Deployment Info" msgstr "" +#: +#~ msgid "Outpost Service-connection" +#~ msgstr "" + #: src/pages/outposts/ServiceConnectionListPage.ts -msgid "Outpost Service-connection" +msgid "Outpost integration" msgstr "" #: src/pages/admin-overview/AdminOverviewPage.ts @@ -3360,9 +3377,9 @@ msgstr "" msgid "Server validation of credential failed: {err}" msgstr "" -#: src/interfaces/AdminInterface.ts -msgid "Service Connections" -msgstr "" +#: +#~ msgid "Service Connections" +#~ msgstr "" #: src/pages/providers/saml/SAMLProviderForm.ts msgid "Service Provider Binding" @@ -3644,6 +3661,11 @@ msgstr "" msgid "Successfully created group." msgstr "" +#: src/pages/outposts/ServiceConnectionDockerForm.ts +#: src/pages/outposts/ServiceConnectionKubernetesForm.ts +msgid "Successfully created integration." +msgstr "" + #: src/pages/stages/invitation/InvitationForm.ts msgid "Successfully created invitation." msgstr "" @@ -3683,10 +3705,10 @@ msgstr "" msgid "Successfully created rule." msgstr "" -#: src/pages/outposts/ServiceConnectionDockerForm.ts -#: src/pages/outposts/ServiceConnectionKubernetesForm.ts -msgid "Successfully created service-connection." -msgstr "" +#: +#: +#~ msgid "Successfully created service-connection." +#~ msgstr "" #: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/oauth/OAuthSourceForm.ts @@ -3788,6 +3810,11 @@ msgstr "" msgid "Successfully updated group." msgstr "" +#: src/pages/outposts/ServiceConnectionDockerForm.ts +#: src/pages/outposts/ServiceConnectionKubernetesForm.ts +msgid "Successfully updated integration." +msgstr "" + #: src/pages/stages/invitation/InvitationForm.ts msgid "Successfully updated invitation." msgstr "" @@ -3827,10 +3854,10 @@ msgstr "" msgid "Successfully updated rule." msgstr "" -#: src/pages/outposts/ServiceConnectionDockerForm.ts -#: src/pages/outposts/ServiceConnectionKubernetesForm.ts -msgid "Successfully updated service-connection." -msgstr "" +#: +#: +#~ msgid "Successfully updated service-connection." +#~ msgstr "" #: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/oauth/OAuthSourceForm.ts @@ -3986,7 +4013,6 @@ msgstr "" #: src/pages/applications/ApplicationViewPage.ts #: src/pages/events/TransportListPage.ts #: src/pages/policies/PolicyListPage.ts -#: src/pages/policies/PolicyListPage.ts #: src/pages/property-mappings/PropertyMappingListPage.ts #: src/pages/property-mappings/PropertyMappingListPage.ts msgid "Test" diff --git a/web/src/pages/applications/ApplicationListPage.ts b/web/src/pages/applications/ApplicationListPage.ts index bc5c49d7d..8e0bd2687 100644 --- a/web/src/pages/applications/ApplicationListPage.ts +++ b/web/src/pages/applications/ApplicationListPage.ts @@ -28,6 +28,8 @@ export class ApplicationListPage extends TablePage { return "pf-icon pf-icon-applications"; } + checkbox = true; + @property() order = "name"; @@ -62,10 +64,33 @@ export class ApplicationListPage extends TablePage { new TableColumn(t`Slug`, "slug"), new TableColumn(t`Provider`), new TableColumn(t`Provider Type`), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new CoreApi(DEFAULT_CONFIG).coreApplicationsUsedByList({ + slug: item.slug, + }); + }} + .delete=${() => { + return new CoreApi(DEFAULT_CONFIG).coreApplicationsDestroy({ + slug: item.slug, + }); + }} + > + + `; + } + row(item: Application): TemplateResult[] { return [ item.metaIcon @@ -91,7 +116,9 @@ export class ApplicationListPage extends TablePage { ${t`Update Application`} - + ${item.launchUrl ? html` { target="_blank" class="pf-c-button pf-m-secondary" > - ${t`Open application`} + ` - : html``} - { - return new CoreApi(DEFAULT_CONFIG).coreApplicationsUsedByList({ - slug: item.slug, - }); - }} - .delete=${() => { - return new CoreApi(DEFAULT_CONFIG).coreApplicationsDestroy({ - slug: item.slug, - }); - }} - > - - `, + : html``}`, ]; } diff --git a/web/src/pages/crypto/CertificateKeyPairListPage.ts b/web/src/pages/crypto/CertificateKeyPairListPage.ts index 49a14342d..19edf1686 100644 --- a/web/src/pages/crypto/CertificateKeyPairListPage.ts +++ b/web/src/pages/crypto/CertificateKeyPairListPage.ts @@ -18,6 +18,7 @@ import { DEFAULT_CONFIG } from "../../api/Config"; @customElement("ak-crypto-certificate-list") export class CertificateKeyPairListPage extends TablePage { expandable = true; + checkbox = true; searchEnabled(): boolean { return true; @@ -53,38 +54,47 @@ export class CertificateKeyPairListPage extends TablePage { new TableColumn(t`Name`, "name"), new TableColumn(t`Private key available?`), new TableColumn(t`Expiry date`), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsUsedByList({ + kpUuid: item.pk, + }); + }} + .delete=${() => { + return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsDestroy({ + kpUuid: item.pk, + }); + }} + > + + `; + } + row(item: CertificateKeyPair): TemplateResult[] { return [ html`${item.name}`, html`${item.privateKeyAvailable ? t`Yes` : t`No`}`, html`${item.certExpiry?.toLocaleString()}`, html` - ${t`Update`} - ${t`Update Certificate-Key Pair`} - - - - - { - return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsUsedByList({ - kpUuid: item.pk, - }); - }} - .delete=${() => { - return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsDestroy({ - kpUuid: item.pk, - }); - }} - > - - `, + ${t`Update`} + ${t`Update Certificate-Key Pair`} + + + + `, ]; } diff --git a/web/src/pages/events/EventListPage.ts b/web/src/pages/events/EventListPage.ts index 24ea3ca8e..998aa4b98 100644 --- a/web/src/pages/events/EventListPage.ts +++ b/web/src/pages/events/EventListPage.ts @@ -46,7 +46,7 @@ export class EventListPage extends TablePage { new TableColumn(t`Creation Date`, "created"), new TableColumn(t`Client IP`, "client_ip"), new TableColumn(t`Tenant`, "tenant_name"), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } diff --git a/web/src/pages/events/RuleListPage.ts b/web/src/pages/events/RuleListPage.ts index 74595dc56..d06e276c0 100644 --- a/web/src/pages/events/RuleListPage.ts +++ b/web/src/pages/events/RuleListPage.ts @@ -16,6 +16,7 @@ import "./RuleForm"; @customElement("ak-event-rule-list") export class RuleListPage extends TablePage { expandable = true; + checkbox = true; searchEnabled(): boolean { return true; @@ -47,37 +48,46 @@ export class RuleListPage extends TablePage { new TableColumn(t`Name`, "name"), new TableColumn(t`Severity`, "severity"), new TableColumn(t`Sent to group`, "group"), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new EventsApi(DEFAULT_CONFIG).eventsRulesUsedByList({ + pbmUuid: item.pk, + }); + }} + .delete=${() => { + return new EventsApi(DEFAULT_CONFIG).eventsRulesDestroy({ + pbmUuid: item.pk, + }); + }} + > + + `; + } + row(item: NotificationRule): TemplateResult[] { return [ html`${item.name}`, html`${item.severity}`, html`${item.groupObj?.name || t`None (rule disabled)`}`, html` - ${t`Update`} - ${t`Update Notification Rule`} - - - - { - return new EventsApi(DEFAULT_CONFIG).eventsRulesUsedByList({ - pbmUuid: item.pk, - }); - }} - .delete=${() => { - return new EventsApi(DEFAULT_CONFIG).eventsRulesDestroy({ - pbmUuid: item.pk, - }); - }} - > - - `, + ${t`Update`} + ${t`Update Notification Rule`} + + + `, ]; } diff --git a/web/src/pages/events/TransportListPage.ts b/web/src/pages/events/TransportListPage.ts index b1e4c7d98..0c19647ba 100644 --- a/web/src/pages/events/TransportListPage.ts +++ b/web/src/pages/events/TransportListPage.ts @@ -28,6 +28,8 @@ export class TransportListPage extends TablePage { return "pf-icon pf-icon-export"; } + checkbox = true; + @property() order = "name"; @@ -44,10 +46,33 @@ export class TransportListPage extends TablePage { return [ new TableColumn(t`Name`, "name"), new TableColumn(t`Mode`, "mode"), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new EventsApi(DEFAULT_CONFIG).eventsTransportsUsedByList({ + uuid: item.pk, + }); + }} + .delete=${() => { + return new EventsApi(DEFAULT_CONFIG).eventsTransportsDestroy({ + uuid: item.pk, + }); + }} + > + + `; + } + row(item: NotificationTransport): TemplateResult[] { return [ html`${item.name}`, @@ -66,24 +91,10 @@ export class TransportListPage extends TablePage { ${t`Update Notification Transport`} - - - { - return new EventsApi(DEFAULT_CONFIG).eventsTransportsUsedByList({ - uuid: item.pk, - }); - }} - .delete=${() => { - return new EventsApi(DEFAULT_CONFIG).eventsTransportsDestroy({ - uuid: item.pk, - }); - }} - > - - `, + + `, ]; } diff --git a/web/src/pages/flows/BoundStagesList.ts b/web/src/pages/flows/BoundStagesList.ts index 97bf14afe..39c4afab3 100644 --- a/web/src/pages/flows/BoundStagesList.ts +++ b/web/src/pages/flows/BoundStagesList.ts @@ -20,6 +20,7 @@ import { ifDefined } from "lit-html/directives/if-defined"; @customElement("ak-bound-stages-list") export class BoundStagesList extends Table { expandable = true; + checkbox = true; @property() target?: string; @@ -38,10 +39,33 @@ export class BoundStagesList extends Table { new TableColumn(t`Order`), new TableColumn(t`Name`), new TableColumn(t`Type`), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new FlowsApi(DEFAULT_CONFIG).flowsBindingsUsedByList({ + fsbUuid: item.pk, + }); + }} + .delete=${() => { + return new FlowsApi(DEFAULT_CONFIG).flowsBindingsDestroy({ + fsbUuid: item.pk, + }); + }} + > + + `; + } + row(item: FlowStageBinding): TemplateResult[] { return [ html`${item.order}`, @@ -70,25 +94,7 @@ export class BoundStagesList extends Table { - - { - return new FlowsApi(DEFAULT_CONFIG).flowsBindingsUsedByList({ - fsbUuid: item.pk, - }); - }} - .delete=${() => { - return new FlowsApi(DEFAULT_CONFIG).flowsBindingsDestroy({ - fsbUuid: item.pk, - }); - }} - > - - `, + `, ]; } diff --git a/web/src/pages/flows/FlowListPage.ts b/web/src/pages/flows/FlowListPage.ts index 9ea55d7cb..ee494abdf 100644 --- a/web/src/pages/flows/FlowListPage.ts +++ b/web/src/pages/flows/FlowListPage.ts @@ -29,6 +29,8 @@ export class FlowListPage extends TablePage { return "pf-icon pf-icon-process-automation"; } + checkbox = true; + @property() order = "slug"; @@ -48,10 +50,33 @@ export class FlowListPage extends TablePage { new TableColumn(t`Designation`, "designation"), new TableColumn(t`Stages`), new TableColumn(t`Policies`), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new FlowsApi(DEFAULT_CONFIG).flowsInstancesUsedByList({ + slug: item.slug, + }); + }} + .delete=${() => { + return new FlowsApi(DEFAULT_CONFIG).flowsInstancesDestroy({ + slug: item.slug, + }); + }} + > + + `; + } + row(item: Flow): TemplateResult[] { return [ html` @@ -65,26 +90,12 @@ export class FlowListPage extends TablePage { ${t`Update`} ${t`Update Flow`} - + - { - return new FlowsApi(DEFAULT_CONFIG).flowsInstancesUsedByList({ - slug: item.slug, - }); - }} - .delete=${() => { - return new FlowsApi(DEFAULT_CONFIG).flowsInstancesDestroy({ - slug: item.slug, - }); - }} - > - - - ${t`Export`} `, + + + `, ]; } diff --git a/web/src/pages/groups/GroupListPage.ts b/web/src/pages/groups/GroupListPage.ts index 220063bfa..7b23abfb4 100644 --- a/web/src/pages/groups/GroupListPage.ts +++ b/web/src/pages/groups/GroupListPage.ts @@ -14,6 +14,7 @@ import "./GroupForm"; @customElement("ak-group-list") export class GroupListPage extends TablePage { + checkbox = true; searchEnabled(): boolean { return true; } @@ -45,10 +46,33 @@ export class GroupListPage extends TablePage { new TableColumn(t`Parent`, "parent"), new TableColumn(t`Members`), new TableColumn(t`Superuser privileges?`), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new CoreApi(DEFAULT_CONFIG).coreGroupsUsedByList({ + groupUuid: item.pk, + }); + }} + .delete=${() => { + return new CoreApi(DEFAULT_CONFIG).coreGroupsDestroy({ + groupUuid: item.pk, + }); + }} + > + + `; + } + row(item: Group): TemplateResult[] { return [ html`${item.name}`, @@ -56,27 +80,13 @@ export class GroupListPage extends TablePage { html`${Array.from(item.users || []).length}`, html`${item.isSuperuser ? t`Yes` : t`No`}`, html` - ${t`Update`} - ${t`Update Group`} - - - - { - return new CoreApi(DEFAULT_CONFIG).coreGroupsUsedByList({ - groupUuid: item.pk, - }); - }} - .delete=${() => { - return new CoreApi(DEFAULT_CONFIG).coreGroupsDestroy({ - groupUuid: item.pk, - }); - }} - > - - `, + ${t`Update`} + ${t`Update Group`} + + + `, ]; } diff --git a/web/src/pages/outposts/OutpostListPage.ts b/web/src/pages/outposts/OutpostListPage.ts index cabdd1281..a88bd5953 100644 --- a/web/src/pages/outposts/OutpostListPage.ts +++ b/web/src/pages/outposts/OutpostListPage.ts @@ -45,10 +45,12 @@ export class OutpostListPage extends TablePage { new TableColumn(t`Providers`), new TableColumn(t`Integration`, "service_connection__name"), new TableColumn(t`Health and Version`), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + checkbox = true; + @property() order = "name"; @@ -71,24 +73,10 @@ export class OutpostListPage extends TablePage { ${t`Update`} ${t`Update Outpost`} - + - { - return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesUsedByList({ - uuid: item.pk, - }); - }} - .delete=${() => { - return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesDestroy({ - uuid: item.pk, - }); - }} - > - - + `; + } + rowInbuilt(item: Outpost): TemplateResult[] { return [ html`${item.name}`, @@ -116,7 +127,9 @@ export class OutpostListPage extends TablePage { ${t`Update`} ${t`Update Outpost`} - + `, ]; } diff --git a/web/src/pages/outposts/ServiceConnectionListPage.ts b/web/src/pages/outposts/ServiceConnectionListPage.ts index ee5d6820f..bf3cb83f1 100644 --- a/web/src/pages/outposts/ServiceConnectionListPage.ts +++ b/web/src/pages/outposts/ServiceConnectionListPage.ts @@ -35,6 +35,8 @@ export class OutpostServiceConnectionListPage extends TablePage> { return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllList({ ordering: this.order, @@ -50,7 +52,7 @@ export class OutpostServiceConnectionListPage extends TablePage`, )}`, html` - ${t`Update`} - ${t`Update ${item.verboseName}`} - - - - - { - return new OutpostsApi( - DEFAULT_CONFIG, - ).outpostsServiceConnectionsAllUsedByList({ - uuid: item.pk, - }); - }} - .delete=${() => { - return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllDestroy( - { - uuid: item.pk, - }, - ); + ${t`Update`} + ${t`Update ${item.verboseName}`} + - - `, + + + `, ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllUsedByList({ + uuid: item.pk, + }); + }} + .delete=${() => { + return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllDestroy({ + uuid: item.pk, + }); + }} + > + + `; + } + renderToolbar(): TemplateResult { return html` + `; + } + row(item: PolicyBinding): TemplateResult[] { return [ html`${this.getPolicyUserGroupRow(item)}`, @@ -113,25 +138,7 @@ export class BoundPoliciesList extends Table { - - { - return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsUsedByList({ - policyBindingUuid: item.pk, - }); - }} - .delete=${() => { - return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsDestroy({ - policyBindingUuid: item.pk, - }); - }} - > - - `, + `, ]; } diff --git a/web/src/pages/policies/PolicyListPage.ts b/web/src/pages/policies/PolicyListPage.ts index c54009301..2ddcb5aaf 100644 --- a/web/src/pages/policies/PolicyListPage.ts +++ b/web/src/pages/policies/PolicyListPage.ts @@ -39,6 +39,8 @@ export class PolicyListPage extends TablePage { return "pf-icon pf-icon-infrastructure"; } + checkbox = true; + @property() order = "name"; @@ -97,7 +99,6 @@ export class PolicyListPage extends TablePage { } renderToolbarSelected(): TemplateResult { - // TODO: bulk delete const disabled = this.selectedElements.length !== 1; const item = this.selectedElements[0]; return html` { @property() order = "ip"; + checkbox = true; + apiEndpoint(page: number): Promise> { return new PoliciesApi(DEFAULT_CONFIG).policiesReputationIpsList({ ordering: this.order, @@ -43,30 +45,34 @@ export class IPReputationListPage extends TablePage { return [ new TableColumn(t`IP`, "ip"), new TableColumn(t`Score`, "score"), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new PoliciesApi(DEFAULT_CONFIG).policiesReputationIpsUsedByList({ + id: item.pk, + }); + }} + .delete=${() => { + return new PoliciesApi(DEFAULT_CONFIG).policiesReputationIpsDestroy({ + id: item.pk, + }); + }} + > + + `; + } + row(item: IPReputation): TemplateResult[] { - return [ - html`${item.ip}`, - html`${item.score}`, - html` { - return new PoliciesApi(DEFAULT_CONFIG).policiesReputationIpsUsedByList({ - id: item.pk, - }); - }} - .delete=${() => { - return new PoliciesApi(DEFAULT_CONFIG).policiesReputationIpsDestroy({ - id: item.pk, - }); - }} - > - - `, - ]; + return [html`${item.ip}`, html`${item.score}`]; } } diff --git a/web/src/pages/policies/reputation/UserReputationListPage.ts b/web/src/pages/policies/reputation/UserReputationListPage.ts index 4ab207c5b..e3545116f 100644 --- a/web/src/pages/policies/reputation/UserReputationListPage.ts +++ b/web/src/pages/policies/reputation/UserReputationListPage.ts @@ -27,6 +27,8 @@ export class UserReputationListPage extends TablePage { return "fa fa-ban"; } + checkbox = true; + @property() order = "username"; @@ -40,33 +42,33 @@ export class UserReputationListPage extends TablePage { } columns(): TableColumn[] { - return [ - new TableColumn(t`Username`, "username"), - new TableColumn(t`Score`, "score"), - new TableColumn("Actions"), - ]; + return [new TableColumn(t`Username`, "username"), new TableColumn(t`Score`, "score")]; + } + + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUsersUsedByList({ + id: item.pk, + }); + }} + .delete=${() => { + return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUsersDestroy({ + id: item.pk, + }); + }} + > + + `; } row(item: UserReputation): TemplateResult[] { - return [ - html`${item.username}`, - html`${item.score}`, - html` { - return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUsersUsedByList({ - id: item.pk, - }); - }} - .delete=${() => { - return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUsersDestroy({ - id: item.pk, - }); - }} - > - - `, - ]; + return [html`${item.username}`, html`${item.score}`]; } } diff --git a/web/src/pages/property-mappings/PropertyMappingListPage.ts b/web/src/pages/property-mappings/PropertyMappingListPage.ts index 303e23ab5..7c8fa67dc 100644 --- a/web/src/pages/property-mappings/PropertyMappingListPage.ts +++ b/web/src/pages/property-mappings/PropertyMappingListPage.ts @@ -34,6 +34,8 @@ export class PropertyMappingListPage extends TablePage { return "pf-icon pf-icon-blueprint"; } + checkbox = true; + @property() order = "name"; @@ -54,10 +56,33 @@ export class PropertyMappingListPage extends TablePage { return [ new TableColumn(t`Name`, "name"), new TableColumn(t`Type`, "type"), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllUsedByList({ + pmUuid: item.pk, + }); + }} + .delete=${() => { + return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllDestroy({ + pmUuid: item.pk, + }); + }} + > + + `; + } + row(item: PropertyMapping): TemplateResult[] { return [ html`${item.name}`, @@ -73,7 +98,9 @@ export class PropertyMappingListPage extends TablePage { type=${ifDefined(item.component)} > - + ${t`Test`} @@ -81,25 +108,7 @@ export class PropertyMappingListPage extends TablePage { - - { - return new PropertymappingsApi( - DEFAULT_CONFIG, - ).propertymappingsAllUsedByList({ - pmUuid: item.pk, - }); - }} - .delete=${() => { - return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllDestroy({ - pmUuid: item.pk, - }); - }} - > - - `, + `, ]; } diff --git a/web/src/pages/providers/ProviderListPage.ts b/web/src/pages/providers/ProviderListPage.ts index 72888711a..fd0ce353d 100644 --- a/web/src/pages/providers/ProviderListPage.ts +++ b/web/src/pages/providers/ProviderListPage.ts @@ -35,6 +35,8 @@ export class ProviderListPage extends TablePage { return "pf-icon pf-icon-integration"; } + checkbox = true; + @property() order = "name"; @@ -52,10 +54,33 @@ export class ProviderListPage extends TablePage { new TableColumn(t`Name`, "name"), new TableColumn(t`Application`), new TableColumn(t`Type`), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new ProvidersApi(DEFAULT_CONFIG).providersAllUsedByList({ + id: item.pk, + }); + }} + .delete=${() => { + return new ProvidersApi(DEFAULT_CONFIG).providersAllDestroy({ + id: item.pk, + }); + }} + > + + `; + } + row(item: Provider): TemplateResult[] { return [ html` ${item.name} `, @@ -69,34 +94,20 @@ export class ProviderListPage extends TablePage { ${t`Warning: Provider not assigned to any application.`}`, html`${item.verboseName}`, html` - ${t`Update`} - ${t`Update ${item.verboseName}`} - - - - - { - return new ProvidersApi(DEFAULT_CONFIG).providersAllUsedByList({ - id: item.pk, - }); - }} - .delete=${() => { - return new ProvidersApi(DEFAULT_CONFIG).providersAllDestroy({ - id: item.pk, - }); + ${t`Update`} + ${t`Update ${item.verboseName}`} + - - `, + + + `, ]; } diff --git a/web/src/pages/sources/SourcesListPage.ts b/web/src/pages/sources/SourcesListPage.ts index 3233e1e0f..a2b6ed80f 100644 --- a/web/src/pages/sources/SourcesListPage.ts +++ b/web/src/pages/sources/SourcesListPage.ts @@ -34,6 +34,8 @@ export class SourceListPage extends TablePage { return true; } + checkbox = true; + @property() order = "name"; @@ -50,6 +52,29 @@ export class SourceListPage extends TablePage { return [new TableColumn(t`Name`, "name"), new TableColumn(t`Type`), new TableColumn("")]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new SourcesApi(DEFAULT_CONFIG).sourcesAllUsedByList({ + slug: item.slug, + }); + }} + .delete=${() => { + return new SourcesApi(DEFAULT_CONFIG).sourcesAllDestroy({ + slug: item.slug, + }); + }} + > + + `; + } + row(item: Source): TemplateResult[] { if (item.component === "") { return this.rowInbuilt(item); @@ -61,34 +86,20 @@ export class SourceListPage extends TablePage { `, html`${item.verboseName}`, html` - ${t`Update`} - ${t`Update ${item.verboseName}`} - - - - - { - return new SourcesApi(DEFAULT_CONFIG).sourcesAllUsedByList({ - slug: item.slug, - }); - }} - .delete=${() => { - return new SourcesApi(DEFAULT_CONFIG).sourcesAllDestroy({ - slug: item.slug, - }); + ${t`Update`} + ${t`Update ${item.verboseName}`} + - - `, + + + `, ]; } diff --git a/web/src/pages/stages/StageListPage.ts b/web/src/pages/stages/StageListPage.ts index e74cb23f6..50a76cf9a 100644 --- a/web/src/pages/stages/StageListPage.ts +++ b/web/src/pages/stages/StageListPage.ts @@ -49,6 +49,8 @@ export class StageListPage extends TablePage { return true; } + checkbox = true; + @property() order = "name"; @@ -62,7 +64,34 @@ export class StageListPage extends TablePage { } columns(): TableColumn[] { - return [new TableColumn(t`Name`, "name"), new TableColumn(t`Flows`), new TableColumn("")]; + return [ + new TableColumn(t`Name`, "name"), + new TableColumn(t`Flows`), + new TableColumn(t`Actions`), + ]; + } + + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new StagesApi(DEFAULT_CONFIG).stagesAllUsedByList({ + stageUuid: item.pk, + }); + }} + .delete=${() => { + return new StagesApi(DEFAULT_CONFIG).stagesAllDestroy({ + stageUuid: item.pk, + }); + }} + > + + `; } row(item: Stage): TemplateResult[] { @@ -77,34 +106,20 @@ export class StageListPage extends TablePage { `; })}`, html` - ${t`Update`} - ${t`Update ${item.verboseName}`} - - - - - { - return new StagesApi(DEFAULT_CONFIG).stagesAllUsedByList({ - stageUuid: item.pk, - }); - }} - .delete=${() => { - return new StagesApi(DEFAULT_CONFIG).stagesAllDestroy({ - stageUuid: item.pk, - }); + ${t`Update`} + ${t`Update ${item.verboseName}`} + - - `, + + + `, ]; } diff --git a/web/src/pages/stages/invitation/InvitationListPage.ts b/web/src/pages/stages/invitation/InvitationListPage.ts index 8dce7bd09..1fbf8e9a0 100644 --- a/web/src/pages/stages/invitation/InvitationListPage.ts +++ b/web/src/pages/stages/invitation/InvitationListPage.ts @@ -31,6 +31,8 @@ export class InvitationListPage extends TablePage { return "pf-icon pf-icon-migration"; } + checkbox = true; + @property() order = "expires"; @@ -48,31 +50,37 @@ export class InvitationListPage extends TablePage { new TableColumn(t`ID`, "pk"), new TableColumn(t`Created by`, "created_by"), new TableColumn(t`Expiry`), - new TableColumn("Actions"), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsUsedByList({ + inviteUuid: item.pk, + }); + }} + .delete=${() => { + return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsDestroy({ + inviteUuid: item.pk, + }); + }} + > + + `; + } + row(item: Invitation): TemplateResult[] { return [ html`${item.pk}`, html`${item.createdBy?.username}`, html`${item.expires?.toLocaleString() || "-"}`, - html` { - return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsUsedByList({ - inviteUuid: item.pk, - }); - }} - .delete=${() => { - return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsDestroy({ - inviteUuid: item.pk, - }); - }} - > - - `, ]; } diff --git a/web/src/pages/stages/prompt/PromptListPage.ts b/web/src/pages/stages/prompt/PromptListPage.ts index 82a7b3fb7..abe2f0400 100644 --- a/web/src/pages/stages/prompt/PromptListPage.ts +++ b/web/src/pages/stages/prompt/PromptListPage.ts @@ -28,6 +28,8 @@ export class PromptListPage extends TablePage { return "pf-icon pf-icon-plugged"; } + checkbox = true; + @property() order = "order"; @@ -47,10 +49,33 @@ export class PromptListPage extends TablePage { new TableColumn(t`Type`, "type"), new TableColumn(t`Order`, "order"), new TableColumn(t`Stages`), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new StagesApi(DEFAULT_CONFIG).stagesPromptPromptsUsedByList({ + promptUuid: item.pk, + }); + }} + .delete=${() => { + return new StagesApi(DEFAULT_CONFIG).stagesPromptPromptsDestroy({ + promptUuid: item.pk, + }); + }} + > + + `; + } + row(item: Prompt): TemplateResult[] { return [ html`${item.fieldKey}`, @@ -61,27 +86,13 @@ export class PromptListPage extends TablePage { return html`
  • ${stage.name}
  • `; })}`, html` - ${t`Update`} - ${t`Update Prompt`} - - - - { - return new StagesApi(DEFAULT_CONFIG).stagesPromptPromptsUsedByList({ - promptUuid: item.pk, - }); - }} - .delete=${() => { - return new StagesApi(DEFAULT_CONFIG).stagesPromptPromptsDestroy({ - promptUuid: item.pk, - }); - }} - > - - `, + ${t`Update`} + ${t`Update Prompt`} + + + `, ]; } diff --git a/web/src/pages/system-tasks/SystemTaskListPage.ts b/web/src/pages/system-tasks/SystemTaskListPage.ts index dfa88bf0d..da45200b5 100644 --- a/web/src/pages/system-tasks/SystemTaskListPage.ts +++ b/web/src/pages/system-tasks/SystemTaskListPage.ts @@ -56,7 +56,7 @@ export class SystemTaskListPage extends TablePage { new TableColumn(t`Description`), new TableColumn(t`Last run`), new TableColumn(t`Status`), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } diff --git a/web/src/pages/tenants/TenantListPage.ts b/web/src/pages/tenants/TenantListPage.ts index 6d03d8e73..bf1b5069e 100644 --- a/web/src/pages/tenants/TenantListPage.ts +++ b/web/src/pages/tenants/TenantListPage.ts @@ -27,6 +27,8 @@ export class TenantListPage extends TablePage { return "pf-icon pf-icon-tenant"; } + checkbox = true; + @property() order = "domain"; @@ -43,36 +45,45 @@ export class TenantListPage extends TablePage { return [ new TableColumn(t`Domain`, "domain"), new TableColumn(t`Default?`, "default"), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new CoreApi(DEFAULT_CONFIG).coreTenantsUsedByList({ + tenantUuid: item.tenantUuid, + }); + }} + .delete=${() => { + return new CoreApi(DEFAULT_CONFIG).coreTenantsDestroy({ + tenantUuid: item.tenantUuid, + }); + }} + > + + `; + } + row(item: Tenant): TemplateResult[] { return [ html`${item.domain}`, html`${item._default ? t`Yes` : t`No`}`, html` - ${t`Update`} - ${t`Update Tenant`} - - - - { - return new CoreApi(DEFAULT_CONFIG).coreTenantsUsedByList({ - tenantUuid: item.tenantUuid, - }); - }} - .delete=${() => { - return new CoreApi(DEFAULT_CONFIG).coreTenantsDestroy({ - tenantUuid: item.tenantUuid, - }); - }} - > - - `, + ${t`Update`} + ${t`Update Tenant`} + + + `, ]; } diff --git a/web/src/pages/tokens/TokenListPage.ts b/web/src/pages/tokens/TokenListPage.ts index 6b50d90e2..6277ab2ad 100644 --- a/web/src/pages/tokens/TokenListPage.ts +++ b/web/src/pages/tokens/TokenListPage.ts @@ -26,6 +26,8 @@ export class TokenListPage extends TablePage { return "pf-icon pf-icon-security"; } + checkbox = true; + @property() order = "expires"; @@ -44,10 +46,33 @@ export class TokenListPage extends TablePage { new TableColumn(t`User`, "user"), new TableColumn(t`Expires?`, "expiring"), new TableColumn(t`Expiry date`, "expires"), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new CoreApi(DEFAULT_CONFIG).coreTokensUsedByList({ + identifier: item.identifier, + }); + }} + .delete=${() => { + return new CoreApi(DEFAULT_CONFIG).coreTokensDestroy({ + identifier: item.identifier, + }); + }} + > + + `; + } + row(item: Token): TemplateResult[] { return [ html`${item.identifier}`, @@ -55,22 +80,6 @@ export class TokenListPage extends TablePage { html`${item.expiring ? t`Yes` : t`No`}`, html`${item.expiring ? item.expires?.toLocaleString() : "-"}`, html` - { - return new CoreApi(DEFAULT_CONFIG).coreTokensUsedByList({ - identifier: item.identifier, - }); - }} - .delete=${() => { - return new CoreApi(DEFAULT_CONFIG).coreTokensDestroy({ - identifier: item.identifier, - }); - }} - > - - ${t`Copy Key`} diff --git a/web/src/pages/user-settings/tokens/UserTokenList.ts b/web/src/pages/user-settings/tokens/UserTokenList.ts index a84bc656c..168876ce1 100644 --- a/web/src/pages/user-settings/tokens/UserTokenList.ts +++ b/web/src/pages/user-settings/tokens/UserTokenList.ts @@ -21,6 +21,7 @@ export class UserTokenList extends Table { } expandable = true; + checkbox = true; @property() order = "expires"; @@ -94,6 +95,24 @@ export class UserTokenList extends Table { `; } + renderToolbarSelected(): TemplateResult { + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new CoreApi(DEFAULT_CONFIG).coreTokensDestroy({ + identifier: item.identifier, + }); + }} + > + + `; + } + row(item: Token): TemplateResult[] { return [ html`${item.identifier}`, @@ -103,19 +122,10 @@ export class UserTokenList extends Table { ${t`Update Token`} - + - { - return new CoreApi(DEFAULT_CONFIG).coreTokensDestroy({ - identifier: item.identifier, - }); - }} - > - - ${t`Copy Key`} diff --git a/web/src/pages/users/UserListPage.ts b/web/src/pages/users/UserListPage.ts index 149e4e7e0..9f40637f2 100644 --- a/web/src/pages/users/UserListPage.ts +++ b/web/src/pages/users/UserListPage.ts @@ -58,7 +58,7 @@ export class UserListPage extends TablePage { new TableColumn(t`Name`, "username"), new TableColumn(t`Active`, "active"), new TableColumn(t`Last login`, "last_login"), - new TableColumn("Actions"), + new TableColumn(t`Actions`), ]; }