Skip to content

Commit

Permalink
Fixing configuration, stations fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
cruizba committed Dec 25, 2018
1 parent 312bff2 commit fb74f29
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 37 deletions.
12 changes: 9 additions & 3 deletions frontend-bikesurbanfleets/src/main/configuration/SchemaParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,15 @@ export default class {
let bikeSchemas: Array<any> = stationSchema.properties.bikes.anyOf;
let finalBikeSchema = bikeSchemas[0];
let finalStationSchema = _.cloneDeep(stationSchema);
delete finalStationSchema.properties.bikes.anyOf;
finalStationSchema.properties.bikes = finalBikeSchema;
delete finalStationSchema.properties.bikes.maximum;
let schProperties = finalStationSchema.properties;
delete schProperties.bikes.anyOf;
schProperties.bikes = finalBikeSchema;
delete schProperties.bikes.maximum;
delete schProperties.availablebikes;
delete schProperties.reservedbikes;
delete schProperties.reservedslots;
delete schProperties.availableslots;
console.log(finalStationSchema);
return finalStationSchema;
}

Expand Down
4 changes: 4 additions & 0 deletions frontend-bikesurbanfleets/src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ export namespace Main {
shell.openExternal(url); // opens links (or dragged documents) in external browser
});


menu.webContents.openDevTools();


menu.loadURL('file://' + app.getAppPath() + '/frontend/index.html#/menu');

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ export class ConfigurationComponent {
/*
* Variables for configuration
*/
globalData: GlobalConfiguration = {
boundingBox: {
northWest: { latitude: 0, longitude:0 },
southEast: { latitude: 0, longitude:0 }
}
};
globalData: GlobalConfiguration;
entryPoints: Array<EntryPoint> = new Array<any>();
stations: Array<Station> = new Array<any>();

Expand Down Expand Up @@ -149,10 +144,6 @@ export class ConfigurationComponent {
this.defineMapEventHandlers();
}

bboxChanged(data: any) {
Object.assign(this.globalData.boundingBox, data);
}

defineMapEventHandlers() {
this.map.on('draw:created', (event: any) => {
let layer: Layer = event.layer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,8 @@ export class ConfigurationLeaflethandler {
// If rectangle is passed, the call comes from the map editor, so the new boundingBox is
// created based in the rectangle drawn in the map
if(rectangle instanceof Rectangle) {
Object.assign(comp.globalData, comp.gsForm.actualData);
let bBox = comp.globalData.boundingBox;
bBox.northWest.latitude = rectangle.getBounds().getNorthWest().lat;
bBox.northWest.longitude = rectangle.getBounds().getNorthWest().lng;
bBox.southEast.latitude = rectangle.getBounds().getSouthEast().lat;
bBox.southEast.longitude = rectangle.getBounds().getSouthEast().lng;
comp.featureGroup.addLayer(rectangle);
comp.hasBoundingBox = true;
comp.gsForm.resetForm();
}

//If bbox is passed (not the rectangle figure), the call comes after loading a global configuration
Expand All @@ -41,7 +34,6 @@ export class ConfigurationLeaflethandler {
let southEastLon = rectangle.southEast.longitude;
let newRectangleBbox = new Rectangle([[northWestLat, northWestLng], [southEastLat, southEastLon]]);
comp.featureGroup.addLayer(newRectangleBbox);
comp.gsForm.resetForm();
}
}

Expand Down
9 changes: 1 addition & 8 deletions fuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,7 @@ Sparky.task('build:frontend:renderer', () => {
template: path.join(projectRoot.frontend.renderer(), 'index.html'),
path: '.'
}),
JSONPlugin(),
production && QuantumPlugin({
bakeApiIntoBundle : false,
target : 'electron',
treeshake: true,
removeExportsInterop: false,
uglify: true
})
JSONPlugin()
]
});

Expand Down
6 changes: 0 additions & 6 deletions schema/schemas-and-form-definitions/global-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ export const layout =
{key: "totalSimulationTime", placeholder: "Total simulation time in seconds."},
{key: "reservationTime", placeholder: "Maximum time for reserves in seconds."},
{key: "randomSeed", placeholder: "Random Seed"},
{key: "recommendationSystemType", placeholder: "Type of the Recommendation System"},
{key: "graphManagerType", placeholder: "Type of graph Manager"},
{key: "maxDistanceRecommendation", placeholder: "Max distance recommended by the system"},
{key: "boundingBox", htmlClass: "bold-text"},
{key: "boundingBox.northWest.latitude", placeholder: "Nort-West latitude", title: "North latitude"},
{key: "boundingBox.northWest.longitude", placeholder: "Nort-West longitude", title: "North longitude"},
{key: "boundingBox.southEast.latitude", placeholder: "South-West latitude", title: "South latitude"},
{key: "boundingBox.southEast.longitude", placeholder: "South-West longitude", title: "South longitude"},
{key: "debugMode", placeholder: "If checked, log files will be generated"}
];
4 changes: 2 additions & 2 deletions schema/schemas-and-form-definitions/stations-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export const Station = sObject({

export const layout =
[
{key: "position.latitude", placeholder: "Latitude"},
{key: "position.longitude", placeholder: "Longitude"},
{key: "id", placeholder: "Station id for the simulator"},
{key: "oficialID", placeholder: "Optional id"},
{key: "capacity", type: "number", placeholder: "Capacity of the station"},
{key: "bikes", type: "number", placeholder: "Number of bikes at the station"}
];

0 comments on commit fb74f29

Please sign in to comment.