From cf0a76ce710c81bf8dd73d180de90e240e2d8f26 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Tue, 21 Nov 2023 12:35:43 +0000 Subject: [PATCH] Add hidePoweredByOneUptimeBranding feature --- CommonServer/API/StatusPageAPI.ts | 1 + .../StatusPages/View/StatusPageSettings.tsx | 40 ++++++++++++++++++- Model/Models/StatusPage.ts | 39 ++++++++++++++++++ StatusPage/src/Components/Footer/Footer.tsx | 24 +++++++---- .../src/Components/MasterPage/MasterPage.tsx | 13 ++++++ 5 files changed, 108 insertions(+), 9 deletions(-) diff --git a/CommonServer/API/StatusPageAPI.ts b/CommonServer/API/StatusPageAPI.ts index 09792b6923..449a01aa1f 100644 --- a/CommonServer/API/StatusPageAPI.ts +++ b/CommonServer/API/StatusPageAPI.ts @@ -231,6 +231,7 @@ export default class StatusPageAPI extends BaseAPI< copyrightText: true, customCSS: true, customJavaScript: true, + hidePoweredByOneUptimeBranding: true, headerHTML: true, footerHTML: true, enableSubscribers: true, diff --git a/Dashboard/src/Pages/StatusPages/View/StatusPageSettings.tsx b/Dashboard/src/Pages/StatusPages/View/StatusPageSettings.tsx index 2a63aedb58..481b647b0e 100644 --- a/Dashboard/src/Pages/StatusPages/View/StatusPageSettings.tsx +++ b/Dashboard/src/Pages/StatusPages/View/StatusPageSettings.tsx @@ -49,7 +49,7 @@ const StatusPageDelete: FunctionComponent = ( title: 'Settings', to: RouteUtil.populateRouteParams( RouteMap[ - PageMap.STATUS_PAGE_VIEW_AUTHENTICATION_SETTINGS + PageMap.STATUS_PAGE_VIEW_AUTHENTICATION_SETTINGS ] as Route, { modelId } ), @@ -196,6 +196,44 @@ const StatusPageDelete: FunctionComponent = ( modelId: modelId, }} /> + + + name="Status Page > Settings" + cardProps={{ + title: 'Powered By OneUptime Branding', + description: 'Show or hide the Powered By OneUptime Branding', + }} + editButtonText="Edit Settings" + isEditable={true} + formFields={[ + { + field: { + hidePoweredByOneUptimeBranding: true, + }, + title: 'Hide Powered By OneUptime Branding', + fieldType: FormFieldSchemaType.Toggle, + required: false, + placeholder: 'No', + } + ]} + modelDetailProps={{ + showDetailsInNumberOfColumns: 1, + modelType: StatusPage, + id: 'model-detail-status-page', + fields: [ + { + field: { + hidePoweredByOneUptimeBranding: true, + }, + fieldType: FieldType.Boolean, + title: 'Hide Powered By OneUptime Branding', + } + ], + modelId: modelId, + }} + /> + + ); }; diff --git a/Model/Models/StatusPage.ts b/Model/Models/StatusPage.ts index fcb59613b5..58474b2f3c 100755 --- a/Model/Models/StatusPage.ts +++ b/Model/Models/StatusPage.ts @@ -1338,4 +1338,43 @@ export default class StatusPage extends BaseModel { nullable: true, }) public overviewPageDescription?: string = undefined; + + + @ColumnAccessControl({ + create: [ + Permission.ProjectOwner, + Permission.ProjectAdmin, + Permission.ProjectMember, + Permission.CanCreateProjectStatusPage, + ], + read: [ + Permission.ProjectOwner, + Permission.ProjectAdmin, + Permission.ProjectMember, + Permission.CanReadProjectStatusPage, + ], + update: [ + Permission.ProjectOwner, + Permission.ProjectAdmin, + Permission.ProjectMember, + Permission.CanEditProjectStatusPage, + ], + }) + @TableColumn({ + isDefaultValueColumn: true, + type: TableColumnType.Boolean, + title: 'Hide Powered By OneUptime Branding', + description: 'Hide Powered By OneUptime Branding?', + }) + @Column({ + type: ColumnType.Boolean, + default: false, + }) + @ColumnBillingAccessControl({ + read: PlanSelect.Free, + update: PlanSelect.Scale, + create: PlanSelect.Free, + }) + public hidePoweredByOneUptimeBranding?: boolean = undefined; + } diff --git a/StatusPage/src/Components/Footer/Footer.tsx b/StatusPage/src/Components/Footer/Footer.tsx index eecec7f6fb..df99e6cda0 100644 --- a/StatusPage/src/Components/Footer/Footer.tsx +++ b/StatusPage/src/Components/Footer/Footer.tsx @@ -7,23 +7,31 @@ export interface ComponentProps { copyright?: string | undefined; links: Array; className?: string | undefined; + hidePoweredByOneUptimeBranding?: boolean | undefined; } const StatusPageFooter: FunctionComponent = ( props: ComponentProps ): ReactElement => { + + const links = [ + ...props.links, + + ]; + + if (!props.hidePoweredByOneUptimeBranding) { + links.push({ + title: 'Powered by OneUptime', + to: URL.fromString('https://oneuptime.com'), + openInNewTab: true, + }); + } + return (