mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
add mode maintenance VC pandora_enterprise#4822
This commit is contained in:
parent
3099ffa7cb
commit
19cfc84a39
@ -3708,6 +3708,8 @@ function visual_map_print_visual_map(
|
||||
|
||||
// End function
|
||||
// Start function
|
||||
|
||||
|
||||
/**
|
||||
* Get a list with the layouts for a user.
|
||||
*
|
||||
@ -3719,8 +3721,6 @@ function visual_map_print_visual_map(
|
||||
*
|
||||
* @return array A list of layouts the user can see.
|
||||
*/
|
||||
|
||||
|
||||
function visual_map_get_user_layouts(
|
||||
$id_user=0,
|
||||
$only_names=false,
|
||||
@ -3729,6 +3729,7 @@ function visual_map_get_user_layouts(
|
||||
$favourite=false,
|
||||
$check_user_groups=true
|
||||
) {
|
||||
$where = '';
|
||||
if (! is_array($filter)) {
|
||||
$filter = [];
|
||||
} else {
|
||||
@ -3814,12 +3815,12 @@ function visual_map_get_user_layouts(
|
||||
$retval = [];
|
||||
foreach ($layouts as $layout) {
|
||||
if ($only_names) {
|
||||
$retval[$layout['id']] = $layout['name'];
|
||||
$retval[$layout['id']]['name'] = $layout['name'];
|
||||
} else {
|
||||
$retval[$layout['id']] = $layout;
|
||||
}
|
||||
|
||||
// add_perms
|
||||
// Aad_perms.
|
||||
if (isset($groups[$layout['id_group']]['vconsole_view'])) {
|
||||
$retval[$layout['id']]['vr'] = $groups[$layout['id_group']]['vconsole_view'];
|
||||
}
|
||||
|
@ -1386,6 +1386,12 @@ function dashboardLoadVC(settings) {
|
||||
: "dashboard"
|
||||
);
|
||||
|
||||
if (settings.props.maintenanceMode != null) {
|
||||
if (settings.props.maintenanceMode.user !== settings.id_user) {
|
||||
visualConsoleManager.visualConsole.enableMaintenanceMode();
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.mobile_view_orientation_vc === true) {
|
||||
$(window).on("orientationchange", function() {
|
||||
$(container).width($(window).height());
|
||||
|
@ -248,6 +248,7 @@ final class Container extends Model
|
||||
*/
|
||||
private static function extractMaintenanceMode(array $data)
|
||||
{
|
||||
global $config;
|
||||
$maintenance_mode = static::notEmptyStringOr(
|
||||
static::issetInArray(
|
||||
$data,
|
||||
@ -262,6 +263,12 @@ final class Container extends Model
|
||||
$result = null;
|
||||
if ($maintenance_mode !== null) {
|
||||
$result = json_decode($maintenance_mode, true);
|
||||
|
||||
$result['date'] = date(
|
||||
$config['date_format'],
|
||||
$result['timestamp']
|
||||
);
|
||||
|
||||
$result['timestamp'] = human_time_description_raw(
|
||||
(time() - $result['timestamp'])
|
||||
);
|
||||
|
@ -7,13 +7,11 @@
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#visual-console-container.is-maintenance {
|
||||
border: 2px solid green;
|
||||
|
||||
.is-maintenance {
|
||||
background-image: url(maintenanceMode.png) !important;
|
||||
}
|
||||
|
||||
#visual-console-container.is-maintenance :nth-child(1) {
|
||||
.is-maintenance :nth-child(1) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -358,6 +358,7 @@ class Visualmap
|
||||
'uniq' => $uniq,
|
||||
'mobile' => true,
|
||||
'vcId' => $visualConsoleId,
|
||||
'id_user' => $config['id_user'],
|
||||
'mobile_view_orientation_vc' => (bool) !$config['mobile_view_orientation_vc'],
|
||||
]
|
||||
);
|
||||
|
@ -281,6 +281,12 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
|
||||
"<?php echo get_parameter('hash', ''); ?>"
|
||||
);
|
||||
|
||||
if(props.maintenanceMode != null) {
|
||||
if(props.maintenanceMode.user !== '<?php echo $config['id_user']; ?>') {
|
||||
visualConsoleManager.visualConsole.enableMaintenanceMode();
|
||||
}
|
||||
}
|
||||
|
||||
var controls = document.getElementById('vc-controls');
|
||||
autoHideElement(controls, 1000);
|
||||
|
||||
|
@ -417,22 +417,20 @@ if ($pure === false) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
$style_edit_mode = '';
|
||||
$disabled_edit_mode = false;
|
||||
if ($aclManage === true) {
|
||||
$style = '';
|
||||
$value_maintenance_mode = true;
|
||||
if ($maintenanceMode === null) {
|
||||
$style = ' style="visibility:hidden"';
|
||||
$value_maintenance_mode = false;
|
||||
} else {
|
||||
if ($maintenanceMode['user'] !== $config['id_user']) {
|
||||
$style_edit_mode = ' style="visibility:hidden"';
|
||||
$disabled_edit_mode = true;
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div id="maintenance-mode-control" class="flex-column" '.$style.'>';
|
||||
echo '<div id="maintenance-mode-control" class="flex-column">';
|
||||
echo html_print_label(
|
||||
__('Maintenance Mode'),
|
||||
__('Maintenance'),
|
||||
'maintenance-mode',
|
||||
true
|
||||
);
|
||||
@ -445,9 +443,9 @@ if ($pure === false) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '<div id="edit-mode-control" class="flex-column" '.$style_edit_mode.'>';
|
||||
echo html_print_label(__('Edit Mode'), 'edit-mode', true);
|
||||
echo html_print_checkbox_switch('edit-mode', 1, false, true);
|
||||
echo '<div id="edit-mode-control" class="flex-column">';
|
||||
echo html_print_label(__('Edit'), 'edit-mode', true);
|
||||
echo html_print_checkbox_switch('edit-mode', 1, false, true, $disabled_edit_mode);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
@ -705,15 +703,13 @@ ui_require_css_file('form');
|
||||
if(newProps.maintenanceMode != null) {
|
||||
$('input[name=maintenance-mode]').prop('checked', true);
|
||||
if(newProps.maintenanceMode.user !== '<?php echo $config['id_user']; ?>') {
|
||||
$('#edit-mode-control').css('visibility', 'hidden');
|
||||
$('#maintenance-mode-control').css('visibility', '');
|
||||
$('input[name=edit-mode]').prop('disabled', true);
|
||||
} else {
|
||||
$('#edit-mode-control').css('visibility', '');
|
||||
$('input[name=edit-mode]').prop('disabled', false);
|
||||
}
|
||||
} else {
|
||||
$('input[name=maintenance-mode]').prop('checked', false);
|
||||
$('#edit-mode-control').css('visibility', '');
|
||||
$('#maintenance-mode-control').css('visibility', '');
|
||||
$('input[name=edit-mode]').prop('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -751,18 +747,12 @@ if ($edit_capable === true) {
|
||||
if ($(this).prop('checked')) {
|
||||
visualConsoleManager.visualConsole.enableEditMode();
|
||||
visualConsoleManager.changeUpdateInterval(0);
|
||||
$('#force_check_control').hide();
|
||||
$('#edit-controls').css('visibility', '');
|
||||
$('#maintenance-mode-control').css('visibility', '');
|
||||
} else {
|
||||
visualConsoleManager.visualConsole.disableEditMode();
|
||||
visualConsoleManager.visualConsole.unSelectItems();
|
||||
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>); // To ms.
|
||||
$('#force_check_control').show();
|
||||
$('#edit-controls').css('visibility', 'hidden');
|
||||
if(maintenanceMode != null && maintenanceMode.user !== '<?php echo $config['id_user']; ?>') {
|
||||
$('#maintenance-mode-control').css('visibility', 'hidden');
|
||||
}
|
||||
}
|
||||
|
||||
resetInterval();
|
||||
@ -783,9 +773,9 @@ if ($edit_capable === true) {
|
||||
msg += '<?php echo __('Are you sure you wish to disable maintenance mode'); ?>';
|
||||
msg += '?';
|
||||
} else {
|
||||
msg = '<?php echo __('The visual console has been in maintenance mode since'); ?>';
|
||||
msg += ' ' + maintenanceMode.timestamp;
|
||||
msg += ' ' + '<?php echo __('by user'); ?>';
|
||||
msg = '<?php echo __('The visual console was set to maintenance mode'); ?>';
|
||||
msg += ' ' + '<span title="'+maintenanceMode.date+'">' + maintenanceMode.timestamp + '</span>';
|
||||
msg += ' ' + '<?php echo __('ago by user'); ?>';
|
||||
msg += ' ' + maintenanceMode.user;
|
||||
msg += '. ' + '<?php echo __('Are you sure you wish to disable maintenance mode'); ?>';
|
||||
msg += '?';
|
||||
|
@ -159,10 +159,10 @@ export interface VisualConsoleProps extends Size {
|
||||
backgroundColor: string | null;
|
||||
isFavorite: boolean;
|
||||
relationLineWidth: number;
|
||||
maintenanceMode: maintenanceModeInterface | null;
|
||||
maintenanceMode: MaintenanceModeInterface | null;
|
||||
}
|
||||
|
||||
export interface maintenanceModeInterface {
|
||||
export interface MaintenanceModeInterface {
|
||||
user: string;
|
||||
timestamp: number;
|
||||
}
|
||||
|
@ -7,13 +7,11 @@
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#visual-console-container.is-maintenance {
|
||||
border: 2px solid green;
|
||||
|
||||
.is-maintenance {
|
||||
background-image: url(./lib/maintenanceMode.png) !important;
|
||||
}
|
||||
|
||||
#visual-console-container.is-maintenance :nth-child(1) {
|
||||
.is-maintenance :nth-child(1) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user