From 2ff5608edfb84e5c40ffd759568e735b3985bf7b Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 15 Apr 2019 17:00:06 +0200 Subject: [PATCH 1/2] Visual Console Refactor: changed the visibility of a function Former-commit-id: fec92cc200de0c9fbc51b82af41943ba5e242565 --- visual_console_client/src/Item.ts | 2 +- visual_console_client/src/items/BarsGraph.ts | 2 +- visual_console_client/src/items/Box.ts | 2 +- visual_console_client/src/items/Clock/index.ts | 2 +- visual_console_client/src/items/ColorCloud.ts | 2 +- visual_console_client/src/items/DonutGraph.ts | 2 +- visual_console_client/src/items/EventsHistory.ts | 2 +- visual_console_client/src/items/Group.ts | 2 +- visual_console_client/src/items/Icon.ts | 2 +- visual_console_client/src/items/Label.ts | 2 +- visual_console_client/src/items/Line.ts | 2 +- visual_console_client/src/items/ModuleGraph.ts | 2 +- visual_console_client/src/items/Percentile.ts | 2 +- visual_console_client/src/items/SimpleValue.ts | 4 ++-- visual_console_client/src/items/StaticGraph.ts | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/visual_console_client/src/Item.ts b/visual_console_client/src/Item.ts index 36a3cbb9a4..ee8a191aec 100644 --- a/visual_console_client/src/Item.ts +++ b/visual_console_client/src/Item.ts @@ -133,7 +133,7 @@ abstract class VisualConsoleItem { * To create a new element which will be inside the item box. * @return Item. */ - abstract createDomElement(): HTMLElement; + protected abstract createDomElement(): HTMLElement; public constructor(props: Props) { this.itemProps = props; diff --git a/visual_console_client/src/items/BarsGraph.ts b/visual_console_client/src/items/BarsGraph.ts index c7be5f82a9..eebbd97322 100644 --- a/visual_console_client/src/items/BarsGraph.ts +++ b/visual_console_client/src/items/BarsGraph.ts @@ -35,7 +35,7 @@ export function barsGraphPropsDecoder( } export default class BarsGraph extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const element = document.createElement("div"); element.innerHTML = this.props.html; diff --git a/visual_console_client/src/items/Box.ts b/visual_console_client/src/items/Box.ts index 86642c2f77..ca3078c0a6 100644 --- a/visual_console_client/src/items/Box.ts +++ b/visual_console_client/src/items/Box.ts @@ -40,7 +40,7 @@ export function boxPropsDecoder(data: UnknownObject): BoxProps | never { } export default class Box extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const box: HTMLDivElement = document.createElement("div"); box.className = "box"; // To prevent this item to expand beyond its parent. diff --git a/visual_console_client/src/items/Clock/index.ts b/visual_console_client/src/items/Clock/index.ts index 70cb6fd743..d5e532ecca 100644 --- a/visual_console_client/src/items/Clock/index.ts +++ b/visual_console_client/src/items/Clock/index.ts @@ -149,7 +149,7 @@ export default class Clock extends Item { * @return DOM Element. * @override */ - public createDomElement(): HTMLElement | never { + protected createDomElement(): HTMLElement | never { return this.createClock(); } diff --git a/visual_console_client/src/items/ColorCloud.ts b/visual_console_client/src/items/ColorCloud.ts index d382211fb5..0b5dfe9948 100644 --- a/visual_console_client/src/items/ColorCloud.ts +++ b/visual_console_client/src/items/ColorCloud.ts @@ -43,7 +43,7 @@ export function colorCloudPropsDecoder( const svgNS = "http://www.w3.org/2000/svg"; export default class ColorCloud extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const container: HTMLDivElement = document.createElement("div"); container.className = "color-cloud"; diff --git a/visual_console_client/src/items/DonutGraph.ts b/visual_console_client/src/items/DonutGraph.ts index 2d4141bc22..e788903b1f 100644 --- a/visual_console_client/src/items/DonutGraph.ts +++ b/visual_console_client/src/items/DonutGraph.ts @@ -46,7 +46,7 @@ export function donutGraphPropsDecoder( } export default class DonutGraph extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const element = document.createElement("div"); element.innerHTML = this.props.html; diff --git a/visual_console_client/src/items/EventsHistory.ts b/visual_console_client/src/items/EventsHistory.ts index 9b002a31e4..61aa5ae83f 100644 --- a/visual_console_client/src/items/EventsHistory.ts +++ b/visual_console_client/src/items/EventsHistory.ts @@ -42,7 +42,7 @@ export function eventsHistoryPropsDecoder( } export default class EventsHistory extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const element = document.createElement("div"); element.innerHTML = this.props.html; diff --git a/visual_console_client/src/items/Group.ts b/visual_console_client/src/items/Group.ts index c40a2475be..c9011437bf 100644 --- a/visual_console_client/src/items/Group.ts +++ b/visual_console_client/src/items/Group.ts @@ -36,7 +36,7 @@ export function groupPropsDecoder(data: UnknownObject): GroupProps | never { } export default class Group extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const img: HTMLImageElement = document.createElement("img"); img.className = "group"; img.src = this.props.imageSrc; diff --git a/visual_console_client/src/items/Icon.ts b/visual_console_client/src/items/Icon.ts index 687aa4094a..5f2d575320 100644 --- a/visual_console_client/src/items/Icon.ts +++ b/visual_console_client/src/items/Icon.ts @@ -31,7 +31,7 @@ export function iconPropsDecoder(data: UnknownObject): IconProps | never { } export default class Icon extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const img: HTMLImageElement = document.createElement("img"); img.className = "icon"; img.src = this.props.imageSrc; diff --git a/visual_console_client/src/items/Label.ts b/visual_console_client/src/items/Label.ts index f3d85e60f0..198bbe5deb 100644 --- a/visual_console_client/src/items/Label.ts +++ b/visual_console_client/src/items/Label.ts @@ -25,7 +25,7 @@ export function labelPropsDecoder(data: UnknownObject): LabelProps | never { } export default class Label extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const element = document.createElement("div"); element.className = "label"; element.innerHTML = this.props.label || ""; diff --git a/visual_console_client/src/items/Line.ts b/visual_console_client/src/items/Line.ts index 625db56cd2..2db1e03a4d 100644 --- a/visual_console_client/src/items/Line.ts +++ b/visual_console_client/src/items/Line.ts @@ -74,7 +74,7 @@ export default class Line extends Item { * To create the item's DOM representation. * @return Item. */ - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const element: HTMLDivElement = document.createElement("div"); element.className = "line"; diff --git a/visual_console_client/src/items/ModuleGraph.ts b/visual_console_client/src/items/ModuleGraph.ts index e6b47733ea..de3ef4548f 100644 --- a/visual_console_client/src/items/ModuleGraph.ts +++ b/visual_console_client/src/items/ModuleGraph.ts @@ -46,7 +46,7 @@ export function moduleGraphPropsDecoder( } export default class ModuleGraph extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const element = document.createElement("div"); element.innerHTML = this.props.html; diff --git a/visual_console_client/src/items/Percentile.ts b/visual_console_client/src/items/Percentile.ts index 09131563cd..412ebf89b4 100644 --- a/visual_console_client/src/items/Percentile.ts +++ b/visual_console_client/src/items/Percentile.ts @@ -100,7 +100,7 @@ export function percentilePropsDecoder( const svgNS = "http://www.w3.org/2000/svg"; export default class Percentile extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { // Progress. const progress = this.getProgress(); // Main element. diff --git a/visual_console_client/src/items/SimpleValue.ts b/visual_console_client/src/items/SimpleValue.ts index 0c37791642..dc39361ac4 100644 --- a/visual_console_client/src/items/SimpleValue.ts +++ b/visual_console_client/src/items/SimpleValue.ts @@ -88,7 +88,7 @@ export function simpleValuePropsDecoder( } export default class SimpleValue extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const element = document.createElement("div"); element.className = "simple-value"; @@ -114,7 +114,7 @@ export default class SimpleValue extends Item { * Create a new label for the visual console item. * @return Item label. */ - public createLabelDomElement(): HTMLElement { + protected createLabelDomElement(): HTMLElement { const element = document.createElement("div"); element.className = "visual-console-item-label"; // Always return an empty label. diff --git a/visual_console_client/src/items/StaticGraph.ts b/visual_console_client/src/items/StaticGraph.ts index 4c920580cc..2ff49e41e6 100644 --- a/visual_console_client/src/items/StaticGraph.ts +++ b/visual_console_client/src/items/StaticGraph.ts @@ -66,7 +66,7 @@ export function staticGraphPropsDecoder( } export default class StaticGraph extends Item { - public createDomElement(): HTMLElement { + protected createDomElement(): HTMLElement { const img: HTMLImageElement = document.createElement("img"); img.className = "static-graph"; img.src = this.props.statusImageSrc || this.props.imageSrc; From f24368b5a0e6c3fa31943e83aad393b3f374b5e1 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 15 Apr 2019 17:10:34 +0200 Subject: [PATCH 2/2] Visual Console Refactor: fixed the analogic clock Former-commit-id: bd85af741c4bcf0fe505e1e6bb0b41d42ab2e090 --- visual_console_client/src/items/Clock/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/visual_console_client/src/items/Clock/index.ts b/visual_console_client/src/items/Clock/index.ts index d5e532ecca..0d9bef5efc 100644 --- a/visual_console_client/src/items/Clock/index.ts +++ b/visual_console_client/src/items/Clock/index.ts @@ -450,7 +450,7 @@ export default class Clock extends Item { to { ${prefixedCssRules( "transform", - `translate(50px, 50px) rotate(${minuteAngle + 360}deg)` + `translate(50px, 50px) rotate(${secAngle + 360}deg)` ).join("\n")} } }