Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert EmptyObject #576

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
68 changes: 38 additions & 30 deletions frontend/src/components/empty-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,41 @@ import {

import { NavLink } from 'react-router-dom';

export class EmptyObject extends React.Component {
static propTypes = {
headingText: PropTypes.string,
bodyText: PropTypes.string,
returnLink: PropTypes.string,
returnLinkText: PropTypes.string
};
render () {
return (
<React.Fragment>
<EmptyState>
<EmptyStateHeader icon={<EmptyStateIcon icon={SearchIcon} />} />
<Text component="h1" size="lg">
{this.props.headingText ? this.props.headingText : 'This object couldn\'t be found.'}
</Text>
<EmptyStateBody>
{this.props.bodyText ? this.props.bodyText : 'Either the object doesn\'t exist or the ID is invalid.'}
</EmptyStateBody>
<EmptyStateFooter>
<NavLink style={{ color: 'white' }} to={!this.props.returnLink ? '' : this.props.returnLink}>
<Button variant="primary" style = {{ margin: '25px' }}>
{this.props.returnLinkText ? this.props.returnLinkText : 'Return to dashboard'}
</Button>
</NavLink>
</EmptyStateFooter>
</EmptyState>
</React.Fragment>
);
}
}
const EmptyObject = (props) => {
const {
headingText,
bodyText,
returnLink,
returnLinkText
} = props;

return (
<React.Fragment>
<EmptyState>
<EmptyStateHeader icon={<EmptyStateIcon icon={SearchIcon} />} />
<Text component="h1" size="lg">
{headingText ? headingText : 'This object couldn\'t be found.'}
</Text>
<EmptyStateBody>
{bodyText ? bodyText : 'Either the object doesn\'t exist or the ID is invalid.'}
</EmptyStateBody>
<EmptyStateFooter>
<NavLink style={{ color: 'white' }} to={!returnLink ? '' : returnLink}>
<Button variant="primary" style = {{ margin: '25px' }}>
{returnLinkText ? returnLinkText : 'Return to dashboard'}
</Button>
</NavLink>
</EmptyStateFooter>
</EmptyState>
</React.Fragment>
);
};

EmptyObject.propTypes = {
headingText: PropTypes.string,
bodyText: PropTypes.string,
returnLink: PropTypes.string,
returnLinkText: PropTypes.string
};

export default EmptyObject;
1 change: 0 additions & 1 deletion frontend/src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export { ClassificationDropdown, MultiClassificationDropdown } from './classification-dropdown';
export { ClassifyFailuresTable } from './classify-failures';
export { DownloadButton } from './download-button';
export { EmptyObject } from './empty-object';
export { IbutsuPage } from './ibutsu-page';
2 changes: 1 addition & 1 deletion frontend/src/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

import { HttpClient } from './services/http';
import { Settings } from './settings';
import { EmptyObject } from './components';
import EmptyObject from './components/empty-object';
import ResultView from './components/result';


Expand Down
2 changes: 1 addition & 1 deletion frontend/src/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ import {
} from './utilities';
import {
DownloadButton,
EmptyObject,
ClassifyFailuresTable,
} from './components';
import EmptyObject from './components/empty-object';
import { FilterTable } from './components/filtertable';
import ResultView from './components/result';
import TabTitle from './components/tabs';
Expand Down
Loading