Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

FLOW-958 : @ollion/flow-dashboard #205

Merged
merged 47 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
cbf5bf9
FLOW-958 flow-dashboard package added
Nov 3, 2023
32e1e68
FLOW-958 f-dashboard story added
Nov 3, 2023
12ff927
FLOW-958 gridstack added
Nov 6, 2023
cddc9e1
FLOW-958 worker added
Nov 8, 2023
de108fb
FLOW-958 worker added
Nov 8, 2023
a18577c
FLOW-958 rebased
Dec 5, 2023
f69b0df
FLOW-958 worker updated
Dec 5, 2023
da7358b
FLOW-958 timeseries chart added
Dec 14, 2023
214ccf2
FLOW-958 tooltip possitioning logic updated
Dec 14, 2023
cfe0ddf
FLOW-958 tooltip css updated
Dec 14, 2023
a628798
FLOW-958 x and y lines feature added
Dec 18, 2023
bdb4d39
FLOW-958 multiline chart
Dec 19, 2023
2f80f0e
FLOW-958 code segregation
Dec 20, 2023
55c7d1e
FLOW-958 area chart added
Dec 21, 2023
a9e3b01
FLOW-958 bar area line chart series added
Dec 21, 2023
91b37e6
FLOW-958 colors updated
Dec 21, 2023
07ec1fd
FLOW-958 colors updated
Dec 22, 2023
a89f5cf
FLOW-958 namespace updated from cldcvr to ollion
Jan 10, 2024
5c6dbcd
Merge branch 'main' into vikas/FLOW-958
vikas-cldcvr Jan 15, 2024
732797c
Merge branch 'main' into vikas/FLOW-958
vikas-cldcvr Jan 17, 2024
c5b1fa5
FLOW-958 tooltip is now configurable
Jan 17, 2024
f6ff12d
FLOW-958 responsive behavior added for chart
Jan 17, 2024
aecc95f
FLOW-958 tick config added for xAxis
Jan 19, 2024
eb6b83f
FLOW-958 yaxis tick config added
Jan 19, 2024
8ebe0d7
FLOW-958 interval type ticks fixed
Jan 22, 2024
df9c2f8
FLOW-958 x-axis tick removal logic updated for small widths or when t…
Jan 22, 2024
3646bdb
FLOW-958 legends added
Jan 22, 2024
bb88a66
FLOW-958 Legend interaction updated
Jan 22, 2024
cdabf27
FLOW-958 tested legend overflow with 50 series
Jan 22, 2024
fed4819
FLOW-958 legends directions added
Jan 23, 2024
995ec99
FLOW-958 legends template added
Jan 24, 2024
c9def6f
FLOW-958 all options story added
Jan 24, 2024
d71211f
FLOW-958 sample tests added to pass lint checks
Jan 24, 2024
3441f0c
Merge branch 'main' into vikas/FLOW-958
vikas-cldcvr Jan 24, 2024
0c446e2
Merge branch 'main' into vikas/FLOW-958
vikas-cldcvr Jan 25, 2024
cfc721c
FLOW-958 integration with f-dashboard
Jan 25, 2024
53ce415
FLOW-958 number widget dimentions updated
Jan 25, 2024
cf6d571
FLOW-958 mock data utils updated
Jan 25, 2024
29ad71c
FLOW-958 mock data util updated
Jan 25, 2024
902cb4f
FLOW-958 realtime data story updated
Jan 25, 2024
ca6a92e
FLOW-958 widget header option added
Jan 29, 2024
5e91f86
FLOW-958 footer option added for widget
Jan 29, 2024
e9534b7
FLOW-958 tooltip sync feature
Jan 29, 2024
59a2f53
FLOW-958 story updated to generate randon data
Jan 30, 2024
68e4393
FLOW-958 changelog updated
Jan 30, 2024
a7094ac
FLOW-958 code duplication reduced
Jan 31, 2024
1f5ef91
FLOW-958 readme updated
Jan 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
"@ollion/flow-core-config":"packages/flow-core-config/CHANGELOG.md",
"@ollion/flow-form-builder":"packages/flow-form-builder/CHANGELOG.md",
"@ollion/flow-lineage":"packages/flow-lineage/CHANGELOG.md",
"@ollion/flow-dashboard":"packages/flow-dashboard/CHANGELOG.md",
"@ollion/custom-elements-manifest-to-types":"packages/custom-elements-manifest-to-types/CHANGELOG.md"
}

Expand Down
3 changes: 2 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const alias = [
"flow-lineage",
"flow-log",
"flow-md-editor",
"flow-table"
"flow-table",
"flow-dashboard"
].map(pkg => ({
find: `@ollion/${pkg}`,
replacement: path.resolve(__dirname, "../packages", pkg, "src")
Expand Down
7 changes: 7 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import "@ollion/flow-table";
import "@ollion/flow-md-editor";
import "@ollion/flow-form-builder";
import "@ollion/flow-lineage";
import "@ollion/flow-dashboard";

import { setCustomElementsManifest, setCustomElements } from "@storybook/web-components";
import { themes } from "@storybook/theming";
import { Preview } from "@storybook/web-components";
Expand Down Expand Up @@ -123,6 +125,9 @@ async function run() {
const tableCustomElements = await (
await fetch(new URL("../packages/flow-table/custom-elements.json", import.meta.url))
).json();
const dashboardCustomElements = await (
await fetch(new URL("../packages/flow-dashboard/custom-elements.json", import.meta.url))
).json();

const mdEditorCustomElements = await (
await fetch(new URL("../packages/flow-md-editor/custom-elements.json", import.meta.url))
Expand All @@ -140,6 +145,8 @@ async function run() {

setCustomElementsManifest(mdEditorCustomElements);
setCustomElements(mdEditorCustomElements);
setCustomElementsManifest(dashboardCustomElements);
setCustomElements(dashboardCustomElements);
}

run();
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@changesets/cli": "^2.25.0",
"@ollion/custom-elements-manifest-to-types": "workspace:*",
"@ollion/prettier-config": "^2.1.0",
"@faker-js/faker": "^7.6.0",
"@faker-js/faker": "^8.3.1",
"@storybook/addon-actions": "^7.5.3",
"@storybook/addon-essentials": "^7.5.3",
"@storybook/addon-links": "^7.5.3",
Expand Down Expand Up @@ -66,7 +66,8 @@
"sass": "^1.52.3",
"storybook": "^7.5.3",
"typescript": "^5.2.2",
"vite": "^4.4.11"
"vite": "^4.4.11",
"@types/d3": "7.4.3"
},
"dependencies": {
"@ollion/flow-aws-icon": "latest",
Expand All @@ -77,11 +78,13 @@
"@ollion/flow-lineage": "workspace:*",
"@ollion/flow-log": "workspace:*",
"@ollion/flow-md-editor": "workspace:*",
"@ollion/flow-product-icon": "latest",
"@ollion/flow-product-icon": "1.14.0",
"@ollion/flow-system-icon": "latest",
"@ollion/flow-table": "workspace:*",
"@ollion/flow-dashboard": "workspace:*",
"jspdf": "^2.5.1",
"lit": "^3.1.0"
"lit": "^3.1.0",
"d3": "^7.6.1"
},
"loki": {
"configurations": {
Expand Down
3 changes: 2 additions & 1 deletion packages/flow-core/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Flow-core

![npm](https://badgen.net/npm/v/@ollion/flow-core) ![license](https://badgen.net/npm/license/@ollion/flow-core) ![types](https://badgen.net/npm/types/@ollion/flow-core) ![downloads](https://badgen.net//npm/dw/@ollion/flow-core) ![build](https://github.com/ollionorg/flow-core/actions/workflows/build.yml/badge.svg) ![release](https://github.com/ollionorg/flow-core/actions/workflows/release.yml/badge.svg) ![CodeQL](https://github.com/ollionorg/flow-core/workflows/CodeQL/badge.svg) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=ollion_flow-core&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=ollion_flow-core) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=ollion_flow-core&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=ollion_flow-core) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ollion_flow-core&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=ollion_flow-core) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=ollion_flow-core&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=ollion_flow-core) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=ollion_flow-core&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=ollion_flow-core) [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=ollion_flow-core&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=ollion_flow-core) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=ollion_flow-core&metric=bugs)](https://sonarcloud.io/summary/new_code?id=ollion_flow-core)
![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Follionorg%2Fflow-core%2Fmain%2Fpackages%2Fflow-core%2Fpackage.json&query=%24.version&prefix=v&logo=npm&label=%40ollion%2Fflow-core) ![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Follionorg%2Fflow-core%2Fmain%2Fpackages%2Fflow-form-builder%2Fpackage.json&query=%24.version&prefix=v&logo=npm&label=%40ollion%2Fflow-form-builder) ![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Follionorg%2Fflow-core%2Fmain%2Fpackages%2Fflow-table%2Fpackage.json&query=%24.version&prefix=v&logo=npm&label=%40ollion%2Fflow-table) ![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Follionorg%2Fflow-core%2Fmain%2Fpackages%2Fflow-lineage%2Fpackage.json&query=%24.version&prefix=v&logo=npm&label=%40ollion%2Fflow-lineage) ![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Follionorg%2Fflow-core%2Fmain%2Fpackages%2Fflow-log%2Fpackage.json&query=%24.version&prefix=v&logo=npm&label=%40ollion%2Fflow-log) ![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Follionorg%2Fflow-core%2Fmain%2Fpackages%2Fflow-code-editor%2Fpackage.json&query=%24.version&prefix=v&logo=npm&label=%40ollion%2Fflow-code-editor) ![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Follionorg%2Fflow-core%2Fmain%2Fpackages%2Fflow-md-editor%2Fpackage.json&query=%24.version&prefix=v&logo=npm&label=%40ollion%2Fflow-md-editor)
![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Follionorg%2Fflow-core%2Fmain%2Fpackages%2Fflow-core%2Fpackage.json&query=%24.license&label=license) ![build](https://github.com/ollionorg/flow-core/actions/workflows/build.yml/badge.svg) ![release](https://github.com/ollionorg/flow-core/actions/workflows/release.yml/badge.svg) ![CodeQL](https://github.com/ollionorg/flow-core/workflows/CodeQL/badge.svg) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=cldcvr_flow-core&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=cldcvr_flow-core) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=cldcvr_flow-core&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=cldcvr_flow-core) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cldcvr_flow-core&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=cldcvr_flow-core) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=cldcvr_flow-core&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=cldcvr_flow-core) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=cldcvr_flow-core&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=cldcvr_flow-core) [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=cldcvr_flow-core&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=cldcvr_flow-core) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=cldcvr_flow-core&metric=bugs)](https://sonarcloud.io/summary/new_code?id=cldcvr_flow-core)

Flow-core is the base library required by any flow dependecies. It consists mostly of building blocks such design + system tokens, atoms, molecules, base themes, etc.

Expand Down
8 changes: 8 additions & 0 deletions packages/flow-dashboard/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*
!dist/**/*.*
!shims.d.ts
!custom-elements.json
!html.html-data.json
!src/**/*.*
!README.md
!umd/**/*.*
13 changes: 13 additions & 0 deletions packages/flow-dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<h4 className="margin-btm-8">Release Notes</h4>

# Change Log

## [0.0.1] - 2023-11-03

### First Release

- `@ollion/flow-dashboard` released.

### Note

- Since this is the first release, we are testing it with various frameworks (thus, it is not production-ready)
21 changes: 21 additions & 0 deletions packages/flow-dashboard/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

Copyright (c) 2022 CloudCover Consultancy Pvt Ltd

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
60 changes: 60 additions & 0 deletions packages/flow-dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Flow Dashboard

The Flow dashboard is built on the Flow design framework ([website](https://flow.ollion.com/) / [github](https://github.com/ollionorg/flow-core))

# Installation

### 1️⃣ Install flow dashboard dependency

```
npm i --save @ollion/flow-dashboard
```

**Note:** after installation, re-start your application.

<br>

### 2️⃣ Import flow-dashboard into your project

Paste the below snippet in your project and add your application startup/runtime code to it.

```javascript
import "@ollion/flow-core";
import "@ollion/flow-dashboard";
```

<br>

### 3️⃣ For a typescript enabled project (optional)

**Note:** After adding, re-start your application. Make sure you are using version >4.5

**For Vue 3:**
Copy paste below import types in your `main.ts` file.

```Javascript
import "@ollion/flow-dashboard/dist/types/vue3";
```

<details>
<summary>For Vue 2</summary>

Copy paste below import types in your `main.ts` file.

```Javascript
import "@ollion/flow-dashboard/dist/types/vue2";
```

</details>

<details>
<summary>For React</summary>

**React**: Include react type in `tsconfig.json` file like below.

```json
"include": ["src", "./node_modules/@ollion/flow-dashboard/dist/types/react.ts"]
```

</details>
<br>
12 changes: 12 additions & 0 deletions packages/flow-dashboard/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

#!/bin/bash

HERE=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

cd "$HERE"

pnpm run analyze

echo "building library..."
pnpm vite build --emptyOutDir
pnpm vite build --emptyOutDir --config vite.umd.config.ts
67 changes: 67 additions & 0 deletions packages/flow-dashboard/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"name": "@ollion/flow-dashboard",
"version": "0.0.1",
"description": "Dashboard as code",
"module": "dist/flow-dashboard.es.js",
"main": "dist/flow-dashboard.cjs.js",
"types": "dist/src/index.d.ts",
"scripts": {
"build": "bash ./compile.sh",
"build:watch": "concurrently --kill-others \"vite build --emptyOutDir --watch\" \"tsc --watch\"",
"analyze": "cem analyze --litelement --globs \"src/**/*.ts\" && wca analyze src --format vscode --outFile html.html-data.json",
"analyze:watch": "cem analyze --litelement --globs \"src/**/*.ts\" --watch",
"test": "web-test-runner ./src/**/*.test.ts --node-resolve --port 8095",
"test:file": "pnpm run build && web-test-runner --node-resolve --port 8095",
"test:watch": "pnpm run build && web-test-runner ./src/**/*.test.ts --node-resolve --watch --port 8095"
},
"keywords": [
"web-components",
"lit-element",
"typescript",
"lit"
],
"dependencies": {
"@ollion/flow-core": "workspace:*",
"@ollion/flow-core-config": "workspace:*",
"axios": "^0.27.2",
"d3": "^7.6.1",
"gridstack": "^9.5.0",
"lit": "^3.1.0",
"rxjs": "^7.8.1"
},
"peerDependencies": {
"@ollion/flow-core": "^*",
"@ollion/flow-core-config": "^*"
},
"devDependencies": {
"@custom-elements-manifest/analyzer": "^0.5.7",
"@open-wc/testing": "^3.1.5",
"@types/d3": "7.4.3",
"@types/jest": "29.5.5",
"@web/dev-server-esbuild": "^0.4.1",
"@web/test-runner": "^0.17.1",
"concurrently": "^8.2.1",
"esbuild-sass-plugin": "2.2.6",
"lit-html": "^3.1.0",
"sass": "^1.52.3",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"web-component-analyzer": "^2.0.0-next.4"
},
"repository": {
"type": "git",
"url": "https://github.com/ollionorg/flow-core.git",
"directory": "packages/flow-dashboard"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
},
"customElements": "custom-elements.json",
"bugs": {
"url": "https://github.com/ollionorg/flow-core/issues"
},
"homepage": "https://github.com/ollionorg/flow-core/packages/flow-dashboard#readme",
"author": "@ollion",
"license": "MIT"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@import "../../../../flow-core/src/mixins/scss/mixins";

@import "gridstack/dist/gridstack.min.css";

f-dashboard {
@include base();
height: 100%;
width: 100%;

display: flex;
overflow: auto;
.grid-stack {
width: 100%;
.grid-stack-item {
.grid-stack-item-content {
background: var(--color-surface-secondary);
display: flex;
flex-direction: column;
f-timeseries-chart {
flex: 1 0 100%;
}
> f-div[height="fill-container"] {
flex: 1 1;
max-height: 100%;
}
> f-div[width="fill-container"] {
width: 100%;
}
}
}
}
}

f-div[direction="column"] {
> f-dashboard {
flex: 1 1;
max-height: 100%;
}
}

f-div[direction="row"] {
> f-dashboard {
flex: 1 1;
max-width: 100%;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { html, nothing } from "lit";
import { FDashboardWidget } from "../../types";

export function getWidgetHeader(widget: FDashboardWidget) {
if (widget.header) {
if (typeof widget.header === "object") {
return html`<f-div
align="middle-left"
height="hug-content"
padding="medium"
direction="column"
border="small solid subtle bottom"
>
<f-text ellipsis .tooltip=${widget.header.title} variant="heading" weight="medium"
>${widget.header.title}</f-text
>
<f-text ellipsis state="secondary" .tooltip=${widget.header.description} size="small"
>${widget.header.description}</f-text
>
</f-div>`;
} else if (typeof widget.header === "function") {
return widget.header();
}
}

return nothing;
}

export function getWidgetFooter(widget: FDashboardWidget) {
if (widget.footer) {
if (typeof widget.footer === "string") {
return html`<f-div
align="middle-left"
height="hug-content"
padding="medium"
direction="column"
border="small solid subtle top"
>
<f-text state="subtle" size="small">${widget.footer}</f-text>
</f-div>`;
} else if (typeof widget.footer === "function") {
return widget.footer();
}
}

return nothing;
}

export function renderWidget(widget: FDashboardWidget) {
switch (widget.type) {
case "big-number":
return html`<f-div padding="medium" class="big-number">${widget.data.toFixed(2)}</f-div>`;

case "timeseries":
return html`<f-div padding="medium"
><f-timeseries-chart .config=${widget.data}></f-timeseries-chart
></f-div>`;

default:
return nothing;
}
}
Loading
Loading