adds global route settings
This commit is contained in:
@@ -211,7 +211,7 @@ define([
|
||||
// get current row data (important!)
|
||||
// -> "rowData" param is not current state, values are "on createCell()" state
|
||||
rowData = tableApi.row( $(cell).parents('tr')).data();
|
||||
let routeData = module.getRouteRequestDataFromRowData(rowData);
|
||||
let routeData = module.getRouteRequestDataFromRowData(rowData, module._systemData.mapId);
|
||||
|
||||
// overwrite some params
|
||||
routeData.skipSearch = 0;
|
||||
@@ -242,7 +242,7 @@ define([
|
||||
// get current row data (important!)
|
||||
// -> "rowData" param is not current state, values are "on createCell()" state
|
||||
rowData = tableApi.row( $(cell).parents('tr')).data();
|
||||
let routeData = module.getRouteRequestDataFromRowData(rowData);
|
||||
let routeData = module.getRouteRequestDataFromRowData(rowData, module._systemData.mapId);
|
||||
|
||||
// overwrite some params
|
||||
routeData.skipSearch = 0;
|
||||
@@ -318,6 +318,8 @@ define([
|
||||
// add "Rally Point" systems to table
|
||||
let systemsToData = module.getRallySystemsData(module._systemData.mapId);
|
||||
systemsToData.push(...systemsTo);
|
||||
|
||||
// set global routeSettings
|
||||
|
||||
module.drawRouteTable(module._systemData.mapId, module._systemFromData, systemsToData);
|
||||
});
|
||||
@@ -441,7 +443,7 @@ define([
|
||||
skipSearch: requestRouteData.length >= defaultRoutesCount
|
||||
};
|
||||
|
||||
requestRouteData.push(this.getRouteRequestDataFromRowData(searchData));
|
||||
requestRouteData.push(this.getRouteRequestDataFromRowData(searchData, mapId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -481,7 +483,23 @@ define([
|
||||
* @param {Object} rowData
|
||||
* @returns {Object}
|
||||
*/
|
||||
getRouteRequestDataFromRowData(rowData){
|
||||
getRouteRequestDataFromRowData(rowData, mapId){
|
||||
|
||||
// Here we need to retrieve the stored settings stored as "routeSettings" in the map module.
|
||||
// This can be done with the function :
|
||||
// Util.getLocalStorage('map').getItem(mapId);
|
||||
// however this returns a promise, and I do not know how to make the return below wait for the promise to
|
||||
// call back without using something like:
|
||||
// async getRouteRequestDataFromRowData(rowData, mapId){
|
||||
// let routeSettings = await Util.getLocalStorage('map').getItem(mapId).routeSettings;
|
||||
// return {
|
||||
// ...
|
||||
// };
|
||||
// }
|
||||
// In theory if the storedLocal data can be retrieved here into a var we can just modify the returned object below
|
||||
// to incorporate these settings like:
|
||||
// wormholesThera: (rowData.hasOwnProperty('wormholesThera')) ? rowData.wormholesThera | 0 : routeSettings.wormholesThera | 1,
|
||||
|
||||
return {
|
||||
mapIds: (rowData.hasOwnProperty('mapIds')) ? rowData.mapIds : [],
|
||||
systemFromData: (rowData.hasOwnProperty('systemFromData')) ? rowData.systemFromData : {},
|
||||
@@ -532,7 +550,7 @@ define([
|
||||
let routeData = [];
|
||||
|
||||
this._tableApi.rows().every(function(){
|
||||
routeData.push(module.getRouteRequestDataFromRowData(this.data()));
|
||||
routeData.push(module.getRouteRequestDataFromRowData(this.data(), module._systemData.mapId));
|
||||
});
|
||||
|
||||
this.getRouteData({routeData: routeData}, 'callbackAddRouteRows');
|
||||
@@ -889,7 +907,17 @@ define([
|
||||
id: this._config.routeSettingsDialogId,
|
||||
selectClass: this._config.systemDialogSelectClass,
|
||||
systemSelectOptions: systemSelectOptions,
|
||||
maxSelectionLength: maxSelectionLength
|
||||
maxSelectionLength: maxSelectionLength, //remove comma
|
||||
// new options
|
||||
select2Class: Util.config.select2Class,
|
||||
routeDialogSizeSelectId: this._config.routeDialogSizeSelectId,
|
||||
select2Class: Util.config.select2Class,
|
||||
sizeOptions: MapUtil.allConnectionJumpMassTypes().map(type => ({
|
||||
id: type,
|
||||
name: type,
|
||||
selected: false
|
||||
}))
|
||||
|
||||
};
|
||||
|
||||
requirejs(['text!templates/dialog/route_settings.html', 'mustache'], (template, Mustache) => {
|
||||
@@ -910,15 +938,38 @@ define([
|
||||
callback: e => {
|
||||
let form = $(e.delegateTarget).find('form');
|
||||
// get all system data from select2
|
||||
|
||||
let systemSelectData = form.find('.' + this._config.systemDialogSelectClass).select2('data');
|
||||
let systemsToData = [];
|
||||
|
||||
// route settings additions
|
||||
let routeSettingsData = $(form).getFormValues();
|
||||
|
||||
if(
|
||||
routeSettingsData
|
||||
){
|
||||
let routeSettings = {
|
||||
stargates: routeSettingsData.hasOwnProperty('stargates') ? parseInt(routeSettingsData.stargates) : 0,
|
||||
jumpbridges: routeSettingsData.hasOwnProperty('jumpbridges') ? parseInt(routeSettingsData.jumpbridges) : 0,
|
||||
wormholes: routeSettingsData.hasOwnProperty('wormholes') ? parseInt(routeSettingsData.wormholes) : 0,
|
||||
wormholesReduced: routeSettingsData.hasOwnProperty('wormholesReduced') ? parseInt(routeSettingsData.wormholesReduced) : 0,
|
||||
wormholesCritical: routeSettingsData.hasOwnProperty('wormholesCritical') ? parseInt(routeSettingsData.wormholesCritical) : 0,
|
||||
wormholesEOL: routeSettingsData.hasOwnProperty('wormholesEOL') ? parseInt(routeSettingsData.wormholesEOL) : 0,
|
||||
wormholesThera: routeSettingsData.hasOwnProperty('wormholesThera') ? parseInt(routeSettingsData.wormholesThera) : 0,
|
||||
wormholesSizeMin: routeSettingsData.wormholesSizeMin || '',
|
||||
excludeTypes: SystemRouteModule.getLowerSizeConnectionTypes(routeSettingsData.wormholesSizeMin),
|
||||
endpointsBubble: routeSettingsData.hasOwnProperty('endpointsBubble') ? parseInt(routeSettingsData.endpointsBubble) : 0,
|
||||
};
|
||||
Util.getLocalStore('map').setItem(`${dialogData.mapId}.routeSettings`, routeSettings);
|
||||
}
|
||||
// end route settings additions
|
||||
|
||||
if(systemSelectData.length > 0){
|
||||
systemsToData = SystemRouteModule.formSystemSelectData(systemSelectData);
|
||||
Util.getLocalStore('map').setItem(`${dialogData.mapId}.routes`, systemsToData);
|
||||
}else{
|
||||
Util.getLocalStore('map').removeItem(`${dialogData.mapId}.routes`);
|
||||
}
|
||||
}
|
||||
|
||||
this.showNotify({title: 'Route settings stored', type: 'success'});
|
||||
|
||||
@@ -935,6 +986,9 @@ define([
|
||||
// -> add some delay until modal transition has finished
|
||||
let systemTargetSelect = $(e.target).find('.' + this._config.systemDialogSelectClass);
|
||||
systemTargetSelect.delay(240).initSystemSelect({key: 'id', maxSelectionLength: maxSelectionLength});
|
||||
|
||||
// init connection jump size select -------------------------------------------------------------------
|
||||
$(e.target).find('#' + this._config.routeDialogSizeSelectId).initConnectionSizeSelect();
|
||||
});
|
||||
|
||||
// show dialog
|
||||
|
||||
@@ -211,7 +211,7 @@ define([
|
||||
// get current row data (important!)
|
||||
// -> "rowData" param is not current state, values are "on createCell()" state
|
||||
rowData = tableApi.row( $(cell).parents('tr')).data();
|
||||
let routeData = module.getRouteRequestDataFromRowData(rowData);
|
||||
let routeData = module.getRouteRequestDataFromRowData(rowData, module._systemData.mapId);
|
||||
|
||||
// overwrite some params
|
||||
routeData.skipSearch = 0;
|
||||
@@ -242,7 +242,7 @@ define([
|
||||
// get current row data (important!)
|
||||
// -> "rowData" param is not current state, values are "on createCell()" state
|
||||
rowData = tableApi.row( $(cell).parents('tr')).data();
|
||||
let routeData = module.getRouteRequestDataFromRowData(rowData);
|
||||
let routeData = module.getRouteRequestDataFromRowData(rowData, module._systemData.mapId);
|
||||
|
||||
// overwrite some params
|
||||
routeData.skipSearch = 0;
|
||||
@@ -318,6 +318,8 @@ define([
|
||||
// add "Rally Point" systems to table
|
||||
let systemsToData = module.getRallySystemsData(module._systemData.mapId);
|
||||
systemsToData.push(...systemsTo);
|
||||
|
||||
// set global routeSettings
|
||||
|
||||
module.drawRouteTable(module._systemData.mapId, module._systemFromData, systemsToData);
|
||||
});
|
||||
@@ -441,7 +443,7 @@ define([
|
||||
skipSearch: requestRouteData.length >= defaultRoutesCount
|
||||
};
|
||||
|
||||
requestRouteData.push(this.getRouteRequestDataFromRowData(searchData));
|
||||
requestRouteData.push(this.getRouteRequestDataFromRowData(searchData, mapId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -481,7 +483,23 @@ define([
|
||||
* @param {Object} rowData
|
||||
* @returns {Object}
|
||||
*/
|
||||
getRouteRequestDataFromRowData(rowData){
|
||||
getRouteRequestDataFromRowData(rowData, mapId){
|
||||
|
||||
// Here we need to retrieve the stored settings stored as "routeSettings" in the map module.
|
||||
// This can be done with the function :
|
||||
// Util.getLocalStorage('map').getItem(mapId);
|
||||
// however this returns a promise, and I do not know how to make the return below wait for the promise to
|
||||
// call back without using something like:
|
||||
// async getRouteRequestDataFromRowData(rowData, mapId){
|
||||
// let routeSettings = await Util.getLocalStorage('map').getItem(mapId).routeSettings;
|
||||
// return {
|
||||
// ...
|
||||
// };
|
||||
// }
|
||||
// In theory if the storedLocal data can be retrieved here into a var we can just modify the returned object below
|
||||
// to incorporate these settings like:
|
||||
// wormholesThera: (rowData.hasOwnProperty('wormholesThera')) ? rowData.wormholesThera | 0 : routeSettings.wormholesThera | 1,
|
||||
|
||||
return {
|
||||
mapIds: (rowData.hasOwnProperty('mapIds')) ? rowData.mapIds : [],
|
||||
systemFromData: (rowData.hasOwnProperty('systemFromData')) ? rowData.systemFromData : {},
|
||||
@@ -532,7 +550,7 @@ define([
|
||||
let routeData = [];
|
||||
|
||||
this._tableApi.rows().every(function(){
|
||||
routeData.push(module.getRouteRequestDataFromRowData(this.data()));
|
||||
routeData.push(module.getRouteRequestDataFromRowData(this.data(), module._systemData.mapId));
|
||||
});
|
||||
|
||||
this.getRouteData({routeData: routeData}, 'callbackAddRouteRows');
|
||||
@@ -889,7 +907,17 @@ define([
|
||||
id: this._config.routeSettingsDialogId,
|
||||
selectClass: this._config.systemDialogSelectClass,
|
||||
systemSelectOptions: systemSelectOptions,
|
||||
maxSelectionLength: maxSelectionLength
|
||||
maxSelectionLength: maxSelectionLength, //remove comma
|
||||
// new options
|
||||
select2Class: Util.config.select2Class,
|
||||
routeDialogSizeSelectId: this._config.routeDialogSizeSelectId,
|
||||
select2Class: Util.config.select2Class,
|
||||
sizeOptions: MapUtil.allConnectionJumpMassTypes().map(type => ({
|
||||
id: type,
|
||||
name: type,
|
||||
selected: false
|
||||
}))
|
||||
|
||||
};
|
||||
|
||||
requirejs(['text!templates/dialog/route_settings.html', 'mustache'], (template, Mustache) => {
|
||||
@@ -910,15 +938,38 @@ define([
|
||||
callback: e => {
|
||||
let form = $(e.delegateTarget).find('form');
|
||||
// get all system data from select2
|
||||
|
||||
let systemSelectData = form.find('.' + this._config.systemDialogSelectClass).select2('data');
|
||||
let systemsToData = [];
|
||||
|
||||
// route settings additions
|
||||
let routeSettingsData = $(form).getFormValues();
|
||||
|
||||
if(
|
||||
routeSettingsData
|
||||
){
|
||||
let routeSettings = {
|
||||
stargates: routeSettingsData.hasOwnProperty('stargates') ? parseInt(routeSettingsData.stargates) : 0,
|
||||
jumpbridges: routeSettingsData.hasOwnProperty('jumpbridges') ? parseInt(routeSettingsData.jumpbridges) : 0,
|
||||
wormholes: routeSettingsData.hasOwnProperty('wormholes') ? parseInt(routeSettingsData.wormholes) : 0,
|
||||
wormholesReduced: routeSettingsData.hasOwnProperty('wormholesReduced') ? parseInt(routeSettingsData.wormholesReduced) : 0,
|
||||
wormholesCritical: routeSettingsData.hasOwnProperty('wormholesCritical') ? parseInt(routeSettingsData.wormholesCritical) : 0,
|
||||
wormholesEOL: routeSettingsData.hasOwnProperty('wormholesEOL') ? parseInt(routeSettingsData.wormholesEOL) : 0,
|
||||
wormholesThera: routeSettingsData.hasOwnProperty('wormholesThera') ? parseInt(routeSettingsData.wormholesThera) : 0,
|
||||
wormholesSizeMin: routeSettingsData.wormholesSizeMin || '',
|
||||
excludeTypes: SystemRouteModule.getLowerSizeConnectionTypes(routeSettingsData.wormholesSizeMin),
|
||||
endpointsBubble: routeSettingsData.hasOwnProperty('endpointsBubble') ? parseInt(routeSettingsData.endpointsBubble) : 0,
|
||||
};
|
||||
Util.getLocalStore('map').setItem(`${dialogData.mapId}.routeSettings`, routeSettings);
|
||||
}
|
||||
// end route settings additions
|
||||
|
||||
if(systemSelectData.length > 0){
|
||||
systemsToData = SystemRouteModule.formSystemSelectData(systemSelectData);
|
||||
Util.getLocalStore('map').setItem(`${dialogData.mapId}.routes`, systemsToData);
|
||||
}else{
|
||||
Util.getLocalStore('map').removeItem(`${dialogData.mapId}.routes`);
|
||||
}
|
||||
}
|
||||
|
||||
this.showNotify({title: 'Route settings stored', type: 'success'});
|
||||
|
||||
@@ -935,6 +986,9 @@ define([
|
||||
// -> add some delay until modal transition has finished
|
||||
let systemTargetSelect = $(e.target).find('.' + this._config.systemDialogSelectClass);
|
||||
systemTargetSelect.delay(240).initSystemSelect({key: 'id', maxSelectionLength: maxSelectionLength});
|
||||
|
||||
// init connection jump size select -------------------------------------------------------------------
|
||||
$(e.target).find('#' + this._config.routeDialogSizeSelectId).initConnectionSizeSelect();
|
||||
});
|
||||
|
||||
// show dialog
|
||||
|
||||
@@ -26,5 +26,103 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="pf-dynamic-area"><i class="fas fa-filter"></i> Filter</h4>
|
||||
|
||||
{{! Filter ------------------------------------------------------------------- }}
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-xs-12 col-sm-5">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-2 col-sm-3 control-label">Type</label>
|
||||
|
||||
<div class="col-sm-offset-1 col-xs-3 col-sm-8 checkbox checkbox-primary">
|
||||
<input id="form_wormholes" name="wormholes" value="1" type="checkbox" checked>
|
||||
<label for="form_wormholes">Wormholes
|
||||
<i class="fas fa-fw fa-question-circle pf-help-light" title="include wormhole connections"></i>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<i class="fas fa-tree-child col-sm-offset-4 hidden-xs"></i>
|
||||
|
||||
<div class="col-xs-4 checkbox checkbox-warning checkbox-circle">
|
||||
<input id="form_wormholes_reduced" name="wormholesReduced" value="1" type="checkbox" checked>
|
||||
<label for="form_wormholes_reduced">Stage 2 (reduced)
|
||||
<i class="fas fa-fw fa-question-circle pf-help-light" title="include reduced connections"></i>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<i class="fas fa-tree-child col-sm-offset-4 hidden-xs"></i>
|
||||
|
||||
<div class="col-xs-3 checkbox checkbox-danger checkbox-circle">
|
||||
<input id="form_wormholes_critical" name="wormholesCritical" value="1" type="checkbox" checked>
|
||||
<label for="form_wormholes_critical">Stage 3 (critical)
|
||||
<i class="fas fa-fw fa-question-circle pf-help-light" title="include critical connections"></i>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<i class="fas fa-tree-child col-sm-offset-4 hidden-xs"></i>
|
||||
|
||||
<div class="col-xs-offset-9 col-xs-3 checkbox checkbox-danger">
|
||||
<input id="form_wormholes_eol" name="wormholesEOL" value="1" type="checkbox" checked>
|
||||
<label for="form_wormholes_eol">End of life (EOL)
|
||||
<i class="fas fa-fw fa-question-circle pf-help-light" title="include EOL connections"></i>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-offset-2 col-sm-offset-4 col-xs-3 col-sm-8 checkbox checkbox-primary">
|
||||
<input id="form_stargates" name="stargates" value="1" type="checkbox" checked>
|
||||
<label for="form_stargates">Stargates
|
||||
<i class="fas fa-fw fa-question-circle pf-help-light" title="include stargate connections"></i>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-offset-4 col-xs-3 col-sm-8 checkbox checkbox-primary">
|
||||
<input id="form_jumpbridges" name="jumpbridges" value="1" type="checkbox" checked>
|
||||
<label for="form_jumpbridges">Jump Bridges
|
||||
<i class="fas fa-fw fa-question-circle pf-help-light" title="include jump bridge connections"></i>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-7">
|
||||
<div class="form-group">
|
||||
<label for="{{routeDialogSizeSelectId}}" class="col-sm-2 control-label">Size min</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="wormholesSizeMin" id="{{routeDialogSizeSelectId}}" class="form-control {{select2Class}}">
|
||||
{{#sizeOptions}}
|
||||
<option value="{{id}}">{{name}}</option>
|
||||
{{/sizeOptions}}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-offset-3 col-xs-6 col-sm-4">
|
||||
<div class="pf-dynamic-area">
|
||||
<div class="form-group">
|
||||
<div class="col-xs-offset-1 checkbox checkbox-default">
|
||||
<input id="form_connections_thera" name="wormholesThera" value="1" type="checkbox" checked>
|
||||
<label for="form_connections_thera">Thera
|
||||
<i class="fas fa-fw fa-question-circle pf-help-light" title="include known Thera connections"></i>
|
||||
<a target="_blank" href="//www.eve-scout.com" rel="noopener"><em>eve-scout.com</em></a>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-offset-1 checkbox checkbox-default">
|
||||
<input id="form_endpoints_bubble" name="endpointsBubble" value="1" type="checkbox" checked>
|
||||
<label for="form_endpoints_bubble">Bubbled
|
||||
<i class="fas fa-fw fa-question-circle pf-help-light" title="include bubbled source/destination endpoints"></i>
|
||||
<span class="pf-endpoint-bubble"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
Reference in New Issue
Block a user