Skip to content
This repository was archived by the owner on Aug 31, 2022. It is now read-only.

Commit 694e83e

Browse files
Anisha1234Anisha Swain
authored andcommitted
adds overview page to pbench dashboard
1 parent ebc237d commit 694e83e

File tree

10 files changed

+1144
-19
lines changed

10 files changed

+1144
-19
lines changed

config/router.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ module.exports = [
9595
exact: true,
9696
component: './Profile',
9797
},
98+
{
99+
path: '/private/overview',
100+
name: 'overview',
101+
component: './Overview',
102+
},
98103
],
99104
},
100105
],

mock/overview.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
export const expirationLimit = 30;
2+
3+
// P.S: the key needs to be unique for this object
4+
export const resultData = [
5+
{
6+
key: 1,
7+
result: ['mock result -1', 'example.lab.eng.com'],
8+
end: '2020-09-10T 11:52:34.552478',
9+
deletion: '2020-10-10T11:52:34.552478',
10+
seen: false,
11+
description: 'More content can be added here',
12+
},
13+
{
14+
key: 2,
15+
result: ['mock result -2', ' example.lab.eng.com'],
16+
end: '2020-10-10T11:52:34.552478',
17+
deletion: '2020-11-10T11:52:34.552478',
18+
seen: false,
19+
description: 'More content can be added here',
20+
},
21+
{
22+
key: 3,
23+
result: ['mock result -3', ' example.lab.eng.com'],
24+
end: '2020-11-10T11:52:34.552478',
25+
deletion: '2020-12-10T11:52:34.552478',
26+
seen: false,
27+
description: 'More content can be added here',
28+
},
29+
{
30+
key: 4,
31+
result: ['mock result -4', ' example.lab.eng.com'],
32+
end: '2020-11-10T11:52:34.552478',
33+
deletion: '2020-12-13T11:52:34.552478',
34+
seen: false,
35+
description: 'More content can be added here',
36+
},
37+
{
38+
key: 5,
39+
result: ['mock result -5', 'example.lab.eng.com'],
40+
end: '2020-12-10T11:52:34.552478',
41+
deletion: '2021-01-10T11:52:34.552478',
42+
seen: true,
43+
description: 'More content can be added here',
44+
},
45+
{
46+
key: 6,
47+
result: ['mock result -6', ' example.lab.eng.com'],
48+
end: '2020-12-10T11:52:34.552478',
49+
deletion: '2021-01-10T11:52:34.552478',
50+
seen: true,
51+
description: 'More content can be added here',
52+
},
53+
{
54+
key: 7,
55+
result: ['mock result -7', ' example.lab.eng.com'],
56+
end: '2021-01-10T11:52:34.552478',
57+
deletion: '2021-02-10T11:52:34.552478',
58+
seen: true,
59+
description: 'More content can be added here',
60+
},
61+
{
62+
key: 8,
63+
result: ['mock result -8', ' example.lab.eng.com'],
64+
end: '2021-01-10T11:52:34.552478',
65+
deletion: '2021-02-10T11:52:34.552478',
66+
seen: true,
67+
description: 'More content can be added here',
68+
},
69+
{
70+
key: 9,
71+
result: ['mock result -9', ' example.lab.eng.com'],
72+
end: '2021-01-20T11:52:34.552478',
73+
deletion: '2021-02-20T11:52:34.552478',
74+
seen: true,
75+
description: 'More content can be added here',
76+
},
77+
];

src/common/menu.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { isUrl } from '../utils/utils';
22

33
const menuData = [
44
{
5-
name: 'Dashboard',
5+
name: 'Overview',
6+
icon: 'dashboard',
67
path: '/private',
78
routes: [
89
{
@@ -27,6 +28,11 @@ const menuData = [
2728
},
2829
],
2930
},
31+
{
32+
name: 'Controllers',
33+
icon: 'controllers',
34+
path: '/',
35+
},
3036
{
3137
name: 'Search',
3238
path: '/search',

src/components/LoginHint/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Title, Button } from '@patternfly/react-core';
77
store,
88
auth: auth.auth,
99
}))
10-
class Overview extends Component {
10+
class LoginHint extends Component {
1111
navigateToAuth = () => {
1212
const { dispatch } = this.props;
1313
dispatch(routerRedux.push(`/auth`));
@@ -33,4 +33,4 @@ class Overview extends Component {
3333
}
3434
}
3535

36-
export default Overview;
36+
export default LoginHint;

src/components/LoginModal/index.js

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import React from 'react';
2+
import {
3+
Modal,
4+
ModalVariant,
5+
Button,
6+
TextContent,
7+
Text,
8+
TextVariants,
9+
} from '@patternfly/react-core';
10+
import { routerRedux } from 'dva/router';
11+
import { connect } from 'dva';
12+
13+
@connect(auth => ({
14+
auth: auth.auth,
15+
}))
16+
class LoginModal extends React.Component {
17+
constructor(props) {
18+
super(props);
19+
this.state = {
20+
isModalOpen: false,
21+
};
22+
}
23+
24+
componentDidMount() {
25+
this.handleModalToggle();
26+
}
27+
28+
handleModalToggle = () => {
29+
this.setState(({ isModalOpen }) => ({
30+
isModalOpen: !isModalOpen,
31+
}));
32+
};
33+
34+
handleModalCancel = () => {
35+
const { dispatch } = this.props;
36+
this.setState(({ isModalOpen }) => ({
37+
isModalOpen: !isModalOpen,
38+
}));
39+
dispatch(routerRedux.push(`/`));
40+
};
41+
42+
handleLoginModal = () => {
43+
const { dispatch } = this.props;
44+
this.setState(({ isModalOpen }) => ({
45+
isModalOpen: !isModalOpen,
46+
}));
47+
dispatch(routerRedux.push(`/auth`));
48+
};
49+
50+
handleSignupModal = () => {
51+
const { dispatch } = this.props;
52+
this.setState(({ isModalOpen }) => ({
53+
isModalOpen: !isModalOpen,
54+
}));
55+
dispatch(routerRedux.push(`/signup`));
56+
};
57+
58+
render() {
59+
const { isModalOpen } = this.state;
60+
61+
return (
62+
<React.Fragment>
63+
<Modal
64+
variant={ModalVariant.small}
65+
isOpen={isModalOpen}
66+
onClose={this.handleModalCancel}
67+
showClose="false"
68+
actions={[
69+
<Button key="confirm" variant="primary" onClick={this.handleLoginModal}>
70+
Login
71+
</Button>,
72+
<Button key="confirm" variant="link" onClick={this.handleSignupModal}>
73+
Signup
74+
</Button>,
75+
<Button key="cancel" variant="link" onClick={this.handleModalCancel}>
76+
Cancel
77+
</Button>,
78+
]}
79+
>
80+
<TextContent>
81+
<Text component={TextVariants.h4}>
82+
This action requires login. Please login to Pbench Dashboard to continue.
83+
</Text>
84+
</TextContent>
85+
</Modal>
86+
</React.Fragment>
87+
);
88+
}
89+
}
90+
91+
export default LoginModal;

src/e2e/search.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ beforeAll(async () => {
1313
await page.goto('http://localhost:8000/dashboard/');
1414

1515
await page.click('#nav-toggle > svg');
16-
await page.click('#page-sidebar > div > nav > ul > li:nth-child(2) > a');
16+
await page.click('#page-sidebar > div > nav > ul > li:nth-child(3) > a');
1717
await page.click('#nav-toggle > svg');
1818

1919
// Intercept network requests

0 commit comments

Comments
 (0)