pennsieve-dashboard 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +415 -2
- package/dist/pennsieve-dashboard.es.js +972 -913
- package/dist/pennsieve-dashboard.umd.js +38 -38
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,418 @@
|
|
|
1
1
|
# Vue 3 + TypeScript + Vite
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# PennsieveDashboard
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[]()
|
|
6
|
+
[]()
|
|
7
|
+
|
|
8
|
+
The **PennsieveDashboard** is a web application that provides a user interface for interacting with Pennsieve data, visualizing metrics, and managing dashboards relevant to scientific datasets.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Table of Contents
|
|
14
|
+
|
|
15
|
+
- [Features](#features)
|
|
16
|
+
- [Getting Started](#getting-started)
|
|
17
|
+
- [Prerequisites](#prerequisites)
|
|
18
|
+
- [Installation](#installation)
|
|
19
|
+
- [Usage](#usage)
|
|
20
|
+
|
|
21
|
+
- [Contributing](#contributing)
|
|
22
|
+
- [Contact / Support](#contact-support)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- Dashboard views for Pennsieve, Sparc, and Percision
|
|
29
|
+
- Visual metrics and charts (e.g. usage, growth)
|
|
30
|
+
- Authentication and role-based access
|
|
31
|
+
- Publishing and versioning support
|
|
32
|
+
- Tag filtering and search
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Getting Started
|
|
37
|
+
|
|
38
|
+
### Prerequisites
|
|
39
|
+
|
|
40
|
+
Before you begin, ensure you have the following installed:
|
|
41
|
+
|
|
42
|
+
- [Node.js](https://nodejs.org/) (version ≥ 14)
|
|
43
|
+
- npm or Yarn
|
|
44
|
+
- Element Plus (^2.11.0)
|
|
45
|
+
- Pinia (^3.0.3)
|
|
46
|
+
|
|
47
|
+
### Installation
|
|
48
|
+
|
|
49
|
+
1. Clone the repository:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git clone https://github.com/Pennsieve/PennsieveDashboard.git
|
|
53
|
+
cd PennsieveDashboard
|
|
54
|
+
|
|
55
|
+
2. Install
|
|
56
|
+
```
|
|
57
|
+
npm install
|
|
58
|
+
# or
|
|
59
|
+
yarn install
|
|
60
|
+
```
|
|
61
|
+
3. App.vue
|
|
62
|
+
For install and testing copy and paste this into your App.vue
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
//App.vue
|
|
66
|
+
<script setup>
|
|
67
|
+
import { computed, ref } from 'vue';
|
|
68
|
+
import {PennsieveDashboard, MarkdownWidget, TextWidget} from 'pennsieve-dashboard'
|
|
69
|
+
import 'element-plus/dist/index.css';
|
|
70
|
+
import 'pennsieve-dashboard/style.css'
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
Computed
|
|
74
|
+
*/
|
|
75
|
+
const publicationStatus = computed(() => {
|
|
76
|
+
return "foobar"
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const filesCount = computed(() => {
|
|
80
|
+
return "b"
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const collaboratorCounts = computed(()=>{
|
|
84
|
+
return "a"
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
const availableWidgets = [
|
|
89
|
+
//name must match componentKey
|
|
90
|
+
{ name: 'TextWidget', component: TextWidget },
|
|
91
|
+
{name:'MarkdownWidget',component:MarkdownWidget}
|
|
92
|
+
]
|
|
93
|
+
const defaultLayout = [
|
|
94
|
+
{
|
|
95
|
+
id: 'MarkdownWidget-6',
|
|
96
|
+
x: 0, y: 0, w: 3, h: 9,
|
|
97
|
+
componentKey: 'MarkdownWidget',
|
|
98
|
+
componentName: 'Markdown Widget',
|
|
99
|
+
component: MarkdownWidget,
|
|
100
|
+
Props:{
|
|
101
|
+
markdownText:[
|
|
102
|
+
'# Human DRG Dataset Dashboard',
|
|
103
|
+
'',
|
|
104
|
+
'This is a dashboard associated with the **NIH HEAL PRECISION Human Pain** consortium project. It aggregates data from several U19 centers in a standardized way. Using the different widgets, you can view, query and export the data in various ways:',
|
|
105
|
+
'',
|
|
106
|
+
'## Widgets',
|
|
107
|
+
'',
|
|
108
|
+
'### UMAP Viewer',
|
|
109
|
+
'This widget provides the UMAP representation of the entire dataset, you can select the color mapping based on different metadata elements.',
|
|
110
|
+
'',
|
|
111
|
+
'### The Data Explorer',
|
|
112
|
+
'Directly query over the data using SQL and export the results as a CSV file.',
|
|
113
|
+
'',
|
|
114
|
+
'### Proportion Viewer',
|
|
115
|
+
'Explore metrics between the different datasets that comprise the aggregated data.'
|
|
116
|
+
].join('\n')
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "TextWidget-1",
|
|
121
|
+
x: 0, y: 0, h: 1, w:4,
|
|
122
|
+
componentName:"Text",
|
|
123
|
+
componentKey:"TextWidget",
|
|
124
|
+
component:TextWidget,
|
|
125
|
+
hideHeader:true,
|
|
126
|
+
Props:{displayText:"Dataset Overview",hideHeader:true}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: "TextWidget-2",
|
|
130
|
+
x: 0, y: 1, h: 2, w:1,
|
|
131
|
+
componentName:"Files",
|
|
132
|
+
componentKey:"TextWidget",
|
|
133
|
+
component:TextWidget,
|
|
134
|
+
Props:{bindedKey:"FileCount"}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: "TextWidget-3",
|
|
138
|
+
x: 1, y: 1, h: 2, w:2,
|
|
139
|
+
componentName:"Status",
|
|
140
|
+
componentKey:"TextWidget",
|
|
141
|
+
component:TextWidget,
|
|
142
|
+
Props:{bindedKey:"Status"}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: "TextWidget-4",
|
|
146
|
+
x: 3, y: 1, h: 2, w:2,
|
|
147
|
+
componentName:"Collaborator Counts",
|
|
148
|
+
componentKey:"TextWidget",
|
|
149
|
+
component:TextWidget,
|
|
150
|
+
Props:{bindedKey:"CollaboratorCounts"}
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
const dashboardOptions = ref({
|
|
155
|
+
globalData: {
|
|
156
|
+
FileCount: filesCount.value,
|
|
157
|
+
Status: publicationStatus.value,
|
|
158
|
+
CollaboratorCounts: collaboratorCounts.value
|
|
159
|
+
},
|
|
160
|
+
availableWidgets,
|
|
161
|
+
defaultLayout,
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
</script>
|
|
165
|
+
<template>
|
|
166
|
+
<PennsieveDashboard class="dashboard-app" :options="dashboardOptions"></PennsieveDashboard>
|
|
167
|
+
|
|
168
|
+
</template>
|
|
169
|
+
|
|
170
|
+
<style scoped>
|
|
171
|
+
/* set style vars from outside the dashboard > customize to match your application */
|
|
172
|
+
.dashboard-app{
|
|
173
|
+
--el-color-primary: #243d8e;
|
|
174
|
+
--el-color-primary-light-3: #fbfdff;
|
|
175
|
+
--el-color-primary-dark-2: #546085;
|
|
176
|
+
--color:#243d8e;
|
|
177
|
+
--el-dialog-width: 90%;
|
|
178
|
+
--dash-secondary: #243d8e;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
</style>
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
4. Run
|
|
186
|
+
```
|
|
187
|
+
npm run dev
|
|
188
|
+
```
|
|
189
|
+
## Usage
|
|
190
|
+
## Using the Dashboard and Widgets
|
|
191
|
+
|
|
192
|
+
The **Pennsieve Dashboard** can be used in two ways:
|
|
193
|
+
|
|
194
|
+
1. **Standalone** – with its built-in widgets.
|
|
195
|
+
2. **Extended** – by integrating with external widget libraries, such as the [SPARC Widgets Library](https://github.com/nih-sparc/SparcDashWidgets).
|
|
196
|
+
- You can see a demo of the SPARC dashboard in action here: [SPARC Dashboard Demo](https://staging.sparc.science/apps/sparc-dashboard).
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
### Built-in Widgets
|
|
201
|
+
|
|
202
|
+
The dashboard ships with a small set of widgets out of the box. These can be used immediately to create dashboards without adding external libraries.
|
|
203
|
+
|
|
204
|
+
- **Markdown Widget**
|
|
205
|
+
Displays formatted text using Markdown syntax. Useful for adding documentation, context, or descriptive notes directly in the dashboard.
|
|
206
|
+
|
|
207
|
+
- **Text Widget**
|
|
208
|
+
Displays plain or bound text values (e.g., counts, statuses, labels). Useful for lightweight metrics and quick information displays.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
### Adding Widgets to the Dashboard
|
|
213
|
+
|
|
214
|
+
Widgets are registered in the `availableWidgets` array, and their default layout is defined in the `defaultLayout` configuration. Each widget requires:
|
|
215
|
+
|
|
216
|
+
- A unique `id`
|
|
217
|
+
- Position and size (`x`, `y`, `w`, `h`)
|
|
218
|
+
- `componentKey` (must match the widget’s registration name)
|
|
219
|
+
- `componentName`
|
|
220
|
+
- Props (e.g., `displayText`, `markdownText`, `bindedKey`)
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
### Example: Embedding the Dashboard in Your Application
|
|
225
|
+
|
|
226
|
+
The following example shows how to embed the **Pennsieve Dashboard** into a Vue 3 application.
|
|
227
|
+
The example is broken down into six key parts so developers can understand how each piece works and how to extend it.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
#### 1. Imports
|
|
233
|
+
```js
|
|
234
|
+
import { computed, ref } from 'vue';
|
|
235
|
+
import { PennsieveDashboard, MarkdownWidget, TextWidget } from 'pennsieve-dashboard';
|
|
236
|
+
import 'element-plus/dist/index.css';
|
|
237
|
+
import 'pennsieve-dashboard/style.css';
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
- **Vue imports**:
|
|
241
|
+
- `ref` – for reactive state.
|
|
242
|
+
- `computed` – for derived or dynamic values you want to expose to widgets.
|
|
243
|
+
- **Dashboard & widgets**: import the core `PennsieveDashboard` component along with any widgets you want to use (in this case, `MarkdownWidget` and `TextWidget`).
|
|
244
|
+
- **Styles**:
|
|
245
|
+
- `element-plus/dist/index.css` – required styles for the Element Plus UI library.
|
|
246
|
+
- `pennsieve-dashboard/style.css` – base dashboard styling.
|
|
247
|
+
|
|
248
|
+
Without these, the dashboard and widgets will not render correctly.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
#### 2. Available Widgets
|
|
253
|
+
```js
|
|
254
|
+
const availableWidgets = [
|
|
255
|
+
{ name: 'TextWidget', component: TextWidget },
|
|
256
|
+
{ name: 'MarkdownWidget', component: MarkdownWidget }
|
|
257
|
+
];
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
- This array **registers which widgets the dashboard can use**.
|
|
261
|
+
- Each widget entry must define:
|
|
262
|
+
- `name` – must match the widget’s `componentKey` in the layout.
|
|
263
|
+
- `component` – the imported Vue component.
|
|
264
|
+
- You can extend this list with custom widgets or external widget libraries.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
#### 3. Default Layout
|
|
269
|
+
```js
|
|
270
|
+
const defaultLayout = [
|
|
271
|
+
{
|
|
272
|
+
id: 'MarkdownWidget-6',
|
|
273
|
+
x: 0, y: 0, w: 3, h: 9,
|
|
274
|
+
componentKey: 'MarkdownWidget',
|
|
275
|
+
componentName: 'Markdown Widget',
|
|
276
|
+
component: MarkdownWidget,
|
|
277
|
+
Props: {
|
|
278
|
+
markdownText: "# Human DRG Dataset Dashboard\n..."
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
id: "TextWidget-1",
|
|
283
|
+
x: 0, y: 0, h: 1, w: 4,
|
|
284
|
+
componentName: "Text",
|
|
285
|
+
componentKey: "TextWidget",
|
|
286
|
+
component: TextWidget,
|
|
287
|
+
hideHeader: true,
|
|
288
|
+
Props: { displayText: "Dataset Overview" }
|
|
289
|
+
}
|
|
290
|
+
// additional TextWidget entries...
|
|
291
|
+
];
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
- Controls **how widgets are arranged on the grid**.
|
|
295
|
+
- Each widget requires:
|
|
296
|
+
- `id` – unique identifier for the widget instance.
|
|
297
|
+
- `x, y, w, h` – grid position and size.
|
|
298
|
+
- `componentKey` – must match the `name` from `availableWidgets`.
|
|
299
|
+
- `componentName` – display label for the widget.
|
|
300
|
+
- `Props` – configuration for the widget (text content, markdown, or bound keys).
|
|
301
|
+
- Developers can define multiple widgets and fine-tune their placement.
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
#### 4. Dashboard Options
|
|
306
|
+
```js
|
|
307
|
+
const publicationStatus = computed(() => "foobar");
|
|
308
|
+
const filesCount = computed(() => "b");
|
|
309
|
+
const collaboratorCounts = computed(() => "a");
|
|
310
|
+
|
|
311
|
+
const dashboardOptions = ref({
|
|
312
|
+
globalData: {
|
|
313
|
+
FileCount: filesCount.value,
|
|
314
|
+
Status: publicationStatus.value,
|
|
315
|
+
CollaboratorCounts: collaboratorCounts.value
|
|
316
|
+
},
|
|
317
|
+
availableWidgets,
|
|
318
|
+
defaultLayout,
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
- **Computed values**: hold live data you want to expose inside the dashboard. These could come from an API call or another reactive source.
|
|
323
|
+
- **globalData**: key/value pairs accessible to widgets. For example, a `TextWidget` can bind to `FileCount` or `Status`.
|
|
324
|
+
- **dashboardOptions**: combines global data, available widgets, and layout into a single configuration object that powers the dashboard.
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
#### 5. Template
|
|
329
|
+
```vue
|
|
330
|
+
<template>
|
|
331
|
+
<PennsieveDashboard class="dashboard-app" :options="dashboardOptions" />
|
|
332
|
+
</template>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
- Renders the `PennsieveDashboard` component.
|
|
336
|
+
- The `:options` prop passes in the configuration created above.
|
|
337
|
+
- Any widget defined in `defaultLayout` will be rendered automatically.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
#### 6. Styles
|
|
342
|
+
```css
|
|
343
|
+
<style scoped>
|
|
344
|
+
.dashboard-app {
|
|
345
|
+
--el-color-primary: #243d8e;
|
|
346
|
+
--el-color-primary-light-3: #fbfdff;
|
|
347
|
+
--el-color-primary-dark-2: #546085;
|
|
348
|
+
--color: #243d8e;
|
|
349
|
+
--el-dialog-width: 90%;
|
|
350
|
+
--dash-secondary: #243d8e;
|
|
351
|
+
}
|
|
352
|
+
</style>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
- Dashboard styling can be overridden using **CSS variables**.
|
|
356
|
+
- Customize colors, spacing, and UI elements to match your application’s theme.
|
|
357
|
+
|
|
358
|
+
## Contributing
|
|
359
|
+
## Contributing
|
|
360
|
+
|
|
361
|
+
We welcome contributions from developers and the community. There are two main ways you can get involved:
|
|
362
|
+
|
|
363
|
+
### 1. Reporting Bugs or Issues
|
|
364
|
+
If you encounter a bug, performance problem, or unexpected behavior in the dashboard:
|
|
365
|
+
- Please report it through the official support channels.
|
|
366
|
+
- Include as much detail as possible (steps to reproduce, screenshots, browser/OS version, etc.) so we can investigate and resolve quickly.
|
|
367
|
+
|
|
368
|
+
### 2. Building Custom Widget Libraries
|
|
369
|
+
The dashboard is designed to be extensible. Developers can build their own widget libraries and plug them into the dashboard.
|
|
370
|
+
|
|
371
|
+
For reference, check out the [SPARC Dash Widgets Library](https://github.com/nih-sparc/SparcDashWidgets), which provides an example of how to build custom widgets. You can also see it in action at the [SPARC Dashboard Demo](https://staging.sparc.science/apps/sparc-dashboard).
|
|
372
|
+
|
|
373
|
+
#### Sample Component
|
|
374
|
+
Here’s a minimal example of a custom widget component:
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
//vue
|
|
378
|
+
<template>
|
|
379
|
+
<!-- Child icons show up in the widget header -->
|
|
380
|
+
<slot :widgetName="widgetName" :childIcons="childIcons"></slot>
|
|
381
|
+
|
|
382
|
+
<div class="my-widget-name-wrap" v-bind="$attrs">
|
|
383
|
+
<!-- Component body goes here -->
|
|
384
|
+
</div>
|
|
385
|
+
</template>
|
|
386
|
+
|
|
387
|
+
<script setup lang="ts">
|
|
388
|
+
import { ref, watch, computed, shallowRef } from 'vue'
|
|
389
|
+
import { Edit } from '@element-plus/icons-vue'
|
|
390
|
+
|
|
391
|
+
defineOptions({ inheritAttrs: false })
|
|
392
|
+
|
|
393
|
+
// Props can be passed in from the defaultLayout in dashboard options or set programmatically.
|
|
394
|
+
const props = defineProps<{
|
|
395
|
+
property1?: string
|
|
396
|
+
}>()
|
|
397
|
+
|
|
398
|
+
const emit = defineEmits<{
|
|
399
|
+
(e: 'updateComponent', value: string): void
|
|
400
|
+
}>()
|
|
401
|
+
|
|
402
|
+
// Provide values for your scoped slot so it doesn't error
|
|
403
|
+
const widgetName = 'example widget'
|
|
404
|
+
const childIcons = shallowRef([
|
|
405
|
+
{ comp: Edit, event: toggleMode, tooltip: 'click to open edit mode' }
|
|
406
|
+
])
|
|
407
|
+
|
|
408
|
+
function toggleMode() {
|
|
409
|
+
// Custom code for toggling edit mode
|
|
410
|
+
}
|
|
411
|
+
</script>
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
## Contact Support
|
|
415
|
+
|
|
416
|
+
There are several ways to get in contact with our support team.
|
|
417
|
+
**support page**
|
|
418
|
+
https://discover.pennsieve.io/about/support
|