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

Addition of Overview page in the dashboard #105

Merged
merged 3 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
5 changes: 1 addition & 4 deletions src/components/LoginForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from '@patternfly/react-core';
import { connect } from 'dva';
import styles from './index.less';
import { validateEmail } from '@/utils/validator';

const mapStateToProps = state => {
const { auth } = state;
Expand All @@ -27,10 +26,8 @@ const LoginForm = props => {

const handleUsernameChange = val => {
setUsername(val);
const validEmail = validateEmail(val);
setErrors({
...errors,
...validEmail,
});
};

Expand Down Expand Up @@ -72,7 +69,7 @@ const LoginForm = props => {
const form = (
<div className={styles.section}>
<Form className={styles.section}>
<FormGroup label="Email address" isRequired fieldId="horizontal-form-name">
<FormGroup label="Username" isRequired fieldId="horizontal-form-name">
<TextInput
isRequired
type="text"
Expand Down
4 changes: 2 additions & 2 deletions src/components/RowSelection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export default class RowSelection extends React.Component {
{' '}
Mark as unread
</DropdownItem>,
<DropdownItem key="favourite" onClick={favoriteResult}>
Mark Favourited
<DropdownItem key="favorite" onClick={favoriteResult}>
Mark Favorited
</DropdownItem>,
<DropdownSeparator key="separator" />,
<DropdownItem key="delete" onClick={deleteResult}>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ExpiringResults/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class ExpiringResults extends Component {
});
};

showDrowpdown = (e, id) => {
showDropdown = (e, id) => {
// Stop propagation from going to the next page
e.stopPropagation();

Expand Down Expand Up @@ -251,7 +251,7 @@ class ExpiringResults extends Component {
return (
<div>
anishaswain marked this conversation as resolved.
Show resolved Hide resolved
<EllipsisVIcon
onClick={e => this.showDrowpdown(e, `newrun${row.result}`)}
onClick={e => this.showDropdown(e, `newrun${row.result}`)}
className="dropbtn"
/>
<div id={`newrun${row.result}`} style={{ display: 'none' }}>
Expand Down
35 changes: 6 additions & 29 deletions src/pages/Overview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
AccordionContent,
AccordionToggle,
Label,
Switch,
Modal,
Alert,
AlertGroup,
Expand All @@ -31,6 +30,8 @@ import { formatDate, getDiffDays, getDiffDate } from '../../utils/moment_constan
import Table from '@/components/Table';
import styles from './index.less';

const expiringLimit = 15;
dbutenhof marked this conversation as resolved.
Show resolved Hide resolved

@connect(({ global, user, loading, dashboard }) => ({
selectedDateRange: global.selectedDateRange,
selectedControllers: global.selectedControllers,
Expand Down Expand Up @@ -84,7 +85,7 @@ class Overview extends React.Component {
const savedData = totalResultData.filter(x => x.serverMetadata.dashboard.saved === true);
const newData = totalResultData.filter(x => x.serverMetadata.dashboard.saved !== true);
const expiringData = totalResultData.filter(
x => getDiffDays(x.serverMetadata['server.deletion']) < 15
x => getDiffDays(x.serverMetadata['server.deletion']) < expiringLimit
);
this.setState({ newData, savedData, expiringData });
}
Expand Down Expand Up @@ -142,7 +143,7 @@ class Overview extends React.Component {
});
};

showDrowpdown = (e, id) => {
showDropdown = (e, id) => {
// Stop propagation from going to the next page
e.stopPropagation();

Expand Down Expand Up @@ -239,19 +240,6 @@ class Overview extends React.Component {
}
}

handleChange() {
const { expiringData, newData } = this.state;
if (expiringData.length > 0) {
this.setState({
expiringData: [],
});
} else {
this.setState({
expiringData: newData.filter(x => getDiffDays(x.serverMetadata['server.deletion']) < 15),
});
}
}

handleModalToggle(e, rows) {
// Stop propagation from going to the next page
if (e !== null) {
Expand Down Expand Up @@ -366,7 +354,7 @@ class Overview extends React.Component {
return (
<div>
<EllipsisVIcon
onClick={e => this.showDrowpdown(e, `newrun${row.result}`)}
onClick={e => this.showDropdown(e, `newrun${row.result}`)}
className="dropbtn"
/>
<div id={`newrun${row.result}`} style={{ display: 'none' }}>
Expand Down Expand Up @@ -496,7 +484,7 @@ class Overview extends React.Component {
return (
<div>
<EllipsisVIcon
onClick={e => this.showDrowpdown(e, `newrun${row.result}`)}
onClick={e => this.showDropdown(e, `newrun${row.result}`)}
className="dropbtn"
/>
<div
Expand Down Expand Up @@ -599,17 +587,6 @@ class Overview extends React.Component {
<Text component={TextVariants.h1}> Overview</Text>
</TextContent>
</GridItem>
<GridItem style={{ textAlign: 'right' }}>
{' '}
<Switch
id="simple-switch"
label="Has expiring runs"
labelOff="Doesn't have expiring runs"
isChecked={expiringData.length > 0}
onChange={() => this.handleChange()}
className={styles.paddingBig}
/>
</GridItem>
</Grid>
</Grid>
<Grid hasGutter span={12}>
Expand Down