Skip to content

Commit

Permalink
feat: add commit has in page header
Browse files Browse the repository at this point in the history
Within the header there will now be a shorthash visible that links to
packit/dashboard page

Part of packit#209
  • Loading branch information
Venefilyn committed Mar 4, 2023
1 parent 4dbb04d commit ae3fa57
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ TEST_IMAGE ?= packit-dashboard-tests
TEST_TARGET ?= ./tests/
CONTAINER_ENGINE ?= $(shell command -v podman 2> /dev/null || echo docker)
API_STG = "https://stg.packit.dev/api"
GIT_SHA_FETCH := $(shell git rev-parse HEAD)
export GIT_SHA=$(GIT_SHA_FETCH)

install-dependencies: .install-logos
sudo dnf -y install python3-flask yarnpkg npm
Expand All @@ -17,7 +19,7 @@ install-dependencies: .install-logos

# this will transpile jsx into js, minify everything and generate static js for production builds
transpile-prod:
cd frontend && REACT_APP_API_URL=$(API_STG) yarn run build
cd frontend && REACT_APP_GIT_SHA=$(GIT_SHA) REACT_APP_API_URL=$(API_STG) yarn run build


# For Development Mode Only:
Expand All @@ -29,7 +31,7 @@ transpile-prod:
# if you change flask port for dev, also change it in frontend/package.json in the proxy key/value

run-dev-frontend:
cd frontend && REACT_APP_API_URL=$(API_STG) GENERATE_SOURCEMAP=true HTTPS=true yarn start
cd frontend && REACT_APP_GIT_SHA=$(GIT_SHA) REACT_APP_API_URL=$(API_STG) GENERATE_SOURCEMAP=true HTTPS=true yarn start

run-dev-flask:
FLASK_ENV=development FLASK_APP=packit_dashboard.app flask-3 run --host=0.0.0.0
Expand Down
1 change: 1 addition & 0 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Dashboard for Packit Service." />
<meta name="ui-version" content="%REACT_APP_GIT_SHA%" />
<style>
html,
body,
Expand Down
21 changes: 21 additions & 0 deletions frontend/src/components/app_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import {
NavList,
NavItem,
Page,
PageHeaderTools,
PageHeader,
PageSidebar,
Button,
SkipToContent,
} from "@patternfly/react-core";
import { routes } from "../routes";
import packitLogo from "../static/logo.png";
import { ExternalLinkSquareAltIcon } from "@patternfly/react-icons";

const AppLayout = ({ children }) => {
const logoProps = {
Expand All @@ -29,13 +32,31 @@ const AppLayout = ({ children }) => {
const onPageResize = (props) => {
setIsMobileView(props.mobileView);
};

const HeaderTools = (
<PageHeaderTools>
<Button
component="a"
href={`https://github.com/packit/dashboard/commit/${process.env.REACT_APP_GIT_SHA}`}
target="_blank"
rel="noreferrer"
variant="link"
icon={<ExternalLinkSquareAltIcon />}
iconPosition="right"
aria-label="External link to page source commit"
>
{process.env.REACT_APP_GIT_SHA.substring(0, 7)}
</Button>
</PageHeaderTools>
);
const Header = (
<PageHeader
logo={<Brand src={packitLogo} alt="Packit Logo" />}
logoProps={logoProps}
showNavToggle
isNavOpen={isNavOpen}
onNavToggle={isMobileView ? onNavToggleMobile : onNavToggle}
headerTools={HeaderTools}
/>
);

Expand Down

0 comments on commit ae3fa57

Please sign in to comment.