This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new a89d05b20 feat(config-ui): adjust env config (#6744)
a89d05b20 is described below
commit a89d05b204de33ca8c490985d57ebfca0325a122
Author: 青湛 <[email protected]>
AuthorDate: Fri Jan 5 15:35:10 2024 +1300
feat(config-ui): adjust env config (#6744)
* fix(config-ui): change warning color
* refactor(config-ui): remove DEVLAKE_LOGO config
* refactor(config-ui): remove DEVLAKE_COPYRIGHT config
* feat(config-ui): adjust env config
* chore(config-ui): remove console.log
---
config-ui/env.example | 6 ++--
config-ui/src/components/logo/index.tsx | 2 +-
config-ui/src/main.tsx | 2 +-
.../error/components/needs-db-migrate/index.tsx | 8 +++--
config-ui/src/routes/error/styled.ts | 2 +-
config-ui/src/routes/layout/layout.tsx | 36 ++++++++++++++--------
config-ui/src/vite-env.d.ts | 6 ++--
7 files changed, 38 insertions(+), 24 deletions(-)
diff --git a/config-ui/env.example b/config-ui/env.example
index 463359c94..442439eda 100644
--- a/config-ui/env.example
+++ b/config-ui/env.example
@@ -1,7 +1,7 @@
# About Basic Information
-# DEVLAKE_LOGO=
-# DEVLAKE_COPYRIGHT=
-# DEVLAKE_PRIMARY_COLOR=
+# DEVLAKE_TITLE_CUSTOM=
+# DEVLAKE_COLOR_CUSTOM=
+# DEVLAKE_COPYRIGHT_HIDE=
# All plugins are loaded by default, optional plugins can be loaded
# eg. DEVLAKE_PLUGINS=github,gitlab
diff --git a/config-ui/src/components/logo/index.tsx
b/config-ui/src/components/logo/index.tsx
index f60e8ac98..bc68a8e65 100644
--- a/config-ui/src/components/logo/index.tsx
+++ b/config-ui/src/components/logo/index.tsx
@@ -32,7 +32,7 @@ interface Props {
export const Logo = ({ style }: Props) => {
return (
<Wrapper style={style}>
- <img src={import.meta.env.DEVLAKE_LOGO ?? LogoImg} alt="Logo" />
+ <img src={LogoImg} alt="Logo" />
</Wrapper>
);
};
diff --git a/config-ui/src/main.tsx b/config-ui/src/main.tsx
index 91b266ef2..d3b35c690 100644
--- a/config-ui/src/main.tsx
+++ b/config-ui/src/main.tsx
@@ -31,7 +31,7 @@ ReactDOM.render(
<ConfigProvider
theme={{
token: {
- colorPrimary: import.meta.env.DEVLAKE_PRIMARY_COLOR ?? '#7497F7',
+ colorPrimary: import.meta.env.DEVLAKE_COLOR_CUSTOM ?? '#7497F7',
},
}}
>
diff --git a/config-ui/src/routes/error/components/needs-db-migrate/index.tsx
b/config-ui/src/routes/error/components/needs-db-migrate/index.tsx
index cebf2c441..10ccd586d 100644
--- a/config-ui/src/routes/error/components/needs-db-migrate/index.tsx
+++ b/config-ui/src/routes/error/components/needs-db-migrate/index.tsx
@@ -18,7 +18,7 @@
import { useState } from 'react';
import { ExclamationCircleOutlined } from '@ant-design/icons';
-import { Card, Flex, Button } from 'antd';
+import { Card, Space, Flex, Button } from 'antd';
import { useNavigate } from 'react-router-dom';
import API from '@/api';
@@ -42,8 +42,10 @@ export const NeedsDBMigrate = () => {
return (
<Card>
<h2>
- <ExclamationCircleOutlined size={20} color="#fa541c" />
- <span>New Migration Scripts Detected</span>
+ <Space>
+ <ExclamationCircleOutlined style={{ fontSize: 20, color: '#faad14'
}} />
+ <span>New Migration Scripts Detected</span>
+ </Space>
</h2>
<p>
If you have already started, please wait for database migrations to
complete, do <strong>NOT</strong> close your
diff --git a/config-ui/src/routes/error/styled.ts
b/config-ui/src/routes/error/styled.ts
index 83bd0e038..14dd42a74 100644
--- a/config-ui/src/routes/error/styled.ts
+++ b/config-ui/src/routes/error/styled.ts
@@ -42,7 +42,7 @@ export const Inner = styled.div`
margin: 16px 0;
&.warning {
- color: #fa541c;
+ color: #faad14;
}
}
`;
diff --git a/config-ui/src/routes/layout/layout.tsx
b/config-ui/src/routes/layout/layout.tsx
index 0b2423aa2..bfc8ce1a0 100644
--- a/config-ui/src/routes/layout/layout.tsx
+++ b/config-ui/src/routes/layout/layout.tsx
@@ -127,7 +127,13 @@ export const Layout = () => {
overflow: 'auto',
}}
>
- <Logo style={{ padding: 24 }} />
+ {import.meta.env.DEVLAKE_TITLE_CUSTOM ? (
+ <h2 style={{ margin: '36px 0', textAlign: 'center', color: '#fff' }}>
+ {import.meta.env.DEVLAKE_TITLE_CUSTOM}
+ </h2>
+ ) : (
+ <Logo style={{ padding: 24 }} />
+ )}
<Menu
mode="inline"
theme="dark"
@@ -152,20 +158,26 @@ export const Layout = () => {
background: 'transparent',
}}
>
- {headerItems.map((item, i) => (
- <ExternalLink key={item.label} link={item.link} style={{ display:
'flex', alignItems: 'center' }}>
- {item.icon}
- <span style={{ marginLeft: 4 }}>{item.label}</span>
- {i !== headerItems.length - 1 && <Divider type="vertical" />}
- </ExternalLink>
- ))}
+ {headerItems
+ .filter((item) =>
+ import.meta.env.DEVLAKE_COPYRIGHT_HIDE ? !['GitHub',
'Slack'].includes(item.label) : true,
+ )
+ .map((item, i, arr) => (
+ <ExternalLink key={item.label} link={item.link} style={{
display: 'flex', alignItems: 'center' }}>
+ {item.icon}
+ <span style={{ marginLeft: 4 }}>{item.label}</span>
+ {i !== arr.length - 1 && <Divider type="vertical" />}
+ </ExternalLink>
+ ))}
</Header>
- <Content style={{ margin: '0 auto', width: 1188 }}>
+ <Content style={{ margin: '16px auto', width: 1188 }}>
<Outlet />
</Content>
- <Footer style={{ color: '#a1a1a1', textAlign: 'center' }}>
- {import.meta.env.DEVLAKE_COPYRIGHT ?? 'Apache 2.0 License'}
- </Footer>
+ {!import.meta.env.DEVLAKE_COPYRIGHT_HIDE && (
+ <Footer>
+ <p style={{ textAlign: 'center' }}>Apache 2.0 License</p>
+ </Footer>
+ )}
<CSSTransition in={!!tipsShow} unmountOnExit timeout={300}
nodeRef={tipsRef} classNames="tips">
<S.Tips ref={tipsRef}>
<div className="content">
diff --git a/config-ui/src/vite-env.d.ts b/config-ui/src/vite-env.d.ts
index cb6ab4665..0327e9ffb 100644
--- a/config-ui/src/vite-env.d.ts
+++ b/config-ui/src/vite-env.d.ts
@@ -20,9 +20,9 @@
/// <reference types="vite-plugin-svgr/client" />
interface ImportMetaEnv {
- readonly DEVLAKE_LOGO: string;
- readonly DEVLAKE_COPYRIGHT: string;
- readonly DEVLAKE_PRIMARY_COLOR: string;
+ readonly DEVLAKE_TITLE_CUSTOM: string;
+ readonly DEVLAKE_COLOR_CUSTOM: string;
+ readonly DEVLAKE_COPYRIGHT_HIDE: boolean;
readonly DEVLAKE_PLUGINS: string;
}