Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.
527 changes: 393 additions & 134 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"devDependencies": {
"@babel/preset-react": "^7.9.4",
"babel-eslint": "^10.1.0",
"copy-webpack-plugin": "^4.1.1",
"copy-webpack-plugin": "^6.0.1",
"css-loader": "^2.1.0",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
Expand Down
57 changes: 30 additions & 27 deletions src/app-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,50 @@ import { mapModel } from "../src/components/map/map-model";
import storage from "./dataStore";
import { initView } from "./index";
import {
apiConfig,
userInfo
apiConfig,
userInfo
} from "./dataStore/api-config";
import {
resetAnimationOnFocus,
resetTransitionAnimation
resetAnimationOnFocus,
resetTransitionAnimation
}
from "./utils/helper";
from "./utils/helper";

export function initBeforeLogin() {
initDateKeeper();
initDateKeeper();
}

export function loginToSession(api) {
apiConfig.api = api;
return new Promise(resolve => {
apiConfig.api.getSession(session => {
userInfo.setUserInfo(session.userName, session.database, session.sessionId);
resolve();
});
});
export function loginToSession(api, state) {
apiConfig.api = api;
apiConfig.state = state;
return new Promise(resolve => {
apiConfig.api.getSession((session, server) => {
userInfo.setUserInfo(session.userName, session.database, session.sessionId, server);
resolve();
});
});
};

export function initAfterLogin() {
storage.dateKeeper$.resume();
initView();
layerModel.initLayers();
mapModel.locateUserAndSetView();
resetAnimationOnFocus();
storage.dateKeeper$.resume();
initView();
layerModel.initLayers();
mapModel.locateUserAndSetView();
resetAnimationOnFocus();

initRealTimeFeedRunner();
initHistoricalFeedRunner();
initRealTimeFeedRunner();
initHistoricalFeedRunner();
}

export function handleBlur() {
storage.dateKeeper$.pause();
console.log("Blurred!");
storage.dateKeeper$.pause();
console.log("Blurred!");
}

export function handleFocus() {
storage.dateKeeper$.resume();
resetTransitionAnimation();
console.log("Focused!");
export function handleFocus(api, state) {
apiConfig.api = api;
apiConfig.state = state;
storage.dateKeeper$.resume();
resetTransitionAnimation();
console.log("Focused!");
}
44 changes: 22 additions & 22 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import {
initBeforeLogin,
initAfterLogin,
loginToSession,
handleFocus,
handleBlur
initBeforeLogin,
initAfterLogin,
loginToSession,
handleFocus,
handleBlur
} from "./app-helper";

import {
geotabStandAlone
geotabStandAlone
} from "./utils/stand-alone/geotab";

if (typeof geotab === "undefined") {
window.geotab = geotabStandAlone;
window.geotab = geotabStandAlone;
}

geotab.addin.realTimeMap = function realTimeMapAddIn() {
return {
initialize(api, state, callback) {
return {
initialize(api, state, callback) {

initBeforeLogin();
initBeforeLogin();

loginToSession(api).then(() => {
loginToSession(api, state).then(() => {

initAfterLogin();
callback();
initAfterLogin();
callback();

});
},
});
},

focus() {
handleFocus();
},
focus(api, state) {
handleFocus(api, state);
},

blur() {
handleBlur();
}
};
blur() {
handleBlur();
}
};
};
138 changes: 69 additions & 69 deletions src/components/configuration/configuration-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,81 +8,81 @@ import { exceptionSearch } from "./exception-config/exception-search";
import { deviceSearch } from "./vehicles-config/vehicle-search";

export class ConfigView extends React.Component {
constructor(props) {
super(props);
this.state = {
exceptionsSearchList: [],
statuses: [],
devices: [],
exceptionDisplayList: [],
statusDisplayList: [],
vehicleDisplayList: []
};
this.setExceptions = this.setExceptions.bind(this);
this.setExceptionsList = this.setExceptionsList.bind(this);
this.setStatusList = this.setStatusList.bind(this);
this.setVehicleList = this.setVehicleList.bind(this);
this.setStatuses = this.setStatuses.bind(this);
this.setDevices = this.setDevices.bind(this);
}
constructor(props) {
super(props);
this.state = {
exceptionsSearchList: [],
statuses: [],
devices: [],
exceptionDisplayList: [],
statusDisplayList: [],
vehicleDisplayList: []
};
this.setExceptions = this.setExceptions.bind(this);
this.setExceptionsList = this.setExceptionsList.bind(this);
this.setStatusList = this.setStatusList.bind(this);
this.setVehicleList = this.setVehicleList.bind(this);
this.setStatuses = this.setStatuses.bind(this);
this.setDevices = this.setDevices.bind(this);
}

setExceptions(props) {
this.setState({ exceptionsSearchList: props });
}
setExceptions(props) {
this.setState({ exceptionsSearchList: props });
}

setExceptionsList(props) {
this.setState({ exceptionDisplayList: props });
}
setExceptionsList(props) {
this.setState({ exceptionDisplayList: props });
}

setStatusList(props) {
this.setState({ statusDisplayList: props });
}
setStatusList(props) {
this.setState({ statusDisplayList: props });
}

setVehicleList(props) {
this.setState({ vehicleDisplayList: props });
}
setVehicleList(props) {
this.setState({ vehicleDisplayList: props });
}

setStatuses(props) {
this.setState({ statuses: props });
}
setStatuses(props) {
this.setState({ statuses: props });
}

setDevices(props) {
this.setState({ devices: props });
}
setDevices(props) {
this.setState({ devices: props });
}

componentDidMount() {
exceptionSearch.init(this.setExceptions);
diagnosticSearch.init(this.setStatuses);
deviceSearch.init(this.setDevices);
exceptionSearch.loadSavedExceptionConfig(this.setExceptionsList);
diagnosticSearch.loadSavedStatusConfig(this.setStatusList);
deviceSearch.loadSavedDeviceConfig(this.setVehicleList);
initCollapse();
}
componentDidMount() {
exceptionSearch.init(this.setExceptions);
diagnosticSearch.init(this.setStatuses);
deviceSearch.init(this.setDevices);
exceptionSearch.loadSavedExceptionConfig(this.setExceptionsList);
diagnosticSearch.loadSavedStatusConfig(this.setStatusList);
deviceSearch.loadSavedDeviceConfig(this.setVehicleList);
initCollapse();
}

render() {
return (
<div id="RTM-config-view">
<div id="RTM-config-container">
<div id="RTM-config-header" className="">
<ExceptionsTab
exceptions={this.state.exceptionsSearchList}
exceptionDisplayList={this.state.exceptionDisplayList}
onClick={this.setExceptionsList}
/>
<StatusTab
statuses={this.state.statuses}
statusDisplayList={this.state.statusDisplayList}
onClick={this.setStatusList}
/>
<VehiclesTab
devices={this.state.devices}
vehicleDisplayList={this.state.vehicleDisplayList}
onClick={this.setVehicleList}
/>
</div>
</div>
</div>
);
}
render() {
return (
<div id="RTM-config-view">
<div id="RTM-config-container">
<div id="RTM-config-header" className="">
<VehiclesTab
devices={this.state.devices}
vehicleDisplayList={this.state.vehicleDisplayList}
onClick={this.setVehicleList}
/>
<StatusTab
statuses={this.state.statuses}
statusDisplayList={this.state.statusDisplayList}
onClick={this.setStatusList}
/>
<ExceptionsTab
exceptions={this.state.exceptionsSearchList}
exceptionDisplayList={this.state.exceptionDisplayList}
onClick={this.setExceptionsList}
/>
</div>
</div>
</div>
);
}
}
62 changes: 31 additions & 31 deletions src/components/configuration/exception-config/exceptions-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,38 @@ import { ExceptionListComponent } from "./exception-list-component";
import { ExceptionToggleButtons } from "./exception-toggle-buttons";

export const ExceptionsTab = props => (
<div>
<button
id="RTM-ExceptionTitle"
className="RTM-Tab RTM-TabSelected"
onClick={() => configuration.selectTab("RTM-ExceptionTitle")}
>
Exceptions
<div>
<button
id="RTM-ExceptionTitle"
className="RTM-Tab RTM-TabNotSelected"
onClick={() => configuration.selectTab("RTM-ExceptionTitle")}
>
Exceptions
</button>
<div id="exception-tab" className="RTM-config-info">
<ExceptionFormComponent
exceptions={props.exceptions}
setExceptionsDisplay={props.onClick}
/>
<div className="config-Header">
<p>Selected Exceptions:</p>
<div className="toggleButtonDiv" id="ToggleExceptionButtons">
<ExceptionToggleButtons setExceptionsDisplay={props.onClick} />
</div>
</div>
<div id="exception-tab" className="RTM-config-info">
<ExceptionFormComponent
exceptions={props.exceptions}
setExceptionsDisplay={props.onClick}
/>
<div className="config-Header">
<p>Selected Exceptions:</p>
<div className="toggleButtonDiv" id="ToggleExceptionButtons">
<ExceptionToggleButtons setExceptionsDisplay={props.onClick} />
</div>
</div>

<div id="RTM-exceptions-view">
<div className="config-list">
<div>
<ul className="mdc-list" id="ExceptionsList">
<ExceptionListComponent
exceptionDisplayList={props.exceptionDisplayList}
setExceptionsDisplay={props.onClick}
/>
</ul>
</div>
</div>
<div id="RTM-exceptions-view">
<div className="config-list">
<div>
<ul className="mdc-list" id="ExceptionsList">
<ExceptionListComponent
exceptionDisplayList={props.exceptionDisplayList}
setExceptionsDisplay={props.onClick}
/>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
Loading