Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c4e0c5b
Built dashboard2 with umi/max and antd pro
dodo920306 Apr 26, 2026
66d7cf6
Finish the register form and i18n
dodo920306 May 3, 2026
d6b7571
Add validation i18n messages
dodo920306 May 3, 2026
ee95ed8
Finish Organization and Login pages
dodo920306 May 7, 2026
1b4416b
Add org creation timestamps
dodo920306 May 7, 2026
bcc0653
Add the Node page
dodo920306 May 7, 2026
f06db69
Add the Channel page
dodo920306 May 8, 2026
564a560
Add avatar
dodo920306 May 8, 2026
9c1bf8b
Add sidebar footer
dodo920306 May 8, 2026
084c0a7
Hide avatar from the login page
dodo920306 May 8, 2026
26407ed
Fix typo
dodo920306 May 9, 2026
cd3c5fe
Add the chaincode page
dodo920306 May 9, 2026
f352ad4
Add node creation form
dodo920306 May 13, 2026
41f4c03
Add channel creation form
dodo920306 May 13, 2026
caaae2f
Add validation messages for forms
dodo920306 May 13, 2026
74ad4f9
Add chaincode creation form
dodo920306 May 13, 2026
97496b2
Render chaincode approvals
dodo920306 May 14, 2026
ef2cc02
Add chaincode operations
dodo920306 May 14, 2026
4433ee2
Make chaincode operations as links
dodo920306 May 14, 2026
26ca36f
Implement form loading
dodo920306 May 14, 2026
47e619b
Implement chaincode operations
dodo920306 May 14, 2026
7107897
Remove the example table page
dodo920306 May 14, 2026
fa42c74
Remove the example demo service
dodo920306 May 14, 2026
2617ef5
Remove the example format util
dodo920306 May 14, 2026
d7ee0f4
Remove the example constant
dodo920306 May 14, 2026
cda88f7
Remove the example model
dodo920306 May 14, 2026
f2eef98
Replace 'home.title' with 'menu.home'
dodo920306 May 14, 2026
0177d2a
Add i18n for the login page
dodo920306 May 14, 2026
4da1f48
Hide the home and login page from the sidebar
dodo920306 May 14, 2026
d256f22
Get the user email on the header
dodo920306 May 14, 2026
0784bd7
Add token verification
dodo920306 May 14, 2026
e8f4d44
Remove token once it's invalid
dodo920306 May 14, 2026
ad081d3
Implement logout
dodo920306 May 14, 2026
a2e5f18
Implement login messages
dodo920306 May 14, 2026
dd085ac
Implement form refreshing
dodo920306 May 14, 2026
911784a
Replace the initial state with response interceptors
dodo920306 May 15, 2026
ed19f8b
Ignore login failures in interceptors
dodo920306 May 15, 2026
708c568
Replace home.welcome.message with app.home.welcome
dodo920306 May 15, 2026
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
3 changes: 3 additions & 0 deletions src/dashboard2/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: require.resolve('@umijs/max/eslint'),
};
14 changes: 14 additions & 0 deletions src/dashboard2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/node_modules
/.env.local
/.umirc.local.ts
/config/config.local.ts
/src/.umi
/src/.umi-production
/src/.umi-test
/.umi
/.umi-production
/.umi-test
/dist
/.mfsu
.swc
.turbopack
17 changes: 17 additions & 0 deletions src/dashboard2/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"*.{md,json}": [
"prettier --cache --write"
],
"*.{js,jsx}": [
"max lint --fix --eslint-only",
"prettier --cache --write"
],
"*.{css,less}": [
"max lint --fix --stylelint-only",
"prettier --cache --write"
],
"*.ts?(x)": [
"max lint --fix --eslint-only",
"prettier --cache --parser=typescript --write"
]
}
2 changes: 2 additions & 0 deletions src/dashboard2/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry=https://registry.npmjs.com/

3 changes: 3 additions & 0 deletions src/dashboard2/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.umi
.umi-production
8 changes: 8 additions & 0 deletions src/dashboard2/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "never",
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }],
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"]
}
3 changes: 3 additions & 0 deletions src/dashboard2/.stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: require.resolve('@umijs/max/stylelint'),
};
71 changes: 71 additions & 0 deletions src/dashboard2/.umirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { defineConfig } from '@umijs/max';

export default defineConfig({
antd: {},
access: {},
model: {},
initialState: {},
request: {},
locale: {
default: 'en-US',
antd: true,
baseNavigator: true,
},
layout: {
title: 'Hyperledger Cello',
},
favicons: [
'/favicon.png'
],
routes: [
{
name: 'login',
path: '/login',
component: './Login',
headerRender: false,
menuRender: false,
hideInMenu: true,
},
{
name: 'home',
path: '/',
component: './Home',
hideInMenu: true,
},
{
name: 'organization',
path: '/organization',
component: './Organization',

icon: 'Team',
title: true
},
{
name: 'node',
path: '/node',
component: './Node',
icon: 'NodeIndex',
title: true
},
{
name: 'channel',
path: '/channel',
component: './Channel',
icon: 'DeploymentUnit',
title: true
},
{
name: 'chaincode',
path: '/chaincode',
component: './Chaincode',
icon: 'Function',
title: true
},
],
npmClient: 'yarn',
utoopack: {},
define: {
'process.env.API_BASE_URL': process.env.API_BASE_URL
},
});

6 changes: 6 additions & 0 deletions src/dashboard2/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
approvedGitRepositories:
- "**"

enableScripts: true

nodeLinker: node-modules
3 changes: 3 additions & 0 deletions src/dashboard2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# README

`@umijs/max` 模板项目,更多功能参考 [Umi Max 简介](https://umijs.org/docs/max/introduce)
30 changes: 30 additions & 0 deletions src/dashboard2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"private": true,
"author": "dodo920306 <dodo920306@gmail.com>",
"scripts": {
"dev": "max dev",
"build": "max build",
"format": "prettier --cache --write .",
"prepare": "husky",
"postinstall": "max setup",
"setup": "max setup",
"start": "npm run dev"
},
"dependencies": {
"@ant-design/icons": "^5.0.1",
"@ant-design/pro-components": "^2.4.4",
"@umijs/max": "^4.6.47",
"antd": "^5.4.0"
},
"devDependencies": {
"@types/react": "^18.0.33",
"@types/react-dom": "^18.0.11",
"husky": "^9",
"lint-staged": "^13.2.0",
"prettier": "^2.8.7",
"prettier-plugin-organize-imports": "^3.2.2",
"prettier-plugin-packagejson": "^2.4.3",
"typescript": "^5.0.3"
},
"packageManager": "yarn@4.14.1"
}
Binary file added src/dashboard2/public/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/dashboard2/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
154 changes: 154 additions & 0 deletions src/dashboard2/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import type { HeaderProps } from '@ant-design/pro-layout';
import { history } from 'umi';
import { ConfigProvider, Menu, Modal, theme } from 'antd';
import HeaderRight from './components/HeaderRight/HeaderRight';
import { ApiOutlined, BookOutlined, GithubOutlined } from '@ant-design/icons';
import { useIntl } from 'umi';

export const rootContainer = (container: React.ReactNode) => {
return (
<ConfigProvider
theme={{
algorithm: theme.darkAlgorithm,
token: {
colorBgLayout: '#20343e',
colorBgBase: '#2d3f49',
colorText: '#ffffff',
colorTextSecondary: '#dfe6eb',
},
}}
>
{container}
</ConfigProvider>
);
};

const { useToken } = theme;

export const layout = () => {
const { token } = useToken();
return {
logo: '/favicon.png',
layout: 'mix',

token: {
header: {
colorBgHeader: token.colorBgLayout,
},

sider: {
colorMenuBackground: token.colorBgBase,
colorTextMenu: token.colorText,
colorTextMenuItemHover: '#5aaafa',
colorTextMenuSelected: '#5aaafa',
colorBgMenuItemSelected: '#121e35',
},

pageContainer: {
colorBgPageContainer: token.colorBgLayout,
},
},

actionsRender: (_props: HeaderProps, defaultDom: React.ReactNode) => {
return <HeaderRight />;
},

menuFooterRender: () => {
const intl = useIntl();
return (
<Menu
mode="inline"
selectable={false}
inlineIndent={16}
style={{
background: token.colorBgLayout,
borderTop: '1px solid rgba(112,204,254,0.27)',
paddingBottom: 10
}}
items={[
{
key: 'api',
icon: <ApiOutlined />,
label: (
<a
href={process.env.API_BASE_URL + '/api/v1/docs'}
target="_blank"
>
REST API
</a>
),
},
{
key: 'github',
icon: <GithubOutlined />,
label: (
<a
href='https://github.com/hyperledger-cello'
target="_blank"
>
GitHub
</a>
),
},
{
key: 'docs',
icon: <BookOutlined />,
label: (
<a
href='https://hyperledger-cello.readthedocs.io'
target="_blank"
>
{intl.formatMessage({id: 'menu.docs'},)}
</a>
),
},
]}
/>
);
},

onPageChange: () => {
const { location } = history;
const isLogin = !!localStorage.getItem('token');
if (isLogin && location.pathname == '/login') {
history.push('/');
}
},
};
};

export const request = {
requestInterceptors: [
(url: string, options: any) => {
options.baseURL = process.env.API_BASE_URL;
return { url, options };
},
],

responseInterceptors: [[
(response: any) => response,
(error: any) => {
const { location } = history;
if (location.pathname == '/login') {
return Promise.reject(error);
}
if (error?.response?.status === 401) {
if (document.querySelector('.token-expired-modal')) {
return Promise.reject(error);
}

Modal.error({
className: 'token-expired-modal',
title: '登入已過期',
content: '您的登入狀態已過期,請重新登入。',
okText: '重新登入',
onOk: () => {
localStorage.removeItem('token');
history.push('/login');
},
});
}
return Promise.reject(error);
},
]],
};
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.dropdown {
padding: 0px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { GlobalOutlined } from "@ant-design/icons";
import styles from './CustomizedSelectLang.less'
import { SelectLang, useIntl } from '@umijs/max';
import { Button } from "antd";

export default function CustomizedSelectLang() {
const intl = useIntl();

return (
<SelectLang
icon={
<Button
className={styles.dropdown}
type="text"
>
<GlobalOutlined />
<span className="lang-text">{intl.formatMessage({id: 'navBar.lang',})}</span>
</Button>
}
reload={false}
/>
);
}
3 changes: 3 additions & 0 deletions src/dashboard2/src/components/HeaderRight/HeaderRight.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.dropdown {
padding: 0px;
}
Loading
Loading