Merge branch '1306-fixes-in-pandora-manage-visual-console-functions-dev' into 'develop'
Added minor changes to duplicate and export functions See merge request !843
This commit is contained in:
commit
e73e20e98c
|
@ -5379,7 +5379,7 @@ sub cli_delete_visual_console_objects() {
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
sub cli_duplicate_visual_console () {
|
sub cli_duplicate_visual_console () {
|
||||||
my ($id_console,$prefix) = @ARGV[2..3];
|
my ($id_console,$times,$prefix) = @ARGV[2..4];
|
||||||
|
|
||||||
if($id_console eq '') {
|
if($id_console eq '') {
|
||||||
print_log "[ERROR] Console ID field cannot be empty.\n\n";
|
print_log "[ERROR] Console ID field cannot be empty.\n\n";
|
||||||
|
@ -5400,6 +5400,7 @@ sub cli_duplicate_visual_console () {
|
||||||
$name_count = 1;
|
$name_count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (my $iteration = 0; $iteration < $times; $iteration++) {
|
||||||
my $exist = 1;
|
my $exist = 1;
|
||||||
while ($exist == 1) {
|
while ($exist == 1) {
|
||||||
my $name_in_db = get_db_single_row ($dbh, "SELECT name FROM tlayout WHERE name = '$new_name'");
|
my $name_in_db = get_db_single_row ($dbh, "SELECT name FROM tlayout WHERE name = '$new_name'");
|
||||||
|
@ -5451,6 +5452,7 @@ sub cli_duplicate_visual_console () {
|
||||||
print_log "[INFO] Element with ID " . $element->{"id"} . " has been duplicated to the new console \n\n";
|
print_log "[INFO] Element with ID " . $element->{"id"} . " has been duplicated to the new console \n\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Export a visual console elements to json.
|
# Export a visual console elements to json.
|
||||||
|
@ -5465,15 +5467,29 @@ sub cli_export_visual_console() {
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $data_to_json = '';
|
||||||
|
my $first = 1;
|
||||||
|
|
||||||
print_log "[INFO] Exporting visual console elements with ID '$id' \n\n";
|
print_log "[INFO] Exporting visual console elements with ID '$id' \n\n";
|
||||||
|
|
||||||
|
my $console = get_db_single_row ($dbh, "SELECT *
|
||||||
|
FROM tlayout
|
||||||
|
WHERE id = $id");
|
||||||
|
|
||||||
|
$data_to_json .= '"' . safe_output($console->{'name'}) . '"';
|
||||||
|
$data_to_json .= ' "' . $console->{'background'} . '"';
|
||||||
|
$data_to_json .= ' ' . $console->{'width'};
|
||||||
|
$data_to_json .= ' ' . $console->{'height'};
|
||||||
|
$data_to_json .= ' ' . $console->{'id_group'};
|
||||||
|
$data_to_json .= ' "static_objects"';
|
||||||
|
$data_to_json .= ' ""';
|
||||||
|
$data_to_json .= ' "' . $console->{'background_color'} . '" ';
|
||||||
|
|
||||||
my @console_elements = get_db_rows ($dbh, "SELECT *
|
my @console_elements = get_db_rows ($dbh, "SELECT *
|
||||||
FROM tlayout_data
|
FROM tlayout_data
|
||||||
WHERE id_layout = $id");
|
WHERE id_layout = $id");
|
||||||
|
|
||||||
my $data_to_json = '[';
|
$data_to_json .= '[';
|
||||||
my $first = 1;
|
|
||||||
|
|
||||||
foreach my $element (@console_elements) {
|
foreach my $element (@console_elements) {
|
||||||
my $pos_x = $element->{'pos_x'};
|
my $pos_x = $element->{'pos_x'};
|
||||||
my $pos_y = $element->{'pos_y'};
|
my $pos_y = $element->{'pos_y'};
|
||||||
|
@ -5989,7 +6005,7 @@ sub pandora_manage_main ($$$) {
|
||||||
cli_delete_visual_console_objects();
|
cli_delete_visual_console_objects();
|
||||||
}
|
}
|
||||||
elsif ($param eq '--duplicate_visual_console') {
|
elsif ($param eq '--duplicate_visual_console') {
|
||||||
param_check($ltotal, 2, 1);
|
param_check($ltotal, 3, 2);
|
||||||
cli_duplicate_visual_console();
|
cli_duplicate_visual_console();
|
||||||
}
|
}
|
||||||
elsif ($param eq '--export_json_visual_console') {
|
elsif ($param eq '--export_json_visual_console') {
|
||||||
|
|
Loading…
Reference in New Issue