From ddd5047cc3310bba3eb5983e493349564c00059a Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 5 Aug 2021 10:40:44 +0200 Subject: [PATCH] web: better label table actions Signed-off-by: Jens Langhammer --- web/package-lock.json | 8 ++- web/src/authentik.css | 12 ---- web/src/elements/oauth/UserCodeList.ts | 2 +- web/src/elements/oauth/UserRefreshList.ts | 2 +- web/src/elements/table/Table.ts | 6 +- web/src/elements/user/SessionList.ts | 2 +- web/src/elements/user/UserConsentList.ts | 2 +- .../pages/applications/ApplicationListPage.ts | 2 +- .../crypto/CertificateKeyPairListPage.ts | 2 +- web/src/pages/events/EventListPage.ts | 2 +- web/src/pages/events/RuleListPage.ts | 2 +- web/src/pages/events/TransportListPage.ts | 2 +- web/src/pages/flows/BoundStagesList.ts | 2 +- web/src/pages/flows/FlowListPage.ts | 2 +- web/src/pages/groups/GroupListPage.ts | 2 +- web/src/pages/outposts/OutpostListPage.ts | 2 +- .../outposts/ServiceConnectionListPage.ts | 2 +- web/src/pages/policies/BoundPoliciesList.ts | 2 +- web/src/pages/policies/PolicyListPage.ts | 61 +++++++++++++------ .../reputation/IPReputationListPage.ts | 2 +- .../reputation/UserReputationListPage.ts | 2 +- .../PropertyMappingListPage.ts | 2 +- web/src/pages/providers/ProviderListPage.ts | 2 +- .../stages/invitation/InvitationListPage.ts | 2 +- web/src/pages/stages/prompt/PromptListPage.ts | 2 +- .../pages/system-tasks/SystemTaskListPage.ts | 2 +- web/src/pages/tenants/TenantListPage.ts | 2 +- web/src/pages/tokens/TokenListPage.ts | 2 +- web/src/pages/users/UserListPage.ts | 2 +- 29 files changed, 76 insertions(+), 61 deletions(-) diff --git a/web/package-lock.json b/web/package-lock.json index fc1641e2c..e49762839 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -67,8 +67,8 @@ }, "api": { "name": "authentik-api", - "version": "0.0.1", - "dependencies": { + "version": "1.0.0", + "devDependencies": { "typescript": "^3.9.5" } }, @@ -76,6 +76,7 @@ "version": "3.9.9", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.9.tgz", "integrity": "sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==", + "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -10230,7 +10231,8 @@ "typescript": { "version": "3.9.9", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.9.tgz", - "integrity": "sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==" + "integrity": "sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==", + "dev": true } } }, diff --git a/web/src/authentik.css b/web/src/authentik.css index 6c5cb5a8a..44cff458e 100644 --- a/web/src/authentik.css +++ b/web/src/authentik.css @@ -76,24 +76,12 @@ html > form > input { .pf-m-success { color: var(--pf-global--success-color--100); } -.pf-c-button.pf-m-success { - color: var(--pf-c-button--m-primary--Color); - background-color: var(--pf-global--success-color--100); -} .pf-m-warning { color: var(--pf-global--warning-color--100); } -.pf-c-button.pf-m-warning { - color: var(--pf-c-button--m-primary--Color); - background-color: var(--pf-global--warning-color--100); -} .pf-m-danger { color: var(--pf-global--danger-color--100); } -.pf-c-button.pf-m-danger { - color: var(--pf-c-button--m-primary--Color); - background-color: var(--pf-global--danger-color--100); -} body { background-color: var(--ak-dark-background) !important; diff --git a/web/src/elements/oauth/UserCodeList.ts b/web/src/elements/oauth/UserCodeList.ts index dbe79ce1c..b732b19ac 100644 --- a/web/src/elements/oauth/UserCodeList.ts +++ b/web/src/elements/oauth/UserCodeList.ts @@ -29,7 +29,7 @@ export class UserOAuthCodeList extends Table { new TableColumn(t`Provider`, "provider"), new TableColumn(t`Expires`, "expires"), new TableColumn(t`Scopes`, "scope"), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/elements/oauth/UserRefreshList.ts b/web/src/elements/oauth/UserRefreshList.ts index 1777e60fd..432f3f917 100644 --- a/web/src/elements/oauth/UserRefreshList.ts +++ b/web/src/elements/oauth/UserRefreshList.ts @@ -37,7 +37,7 @@ export class UserOAuthRefreshList extends Table { new TableColumn(t`Revoked?`, "revoked"), new TableColumn(t`Expires`, "expires"), new TableColumn(t`Scopes`, "scope"), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/elements/table/Table.ts b/web/src/elements/table/Table.ts index 79aeab2a5..2afe4a859 100644 --- a/web/src/elements/table/Table.ts +++ b/web/src/elements/table/Table.ts @@ -279,6 +279,10 @@ export abstract class Table extends LitElement { `; } + renderToolbarSelected(): TemplateResult { + return html``; + } + renderToolbarAfter(): TemplateResult { return html``; } @@ -322,7 +326,7 @@ export abstract class Table extends LitElement { : html``}
- ${this.renderSearch()} + ${this.renderToolbarSelected()}   ${this.renderSearch()}
${this.renderToolbar()}
${this.renderToolbarAfter()} { new TableColumn(t`Browser`, "user_agent"), new TableColumn(t`Device`, "user_agent"), new TableColumn(t`Expires`, "expires"), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/elements/user/UserConsentList.ts b/web/src/elements/user/UserConsentList.ts index 40f5ae84a..4302026d5 100644 --- a/web/src/elements/user/UserConsentList.ts +++ b/web/src/elements/user/UserConsentList.ts @@ -28,7 +28,7 @@ export class UserConsentList extends Table { return [ new TableColumn(t`Application`, "application"), new TableColumn(t`Expires`, "expires"), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/pages/applications/ApplicationListPage.ts b/web/src/pages/applications/ApplicationListPage.ts index 3d086c379..bc5c49d7d 100644 --- a/web/src/pages/applications/ApplicationListPage.ts +++ b/web/src/pages/applications/ApplicationListPage.ts @@ -62,7 +62,7 @@ export class ApplicationListPage extends TablePage { new TableColumn(t`Slug`, "slug"), new TableColumn(t`Provider`), new TableColumn(t`Provider Type`), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/pages/crypto/CertificateKeyPairListPage.ts b/web/src/pages/crypto/CertificateKeyPairListPage.ts index 18bb91c1e..49a14342d 100644 --- a/web/src/pages/crypto/CertificateKeyPairListPage.ts +++ b/web/src/pages/crypto/CertificateKeyPairListPage.ts @@ -53,7 +53,7 @@ export class CertificateKeyPairListPage extends TablePage { new TableColumn(t`Name`, "name"), new TableColumn(t`Private key available?`), new TableColumn(t`Expiry date`), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/pages/events/EventListPage.ts b/web/src/pages/events/EventListPage.ts index d96ccb4ff..24ea3ca8e 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(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/pages/events/RuleListPage.ts b/web/src/pages/events/RuleListPage.ts index 1bbef9ddb..74595dc56 100644 --- a/web/src/pages/events/RuleListPage.ts +++ b/web/src/pages/events/RuleListPage.ts @@ -47,7 +47,7 @@ export class RuleListPage extends TablePage { new TableColumn(t`Name`, "name"), new TableColumn(t`Severity`, "severity"), new TableColumn(t`Sent to group`, "group"), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/pages/events/TransportListPage.ts b/web/src/pages/events/TransportListPage.ts index cf5cb7442..b1e4c7d98 100644 --- a/web/src/pages/events/TransportListPage.ts +++ b/web/src/pages/events/TransportListPage.ts @@ -44,7 +44,7 @@ export class TransportListPage extends TablePage { return [ new TableColumn(t`Name`, "name"), new TableColumn(t`Mode`, "mode"), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/pages/flows/BoundStagesList.ts b/web/src/pages/flows/BoundStagesList.ts index 3c812c780..97bf14afe 100644 --- a/web/src/pages/flows/BoundStagesList.ts +++ b/web/src/pages/flows/BoundStagesList.ts @@ -38,7 +38,7 @@ export class BoundStagesList extends Table { new TableColumn(t`Order`), new TableColumn(t`Name`), new TableColumn(t`Type`), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/pages/flows/FlowListPage.ts b/web/src/pages/flows/FlowListPage.ts index 9467f7cbf..9ea55d7cb 100644 --- a/web/src/pages/flows/FlowListPage.ts +++ b/web/src/pages/flows/FlowListPage.ts @@ -48,7 +48,7 @@ export class FlowListPage extends TablePage { new TableColumn(t`Designation`, "designation"), new TableColumn(t`Stages`), new TableColumn(t`Policies`), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/pages/groups/GroupListPage.ts b/web/src/pages/groups/GroupListPage.ts index de620ab24..220063bfa 100644 --- a/web/src/pages/groups/GroupListPage.ts +++ b/web/src/pages/groups/GroupListPage.ts @@ -45,7 +45,7 @@ export class GroupListPage extends TablePage { new TableColumn(t`Parent`, "parent"), new TableColumn(t`Members`), new TableColumn(t`Superuser privileges?`), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/pages/outposts/OutpostListPage.ts b/web/src/pages/outposts/OutpostListPage.ts index 9aacdebb8..cabdd1281 100644 --- a/web/src/pages/outposts/OutpostListPage.ts +++ b/web/src/pages/outposts/OutpostListPage.ts @@ -45,7 +45,7 @@ export class OutpostListPage extends TablePage { new TableColumn(t`Providers`), new TableColumn(t`Integration`, "service_connection__name"), new TableColumn(t`Health and Version`), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/pages/outposts/ServiceConnectionListPage.ts b/web/src/pages/outposts/ServiceConnectionListPage.ts index b90f7bfa5..ee5d6820f 100644 --- a/web/src/pages/outposts/ServiceConnectionListPage.ts +++ b/web/src/pages/outposts/ServiceConnectionListPage.ts @@ -50,7 +50,7 @@ export class OutpostServiceConnectionListPage extends TablePage { new TableColumn(t`Enabled`, "enabled"), new TableColumn(t`Order`, "order"), new TableColumn(t`Timeout`, "timeout"), - new TableColumn(""), + new TableColumn("Actions"), ]; } diff --git a/web/src/pages/policies/PolicyListPage.ts b/web/src/pages/policies/PolicyListPage.ts index d60befee8..c54009301 100644 --- a/web/src/pages/policies/PolicyListPage.ts +++ b/web/src/pages/policies/PolicyListPage.ts @@ -52,7 +52,11 @@ export class PolicyListPage extends TablePage { } columns(): TableColumn[] { - return [new TableColumn(t`Name`, "name"), new TableColumn(t`Type`), new TableColumn("")]; + return [ + new TableColumn(t`Name`, "name"), + new TableColumn(t`Type`), + new TableColumn(t`Actions`), + ]; } row(item: Policy): TemplateResult[] { @@ -77,33 +81,50 @@ export class PolicyListPage extends TablePage { type=${ifDefined(item.component)} > - + ${t`Test`} ${t`Test Policy`} - - - { - return new PoliciesApi(DEFAULT_CONFIG).policiesAllUsedByList({ - policyUuid: item.pk, - }); - }} - .delete=${() => { - return new PoliciesApi(DEFAULT_CONFIG).policiesAllDestroy({ - policyUuid: item.pk, - }); - }} - > - - `, + + `, ]; } + renderToolbarSelected(): TemplateResult { + // TODO: bulk delete + const disabled = this.selectedElements.length !== 1; + const item = this.selectedElements[0]; + return html` { + return new PoliciesApi(DEFAULT_CONFIG).policiesAllUsedByList({ + policyUuid: item.pk, + }); + }} + .delete=${() => { + return new PoliciesApi(DEFAULT_CONFIG).policiesAllDestroy({ + policyUuid: item.pk, + }); + }} + > + + `; + } + renderToolbar(): TemplateResult { return html`