Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Display version #779

Merged
merged 3 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ui/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
{
"ts": "never",
"tsx": "never",
"json": "never",
"js": "never",
"jsx": "never"
}
Expand Down
28 changes: 28 additions & 0 deletions ui/craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ const path = require("path");
const { loaderByName } = require("@craco/craco");
const CracoLessPlugin = require("craco-less");

const webpack = require("webpack");

const packageJson = require("./package.json");

const resolve = (dir) => path.resolve(__dirname, dir);

const currentTime = new Date();

module.exports = {
babel: {
plugins: [
Expand All @@ -22,6 +28,28 @@ module.exports = {
alias: {
"@": resolve("src"),
},
configure: (webpackConfig, { env, paths }) => {
const index = webpackConfig.plugins.findIndex(
(itme) => itme instanceof webpack.DefinePlugin
);

if (index > -1) {
const definePlugin = webpackConfig.plugins[index];
webpackConfig.plugins.splice(
index,
1,
new webpack.DefinePlugin({
"process.env": {
...definePlugin.definitions["process.env"],
FEATHR_VERSION: JSON.stringify(packageJson.version),
FEATHR_GENERATED_TIME: JSON.stringify(currentTime.toISOString()),
},
})
);
}

return webpackConfig;
},
},
plugins: [
{
Expand Down
8 changes: 6 additions & 2 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "feathr-ui",
"version": "0.1.0",
"version": "0.8.1",
Fendoe marked this conversation as resolved.
Show resolved Hide resolved
"private": true,
"dependencies": {
"@ant-design/icons": "^4.7.0",
Expand All @@ -21,7 +21,7 @@
"@craco/craco": "^7.0.0-alpha.8",
"@testing-library/jest-dom": "^5.16.3",
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^13.5.0",
"@testing-library/user-event": "^13.5.0",
"@types/dagre": "^0.7.47",
"@types/jest": "^27.5.0",
"@types/node": "^16.11.26",
Expand All @@ -42,7 +42,8 @@
"prettier": "2.7.1",
"react-scripts": "5.0.0",
"typescript": "^4.6.3",
"web-vitals": "^2.1.4"
"web-vitals": "^2.1.4",
"webpack": "^5.72.0"
},
"scripts": {
"start": "craco start",
Expand Down
66 changes: 37 additions & 29 deletions ui/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,48 +20,56 @@ import RoleManagement from "./pages/management/roleManagement";
import Home from "./pages/home/home";
import Projects from "./pages/project/projects";
import { getMsalConfig } from "./utils/utils";
import Footer from "@/components/footer";

const queryClient = new QueryClient();

const msalClient = getMsalConfig();

const App = () => {
return (
<MsalProvider instance={msalClient}>
<MsalAuthenticationTemplate interactionType={InteractionType.Redirect}>
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<Layout style={{ minHeight: "100vh" }}>
<Layout style={{ minHeight: "100vh", position: "relative" }}>
<SideMenu />
<Layout>
<Header />
<Routes>
<Route index element={<Home />} />
<Route path="/home" element={<Home />} />
<Route path="/projects" element={<Projects />} />
<Route path="/dataSources" element={<DataSources />} />
<Route path="/features" element={<Features />} />
<Route path="/new-feature" element={<NewFeature />} />
<Route
path="/projects/:project/features/:featureId"
element={<FeatureDetails />}
/>
<Route
path="/projects/:project/dataSources/:dataSourceId"
element={<DataSourceDetails />}
/>
<Route
path="/projects/:project/lineage"
element={<LineageGraph />}
/>
<Route path="/jobs" element={<Jobs />} />
<Route path="/monitoring" element={<Monitoring />} />
<Route path="/management" element={<Management />} />
<Route path="/role-management" element={<RoleManagement />} />
<Route
path="/responseErrors/:status/:detail"
element={<ResponseErrors />}
/>
</Routes>
<Layout.Content>
<Routes>
<Route index element={<Home />} />
<Route path="/home" element={<Home />} />
<Route path="/projects" element={<Projects />} />
<Route path="/dataSources" element={<DataSources />} />
<Route path="/features" element={<Features />} />
<Route path="/new-feature" element={<NewFeature />} />
<Route
path="/projects/:project/features/:featureId"
element={<FeatureDetails />}
/>
<Route
path="/projects/:project/dataSources/:dataSourceId"
element={<DataSourceDetails />}
/>
<Route
path="/projects/:project/lineage"
element={<LineageGraph />}
/>
<Route path="/jobs" element={<Jobs />} />
<Route path="/monitoring" element={<Monitoring />} />
<Route path="/management" element={<Management />} />
<Route
path="/role-management"
element={<RoleManagement />}
/>
<Route
path="/responseErrors/:status/:detail"
element={<ResponseErrors />}
/>
</Routes>
</Layout.Content>
<Footer />
</Layout>
</Layout>
</BrowserRouter>
Expand Down
12 changes: 12 additions & 0 deletions ui/src/components/footer/index.module.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.footer {
position: fixed;
bottom: 0;
left: 200px;
right: 0;
padding: 16px;
text-align: center;
border-top: 1px solid rgba(0, 0, 0, 0.06);
background-color: rgb(240 242 245 / 40%);
backdrop-filter: blur(8px);
z-index: 10;
}
25 changes: 25 additions & 0 deletions ui/src/components/footer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from "react";

import { Layout, Space } from "antd";
import dayjs from "dayjs";

import styles from "./index.module.less";

const { Footer } = Layout;

const FooterBar = () => {
const generatedTime = dayjs(process.env.FEATHR_GENERATED_TIME)
.utc()
.format("YYYY-MM-DD HH:mm:DD UTC");

return (
<Footer className={styles.footer}>
<Space size={32}>
<span>version {process.env.FEATHR_VERSION}</span>
<span> generated at {generatedTime}</span>
</Space>
</Footer>
);
};

export default FooterBar;
4 changes: 4 additions & 0 deletions ui/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import React from "react";
import ReactDOM from "react-dom";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import App from "./app";
import "./site.css";

dayjs.extend(utc);

ReactDOM.render(
<React.StrictMode>
<App />
Expand Down
3 changes: 2 additions & 1 deletion ui/src/site.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.page {
margin: 1%;
margin: 16px;
padding-bottom: 100px;
}

.card {
Expand Down