- added "no data found" information in case system jump/kill data not found for a k-space system (e.g. cronjob has not imported data)

- fixed a bug in /setup page where "eve_universe" could not be created properly
- fixed a bug with drag&drop re-order of module positions
This commit is contained in:
Mark Friedrich
2018-09-16 15:18:23 +02:00
parent 712764294c
commit baf524a350
12 changed files with 82 additions and 58 deletions

View File

@@ -118,24 +118,29 @@ class System extends Controller\AccessController {
// 10min cache (could be up to 1h cache time)
$systemLogModel->getByForeignKey('systemId', $systemId, [], 60 * 10);
$systemLogExists = !$systemLogModel->dry();
if( !$systemLogModel->dry() ){
$counter = 0;
for( $i = $logEntryCount; $i >= 1; $i--){
$column = 'value' . $i;
// podKills share graph with shipKills -> skip
if($label != 'podKills'){
$graphData[$systemId][$label]['logExists'] = $systemLogExists;
}
// ship and pod kills should be merged into one table
if($label == 'podKills'){
$graphData[$systemId]['shipKills'][$counter]['z'] = $systemLogModel->$column;
}else{
$dataSet = [
'x' => ($i - 1) . 'h',
'y' => $systemLogModel->$column
];
$graphData[$systemId][$label][] = $dataSet;
}
$counter++;
$counter = 0;
for( $i = $logEntryCount; $i >= 1; $i--){
$column = 'value' . $i;
$value = $systemLogExists ? $systemLogModel->$column : 0;
// ship and pod kills should be merged into one table
if($label == 'podKills'){
$graphData[$systemId]['shipKills']['data'][$counter]['z'] = $value;
}else{
$dataSet = [
'x' => ($i - 1) . 'h',
'y' => $value
];
$graphData[$systemId][$label]['data'][] = $dataSet;
}
$counter++;
}
}
}

View File

@@ -175,12 +175,12 @@ class Universe extends Controller {
* @var $system Model\Universe\SystemModel
*/
$system = Model\Universe\BasicUniverseModel::getNew('SystemModel');
$systems = $system->find();
$systemIds = $systems->getAll('id');
if(count($systemIds)){
sort($systemIds, SORT_NUMERIC);
$f3->set(self::SESSION_KEY_SYSTEM_IDS, $systemIds);
if($systems = $system->find()){
$systemIds = $systems->getAll('id');
if(count($systemIds)){
sort($systemIds, SORT_NUMERIC);
$f3->set(self::SESSION_KEY_SYSTEM_IDS, $systemIds);
}
}
}

View File

@@ -277,13 +277,15 @@ define([
}
// find correct position for new moduleElement ----------------------------------------------------
let position = getModulePosition(this.parentElement, defaultPosition);
let position = getModulePosition(this.parentElement, '.' + config.moduleClass, defaultPosition);
this.moduleElement.attr('data-position', defaultPosition);
this.moduleElement.attr('data-module', Module.config.moduleName);
// insert at correct position ---------------------------------------------------------------------
let prevModuleElement = this.parentElement.find('.' + config.moduleClass + ':nth-child(' + position + ')');
// -> no :nth-child or :nth-of-type here because there might be temporary "spacer" div "modules"
// that should be ignored for positioning
let prevModuleElement = this.parentElement.find('.' + config.moduleClass).filter(i => ++i === position);
if(prevModuleElement.length) {
this.moduleElement.insertAfter(prevModuleElement);
} else {
@@ -639,13 +641,14 @@ define([
/**
* get module position
* @param parentElement
* @param childSelector
* @param defaultPosition
* @returns {number}
*/
let getModulePosition = (parentElement, defaultPosition) => {
let getModulePosition = (parentElement, childSelector, defaultPosition) => {
let position = 0;
if(defaultPosition > 0){
parentElement.children().each((i, moduleElement) => {
parentElement.children(childSelector).each((i, moduleElement) => {
position = i + 1;
let tempPosition = parseInt(moduleElement.getAttribute('data-position')) || 0;
if(tempPosition >= defaultPosition){
@@ -1006,7 +1009,7 @@ define([
}
// find correct position for new tabs -----------------------------------------------------------------
let position = getModulePosition(tabBar, defaultPosition);
let position = getModulePosition(tabBar, '.' + config.mapTabClass, defaultPosition);
tabListElement.attr('data-position', defaultPosition);
// insert at correct position -------------------------------------------------------------------------

View File

@@ -73,20 +73,21 @@ define([
* @param eventLine
*/
let initGraph = function(graphElement, graphKey, graphData, eventLine){
if(graphData.length > 0){
let labelYFormat = function(y){
return Math.round(y);
};
if(
graphData.logExists &&
graphData.data &&
graphData.data.length
){
let graphConfig = {
element: graphElement,
data: graphData,
data: graphData.data,
xkey: 'x',
ykeys: getInfoForGraph(graphKey, 'ykeys'),
labels: getInfoForGraph(graphKey, 'labels'),
parseTime: false,
ymin: 0,
yLabelFormat: labelYFormat,
yLabelFormat: value => Math.round(value),
padding: 10,
hideHover: true,
pointSize: 3,
@@ -115,6 +116,9 @@ define([
}
Morris.Area(graphConfig);
}else{
// make container a bit smaller -> no graph shown
graphElement.css('height', '22px').text('No data');
}
};
@@ -161,8 +165,8 @@ define([
let timeInHours = Math.floor(timeSinceUpdate / 3600);
let timeInMinutes = Math.floor((timeSinceUpdate % 3600) / 60);
let timeInMinutesPercent = ( timeInMinutes / 60 ).toFixed(2);
let eventLine = timeInHours + timeInMinutesPercent;
let timeInMinutesPercent = parseFloat((timeInMinutes / 60).toFixed(2));
let eventLine = timeInHours * timeInMinutesPercent;
// graph is from right to left -> convert event line
eventLine = 23 - eventLine;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -277,13 +277,15 @@ define([
}
// find correct position for new moduleElement ----------------------------------------------------
let position = getModulePosition(this.parentElement, defaultPosition);
let position = getModulePosition(this.parentElement, '.' + config.moduleClass, defaultPosition);
this.moduleElement.attr('data-position', defaultPosition);
this.moduleElement.attr('data-module', Module.config.moduleName);
// insert at correct position ---------------------------------------------------------------------
let prevModuleElement = this.parentElement.find('.' + config.moduleClass + ':nth-child(' + position + ')');
// -> no :nth-child or :nth-of-type here because there might be temporary "spacer" div "modules"
// that should be ignored for positioning
let prevModuleElement = this.parentElement.find('.' + config.moduleClass).filter(i => ++i === position);
if(prevModuleElement.length) {
this.moduleElement.insertAfter(prevModuleElement);
} else {
@@ -639,13 +641,14 @@ define([
/**
* get module position
* @param parentElement
* @param childSelector
* @param defaultPosition
* @returns {number}
*/
let getModulePosition = (parentElement, defaultPosition) => {
let getModulePosition = (parentElement, childSelector, defaultPosition) => {
let position = 0;
if(defaultPosition > 0){
parentElement.children().each((i, moduleElement) => {
parentElement.children(childSelector).each((i, moduleElement) => {
position = i + 1;
let tempPosition = parseInt(moduleElement.getAttribute('data-position')) || 0;
if(tempPosition >= defaultPosition){
@@ -1006,7 +1009,7 @@ define([
}
// find correct position for new tabs -----------------------------------------------------------------
let position = getModulePosition(tabBar, defaultPosition);
let position = getModulePosition(tabBar, '.' + config.mapTabClass, defaultPosition);
tabListElement.attr('data-position', defaultPosition);
// insert at correct position -------------------------------------------------------------------------

View File

@@ -73,20 +73,21 @@ define([
* @param eventLine
*/
let initGraph = function(graphElement, graphKey, graphData, eventLine){
if(graphData.length > 0){
let labelYFormat = function(y){
return Math.round(y);
};
if(
graphData.logExists &&
graphData.data &&
graphData.data.length
){
let graphConfig = {
element: graphElement,
data: graphData,
data: graphData.data,
xkey: 'x',
ykeys: getInfoForGraph(graphKey, 'ykeys'),
labels: getInfoForGraph(graphKey, 'labels'),
parseTime: false,
ymin: 0,
yLabelFormat: labelYFormat,
yLabelFormat: value => Math.round(value),
padding: 10,
hideHover: true,
pointSize: 3,
@@ -115,6 +116,9 @@ define([
}
Morris.Area(graphConfig);
}else{
// make container a bit smaller -> no graph shown
graphElement.css('height', '22px').text('No data');
}
};
@@ -161,8 +165,8 @@ define([
let timeInHours = Math.floor(timeSinceUpdate / 3600);
let timeInMinutes = Math.floor((timeSinceUpdate % 3600) / 60);
let timeInMinutesPercent = ( timeInMinutes / 60 ).toFixed(2);
let eventLine = timeInHours + timeInMinutesPercent;
let timeInMinutesPercent = parseFloat((timeInMinutes / 60).toFixed(2));
let eventLine = timeInHours * timeInMinutesPercent;
// graph is from right to left -> convert event line
eventLine = 23 - eventLine;

View File

@@ -1249,8 +1249,8 @@ input[type="email"]{
border-radius: 5px;
padding: 5px;
color: #666;
background: rgba(red( $gray-darkest), green($gray-darkest), blue($gray-darkest), 0.9);
border: solid 2px $teal-dark;
background: rgba($gray-darkest, 0.85);
//border: solid 2px $teal-dark;
font-family: 'Oxygen Bold';
font-size: 10px;
text-align: left;

View File

@@ -4,6 +4,7 @@
border-radius: 5px;
padding: 7px;
box-shadow: 0 4px 10px rgba(0,0,0,0.4);
z-index: 100; // over "gallery slider"
background: {
color: rgba(43, 43, 43, 0.7);
}

View File

@@ -115,6 +115,10 @@
position: relative;
width: 100%;
height: 100px;
display: flex;
justify-content: center;
align-items: center;
@include transition(height .18s ease-out); // height is reduced when no graph shown
}
}

View File

@@ -33,7 +33,7 @@
z-index: 999999;
overflow: hidden;
background: #000;
background: rgba(0, 0, 0, 0.9);
background: rgba(0, 0, 0, 0.3);
opacity: 0;
display: none;
direction: ltr;
@@ -77,11 +77,11 @@
}
.blueimp-gallery,
.blueimp-gallery > .slides > .slide > .slide-content {
-webkit-transition: opacity 0.5s linear;
-moz-transition: opacity 0.5s linear;
-ms-transition: opacity 0.5s linear;
-o-transition: opacity 0.5s linear;
transition: opacity 0.5s linear;
-webkit-transition: opacity 0.15s linear;
-moz-transition: opacity 0.15s linear;
-ms-transition: opacity 0.15s linear;
-o-transition: opacity 0.15s linear;
transition: opacity 0.15s linear;
}
.blueimp-gallery > .slides > .slide-loading {
// background: url(../img/loading.gif) center no-repeat;