continue VC form create items

This commit is contained in:
Daniel Barbero 2019-09-27 15:44:39 +02:00
parent cf0ad42e2a
commit d35a5d4f71
7 changed files with 812 additions and 662 deletions

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@ div#vc-controls img.vc-qr {
.visual-console-edit-controls {
display: flex;
justify-content: flex-end;
justify-content: space-between;
}
.visual-console-edit-controls > span {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,32 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Extensions
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
// Login check.
@ -19,6 +35,38 @@ check_login();
require_once $config['homedir'].'/vendor/autoload.php';
require_once $config['homedir'].'/include/functions_visual_map.php';
// TODO: include file functions.
/**
* Function for return button visual console edition.
*
* @param string $idDiv Id button.
* @param string $label Label and title button.
* @param string $class Class button.
* @param boolean $disabled Disabled button.
*
* @return void Retun button.
*/
function visual_map_print_button_editor_refactor(
$idDiv,
$label,
$class='',
$disabled=false
) {
html_print_button(
$label,
$idDiv,
$disabled,
'',
// "click_button_toolbox('".$idDiv."');",
'class="sub visual_editor_button_toolbox '.$idDiv.' '.$class.'"',
false,
true
);
}
ui_require_css_file('visual_maps');
// Query parameters.
@ -165,24 +213,92 @@ if ($pure === false) {
echo '</span>';
echo '</div>';
echo '<div id ="edit-controls" class="visual-console-edit-controls" style="visibility:hidden">';
html_print_button(
'delete_item',
'button_delete',
true,
'',
'class="sub visual_editor_button_toolbox delete_item delete_min"',
false,
true
);
html_print_button(
'copy_item',
'button_copy',
true,
'',
'class="sub visual_editor_button_toolbox copy_item delete_min"',
false,
true
);
echo '<div>';
visual_map_print_button_editor_refactor(
'static_graph',
__('Static Image'),
'camera_min'
);
visual_map_print_button_editor_refactor(
'percentile_item',
__('Percentile Item'),
'percentile_item_min'
);
visual_map_print_button_editor_refactor(
'module_graph',
__('Module Graph'),
'graph_min'
);
visual_map_print_button_editor_refactor(
'donut_graph',
__('Serialized pie graph'),
'donut_graph_min'
);
visual_map_print_button_editor_refactor(
'bars_graph',
__('Bars Graph'),
'bars_graph_min'
);
visual_map_print_button_editor_refactor(
'auto_sla_graph',
__('Auto SLA Graph'),
'auto_sla_graph_min'
);
visual_map_print_button_editor_refactor(
'simple_value',
__('Simple Value'),
'binary_min'
);
visual_map_print_button_editor_refactor(
'label',
__('Label'),
'label_min'
);
visual_map_print_button_editor_refactor(
'icon',
__('Icon'),
'icon_min'
);
visual_map_print_button_editor_refactor(
'clock',
__('Clock'),
'clock_min'
);
visual_map_print_button_editor_refactor(
'group_item',
__('Group'),
'group_item_min'
);
visual_map_print_button_editor_refactor(
'box_item',
__('Box'),
'box_item_min'
);
visual_map_print_button_editor_refactor(
'line_item',
__('Line'),
'line_item_min'
);
visual_map_print_button_editor_refactor(
'color_cloud',
__('Color cloud'),
'color_cloud_min'
);
echo '</div>';
echo '<div>';
visual_map_print_button_editor_refactor(
'button_delete',
__('Delete Item'),
'delete_item delete_min',
true
);
visual_map_print_button_editor_refactor(
'button_copy',
__('Copy Item'),
'copy_item',
true
);
echo '</div>';
echo '</div>';
echo '<br />';
}
@ -411,4 +527,8 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
}
});
});
$('#button-static_graph').click(function (event){
console.log(visualConsoleManager.visualConsole.getFormContainer(20));
});
</script>

View File

@ -1260,6 +1260,81 @@ export function itemBasePropsDecoder(data: AnyObject): ItemProps | never {
};
}
//TODO: Document
export function titleItem(id: number): string {
let title = "";
switch (id) {
case ItemType.STATIC_GRAPH:
title = t("Static image");
break;
case ItemType.MODULE_GRAPH:
title = t("Module graph");
break;
case ItemType.SIMPLE_VALUE:
title = t("Simple value");
break;
case ItemType.PERCENTILE_BAR:
title = t("Percentile item");
break;
case ItemType.LABEL:
title = t("Label");
break;
case ItemType.ICON:
title = t("Icon");
break;
case ItemType.SIMPLE_VALUE_MAX:
title = t("Simple value");
break;
case ItemType.SIMPLE_VALUE_MIN:
title = t("Simple value");
break;
case ItemType.SIMPLE_VALUE_AVG:
title = t("Simple value");
break;
case ItemType.PERCENTILE_BUBBLE:
title = t("Percentile item");
break;
case ItemType.SERVICE:
title = t("Service");
break;
case ItemType.GROUP_ITEM:
title = t("Group");
break;
case ItemType.BOX_ITEM:
title = t("Box");
break;
case ItemType.LINE_ITEM:
title = t("Line");
break;
case ItemType.AUTO_SLA_GRAPH:
title = t("Auto SLA graph");
break;
case ItemType.CIRCULAR_PROGRESS_BAR:
title = t("Percentile item");
break;
case ItemType.CIRCULAR_INTERIOR_PROGRESS_BAR:
title = t("Percentile item");
break;
case ItemType.DONUT_GRAPH:
title = t("Serialized pie graph");
break;
case ItemType.BARS_GRAPH:
title = t("Bars graph");
break;
case ItemType.CLOCK:
title = t("Clock");
break;
case ItemType.COLOR_CLOUD:
title = t("Color cloud");
break;
default:
title = t("Item");
break;
}
return title;
}
/**
* Base class of the visual console items. Should be extended to use its capabilities.
*/
@ -2177,85 +2252,10 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
return disposable;
}
//TODO: Document
public titleItem(id: number): string {
let title = "";
switch (id) {
case ItemType.STATIC_GRAPH:
title = t("Static image");
break;
case ItemType.MODULE_GRAPH:
title = t("Module graph");
break;
case ItemType.SIMPLE_VALUE:
title = t("Simple value");
break;
case ItemType.PERCENTILE_BAR:
title = t("Percentile item");
break;
case ItemType.LABEL:
title = t("Label");
break;
case ItemType.ICON:
title = t("Icon");
break;
case ItemType.SIMPLE_VALUE_MAX:
title = t("Simple value");
break;
case ItemType.SIMPLE_VALUE_MIN:
title = t("Simple value");
break;
case ItemType.SIMPLE_VALUE_AVG:
title = t("Simple value");
break;
case ItemType.PERCENTILE_BUBBLE:
title = t("Percentile item");
break;
case ItemType.SERVICE:
title = t("Service");
break;
case ItemType.GROUP_ITEM:
title = t("Group");
break;
case ItemType.BOX_ITEM:
title = t("Box");
break;
case ItemType.LINE_ITEM:
title = t("Line");
break;
case ItemType.AUTO_SLA_GRAPH:
title = t("Auto SLA graph");
break;
case ItemType.CIRCULAR_PROGRESS_BAR:
title = t("Percentile item");
break;
case ItemType.CIRCULAR_INTERIOR_PROGRESS_BAR:
title = t("Percentile item");
break;
case ItemType.DONUT_GRAPH:
title = t("Serialized pie graph");
break;
case ItemType.BARS_GRAPH:
title = t("Bars graph");
break;
case ItemType.CLOCK:
title = t("Clock");
break;
case ItemType.COLOR_CLOUD:
title = t("Color cloud");
break;
default:
title = t("Item");
break;
}
return title;
}
// TODO: Document
public getFormContainer(): FormContainer {
return new FormContainer(
this.titleItem(this.props.type),
titleItem(this.props.type),
[
new SizeInputGroup("size", this.props),
new LabelInputGroup("label", this.props),

View File

@ -15,7 +15,8 @@ import Item, {
ItemRemoveEvent,
ItemMovedEvent,
ItemResizedEvent,
ItemSelectionChangedEvent
ItemSelectionChangedEvent,
titleItem
} from "./Item";
import StaticGraph, { staticGraphPropsDecoder } from "./items/StaticGraph";
import Icon, { iconPropsDecoder } from "./items/Icon";
@ -35,6 +36,7 @@ import DonutGraph, { donutGraphPropsDecoder } from "./items/DonutGraph";
import BarsGraph, { barsGraphPropsDecoder } from "./items/BarsGraph";
import ModuleGraph, { moduleGraphPropsDecoder } from "./items/ModuleGraph";
import Service, { servicePropsDecoder } from "./items/Service";
import { FormContainer } from "./Form";
// TODO: Document.
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@ -1056,4 +1058,8 @@ export default class VisualConsole {
return text;
}
public getFormContainer(type: number): FormContainer {
return new FormContainer(titleItem(type));
}
}