Skip to content

Commit dfc8553

Browse files
committed
add /integration
1 parent 54e27ab commit dfc8553

File tree

9 files changed

+268
-14
lines changed

9 files changed

+268
-14
lines changed

opensergo-dashboard-ui/package-lock.json

Lines changed: 105 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

opensergo-dashboard-ui/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@alicloud/console-components-app-layout": "^1.1.4",
2929
"@alicloud/console-components-console-menu": "^1.2.12",
3030
"@alicloud/console-components-page": "^1.0.18",
31+
"@alicloud/console-components-slide-panel": "^2.2.14",
3132
"@alicloud/console-components-table": "^1.0.21",
3233
"@alicloudfe/components-console-menu": "^1.1.0",
3334
"@types/node": "^16.11.25",
@@ -62,6 +63,7 @@
6263
"react": "^16.8.6",
6364
"react-dom": "^16.8.6",
6465
"react-scripts": "^4.0.3",
66+
"sass": "^1.51.0",
6567
"selectize": "^0.12.1",
6668
"styled-components": "^4.3.2"
6769
},

opensergo-dashboard-ui/src/App.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import './App.css';
32
import { IRoutableItemDescriptor } from "@alicloud/console-components-console-menu";
43
import RoutableMenu from "@alicloud/console-components-console-menu/lib/RoutableMenu";
@@ -9,11 +8,13 @@ import "@alicloud/console-components/dist/wind.css";
98
import { Redirect, Route, Switch } from "dva/router";
109
import AppList from "./AppList";
1110
import AppDetail from "./page/AppDetail";
11+
import Integration from './page/Integration';
1212

1313

1414
const items: IRoutableItemDescriptor[] = [
1515
// {key: '/home', to: '/', label: '概览'},
1616
{ key: '/application', to: '/application', label: '应用列表' },
17+
{ key: '/integration', to: '/integration', label: '接入中心' },
1718
];
1819

1920
const Nav = () => (
@@ -30,17 +31,20 @@ function App() {
3031
>
3132
<Switch>
3233
<Route path="/application/detail">
33-
<AppDetail />
34+
<AppDetail />
3435
</Route>
3536
<Route path="/application/service">
36-
<AppDetail />
37+
<AppDetail />
3738
</Route>
3839
<Route exact path="/application">
3940
<AppList />
4041
</Route>
4142
<Route exact path="/application">
4243
<AppList />
4344
</Route>
45+
<Route exact path="/integration">
46+
<Integration />
47+
</Route>
4448
<Route path="/">
4549
<Redirect to={'/application'} />
4650
</Route>

opensergo-dashboard-ui/src/AppList.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React, { useEffect, useState } from 'react';
2-
import { Badge, Button, Icon, Select } from '@alicloud/console-components';
3-
import Actions, { LinkButton } from "@alicloud/console-components-actions";
2+
import { Button } from '@alicloud/console-components';
3+
import { LinkButton } from "@alicloud/console-components-actions";
44
import Page from '@alicloud/console-components-page';
55
import Table from '@alicloud/console-components-table';
66
import type { TableProps } from '@alicloud/console-components/types/table';
77
import axios from 'axios';
8-
import { Link } from 'dva/router'
8+
import { Link, useHistory } from 'dva/router'
99

1010

1111
const rowSelection: TableProps['rowSelection'] & {
@@ -17,25 +17,33 @@ const rowSelection: TableProps['rowSelection'] & {
1717
}
1818

1919
const AppList: React.FC<{}> = () => {
20+
const history = useHistory();
21+
22+
const [loading, setLoading] = useState(true);
23+
2024
const [appList, setAppList] = useState([]);
2125
useEffect(() => {
2226
fetchAppList();
2327
}, []);
2428
// TODO need to support paging
2529
const fetchAppList = async () => {
30+
setLoading(true);
2631
const data = await axios.get('/api/application/getApplicationList')
2732
.then(function (response) {
2833
return response?.data?.data;
2934
});
3035
setAppList(data);
36+
setLoading(false);
3137
};
3238

3339
const Operation = () => (
3440
<>
3541
<Button
36-
// type="primary"
37-
>
38-
应用接入🚧
42+
onClick={() => {
43+
history.push("/integration");
44+
}}
45+
>
46+
应用接入
3947
</Button>
4048
<Button onClick={fetchAppList}>刷新</Button>
4149
</>
@@ -46,6 +54,7 @@ const AppList: React.FC<{}> = () => {
4654
<Page.Header title="应用列表" />
4755
<Page.Content>
4856
<Table
57+
loading={loading}
4958
exact
5059
fixedBarExpandWidth={[24]}
5160
affixActionBar
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
.integration-card {
2+
width: 120px;
3+
height: 120px;
4+
padding: 4px 8px;
5+
padding-top: 10px;
6+
background-color: #FAFAFA;
7+
display: flex;
8+
flex-direction: column;
9+
align-items: center;
10+
margin: 12px;
11+
margin-left: 0px;
12+
// box-shadow: 0 1px 4px 0 rgba(0, 0, 0, .13);
13+
// border: 1px solid transparent;
14+
background-color: #fff;
15+
border: 1px solid #DEDEDE;
16+
.integration-icon {
17+
width: 56px;
18+
height: 56px;
19+
}
20+
21+
&__name {
22+
font-size: 12px;
23+
text-align: center;
24+
flex: 1;
25+
display: flex;
26+
align-items: center;
27+
}
28+
29+
&:hover {
30+
text-decoration: none !important;
31+
cursor: pointer;
32+
border: 1px solid #0070CC;
33+
box-shadow: 0 2px 8px 0 rgba(0,112,204,0.08);
34+
background-color: #FFFFFF;
35+
}
36+
37+
&--disabled {
38+
&:hover {
39+
cursor: not-allowed;
40+
background-color: #FAFAFA;
41+
}
42+
cursor: not-allowed;
43+
& > * {
44+
opacity: 0.2;
45+
}
46+
}
47+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
import cx from 'classnames';
3+
import './IntegrationCard.scss';
4+
5+
6+
const BLOCK = 'integration-card';
7+
8+
const IntegrationIcon: React.FC<{ imgUrl: string }> = ({ imgUrl }) => {
9+
return (
10+
<img className="integration-icon" src={imgUrl} alt='logo' />
11+
)
12+
}
13+
14+
const IntegrationCard: React.FC<{ name: string, imgUrl: string, disabled?: boolean }> = ({ name, imgUrl, disabled }) => {
15+
16+
return (
17+
<div
18+
className={cx(`${BLOCK}`, { [`${BLOCK}--disabled`]: disabled })}
19+
title={disabled ? '正在接入中...' : undefined}
20+
onClick={() => { }}
21+
>
22+
<div>
23+
<IntegrationIcon imgUrl={imgUrl} />
24+
</div>
25+
<div className={`${BLOCK}__name`}>{name}</div>
26+
</div>
27+
)
28+
};
29+
30+
export default IntegrationCard;

0 commit comments

Comments
 (0)