fixed errors VC

This commit is contained in:
Daniel Barbero Martin 2020-01-16 16:55:48 +01:00
parent d5e21499c2
commit 02199b19b5
14 changed files with 118 additions and 65 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

View File

@ -1797,6 +1797,14 @@ class Item extends CachedModel
switch ($values['tabSelected']) {
case 'label':
$inputs[] = [
'arguments' => [
'type' => 'hidden',
'name' => 'tabLabel',
'value' => true,
],
];
// Label.
$inputs[] = ['label' => __('Label')];

View File

@ -265,53 +265,6 @@ final class Clock extends Item
}
if ($values['tabSelected'] === 'specific') {
// Clock animation.
$fields = [
'analogic' => __('Simple analogic'),
'digital' => __('Simple digital'),
];
$inputs[] = [
'label' => __('Clock animation'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'clockType',
'selected' => $values['clockType'],
'return' => true,
'sort' => false,
],
];
// Time format.
$fields = [
'time' => __('Only time'),
'datetime' => __('Time and date'),
];
$inputs[] = [
'label' => __('Time format'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'clockFormat',
'selected' => $values['clockFormat'],
'return' => true,
'sort' => false,
],
];
// Width.
$inputs[] = [
'label' => __('Width'),
'arguments' => [
'name' => 'width',
'type' => 'number',
'value' => $values['width'],
'return' => true,
],
];
// Time zone.
$baseUrl = ui_get_full_url('/', false, false, false);
$fields = [
@ -370,6 +323,42 @@ final class Clock extends Item
],
];
// Clock animation.
$fields = [
'analogic' => __('Simple analogic'),
'digital' => __('Simple digital'),
];
$inputs[] = [
'label' => __('Clock animation'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'clockType',
'selected' => $values['clockType'],
'return' => true,
'sort' => false,
],
];
// Time format.
$fields = [
'time' => __('Only time'),
'datetime' => __('Time and date'),
];
$inputs[] = [
'label' => __('Time format'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'clockFormat',
'selected' => $values['clockFormat'],
'return' => true,
'sort' => false,
],
];
// Element color.
$inputs[] = [
'label' => __('Fill color'),

View File

@ -304,6 +304,18 @@ final class Group extends Item
$groupName,
$agentStats
);
if (isset($data['width']) === false
|| (int) $data['width'] === 0
) {
$data['width'] = 500;
}
if (isset($data['height']) === false
|| (int) $data['height'] === 0
) {
$data['height'] = 70;
}
} else {
if (\is_metaconsole()) {
$groupFilter = $groupId;

View File

@ -64,17 +64,17 @@ class View extends \HTML
'name' => __('Label settings'),
'id' => 'tab-label',
'href' => $url.'&tabSelected=label',
'img' => 'zoom.png',
'img' => 'label-settings.png',
],[
'name' => __('General settings'),
'id' => 'tab-general',
'href' => $url.'&tabSelected=general',
'img' => 'pencil.png',
'img' => 'general-settings.png',
],[
'name' => __('Specific settings'),
'id' => 'tab-specific',
'href' => $url.'&tabSelected=specific',
'img' => 'event_responses_col.png',
'img' => 'specific-settings.png',
],
];
@ -278,8 +278,11 @@ class View extends \HTML
$data['type'] = $type;
// Page Label for each item.
$data['label'] = \get_parameter('label');
$data['labelPosition'] = \get_parameter('labelPosition');
$tabLabel = (bool) \get_parameter('tabLabel', false);
if ($tabLabel === true) {
$data['label'] = \get_parameter('label');
$data['labelPosition'] = \get_parameter('labelPosition');
}
// Page general for each item.
$tabGeneral = (bool) \get_parameter('tabGeneral', false);

View File

@ -617,8 +617,8 @@ li#li-timeZone-item > select:not(:first-child) {
.group-container .group-item-info .group-item-info-container {
-webkit-box-flex: 1;
-ms-flex: 1 1 100px;
flex: 1 1 100px;
-ms-flex: 1 1 80px;
flex: 1 1 80px;
display: -webkit-box;
display: -ms-flexbox;
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

View File

@ -338,9 +338,21 @@ export default class Clock extends Item<ClockProps> {
* @override Item.updateDomElement
*/
protected updateDomElement(element: HTMLElement): void {
// Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation
const { width: newWidth, height: newHeight } = this.getElementSize(
this.props.width,
this.props.height
);
if (this.props.clockType === "digital") {
if (this.meta.isBeingResized === false) {
super.resizeElement(this.props.width, this.props.height);
}
element.classList.replace("analogic-clock", "digital-clock");
} else {
if (this.meta.isBeingResized === false) {
super.resizeElement(newWidth, newHeight);
}
element.classList.replace("digital-clock", "analogic-clock");
}
element.innerHTML = this.createDomElement().innerHTML;
@ -364,16 +376,20 @@ export default class Clock extends Item<ClockProps> {
* @param height
*/
protected resizeElement(width: number, height: number): void {
// Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation
const { width: newWidth, height: newHeight } = this.getElementSize(
width,
height
); // Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation
super.resizeElement(newWidth, height);
);
// Re-render the item to force it calculate a new font size.
//if (this.props.clockType === "digital") {
// Replace the old element with the updated date.
this.childElementRef.innerHTML = this.createClock().innerHTML;
//}
if (this.props.clockType === "digital") {
super.resizeElement(width, height);
// Replace the old element with the updated date.
//this.childElementRef.innerHTML = this.createClock().innerHTML;
} else {
super.resizeElement(newWidth, newHeight);
}
}
/**
@ -778,9 +794,14 @@ export default class Clock extends Item<ClockProps> {
diameter = height;
}
let extraHeigth = 0;
if (this.props.clockFormat === "datetime") {
extraHeigth = height / 8;
}
return {
width: diameter,
height: diameter
height: diameter + extraHeigth
};
}
case "digital": {

View File

@ -583,6 +583,26 @@ export default class Percentile extends Item<PercentileProps> {
return element;
}
/**
* To update the content element.
* @override Item.updateDomElement
*/
protected updateDomElement(element: HTMLElement): void {
if (this.meta.isBeingResized === false) {
this.resizeElement(this.props.width, this.props.height);
}
element.innerHTML = this.createDomElement().innerHTML;
}
protected resizeElement(width: number, height: number): void {
if (this.props.percentileType === "progress-bar") {
super.resizeElement(width, height);
} else {
console.log("entra por donde ancho y alto es lo mismo");
super.resizeElement(width, width);
}
}
private getProgress(): number {
const minValue = this.props.minValue || 0;
const maxValue = this.props.maxValue || 100;

View File

@ -471,7 +471,7 @@ li#li-timeZone-item > select:not(:first-child) {
}
.group-container .group-item-info .group-item-info-container {
flex: 1 1 100px;
flex: 1 1 80px;
display: flex;
flex-direction: row;
border-radius: 2px;