Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI: Remove or-timeline component (#2471)

Martin Peetersc8a951d6fe84
diff --git a/ui/component/or-timeline/.npmignore b/ui/component/or-timeline/.npmignore
deleted file mode 100644
index b2544e0f1..000000000
--- a/ui/component/or-timeline/.npmignore
+++ /dev/null
@@ -1,9 +0,0 @@
-build/
-build.gradle
-test/
-src/
-webpack.config.js
-rspack.config.js
-tsconfig.json
-dist/*.map
-*.tsbuildinfo
diff --git a/ui/component/or-timeline/README.md b/ui/component/or-timeline/README.md
deleted file mode 100644
index f25a46f86..000000000
--- a/ui/component/or-timeline/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# @openremote/or-timeline \<or-timeline\>
-[![NPM Version][npm-image]][npm-url]
-[![Linux Build][travis-image]][travis-url]
-[![Test Coverage][coveralls-image]][coveralls-url]
-
-Web Component for displaying a timeline control.
-
-## Install
-```bash
-npm i @openremote/or-timeline
-yarn add @openremote/or-timeline
-```
-
-## Usage
-For a full list of properties, methods and options refer to the TypeDoc generated [documentation]().
-
-
-## Supported Browsers
-The last 2 versions of all modern browsers are supported, including Chrome, Safari, Opera, Firefox, Edge. In addition,
-Internet Explorer 11 is also supported.
-
-
-## License
-[GNU AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)
-
-[npm-image]: https://img.shields.io/npm/v/live-xxx.svg
-[npm-url]: https://npmjs.org/package/@openremote/or-timeline
-[travis-image]: https://img.shields.io/travis/live-js/live-xxx/master.svg
-[travis-url]: https://travis-ci.org/live-js/live-xxx
-[coveralls-image]: https://img.shields.io/coveralls/live-js/live-xxx/master.svg
-[coveralls-url]: https://coveralls.io/r/live-js/live-xxx?branch=master
diff --git a/ui/component/or-timeline/build.gradle b/ui/component/or-timeline/build.gradle
deleted file mode 100644
index 715a0847b..000000000
--- a/ui/component/or-timeline/build.gradle
+++ /dev/null
@@ -1,26 +0,0 @@
-buildDir = "dist"
-
-tasks.register('clean') {
- doLast {
- delete "dist"
- delete "lib"
- }
-}
-
-tasks.register('npmAnalyze', Exec) {
- mustRunAfter npmClean
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "analyze"
-}
-
-tasks.register('installDist') {
- dependsOn npmAnalyze
-}
-
-tasks.register('prepareUi') {
- dependsOn clean, npmAnalyze, npmPrepare
-}
-
-tasks.register('publishUi') {
- dependsOn clean, npmPublish
-}
diff --git a/ui/component/or-timeline/package.json b/ui/component/or-timeline/package.json
deleted file mode 100644
index bf12709fa..000000000
--- a/ui/component/or-timeline/package.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "name": "@openremote/or-timeline",
- "version": "1.14.0-snapshot",
- "description": "OpenRemote Timeline",
- "customElements": "custom-elements.json",
- "main": "dist/umd/index.bundle.js",
- "module": "lib/index.js",
- "exports": {
- ".": "./lib/index.js",
- "./*": "./lib/*.js",
- "./jsx": {
- "types": "./custom-elements-jsx.d.ts"
- }
- },
- "types": "lib/index.d.ts",
- "scripts": {
- "analyze": "npx cem analyze --config ../custom-elements-manifest.config.mjs",
- "test": "echo \"No tests\" && exit 0",
- "prepack": "npx rspack"
- },
- "author": "OpenRemote",
- "license": "AGPL-3.0-or-later",
- "dependencies": {
- "lit": "^3.3.1",
- "moment": "^2.29.4"
- },
- "publishConfig": {
- "access": "public"
- }
-}
diff --git a/ui/component/or-timeline/rspack.config.js b/ui/component/or-timeline/rspack.config.js
deleted file mode 100644
index b8431e890..000000000
--- a/ui/component/or-timeline/rspack.config.js
+++ /dev/null
@@ -1,16 +0,0 @@
-const util = require("@openremote/util");
-
-bundles = {
- "index": {
- vendor: {
- "moment": "moment"
- },
- excludeOr: true
- },
- "index.bundle": {
- excludeOr: true,
- },
- "index.orbundle": undefined
-};
-
-module.exports = util.generateExports(__dirname);
diff --git a/ui/component/or-timeline/src/index.ts b/ui/component/or-timeline/src/index.ts
deleted file mode 100644
index b5face2fe..000000000
--- a/ui/component/or-timeline/src/index.ts
+++ /dev/null
@@ -1,282 +0,0 @@
-import {html, LitElement} from "lit";
-import {customElement, property} from "lit/decorators.js";
-import moment from "moment";
-
-@customElement("or-timeline")
-class OrTimeline extends LitElement {
-
- // default value in minutes
- @property({type: Number})
- public current: number = 0;
-
- @property({type: Function})
- public onChange: any;
-
- // default value in minutes
- @property({type: Number})
- public value: number = 0;
-
- // maxRange in minutes
- @property({type: Number})
- public maxRange: number = 360;
-
- // minRange in minutes
- @property({type: Number})
- public minRange: number = 0;
-
- // Steps in minutes
- @property({type: Number})
- public step: number = 5;
-
- constructor() {
- super();
- }
-
- public moveBubble(e: any= null, value: string|null= null) {
- let el;
- if (e) {
- el = e.target;
- } else {
- if (this.shadowRoot) {
- el = this.shadowRoot.getElementById("or-timeline-slider");
- }
- }
-
- if (el) {
- if (value) {
- this.current = parseInt(value);
- } else {
- this.current = parseInt(el.value);
- }
- // Measure width of range input
- const width = el.offsetWidth;
- const v = this.current;
-
- // Figure out placement percentage between left and right of input
- const newPoint = v / this.maxRange;
- // Janky value to get pointer to line up better
- const offset = 15;
- let newPlace;
-
- // Prevent bubble from going beyond left or right (unsupported browsers)
- if (newPoint < 0) {
- newPlace = 0;
- } else if (newPoint > 1) {
- newPlace = width - offset;
- } else {
- newPlace = (width - offset) * newPoint;
-
- if (newPlace < 0 ) {
- newPlace = 0;
- }
-
- }
-
- // Move bubble
- if (this.shadowRoot) {
- const range: HTMLElement | null = this.shadowRoot.getElementById("range-value");
- if (range) {
- range.style.left = newPlace + "px";
- }
- }
- }
- }
-
- public valueChange(e: any) {
- this.moveBubble(e);
- this.onChange();
- }
-
- protected render() {
-
- return html`
- <style>
- :host {
- position: relative;
- }
- .timeline-container {
- display: block;
- height: 52px;
- background-color: var(--app-white, #FFFFFF);
-
- -webkit-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
- -moz-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
- box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.28);
-
- padding-top: 20px;
- }
- .slidecontainer {
- position: relative;
- margin: -5px 44px 0 19px;
- }
-
- /* The slider itself */
- .slider {
- color: var(--timeline-accent, #1D5632);
- box-sizing: border-box;
- -webkit-appearance: none;
- outline: none;
- width: 100%;
- }
- .slider::-webkit-slider-runnable-track {
- cursor: pointer;
- border: transparent;
- background: #bdbdbd;
- border-radius: 6px;
- height: 12px;
- }
- .slider::-webkit-slider-thumb {
- height: 18px;
- width: 18px;
- border-radius: 50%;
- cursor: pointer;
- -webkit-appearance: none;
- background-color: var(--timeline-accent, #1D5632); /* Green background */
- pointer-events: all;
- margin-top: -2px;
- }
-
- .slider::-moz-range-track {
- cursor: pointer;
- border: transparent;
- background: #bdbdbd;
- border-radius: 6px;
- height: 12px;
- }
- .slider::-moz-range-thumb {
- border: 0 none;
- height: 18px;
- width: 18px;
- border-radius: 50%;
- cursor: pointer;
- -webkit-appearance: none;
- background-color: var(--timeline-accent, #1D5632); /* Green background */
- pointer-events: all;
- margin-top: -2px;
- }
- .slider::-moz-range-progress {
- background-color: var(--timeline-accent, #1D5632);
- height: 12px;
- border-radius: 6px;
- }
-
- .slider::-ms-track {
- cursor: pointer;
- border: transparent;
- background: #bdbdbd;
- border-radius: 6px;
- height: 12px;
- }
- .slider::-ms-thumb {
- border: 0 none;
- height: 18px;
- width: 18px;
- border-radius: 50%;
- cursor: pointer;
- -webkit-appearance: none;
- background-color: var(--timeline-accent, currentColor); /* Bug in Edge set colour on slider itself */
- pointer-events: all;
- margin-top: -2px;
- }
-
- .slider::-ms-fill-lower {
- background-color: var(--timeline-accent, currentColor);
- border: 0 none;
- border-radius: 6px;
- }
-
- .slider::-ms-fill-upper {
- background: transparent;
- border: 0 none;
- }
-
- #timelineHourMarkers {
- position: relative;
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -webkit-box-direction: normal;
- -moz-box-direction: normal;
- -webkit-flex-direction: row;
- -ms-flex-direction: row;
- flex-direction: row;
-
- margin: 0 50px 0 30px;
- }
-
- #timelineHourMarkers > .timelineHourMark{
- display: flex;
- flex: 1 100%;
- flex-grow: 1;
- flex-shrink: 1;
- flex-basis: 100%;
-
- overflow: visible;
- color: var(--timeline-grey, darkgrey);
- border-left: 1px solid var(--timeline-grey, darkgrey);
- font-size: 12px;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- padding-left: 4px;
- padding-bottom: 4px;
- }
- #timelineHourMarkers .timelineHourMark:last-child {
- position: absolute;
- right: -25px;
- }
-
- #range-value {
- position: absolute;
- background-color: var(--timeline-accent, #1D5632);
- height: 30px;
- width: 60px;
- margin-left: -30px;
- text-align: center;
- color: white;
- display: inline-block;
- left: 0;
- font-size: 12px;
- font-weight: bold;
- line-height: 30px;
- }
-
- .time-value-container {
- width: calc(100% - 80px);
- display: block;
- position: relative;
- height: 30px;
- margin: 0 50px 0 30px;
- }
- </style>
-
-
- <div class="time-value-container">
- <div id="range-value">${this.current === 0 ? "LIVE" : moment().add(this.current, "minutes").format("HH:mm")}</div>
- </div>
- <div class="timeline-container">
- <div id="timelineHourMarkers" class="layout horizontal justified style-scope controller-timeline">
- ${new Array((this.maxRange / 60) + 1).fill(0).map((_, idx) => {
- return html`
- ${idx === 0 ? html`
- <div class="timelineHourMark style-scope controller-timeline">Nu</div>
- ` : html`
- <div class="timelineHourMark style-scope controller-timeline">+${idx}u</div>
- `}
- `; })}
- </div>
-
- <div class="slidecontainer">
- <input id="or-timeline-slider" class="slider" type="range" @input="${this.moveBubble}" @change="${this.valueChange}" value="${this.current}" min="${this.minRange}" max="${this.maxRange}" step="${this.step}">
- </div>
- </div>
-
- `;
- }
-
-}
diff --git a/ui/component/or-timeline/tsconfig.json b/ui/component/or-timeline/tsconfig.json
deleted file mode 100644
index 36a7c304b..000000000
--- a/ui/component/or-timeline/tsconfig.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "./lib",
- "rootDir": "src"
- },
- "include": [
- "./src"
- ],
- "references": [
- { "path": "../core" },
- { "path": "../rest" }
- ]
-}
diff --git a/yarn.lock b/yarn.lock
index 7a7a80dea..cadeb2e75 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2127,15 +2127,6 @@ __metadata:
languageName: unknown
linkType: soft
-"@openremote/or-timeline@workspace:ui/component/or-timeline":
- version: 0.0.0-use.local
- resolution: "@openremote/or-timeline@workspace:ui/component/or-timeline"
- dependencies:
- lit: "npm:^3.3.1"
- moment: "npm:^2.29.4"
- languageName: unknown
- linkType: soft
-
"@openremote/or-translate@workspace:*, @openremote/or-translate@workspace:ui/component/or-translate":
version: 0.0.0-use.local
resolution: "@openremote/or-translate@workspace:ui/component/or-translate"