web: add TablePage
This commit is contained in:
51
web/src/pages/applications/ApplicationListPage.ts
Normal file
51
web/src/pages/applications/ApplicationListPage.ts
Normal file
@ -0,0 +1,51 @@
|
||||
import { customElement } from "lit-element";
|
||||
import { Application } from "../../api/application";
|
||||
import { PBResponse } from "../../api/client";
|
||||
import { TablePage } from "../../elements/table/TablePage";
|
||||
|
||||
@customElement("pb-application-list")
|
||||
export class ApplicationList extends TablePage<Application> {
|
||||
pageTitle(): string {
|
||||
return "Applications";
|
||||
}
|
||||
pageDescription(): string {
|
||||
return "External Applications which use passbook as Identity-Provider, utilizing protocols like OAuth2 and SAML.";
|
||||
}
|
||||
pageIcon(): string {
|
||||
return "pf-icon pf-icon-applications";
|
||||
}
|
||||
|
||||
apiEndpoint(page: number): Promise<PBResponse<Application>> {
|
||||
return Application.list({
|
||||
ordering: "order",
|
||||
page: page,
|
||||
});
|
||||
}
|
||||
|
||||
columns(): string[] {
|
||||
return ["Name", "Slug", "Provider", "Provider Type", ""];
|
||||
}
|
||||
|
||||
row(item: Application): string[] {
|
||||
return [
|
||||
item.name!,
|
||||
item.slug!,
|
||||
item.provider!.toString(),
|
||||
item.provider!.toString(),
|
||||
`
|
||||
<pb-modal-button href="administration/policies/bindings/${item.pk}/update/">
|
||||
<pb-spinner-button slot="trigger" class="pf-m-secondary">
|
||||
Edit
|
||||
</pb-spinner-button>
|
||||
<div slot="modal"></div>
|
||||
</pb-modal-button>
|
||||
<pb-modal-button href="administration/policies/bindings/${item.pk}/delete/">
|
||||
<pb-spinner-button slot="trigger" class="pf-m-danger">
|
||||
Delete
|
||||
</pb-spinner-button>
|
||||
<div slot="modal"></div>
|
||||
</pb-modal-button>
|
||||
`,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user