Skip to content

Commit

Permalink
fix 1666
Browse files Browse the repository at this point in the history
fix #1666


fix sonar


fix


Modification ajax et manager

optimize notif update


phase 2


fix


increment update


fix
  • Loading branch information
cyrilphoenix71 committed Jan 25, 2020
1 parent b872afa commit f4c4a5f
Show file tree
Hide file tree
Showing 37 changed files with 690 additions and 366 deletions.
3 changes: 2 additions & 1 deletion assets/css/components/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
.btn-box-tool {
padding: 8px 5px;
}
.btn-action-bar {
.btn-action-bar,
.box-footer .btn {
margin-bottom: 2px;
margin-top: 2px;
}
Expand Down
5 changes: 5 additions & 0 deletions assets/css/containers/_containers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@
.form-control {
width: auto;
}
legend {
width: auto;
margin-right: auto;
padding-right: 20px;
}
}
.form-group-light {
margin-bottom: 4px;
Expand Down
3 changes: 3 additions & 0 deletions assets/css/divers/_positions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
.spacing-top-big {
margin-top: 10px !important;
}
.spacing-top-big-three {
margin-top: 30px !important;
}
.no-spacing {
margin-right: 0 !important;
}
Expand Down
9 changes: 9 additions & 0 deletions assets/css/pages/_modals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
min-height: 0;
pre {
margin: 0;
overflow: scroll;
}
}
.ui-dialog-content {
Expand Down Expand Up @@ -131,3 +132,11 @@
.modal-padding {
padding: 15px !important;
}
.modal-pre-full {
height: calc(100% - 30px);
width: calc(100% - 30px);
position: absolute;
bottom: 0;
top: 0;
margin: 15px 0 !important;
}
3 changes: 2 additions & 1 deletion assets/css/themes/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ html {

/* Progressbar */
.box-body .progress,
.tab-pane .progress {
.tab-pane .progress,
.form-group .progress {
background-color: map_get($color_theme, 'color7') !important;
}

Expand Down
12 changes: 6 additions & 6 deletions assets/js/core/log.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ nextdom.log.autoupdate = function (queryParams) {
} else {
queryParams['search'].value('');
}
queryParams.display.scrollTop(queryParams.display.height() + 200000);
queryParams.display.scrollTop(queryParams.display.innerHeight()+scrollTopToDown);
if (queryParams['control'].attr('data-state') == 0) {
queryParams['control'].attr('data-state', 1);
}
Expand All @@ -80,7 +80,7 @@ nextdom.log.autoupdate = function (queryParams) {
$(this).removeClass('btn-success').addClass('btn-warning');
$(this).html('<i class="fas fa-pause spacing-right"></i>{{Pause}}');
$(this).attr('data-state', 1);
queryParams.display.scrollTop(queryParams.display.height() + 200000);
queryParams.display.scrollTop(queryParams.display.innerHeight()+scrollTopToDown);
nextdom.log.autoupdate(queryParams);
}
});
Expand Down Expand Up @@ -115,21 +115,21 @@ nextdom.log.autoupdate = function (queryParams) {
}
}
queryParams.display.text(log);
queryParams.display.scrollTop(queryParams.display.height() + 200000);
queryParams.display.scrollTop(queryParams.display.innerHeight()+scrollTopToDown);
if (nextdom.log.timeout !== null) {
clearTimeout(jeedom.log.timeout);
clearTimeout(nextdom.log.timeout);
}
nextdom.log.timeout = setTimeout(function () {
nextdom.log.autoupdate(queryParams)
}, 1000);
}, 500);
},
error: function () {
if (nextdom.log.timeout !== null) {
clearTimeout(jeedom.log.timeout);
}
nextdom.log.timeout = setTimeout(function () {
nextdom.log.autoupdate(queryParams)
}, 1000);
}, 500);
},
});
};
9 changes: 7 additions & 2 deletions assets/js/core/update.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,10 @@ nextdom.update.saves = function (queryParams) {
};

nextdom.update.number = function (queryParams) {
nextdom.private.ajax('Update', 'nbUpdate', queryParams, false, false, false);
};
var params = $.extend({}, nextdom.private.default_params, queryParams || {});
var ajaxParams = nextdom.private.getParamsAJAX(params, 'Update', 'nbUpdate');
if (queryParams !== undefined && queryParams.hasOwnProperty('filter')) {
ajaxParams.data['filter'] = json_encode(queryParams.filter);
}
nextdom.private.ajaxCall(ajaxParams);
};
6 changes: 4 additions & 2 deletions assets/js/desktop/diagnostic/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ initEvents();
*/
function loadInformations() {
$(document).ready(function () {
$('pre').height($(window).height() - 339);
$('#ul_object').height($(window).height() - 339);
$('pre').height($(window).height() - 300);
$('#ul_object').height($(window).height() - 279);
$('#ul_object').css("overflow-y", "auto");
$('#ul_object').css("padding-right", "5px");
sortList("#ul_object", "timing");
Expand Down Expand Up @@ -122,6 +122,7 @@ function initEvents() {
// Display log by alphabetic sort
$("#bt_LogAlphabetic").on('click', function (event) {
sortList("#ul_object", "log");
$(".li_log").removeClass('active');
$('.li_log').first().addClass('active');
$('#bt_LogAlphabetic').removeClass('btn-action').addClass('btn-info');
$('#bt_LogChronologic').removeClass('btn-info').addClass('btn-action');
Expand All @@ -131,6 +132,7 @@ function initEvents() {
// Display log by timing sort
$("#bt_LogChronologic").on('click', function (event) {
sortList("#ul_object", "timing");
$(".li_log").removeClass('active');
$('.li_log').first().addClass('active');
$('#bt_LogChronologic').removeClass('btn-action').addClass('btn-info');
$('#bt_LogAlphabetic').removeClass('btn-info').addClass('btn-action');
Expand Down
64 changes: 63 additions & 1 deletion assets/js/desktop/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,36 @@ function refreshUpdateNumber() {
}
}
});
if($('#spanNbUpdates').length){
nextdom.update.number({
filter: ['core', 'plugin', 'widget', 'script'],
error: function (error) {
notify("Erreur", error.message, 'error');
},
success: function (updatesData) {
var updateSum = 0;
for (var updateIndex in updatesData) {
var target = $('#spanNbUpdates-' + updatesData[updateIndex].type);
var targetCount = updatesData[updateIndex].count;
updateSum += targetCount;
if (targetCount == 0) {
target.hide();
}
else {
target.html(targetCount);
target.show();
}
}
if (updateSum == 0) {
$('#spanNbUpdates').hide();
}
else {
$('#spanNbUpdates').html(updateSum);
$('#spanNbUpdates').hide();
}
}
});
}
}

/**
Expand Down Expand Up @@ -406,18 +436,50 @@ function displayClock() {
* Adjust size and position of jquery modales
*/
function modalesAdjust() {
var modals = [$('#md_modal'), $('#md_modal2')];
var modals = [$('#md_modal'), $('#md_modal2'), $('#md_pageHelp')];
modals.forEach(function (modal) {
if (modal.is(':ui-dialog')) {
modal.dialog('option', 'width', getModalWidth());
modal.dialog('option', 'height', getModalHeight());
modal.dialog('option', 'position', {my: 'center', at: 'center', of: window});
}
});
}

/**
* Calcul modal width depend of width screen
*/
function getModalWidth() {
if (jQuery(window).width() < 1000) {
return '96%';
}
return '80%';
}

/**
* Calcul modal width depend of width screen
*/
function getModalHeight() {
return (jQuery(window).height() - 100);
}

/**
* Set new progress bar value
*
* @param progressElement the progress element to set.
* @param newValue new progress value.
*/
function setProgressBar(progressElement, newValue) {
if (newValue == 0) {
progressStatus = 0;
}
$(progressElement).attr('aria-valuenow',newValue);
$(progressElement).css('width',newValue + '%');
$(progressElement).find('span').html(newValue + '%');
if ($(progressElement).parent().hasClass('progress') && $(progressElement).parent().next('span').length>0) {
let spanValue = $(progressElement).parent().next('span').html();
let spanSplit = spanValue.split('%');
spanSplit[0] = newValue + '%';
$(progressElement).parent().next('span').html(spanSplit.join(''));
}
}
68 changes: 68 additions & 0 deletions assets/js/desktop/inits.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function initPage(){
initTextArea();
initEventHandler();
initFields();
initModals();

// Trig page loaded
$('body').trigger('nextdom_page_load');
Expand Down Expand Up @@ -179,3 +180,70 @@ function initTextArea(){
}
});
}

/**
* Init of modals pages
*/
function initModals(){
// Help modal trigger declaration
$("#md_pageHelp").dialog({
autoOpen: false,
modal: false,
closeText: '',
height: getModalHeight(),
width: getModalWidth(),
resizable: false,
open: function () {
$("body").css({overflow: 'hidden'});
modalesAdjust();
$(".wrapper").addClass("blur");
},
beforeClose: function (event, ui) {
$("body").css({overflow: 'inherit'});
$("#md_pageHelp").empty();
$(".wrapper").removeClass("blur");
}
});

// modal trigger declaration
$("#md_modal").dialog({
autoOpen: false,
modal: false,
closeText: '',
height: getModalHeight(),
width: getModalWidth(),
resizable: false,
open: function () {
$("body").css({overflow: 'hidden'});
modalesAdjust();
$(".wrapper").addClass("blur");
},
beforeClose: function (event, ui) {
$("body").css({overflow: 'inherit'});
$("#md_modal").empty();
$("#md_modal").dialog('option', 'buttons', []);
$(".wrapper").removeClass("blur");
}
});

// modal bis trigger declaration
$("#md_modal2").dialog({
autoOpen: false,
modal: false,
closeText: '',
height: getModalHeight(),
width: getModalWidth(),
resizable: false,
open: function () {
$("body").css({overflow: 'hidden'});
modalesAdjust();
$(".wrapper").addClass("blur");
},
beforeClose: function (event, ui) {
$("body").css({overflow: 'inherit'});
$("#md_modal2").empty();
$("#md_modal2").dialog('option', 'buttons', []);
$(".wrapper").removeClass("blur");
}
});
}
57 changes: 0 additions & 57 deletions assets/js/desktop/loads.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,63 +310,6 @@ $(function () {
});
});

// Help modal trigger declaration
$("#md_pageHelp").dialog({
autoOpen: false,
modal: false,
closeText: '',
height: (jQuery(window).height() - 100),
width: getModalWidth(),
show: { effect: "blind", duration: 200 },
resizable: false,
open: function () {
$("body").css({overflow: 'hidden'});
$(this).dialog("option", "position", {my: "center", at: "center", of: window});
},
beforeClose: function (event, ui) {
$("body").css({overflow: 'inherit'});
$("#md_pageHelp").empty();
}
});

// modal trigger declaration
$("#md_modal").dialog({
autoOpen: false,
modal: false,
closeText: '',
height: (jQuery(window).height() - 100),
width: getModalWidth(),
show: { effect: "blind", duration: 200 },
resizable: false,
open: function () {
$("body").css({overflow: 'hidden'});
$(this).dialog("option", "position", {my: "center", at: "center", of: window});
},
beforeClose: function (event, ui) {
$("body").css({overflow: 'inherit'});
$("#md_modal").empty();
}
});

// modal bis trigger declaration
$("#md_modal2").dialog({
autoOpen: false,
modal: false,
closeText: '',
height: (jQuery(window).height() - 100),
width: getModalWidth(),
show: { effect: "blind", duration: 200 },
resizable: false,
open: function () {
$("body").css({overflow: 'hidden'});
$(this).dialog("option", "position", {my: "center", at: "center", of: window});
},
beforeClose: function (event, ui) {
$("body").css({overflow: 'inherit'});
$("#md_modal2").empty();
}
});

// Prevent close event handler declaration to advise user for exit without saving
$(window).bind('beforeunload', function (e) {
if (modifyWithoutSave) {
Expand Down
2 changes: 2 additions & 0 deletions assets/js/desktop/pages/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ function updateTwoFactorVisibility() {
if (useTwoFactor === 1) {
divLogin.hide();
divTwoFactor.show();
twoFactorInput.focus();
} else {
divLogin.show();
divTwoFactor.hide();
loginInput.focus();
}
}

Expand Down
Loading

0 comments on commit f4c4a5f

Please sign in to comment.