Skip to content
Snippets Groups Projects
Commit 2888b38b authored by Antoine Detailleur's avatar Antoine Detailleur
Browse files

[NRRPLT-8276] CSS and fix names

parent cd726eea
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ import { HashRouter, Switch, Route } from 'react-router-dom'; ...@@ -4,7 +4,7 @@ import { HashRouter, Switch, Route } from 'react-router-dom';
import EntryPage from './components/entry-page/entry-page.js'; import EntryPage from './components/entry-page/entry-page.js';
import ErrorDialog from './components/dialog/error-dialog.js'; import ErrorDialog from './components/dialog/error-dialog.js';
import ToastNotification from './components/dialog/toast-notification.js'; import NotificationDialog from './components/dialog/notification-dialog.js';
import ExperimentOverview from './components/experiment-overview/experiment-overview.js'; import ExperimentOverview from './components/experiment-overview/experiment-overview.js';
class App extends React.Component { class App extends React.Component {
...@@ -12,7 +12,7 @@ class App extends React.Component { ...@@ -12,7 +12,7 @@ class App extends React.Component {
return( return(
<div> <div>
<ErrorDialog /> <ErrorDialog />
<ToastNotification/> <NotificationDialog/>
<HashRouter> <HashRouter>
<Switch> <Switch>
<Route path='/experiments-overview'> <Route path='/experiments-overview'>
......
...@@ -7,6 +7,6 @@ ...@@ -7,6 +7,6 @@
} }
.modal-header{ .modal-header{
background-color: rgb(241, 185, 185); background-color: rgb(238, 173, 173);
color: rgb(138, 41, 41); color: rgb(138, 41, 41);
} }
\ No newline at end of file
...@@ -2,9 +2,24 @@ ...@@ -2,9 +2,24 @@
position: fixed; position: fixed;
bottom: 0; bottom: 0;
right: 0; right: 0;
z-index: 999; z-index: 498;
} }
.no-style{ .no-style{
list-style-type: none; list-style-type: none;
} }
\ No newline at end of file
.toast-width{
max-width: none;
width: 350px;
}
.warning{
background-color:rgb(248, 248, 122);
color:rgb(126, 126, 45);
}
.info{
background-color: rgb(143, 143, 250);
color: rgb(48, 48, 134)
}
...@@ -3,7 +3,7 @@ import { Toast } from 'react-bootstrap'; ...@@ -3,7 +3,7 @@ import { Toast } from 'react-bootstrap';
import DialogService from '../../services/dialog-service.js'; import DialogService from '../../services/dialog-service.js';
import './toast-notification.css'; import './notification-dialog.css';
class NotificationDialog extends React.Component{ class NotificationDialog extends React.Component{
constructor(props){ constructor(props){
...@@ -27,9 +27,18 @@ class NotificationDialog extends React.Component{ ...@@ -27,9 +27,18 @@ class NotificationDialog extends React.Component{
} }
onNotification(notification) { onNotification(notification) {
this.setState({ // avoid duplicates
notifications: [...this.state.notifications, notification] var isIn = false;
this.state.notifications.forEach((notif) =>{
if (notification.type===notif.type && notification.message===notif.message){
isIn = true;
}
}); });
if (!isIn){
this.setState({
notifications: [...this.state.notifications, notification]
});
}
} }
handleClose(index) { handleClose(index) {
...@@ -44,14 +53,14 @@ class NotificationDialog extends React.Component{ ...@@ -44,14 +53,14 @@ class NotificationDialog extends React.Component{
let notifications = this.state.notifications; let notifications = this.state.notifications;
return( return(
<div className='toast-notification-wrapper'> <div className='toast-notification-wrapper'>
{!notifications.length==0? {notifications.length!==0?
<ol> <ol>
{notifications.map((notification, index) => { {notifications.map((notification, index) => {
return ( return (
<li key={index} className='no-style'> <li key={index} className='no-style'>
<Toast onClose={(index) => this.handleClose(index)}> <Toast className='toast-width' onClose={(index) => this.handleClose(index)}>
<Toast.Header> <Toast.Header className={notification.type==='Warning'? 'warning': 'info'} >
<h4>{notification.type}</h4> <strong className='mr-auto'>{notification.type}</strong>
</Toast.Header> </Toast.Header>
<Toast.Body> <Toast.Body>
{notification.message} {notification.message}
......
...@@ -13,7 +13,7 @@ export default class ExperimentList extends React.Component { ...@@ -13,7 +13,7 @@ export default class ExperimentList extends React.Component {
<ol> <ol>
{this.props.experiments.map(experiment => { {this.props.experiments.map(experiment => {
return ( return (
<li key={experiment.id || experiment.configuration.id} className='nostyle'> <li key={experiment.id || experiment.configuration.id} className='no-style'>
<ExperimentListElement experiment={experiment} <ExperimentListElement experiment={experiment}
availableServers={this.props.availableServers} availableServers={this.props.availableServers}
startingExperiment={this.props.startingExperiment} startingExperiment={this.props.startingExperiment}
......
...@@ -8,7 +8,7 @@ import MockAvailableServers from '../../../../mocks/mock_available-servers.json' ...@@ -8,7 +8,7 @@ import MockAvailableServers from '../../../../mocks/mock_available-servers.json'
import MockSimulations from '../../../../mocks/mock_simulations.json'; import MockSimulations from '../../../../mocks/mock_simulations.json';
import RunningSimulationService from '../running-simulation-service.js'; import RunningSimulationService from '../running-simulation-service.js';
import DialogService from '../../../error-handler-service'; import DialogService from '../../../dialog-service';
import RoslibService from '../../../roslib-service'; import RoslibService from '../../../roslib-service';
import { EXPERIMENT_STATE } from '../../experiment-constants.js'; import { EXPERIMENT_STATE } from '../../experiment-constants.js';
......
...@@ -7,7 +7,7 @@ import 'jest-fetch-mock'; ...@@ -7,7 +7,7 @@ import 'jest-fetch-mock';
import MockServerconfig from '../../../../mocks/mock_server-config.json'; import MockServerconfig from '../../../../mocks/mock_server-config.json';
import ServerResourcesService from '../../../../services/experiments/execution/server-resources-service'; import ServerResourcesService from '../../../../services/experiments/execution/server-resources-service';
import DialogService from '../../../error-handler-service'; import DialogService from '../../../dialog-service';
jest.setTimeout(10000); jest.setTimeout(10000);
......
...@@ -37,14 +37,14 @@ class RemoteExperimentFilesService extends HttpService { ...@@ -37,14 +37,14 @@ class RemoteExperimentFilesService extends HttpService {
return _instance; return _instance;
} }
isSupported (){ isSupported() {
return window.showDirectoryPicker !== undefined && window.showDirectoryPicker !== null; return window.showDirectoryPicker !== undefined && window.showDirectoryPicker !== null;
} }
notifyNotSupported() { notifyNotSupported() {
if (!this.isSupported()){ if (!this.isSupported()){
DialogService.instance.warningNotification({ DialogService.instance.warningNotification({
message : 'The remote experiment files is not supported on ' + browserName() message : 'The remote experiment file system is not supported on ' + browserName()
}); });
} }
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment