-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a new About modal in the UI (#3933)
* Added a new About modal in the UI (and revamped the masthead). * Refactored the auth components
- Loading branch information
1 parent
1d5cad2
commit 6ac5800
Showing
18 changed files
with
187 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
...-app/src/app/components/common/IfAuth.tsx → ui/ui-app/src/app/components/auth/IfAuth.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./ApplicationAuth.tsx"; | ||
export * from "./IfAuth.tsx"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { FunctionComponent } from "react"; | ||
import { AboutModal, TextContent, TextList, TextListItem } from "@patternfly/react-core"; | ||
import { VersionType } from "@services/version"; | ||
import { Services } from "@services/services.ts"; | ||
|
||
|
||
export type AppAboutModalProps = { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
}; | ||
|
||
|
||
export const AppAboutModal: FunctionComponent<AppAboutModalProps> = (props: AppAboutModalProps) => { | ||
const version: VersionType = Services.getVersionService().getVersion(); | ||
|
||
return ( | ||
<AboutModal | ||
isOpen={props.isOpen} | ||
onClose={props.onClose} | ||
trademark="© 2024 Red Hat" | ||
brandImageSrc="/apicurio_registry_icon_reverse.svg" | ||
brandImageAlt={version.name} | ||
productName={version.name} | ||
> | ||
<TextContent> | ||
<TextList component="dl"> | ||
<TextListItem component="dt">Project</TextListItem> | ||
<TextListItem component="dd"><a href={version.url} target="_blank">{ version.name }</a></TextListItem> | ||
|
||
<TextListItem component="dt">Version</TextListItem> | ||
<TextListItem component="dd">{ version.version }</TextListItem> | ||
|
||
<TextListItem component="dt">Built on</TextListItem> | ||
<TextListItem component="dd">{ "" + version.builtOn }</TextListItem> | ||
|
||
<TextListItem component="dt">Digest</TextListItem> | ||
<TextListItem component="dd">{ version.digest }</TextListItem> | ||
</TextList> | ||
</TextContent> | ||
</AboutModal> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { FunctionComponent, useState } from "react"; | ||
import { Button, Toolbar, ToolbarContent, ToolbarGroup, ToolbarItem } from "@patternfly/react-core"; | ||
import { QuestionCircleIcon } from "@patternfly/react-icons"; | ||
import { AvatarDropdown, IfAuth } from "@app/components"; | ||
import { AppAboutModal } from "@app/components/header/AppAboutModal.tsx"; | ||
|
||
|
||
export type AppHeaderToolbarProps = { | ||
// No properties. | ||
}; | ||
|
||
|
||
export const AppHeaderToolbar: FunctionComponent<AppHeaderToolbarProps> = () => { | ||
const [isAboutModalOpen, setIsAboutModalOpen] = useState(false); | ||
|
||
return ( | ||
<> | ||
<AppAboutModal isOpen={isAboutModalOpen} onClose={() => setIsAboutModalOpen(false)} /> | ||
<Toolbar id="app-header-toolbar" isFullHeight={true}> | ||
<ToolbarContent> | ||
<ToolbarGroup align={{ default: "alignRight" }}> | ||
<ToolbarItem> | ||
<Button variant="plain" onClick={() => setIsAboutModalOpen(!isAboutModalOpen)}> | ||
<QuestionCircleIcon style={{ fontSize: "16px" }} /> | ||
</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<IfAuth enabled={true}> | ||
<AvatarDropdown /> | ||
</IfAuth> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
</ToolbarContent> | ||
</Toolbar> | ||
</> | ||
); | ||
|
||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./AvatarDropdown"; | ||
export * from "./AppHeader.tsx"; | ||
export * from "./RootPageHeader.tsx"; | ||
export * from "./AppHeader"; | ||
export * from "./AppHeaderToolbar"; | ||
export * from "./RootPageHeader"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./version.service.ts"; | ||
export * from "./version.type.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { VersionType } from "@services/version/version.type.ts"; | ||
import { Service } from "@services/baseService.ts"; | ||
|
||
const DEFAULT_VERSION: VersionType = { | ||
name: "Apicurio Registry", | ||
version: "DEV", | ||
digest: "DEV", | ||
builtOn: new Date().toString(), | ||
url: "http://www.apicur.io/" | ||
}; | ||
|
||
|
||
export function getVersion(): VersionType { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
if (ApicurioInfo) { return ApicurioInfo as VersionType; } | ||
|
||
const gw: any = window as any; | ||
if (gw["ApicurioInfo"]) { | ||
return gw["ApicurioInfo"] as VersionType; | ||
} | ||
|
||
return DEFAULT_VERSION; | ||
} | ||
|
||
|
||
/** | ||
* A simple configuration service. Reads information from a global "ApicurioRegistryConfig" variable | ||
* that is typically included via JSONP. | ||
*/ | ||
export class VersionService implements Service { | ||
private version: VersionType; | ||
|
||
constructor() { | ||
this.version = getVersion(); | ||
} | ||
|
||
public init(): void { | ||
// Nothing to init (done in c'tor) | ||
} | ||
|
||
public updateConfig(version: VersionType): void { | ||
this.version = version; | ||
} | ||
|
||
public getVersion(): VersionType { | ||
return this.version; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
export interface VersionType { | ||
name: string; | ||
version: string; | ||
digest: string; | ||
builtOn: string; | ||
url: string; | ||
} |