mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-26 03:19:05 +02:00
add mode maintenance VC pandora_enterprise#4822
This commit is contained in:
parent
b98b0f3ab3
commit
9c93a99fb2
@ -1,5 +1,7 @@
|
|||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE `tlayout` ADD COLUMN `maintenance_mode` TEXT NULL;
|
||||||
|
|
||||||
ALTER TABLE `tmodule_inventory` ADD COLUMN `script_mode` INT NOT NULL DEFAULT 2;
|
ALTER TABLE `tmodule_inventory` ADD COLUMN `script_mode` INT NOT NULL DEFAULT 2;
|
||||||
ALTER TABLE `tmodule_inventory` ADD COLUMN `script_path` VARCHAR(1000) DEFAULT '';
|
ALTER TABLE `tmodule_inventory` ADD COLUMN `script_path` VARCHAR(1000) DEFAULT '';
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ $ajax = true;
|
|||||||
$render_map = (bool) get_parameter('render_map', false);
|
$render_map = (bool) get_parameter('render_map', false);
|
||||||
$graph_javascript = (bool) get_parameter('graph_javascript', false);
|
$graph_javascript = (bool) get_parameter('graph_javascript', false);
|
||||||
$force_remote_check = (bool) get_parameter('force_remote_check', false);
|
$force_remote_check = (bool) get_parameter('force_remote_check', false);
|
||||||
|
$update_maintanance_mode = (bool) get_parameter('update_maintanance_mode', false);
|
||||||
$load_css_cv = (bool) get_parameter('load_css_cv', false);
|
$load_css_cv = (bool) get_parameter('load_css_cv', false);
|
||||||
|
|
||||||
if ($render_map) {
|
if ($render_map) {
|
||||||
@ -99,3 +100,29 @@ if ($load_css_cv === true) {
|
|||||||
echo $output;
|
echo $output;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($update_maintanance_mode === true) {
|
||||||
|
$idVisualConsole = (int) get_parameter('idVisualConsole', 0);
|
||||||
|
$mode = (bool) get_parameter('mode', false);
|
||||||
|
|
||||||
|
$values = [];
|
||||||
|
if ($mode === true) {
|
||||||
|
$values['maintenance_mode'] = json_encode(
|
||||||
|
[
|
||||||
|
'user' => $config['id_user'],
|
||||||
|
'timestamp' => time(),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$values['maintenance_mode'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = db_process_sql_update(
|
||||||
|
'tlayout',
|
||||||
|
$values,
|
||||||
|
['id' => $idVisualConsole]
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode(['result' => $result]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@ -117,6 +117,17 @@ function createVisualConsole(
|
|||||||
visualConsole.updateElements(items);
|
visualConsole.updateElements(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(visualConsole.props);
|
||||||
|
console.log(id_user);
|
||||||
|
if (
|
||||||
|
visualConsole.props.maintenanceMode != null &&
|
||||||
|
visualConsole.props.maintenanceMode.user !== id_user
|
||||||
|
) {
|
||||||
|
visualConsole.enableMaintenanceMode();
|
||||||
|
} else {
|
||||||
|
visualConsole.disableMaintenanceMode();
|
||||||
|
}
|
||||||
|
|
||||||
// Emit the VC update event.
|
// Emit the VC update event.
|
||||||
if (onUpdate) onUpdate(prevProps, visualConsole.props);
|
if (onUpdate) onUpdate(prevProps, visualConsole.props);
|
||||||
} catch (ignored) {} // eslint-disable-line no-empty
|
} catch (ignored) {} // eslint-disable-line no-empty
|
||||||
@ -151,6 +162,7 @@ function createVisualConsole(
|
|||||||
// Wait to start the fetch interval.
|
// Wait to start the fetch interval.
|
||||||
asyncTaskManager.init("visual-console-start");
|
asyncTaskManager.init("visual-console-start");
|
||||||
} else {
|
} else {
|
||||||
|
console.log("vendria aki");
|
||||||
// Start the fetch interval immediately.
|
// Start the fetch interval immediately.
|
||||||
asyncTaskManager.init("visual-console");
|
asyncTaskManager.init("visual-console");
|
||||||
}
|
}
|
||||||
@ -159,6 +171,7 @@ function createVisualConsole(
|
|||||||
// Initialize the Visual Console.
|
// Initialize the Visual Console.
|
||||||
try {
|
try {
|
||||||
visualConsole = new VisualConsole(container, props, items);
|
visualConsole = new VisualConsole(container, props, items);
|
||||||
|
|
||||||
// VC Item clicked.
|
// VC Item clicked.
|
||||||
visualConsole.onItemClick(function(e) {
|
visualConsole.onItemClick(function(e) {
|
||||||
var data = e.item.props || {};
|
var data = e.item.props || {};
|
||||||
@ -357,7 +370,6 @@ function createVisualConsole(
|
|||||||
})
|
})
|
||||||
.init();
|
.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
// VC Item resized.
|
// VC Item resized.
|
||||||
visualConsole.onItemResized(function(e) {
|
visualConsole.onItemResized(function(e) {
|
||||||
var item = e.item;
|
var item = e.item;
|
||||||
@ -473,6 +485,13 @@ function createVisualConsole(
|
|||||||
updateVisualConsole(visualConsole.props.id, interval, null, dimensions);
|
updateVisualConsole(visualConsole.props.id, interval, null, dimensions);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
forceUpdateVisualConsole: function() {
|
||||||
|
console.log(visualConsole);
|
||||||
|
console.log("Entrando desde el force");
|
||||||
|
asyncTaskManager.cancel("visual-console");
|
||||||
|
asyncTaskManager.cancel("visual-console-start");
|
||||||
|
updateVisualConsole(visualConsole.props.id);
|
||||||
|
},
|
||||||
createItem: function(typeString) {
|
createItem: function(typeString) {
|
||||||
var type;
|
var type;
|
||||||
switch (typeString) {
|
switch (typeString) {
|
||||||
|
@ -90,6 +90,7 @@ final class Container extends Model
|
|||||||
'backgroundURL' => static::extractBackgroundUrl($data),
|
'backgroundURL' => static::extractBackgroundUrl($data),
|
||||||
'relationLineWidth' => (int) $data['relationLineWidth'],
|
'relationLineWidth' => (int) $data['relationLineWidth'],
|
||||||
'hash' => static::extractHash($data),
|
'hash' => static::extractHash($data),
|
||||||
|
'maintenanceMode' => static::extractMaintenanceMode($data),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,6 +239,30 @@ final class Container extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract a background color value.
|
||||||
|
*
|
||||||
|
* @param array $data Unknown input data structure.
|
||||||
|
*
|
||||||
|
* @return mixed String representing the color (not empty) or null.
|
||||||
|
*/
|
||||||
|
private static function extractMaintenanceMode(array $data)
|
||||||
|
{
|
||||||
|
$maintenance_mode = static::notEmptyStringOr(
|
||||||
|
static::issetInArray(
|
||||||
|
$data,
|
||||||
|
[
|
||||||
|
'maintenanceMode',
|
||||||
|
'maintenance_mode',
|
||||||
|
]
|
||||||
|
),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
return ($maintenance_mode !== null) ? json_decode($maintenance_mode, true) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract the "is favorite" switch value.
|
* Extract the "is favorite" switch value.
|
||||||
*
|
*
|
||||||
@ -299,6 +324,9 @@ final class Container extends Model
|
|||||||
// Clean HTML entities.
|
// Clean HTML entities.
|
||||||
$row = \io_safe_output($row);
|
$row = \io_safe_output($row);
|
||||||
|
|
||||||
|
hd('?????????????????????', true);
|
||||||
|
hd($row, true);
|
||||||
|
|
||||||
$row['relationLineWidth'] = (int) $config['vc_line_thickness'];
|
$row['relationLineWidth'] = (int) $config['vc_line_thickness'];
|
||||||
|
|
||||||
$backgroundUrl = static::extractBackgroundUrl($row);
|
$backgroundUrl = static::extractBackgroundUrl($row);
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
@ -7,6 +7,16 @@
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#visual-console-container.is-maintenance {
|
||||||
|
border: 2px solid green;
|
||||||
|
|
||||||
|
background-image: url(maintenanceMode.png) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#visual-console-container.is-maintenance :nth-child(1) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.visual-console-item {
|
.visual-console-item {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -33,7 +33,6 @@ global $config;
|
|||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
require_once $config['homedir'].'/vendor/autoload.php';
|
require_once $config['homedir'].'/vendor/autoload.php';
|
||||||
// TODO: include file functions.
|
|
||||||
require_once $config['homedir'].'/include/functions_visual_map.php';
|
require_once $config['homedir'].'/include/functions_visual_map.php';
|
||||||
|
|
||||||
|
|
||||||
@ -103,6 +102,9 @@ $aclRead = (bool) check_acl_restricted_all($config['id_user'], $groupId, 'VR')
|
|||||||
$aclWrite = (bool) check_acl_restricted_all($config['id_user'], $groupId, 'VW');
|
$aclWrite = (bool) check_acl_restricted_all($config['id_user'], $groupId, 'VW');
|
||||||
$aclManage = (bool) check_acl_restricted_all($config['id_user'], $groupId, 'VM');
|
$aclManage = (bool) check_acl_restricted_all($config['id_user'], $groupId, 'VM');
|
||||||
|
|
||||||
|
// Maintenance Mode.
|
||||||
|
$maintenanceMode = $visualConsoleData['maintenanceMode'];
|
||||||
|
|
||||||
if ($aclRead === false && $aclWrite === false && $aclManage === false) {
|
if ($aclRead === false && $aclWrite === false && $aclManage === false) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
AUDIT_LOG_ACL_VIOLATION,
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
@ -398,18 +400,56 @@ if ($pure === false) {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
if ($aclWrite === true || $aclManage === true) {
|
if ($aclWrite === true || $aclManage === true) {
|
||||||
if (!is_metaconsole()) {
|
echo '<div class="flex-row" style="width:220px;">';
|
||||||
echo '<a id ="force_check" href="" style="margin-right: 25px;">'.html_print_image(
|
if (is_metaconsole() === false) {
|
||||||
|
echo '<div id="force_check_control" class="flex-column">';
|
||||||
|
echo html_print_label(__('Force'), 'force-mode', true);
|
||||||
|
echo '<a id ="force_check" href="">';
|
||||||
|
echo html_print_image(
|
||||||
'images/target.png',
|
'images/target.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('Force remote checks'),
|
'title' => __('Force remote checks'),
|
||||||
'class' => 'invert_filter',
|
'class' => 'invert_filter',
|
||||||
]
|
]
|
||||||
).'</a>';
|
);
|
||||||
|
echo '</a>';
|
||||||
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$style_edit_mode = '';
|
||||||
|
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"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<div id="maintenance-mode-control" class="flex-column" '.$style.'>';
|
||||||
|
echo html_print_label(
|
||||||
|
__('Maintenance Mode'),
|
||||||
|
'maintenance-mode',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
echo html_print_checkbox_switch(
|
||||||
|
'maintenance-mode',
|
||||||
|
1,
|
||||||
|
$value_maintenance_mode,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
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 html_print_checkbox_switch('edit-mode', 1, false, true);
|
||||||
|
echo '</div>';
|
||||||
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@ -676,27 +716,83 @@ ui_require_css_file('form');
|
|||||||
items,
|
items,
|
||||||
baseUrl,
|
baseUrl,
|
||||||
<?php echo ($refr * 1000); ?>,
|
<?php echo ($refr * 1000); ?>,
|
||||||
handleUpdate
|
handleUpdate,
|
||||||
|
false,
|
||||||
|
undefined,
|
||||||
|
'<?php echo $config['id_user']; ?>',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log(props);
|
||||||
|
if(props.maintenanceMode != null) {
|
||||||
|
if(props.maintenanceMode.user !== '<?php echo $config['id_user']; ?>') {
|
||||||
|
visualConsoleManager.visualConsole.enableMaintenanceMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($edit_capable === true) {
|
if ($edit_capable === true) {
|
||||||
?>
|
?>
|
||||||
// Enable/disable the edition mode.
|
// Enable/disable the edition mode.
|
||||||
$('input[name=edit-mode]').change(function(event) {
|
$('input[name=edit-mode]').change(function(event) {
|
||||||
|
const maintenanceMode = '<?php echo json_encode($maintenanceMode); ?>';
|
||||||
if ($(this).prop('checked')) {
|
if ($(this).prop('checked')) {
|
||||||
visualConsoleManager.visualConsole.enableEditMode();
|
visualConsoleManager.visualConsole.enableEditMode();
|
||||||
visualConsoleManager.changeUpdateInterval(0);
|
visualConsoleManager.changeUpdateInterval(0);
|
||||||
$('#force_check').hide();
|
$('#force_check_control').hide();
|
||||||
$('#edit-controls').css('visibility', '');
|
$('#edit-controls').css('visibility', '');
|
||||||
|
if (maintenanceMode == 'null') {
|
||||||
|
$('#maintenance-mode-control').css('visibility', '');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
visualConsoleManager.visualConsole.disableEditMode();
|
visualConsoleManager.visualConsole.disableEditMode();
|
||||||
visualConsoleManager.visualConsole.unSelectItems();
|
visualConsoleManager.visualConsole.unSelectItems();
|
||||||
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>); // To ms.
|
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>); // To ms.
|
||||||
|
$('#force_check_control').show();
|
||||||
$('#edit-controls').css('visibility', 'hidden');
|
$('#edit-controls').css('visibility', 'hidden');
|
||||||
$('#force_check').show();
|
if(maintenanceMode == 'null') {
|
||||||
|
$('#maintenance-mode-control').css('visibility', 'hidden');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Enable/disable the maintenance mode.
|
||||||
|
$('input[name=maintenance-mode]').click(function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
const idVisualConsole = '<?php echo $visualConsoleId; ?>';
|
||||||
|
const mode = ($(this).prop('checked') === true) ? 1 : 0;
|
||||||
|
|
||||||
|
confirmDialog({
|
||||||
|
title: '<?php echo __('Maintenance mode'); ?>',
|
||||||
|
message: '<?php echo __('XXXXXXXXXXXXXXXXXXX'); ?>',
|
||||||
|
onAccept: function() {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "ajax.php",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
page: "include/ajax/visual_console.ajax",
|
||||||
|
update_maintanance_mode: true,
|
||||||
|
idVisualConsole: idVisualConsole,
|
||||||
|
mode: mode
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
if(data.result) {
|
||||||
|
console.log('----------------');
|
||||||
|
$('input[name=maintenance-mode]').prop('checked', mode);
|
||||||
|
$('input[name=maintenance-mode]').trigger('change');
|
||||||
|
|
||||||
|
//if ($('input[name=edit-mode]').prop('checked') === false) {
|
||||||
|
// $('#maintenance-mode-control').css('visibility', 'hidden');
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -797,6 +893,7 @@ if ($edit_capable === true) {
|
|||||||
|
|
||||||
function resetInterval() {
|
function resetInterval() {
|
||||||
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>);
|
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>);
|
||||||
|
visualConsoleManager.forceUpdateVisualConsole();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1676,6 +1676,7 @@ CREATE TABLE IF NOT EXISTS `tlayout` (
|
|||||||
`background_color` VARCHAR(50) NOT NULL DEFAULT '#FFF',
|
`background_color` VARCHAR(50) NOT NULL DEFAULT '#FFF',
|
||||||
`is_favourite` INT UNSIGNED NOT NULL DEFAULT 0,
|
`is_favourite` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
`auto_adjust` INT UNSIGNED NOT NULL DEFAULT 0,
|
`auto_adjust` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`maintenance_mode` TEXT NULL,
|
||||||
PRIMARY KEY(`id`)
|
PRIMARY KEY(`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
|
@ -591,6 +591,9 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Metadata state.
|
// Metadata state.
|
||||||
|
if (this.meta.maintenanceMode) {
|
||||||
|
box.classList.add("is-maintenance");
|
||||||
|
}
|
||||||
if (this.meta.editMode) {
|
if (this.meta.editMode) {
|
||||||
box.classList.add("is-editing");
|
box.classList.add("is-editing");
|
||||||
}
|
}
|
||||||
@ -877,8 +880,12 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Change metadata related things.
|
// Change metadata related things.
|
||||||
if (!prevMeta || prevMeta.editMode !== this.meta.editMode) {
|
if (
|
||||||
if (this.meta.editMode) {
|
!prevMeta ||
|
||||||
|
prevMeta.editMode !== this.meta.editMode ||
|
||||||
|
prevMeta.maintenanceMode !== this.meta.maintenanceMode
|
||||||
|
) {
|
||||||
|
if (this.meta.editMode && this.meta.maintenanceMode === false) {
|
||||||
this.elementRef.classList.add("is-editing");
|
this.elementRef.classList.add("is-editing");
|
||||||
} else {
|
} else {
|
||||||
this.elementRef.classList.remove("is-editing");
|
this.elementRef.classList.remove("is-editing");
|
||||||
|
@ -159,6 +159,12 @@ export interface VisualConsoleProps extends Size {
|
|||||||
backgroundColor: string | null;
|
backgroundColor: string | null;
|
||||||
isFavorite: boolean;
|
isFavorite: boolean;
|
||||||
relationLineWidth: number;
|
relationLineWidth: number;
|
||||||
|
maintenanceMode: maintenanceModeInterface | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface maintenanceModeInterface {
|
||||||
|
user: string;
|
||||||
|
timestamp: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,7 +187,8 @@ export function visualConsolePropsDecoder(
|
|||||||
backgroundURL,
|
backgroundURL,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
isFavorite,
|
isFavorite,
|
||||||
relationLineWidth
|
relationLineWidth,
|
||||||
|
maintenanceMode
|
||||||
} = data;
|
} = data;
|
||||||
|
|
||||||
if (id == null || isNaN(parseInt(id))) {
|
if (id == null || isNaN(parseInt(id))) {
|
||||||
@ -202,6 +209,7 @@ export function visualConsolePropsDecoder(
|
|||||||
backgroundColor: notEmptyStringOr(backgroundColor, null),
|
backgroundColor: notEmptyStringOr(backgroundColor, null),
|
||||||
isFavorite: parseBoolean(isFavorite),
|
isFavorite: parseBoolean(isFavorite),
|
||||||
relationLineWidth: parseIntOr(relationLineWidth, 0),
|
relationLineWidth: parseIntOr(relationLineWidth, 0),
|
||||||
|
maintenanceMode: maintenanceMode,
|
||||||
...sizePropsDecoder(data)
|
...sizePropsDecoder(data)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1222,6 +1230,28 @@ export default class VisualConsole {
|
|||||||
this.containerRef.classList.remove("is-editing");
|
this.containerRef.classList.remove("is-editing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the maintenance mode.
|
||||||
|
*/
|
||||||
|
public enableMaintenanceMode(): void {
|
||||||
|
this.elements.forEach(item => {
|
||||||
|
item.meta = { ...item.meta, maintenanceMode: true };
|
||||||
|
});
|
||||||
|
this.containerRef.classList.add("is-maintenance");
|
||||||
|
this.containerRef.classList.remove("is-editing");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the maintenance mode.
|
||||||
|
*/
|
||||||
|
public disableMaintenanceMode(): void {
|
||||||
|
this.elements.forEach(item => {
|
||||||
|
item.meta = { ...item.meta, maintenanceMode: false };
|
||||||
|
});
|
||||||
|
this.containerRef.classList.remove("is-maintenance");
|
||||||
|
this.containerRef.classList.add("is-editing");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select an item.
|
* Select an item.
|
||||||
* @param itemId Item Id.
|
* @param itemId Item Id.
|
||||||
|
@ -275,6 +275,7 @@ export function itemMetaDecoder(data: UnknownObject): ItemMeta | never {
|
|||||||
receivedAt,
|
receivedAt,
|
||||||
error,
|
error,
|
||||||
editMode: parseBoolean(data.editMode),
|
editMode: parseBoolean(data.editMode),
|
||||||
|
maintenanceMode: parseBoolean(data.maintenanceMode),
|
||||||
isFromCache: parseBoolean(data.isFromCache),
|
isFromCache: parseBoolean(data.isFromCache),
|
||||||
isFetching: false,
|
isFetching: false,
|
||||||
isUpdating: false,
|
isUpdating: false,
|
||||||
|
BIN
visual_console_client/src/lib/maintenanceMode.png
Normal file
BIN
visual_console_client/src/lib/maintenanceMode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
@ -133,6 +133,7 @@ describe("itemMetaDecoder function", () => {
|
|||||||
isFetching: false,
|
isFetching: false,
|
||||||
isUpdating: false,
|
isUpdating: false,
|
||||||
editMode: false,
|
editMode: false,
|
||||||
|
maintenanceMode: false,
|
||||||
isBeingMoved: false,
|
isBeingMoved: false,
|
||||||
isBeingResized: false,
|
isBeingResized: false,
|
||||||
isSelected: false,
|
isSelected: false,
|
||||||
@ -154,6 +155,7 @@ describe("itemMetaDecoder function", () => {
|
|||||||
isFetching: false,
|
isFetching: false,
|
||||||
isUpdating: false,
|
isUpdating: false,
|
||||||
editMode: true,
|
editMode: true,
|
||||||
|
maintenanceMode: false,
|
||||||
isBeingMoved: false,
|
isBeingMoved: false,
|
||||||
isBeingResized: false,
|
isBeingResized: false,
|
||||||
isSelected: false,
|
isSelected: false,
|
||||||
|
@ -61,5 +61,6 @@ export interface ItemMeta {
|
|||||||
isBeingMoved: boolean;
|
isBeingMoved: boolean;
|
||||||
isBeingResized: boolean;
|
isBeingResized: boolean;
|
||||||
editMode: boolean;
|
editMode: boolean;
|
||||||
|
maintenanceMode: boolean;
|
||||||
lineMode: boolean;
|
lineMode: boolean;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,16 @@
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#visual-console-container.is-maintenance {
|
||||||
|
border: 2px solid green;
|
||||||
|
|
||||||
|
background-image: url(./lib/maintenanceMode.png) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#visual-console-container.is-maintenance :nth-child(1) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.visual-console-item {
|
.visual-console-item {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user