Browse Source

feat: add version and commit hash to footer (#11660)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
claude/review-open-issues-and-changes
afc163 6 months ago
committed by GitHub
parent
commit
85adf9f65f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      .github/workflows/deploy.yml
  2. 2
      .github/workflows/preview-build.yml
  3. 22
      cloudflare-worker/src/data/dashboard.ts
  4. 4
      cloudflare-worker/src/routes/list.ts
  5. 5
      config/config.ts
  6. 5
      package.json
  7. 52
      src/components/Footer/index.tsx
  8. 2
      src/pages/dashboard/analysis/components/Charts/index.tsx
  9. 22
      src/pages/dashboard/workplace/_mock.ts
  10. 86
      src/pages/user/login/__snapshots__/login.test.tsx.snap
  11. 3
      tsconfig.json

2
.github/workflows/deploy.yml

@ -19,6 +19,8 @@ jobs:
- uses: utooland/setup-utoo@v1
- run: ut
- name: Set COMMIT_HASH
run: echo "COMMIT_HASH=${{ github.sha }}" >> $GITHUB_ENV
- run: ut build
- name: Deploy to GitHub Pages

2
.github/workflows/preview-build.yml

@ -18,6 +18,8 @@ jobs:
- uses: utooland/setup-utoo@v1
- run: ut
- name: Set COMMIT_HASH
run: echo "COMMIT_HASH=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
- run: ut build
- name: upload dist artifact

22
cloudflare-worker/src/data/dashboard.ts

@ -191,47 +191,47 @@ export const activities = [
id: 'trend-1',
updatedAt: new Date().toISOString(),
user: { name: '曲丽丽', avatar: avatars2[0] },
group: { name: '高逼格设计天团', link: 'http://github.com/' },
project: { name: '六月迭代', link: 'http://github.com/' },
group: { name: '高逼格设计天团', link: 'https://github.com/' },
project: { name: '六月迭代', link: 'https://github.com/' },
template: '在 @{group} 新建项目 @{project}',
},
{
id: 'trend-2',
updatedAt: new Date().toISOString(),
user: { name: '付小小', avatar: avatars2[1] },
group: { name: '高逼格设计天团', link: 'http://github.com/' },
project: { name: '六月迭代', link: 'http://github.com/' },
group: { name: '高逼格设计天团', link: 'https://github.com/' },
project: { name: '六月迭代', link: 'https://github.com/' },
template: '在 @{group} 新建项目 @{project}',
},
{
id: 'trend-3',
updatedAt: new Date().toISOString(),
user: { name: '林东东', avatar: avatars2[2] },
group: { name: '中二少女团', link: 'http://github.com/' },
project: { name: '六月迭代', link: 'http://github.com/' },
group: { name: '中二少女团', link: 'https://github.com/' },
project: { name: '六月迭代', link: 'https://github.com/' },
template: '在 @{group} 新建项目 @{project}',
},
{
id: 'trend-4',
updatedAt: new Date().toISOString(),
user: { name: '周星星', avatar: avatars2[4] },
project: { name: '5 月日常迭代', link: 'http://github.com/' },
project: { name: '5 月日常迭代', link: 'https://github.com/' },
template: '将 @{project} 更新至已发布状态',
},
{
id: 'trend-5',
updatedAt: new Date().toISOString(),
user: { name: '朱偏右', avatar: avatars2[3] },
project: { name: '工程效能', link: 'http://github.com/' },
comment: { name: '留言', link: 'http://github.com/' },
project: { name: '工程效能', link: 'https://github.com/' },
comment: { name: '留言', link: 'https://github.com/' },
template: '在 @{project} 发布了 @{comment}',
},
{
id: 'trend-6',
updatedAt: new Date().toISOString(),
user: { name: '乐哥', avatar: avatars2[5] },
group: { name: '程序员日常', link: 'http://github.com/' },
project: { name: '品牌迭代', link: 'http://github.com/' },
group: { name: '程序员日常', link: 'https://github.com/' },
project: { name: '品牌迭代', link: 'https://github.com/' },
template: '在 @{group} 新建项目 @{project}',
},
];

4
cloudflare-worker/src/routes/list.ts

@ -84,8 +84,8 @@ function fakeList(count: number) {
percent: Math.ceil(Math.random() * 50) + 50,
logo: avatars[i % 8],
href: 'https://ant.design',
updatedAt: new Date().getTime() - Math.floor(Math.random() * 1000000000),
createdAt: new Date().getTime() - Math.floor(Math.random() * 1000000000),
updatedAt: Date.now() - Math.floor(Math.random() * 1000000000),
createdAt: Date.now() - Math.floor(Math.random() * 1000000000),
subDescription: desc[i % 5],
description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的共通点和组成部分,该专案即是致力于归纳和吸收各种产品的各自优势,致力于打造成中后台产品的根底',

5
config/config.ts

@ -18,6 +18,9 @@ const { UMI_ENV = 'dev' } = process.env;
const PUBLIC_PATH: string = '/';
export default defineConfig({
alias: {
'@root': join(__dirname, '..'),
},
/**
* @name 开启 hash 模式
* @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。
@ -190,6 +193,8 @@ export default defineConfig({
exportStatic: {},
define: {
'process.env.CI': process.env.CI,
'process.env.COMMIT_HASH': process.env.COMMIT_HASH || '',
'process.env.CF_PAGES_COMMIT_SHA': process.env.CF_PAGES_COMMIT_SHA || '',
},
extraPostCSSPlugins: [tailwindcss],
});

5
package.json

@ -47,6 +47,7 @@
"antd-style": "^4.1.0",
"clsx": "^2.1.1",
"dayjs": "^1.11.19",
"git-url-parse": "^16.1.0",
"numeral": "^2.0.6",
"react": "^19.2.4",
"react-dom": "^19.2.4"
@ -67,6 +68,8 @@
"@types/react-helmet": "^6.1.11",
"@umijs/lint": "^4.6.40",
"@umijs/max": "^4.6.40",
"@umijs/max-plugin-openapi": "^2.0.3",
"@umijs/request-record": "^1.1.3",
"cross-env": "^10.1.0",
"express": "^5.2.1",
"gh-pages": "^6.1.1",
@ -78,8 +81,6 @@
"tailwindcss": "^4",
"ts-node": "^10.9.2",
"typescript": "^6.0.2",
"@umijs/max-plugin-openapi": "^2.0.3",
"@umijs/request-record": "^1.1.3",
"umi-serve": "^1.9.11"
},
"engines": {

52
src/components/Footer/index.tsx

@ -1,31 +1,57 @@
import { GithubOutlined } from '@ant-design/icons';
import { DefaultFooter } from '@ant-design/pro-components';
import packageJson from '@root/package.json';
import GitUrlParse from 'git-url-parse';
import React from 'react';
const getRepoUrl = () => {
if (!packageJson.repository)
return 'https://github.com/ant-design/ant-design-pro';
const parsed = GitUrlParse(packageJson.repository);
return `https://${parsed.source}/${parsed.owner}/${parsed.name}`;
};
const REPO = getRepoUrl();
// Git commit hash, can be updated via CI/CD (GitHub Actions or Cloudflare Pages)
const COMMIT_HASH =
process.env.COMMIT_HASH || process.env.CF_PAGES_COMMIT_SHA || '';
const Footer: React.FC = () => {
const commitUrl = COMMIT_HASH ? `${REPO}/commit/${COMMIT_HASH}` : undefined;
return (
<DefaultFooter
copyright={false}
style={{
background: 'none',
}}
copyright="Powered by Ant Design"
links={[
{
key: 'Ant Design Pro',
title: 'Ant Design Pro',
href: 'https://pro.ant.design',
blankTarget: true,
},
{
key: 'github',
title: <GithubOutlined />,
href: 'https://github.com/ant-design/ant-design-pro',
key: 'version',
title: `v${packageJson.version}`,
href: REPO,
blankTarget: true,
},
...(COMMIT_HASH
? [
{
key: 'commit',
title: COMMIT_HASH.slice(0, 7),
href: commitUrl!,
blankTarget: true,
},
]
: []),
{
key: 'Ant Design',
title: 'Ant Design',
href: 'https://ant.design',
key: 'repo',
title: (
<>
<GithubOutlined style={{ marginRight: 8 }} />
Ant Design Pro
</>
),
href: REPO,
blankTarget: true,
},
]}

2
src/pages/dashboard/analysis/components/Charts/index.tsx

@ -10,4 +10,4 @@ const Charts = {
Field,
};
export { Charts as default, yuan, ChartCard, Field };
export { ChartCard, Charts as default, Field, yuan };

22
src/pages/dashboard/workplace/_mock.ts

@ -246,11 +246,11 @@ const getActivities = (_: Request, res: Response) => {
},
group: {
name: '高逼格设计天团',
link: 'http://github.com/',
link: 'https://github.com/',
},
project: {
name: '六月迭代',
link: 'http://github.com/',
link: 'https://github.com/',
},
template: '在 @{group} 新建项目 @{project}',
},
@ -263,11 +263,11 @@ const getActivities = (_: Request, res: Response) => {
},
group: {
name: '高逼格设计天团',
link: 'http://github.com/',
link: 'https://github.com/',
},
project: {
name: '六月迭代',
link: 'http://github.com/',
link: 'https://github.com/',
},
template: '在 @{group} 新建项目 @{project}',
},
@ -280,11 +280,11 @@ const getActivities = (_: Request, res: Response) => {
},
group: {
name: '中二少女团',
link: 'http://github.com/',
link: 'https://github.com/',
},
project: {
name: '六月迭代',
link: 'http://github.com/',
link: 'https://github.com/',
},
template: '在 @{group} 新建项目 @{project}',
},
@ -297,7 +297,7 @@ const getActivities = (_: Request, res: Response) => {
},
project: {
name: '5 月日常迭代',
link: 'http://github.com/',
link: 'https://github.com/',
},
template: '将 @{project} 更新至已发布状态',
},
@ -310,11 +310,11 @@ const getActivities = (_: Request, res: Response) => {
},
project: {
name: '工程效能',
link: 'http://github.com/',
link: 'https://github.com/',
},
comment: {
name: '留言',
link: 'http://github.com/',
link: 'https://github.com/',
},
template: '在 @{project} 发布了 @{comment}',
},
@ -327,11 +327,11 @@ const getActivities = (_: Request, res: Response) => {
},
group: {
name: '程序员日常',
link: 'http://github.com/',
link: 'https://github.com/',
},
project: {
name: '品牌迭代',
link: 'http://github.com/',
link: 'https://github.com/',
},
template: '在 @{group} 新建项目 @{project}',
},

86
src/pages/user/login/__snapshots__/login.test.tsx.snap

@ -468,24 +468,25 @@ exports[`Login Page should login success 1`] = `
>
<a
class="ant-pro-global-footer-list-link"
href="https://pro.ant.design"
href="https://github.com/ant-design/ant-design-pro"
rel="noreferrer"
target="_blank"
title="Ant Design Pro"
title="version"
>
Ant Design Pro
v6.0.0-beta.3
</a>
<a
class="ant-pro-global-footer-list-link"
href="https://github.com/ant-design/ant-design-pro"
rel="noreferrer"
target="_blank"
title="github"
title="repo"
>
<span
aria-label="github"
class="anticon anticon-github"
role="img"
style="margin-right: 8px;"
>
<svg
aria-hidden="true"
@ -501,40 +502,8 @@ exports[`Login Page should login success 1`] = `
/>
</svg>
</span>
Ant Design Pro
</a>
<a
class="ant-pro-global-footer-list-link"
href="https://ant.design"
rel="noreferrer"
target="_blank"
title="Ant Design"
>
Ant Design
</a>
</div>
<div
class="ant-pro-global-footer-copyright"
>
<span
aria-label="copyright"
class="anticon anticon-copyright"
role="img"
>
<svg
aria-hidden="true"
data-icon="copyright"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm5.6-532.7c53 0 89 33.8 93 83.4.3 4.2 3.8 7.4 8 7.4h56.7c2.6 0 4.7-2.1 4.7-4.7 0-86.7-68.4-147.4-162.7-147.4C407.4 290 344 364.2 344 486.8v52.3C344 660.8 407.4 734 517.3 734c94 0 162.7-58.8 162.7-141.4 0-2.6-2.1-4.7-4.7-4.7h-56.8c-4.2 0-7.6 3.2-8 7.3-4.2 46.1-40.1 77.8-93 77.8-65.3 0-102.1-47.9-102.1-133.6v-52.6c.1-87 37-135.5 102.2-135.5z"
/>
</svg>
</span>
Powered by Ant Design
</div>
</div>
</footer>
@ -1010,24 +979,25 @@ exports[`Login Page should show login form 1`] = `
>
<a
class="ant-pro-global-footer-list-link"
href="https://pro.ant.design"
href="https://github.com/ant-design/ant-design-pro"
rel="noreferrer"
target="_blank"
title="Ant Design Pro"
title="version"
>
Ant Design Pro
v6.0.0-beta.3
</a>
<a
class="ant-pro-global-footer-list-link"
href="https://github.com/ant-design/ant-design-pro"
rel="noreferrer"
target="_blank"
title="github"
title="repo"
>
<span
aria-label="github"
class="anticon anticon-github"
role="img"
style="margin-right: 8px;"
>
<svg
aria-hidden="true"
@ -1043,40 +1013,8 @@ exports[`Login Page should show login form 1`] = `
/>
</svg>
</span>
Ant Design Pro
</a>
<a
class="ant-pro-global-footer-list-link"
href="https://ant.design"
rel="noreferrer"
target="_blank"
title="Ant Design"
>
Ant Design
</a>
</div>
<div
class="ant-pro-global-footer-copyright"
>
<span
aria-label="copyright"
class="anticon anticon-copyright"
role="img"
>
<svg
aria-hidden="true"
data-icon="copyright"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm5.6-532.7c53 0 89 33.8 93 83.4.3 4.2 3.8 7.4 8 7.4h56.7c2.6 0 4.7-2.1 4.7-4.7 0-86.7-68.4-147.4-162.7-147.4C407.4 290 344 364.2 344 486.8v52.3C344 660.8 407.4 734 517.3 734c94 0 162.7-58.8 162.7-141.4 0-2.6-2.1-4.7-4.7-4.7h-56.8c-4.2 0-7.6 3.2-8 7.3-4.2 46.1-40.1 77.8-93 77.8-65.3 0-102.1-47.9-102.1-133.6v-52.6c.1-87 37-135.5 102.2-135.5z"
/>
</svg>
</span>
Powered by Ant Design
</div>
</div>
</footer>

3
tsconfig.json

@ -15,7 +15,8 @@
"paths": {
"@/*": ["./src/*"],
"@@/*": ["./src/.umi/*"],
"@@test/*": ["./src/.umi-test/*"]
"@@test/*": ["./src/.umi-test/*"],
"@root/*": ["./*"]
}
},
"include": ["./**/*.d.ts", "./**/*.ts", "./**/*.tsx"]

Loading…
Cancel
Save