Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdriscoll committed Jul 31, 2020
1 parent 541e887 commit 39dbbfc
Show file tree
Hide file tree
Showing 53 changed files with 4,104 additions and 3,459 deletions.
Binary file modified src/UniversalDashboard.Charts/UniversalDashboard.Charts.psd1
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public Hashtable Theme {
[Parameter(ParameterSetName = "Pie")]
[Parameter(ParameterSetName = "Stream")]
[Parameter(ParameterSetName = "Treemap")]
[Parameter(ParameterSetName = "Bubble")]
public int BorderWidth
{
set
Expand All @@ -111,6 +112,7 @@ public int BorderWidth
[Parameter(ParameterSetName = "Pie")]
[Parameter(ParameterSetName = "Stream")]
[Parameter(ParameterSetName = "Treemap")]
[Parameter(ParameterSetName = "Bubble")]
public string BorderColor
{
set
Expand Down Expand Up @@ -379,6 +381,7 @@ public object[] GridYValues
[Parameter(ParameterSetName = "Bar")]
[Parameter(ParameterSetName = "Heatmap")]
[Parameter(ParameterSetName = "Stream")]
[Parameter(ParameterSetName = "Bubble")]
public SwitchParameter DisableAnimations
{
set
Expand All @@ -390,6 +393,7 @@ public SwitchParameter DisableAnimations
[Parameter(ParameterSetName = "Bar")]
[Parameter(ParameterSetName = "Heatmap")]
[Parameter(ParameterSetName = "Stream")]
[Parameter(ParameterSetName = "Bubble")]
public int MotionStiffness
{
set
Expand All @@ -401,6 +405,7 @@ public int MotionStiffness
[Parameter(ParameterSetName = "Bar")]
[Parameter(ParameterSetName = "Heatmap")]
[Parameter(ParameterSetName = "Stream")]
[Parameter(ParameterSetName = "Bubble")]
public int MotionDamping
{
set
Expand Down Expand Up @@ -574,6 +579,7 @@ public int BorderRadius

[Parameter(ParameterSetName = "Bar")]
[Parameter(ParameterSetName = "Treemap")]
[Parameter(ParameterSetName = "Bubble")]
public SwitchParameter DisableLabel
{
set
Expand Down Expand Up @@ -1106,6 +1112,7 @@ public SwitchParameter Treemap
}

[Parameter(ParameterSetName = "Treemap")]
[Parameter(ParameterSetName = "Bubble")]
public string Identity
{
set
Expand All @@ -1115,6 +1122,7 @@ public string Identity
}

[Parameter(ParameterSetName = "Treemap")]
[Parameter(ParameterSetName = "Bubble")]
public string Value
{
set
Expand All @@ -1134,6 +1142,7 @@ public string Tile
}

[Parameter(ParameterSetName = "Treemap")]
[Parameter(ParameterSetName = "Bubble")]
public SwitchParameter LeavesOnly
{
set
Expand All @@ -1152,11 +1161,24 @@ public int OuterPadding
}


#endregion

#region Bubble

[Parameter(ParameterSetName = "Bubble")]
public SwitchParameter Bubble
{
set
{
_values.Add("type", "nivo-bubble");
}
}

#endregion

protected override void ProcessRecord()
{
if (ParameterSetName == "Treemap")
if (ParameterSetName == "Treemap" || ParameterSetName == "Bubble")
{
_values["root"] = _values["data"];
_values.Remove("data");
Expand Down
2 changes: 2 additions & 0 deletions src/UniversalDashboard.Charts/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import NivoLine from './nivo-line';
import NivoPie from './nivo-pie';
import NivoStream from './nivo-stream';
import NivoTreemap from './nivo-treemap';
import NivoBubble from './nivo-bubble';
import UDSparklines from './sparklines';

UniversalDashboard.register("nivo-bar", NivoBar);
Expand All @@ -14,4 +15,5 @@ UniversalDashboard.register("nivo-line", NivoLine);
UniversalDashboard.register("nivo-pie", NivoPie);
UniversalDashboard.register("nivo-stream", NivoStream);
UniversalDashboard.register("nivo-treemap", NivoTreemap);
UniversalDashboard.register("nivo-bubble", NivoBubble);
UniversalDashboard.register("sparklines", UDSparklines);
23 changes: 23 additions & 0 deletions src/UniversalDashboard.Charts/components/nivo-bubble.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { ResponsiveBubble, Bubble } from '@nivo/circle-packing';

export default class NivoBubble extends React.Component {
onClick(e) {
if (this.props.hasCallback) {
UniversalDashboard.publish('element-event', {
type: "clientEvent",
eventId: this.props.id,
eventName: 'onClick',
eventData: JSON.stringify(e)
});
}
}

render() {
if (this.props.responsive) {
return <div style={{height: this.props.height}}><ResponsiveBubble {...this.props} onClick={this.onClick.bind(this)}/></div>
} else {
return <Bubble {...this.props} onClick={this.onClick.bind(this)}/>
}
}
}
2 changes: 1 addition & 1 deletion src/UniversalDashboard.Map/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = (env) => {

return {
entry: {
'index' : __dirname + '/components/index.js'
'index' : __dirname + '/Components/index.js'
},
output: {
path: BUILD_DIR,
Expand Down
9 changes: 2 additions & 7 deletions src/v2/Components/ud-footer.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import React from 'react';
import UdLink from './ud-link.jsx'

const style = {
position: 'absolute',
width: '100%',
bottom: '0'
}

export default class UdFooter extends React.Component {
render() {
if (this.props.footer == null) {
return <footer id="ud-footer" style={style} className="page-footer ud-footer" style={{backgroundColor: this.props.backgroundColor, color: this.props.fontColor}}>
return <footer id="ud-footer" className="page-footer ud-footer" style={{backgroundColor: this.props.backgroundColor, color: this.props.fontColor}}>
<div className="footer-copyright">
<div className="container">
<a className="grey-text text-lighten-4 right" href="http://www.poshud.com">Created with PowerShell Universal Dashboard</a>
Expand All @@ -28,7 +23,7 @@ export default class UdFooter extends React.Component {
var backgroundColor = this.props.footer.backgroundColor ? this.props.footer.backgroundColor : this.props.backgroundColor;
var fontColor = this.props.footer.fontColor ? this.props.footer.fontColor : this.props.fontColor;

return <footer id="ud-footer" style={style} className="page-footer ud-footer" style={{backgroundColor: backgroundColor, color: fontColor}}>
return <footer id="ud-footer" className="page-footer ud-footer" style={{backgroundColor: backgroundColor, color: fontColor}}>
<div className="footer-copyright" style={{backgroundColor: backgroundColor, color: fontColor}}>
<div className="container">
{this.props.footer.copyright}
Expand Down
4 changes: 2 additions & 2 deletions src/v2/Components/ud-navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ class UDSideNavItem extends React.Component {
if (!url.startsWith("/")) {
url = "/" + url;
}
this.props.history.push(`${window.baseUrl + url.replace(/ /g, "-")}`);
this.props.history.push(`${url.replace(/ /g, "-")}`);
}
else if (this.props.name != null) {
this.props.history.push(window.baseUrl + `/${this.props.name.replace(/ /g, "-")}`);
this.props.history.push(`/${this.props.name.replace(/ /g, "-")}`);
}

if (!this.props.fixed) {
Expand Down
11 changes: 11 additions & 0 deletions src/v2/Scripts/dashboard.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ function New-UDDashboard
[Parameter()]
[Hashtable[]]$NavbarLinks,
[Parameter()]
[Element]$NavBarLogo,
[Parameter()]
[DashboardColor]$NavBarColor,
[Parameter()]
[DashboardColor]$NavBarFontColor,
[Parameter()]
[Hashtable]$Footer,
[Parameter()]
[Hashtable]$Navigation,
Expand All @@ -27,6 +33,8 @@ function New-UDDashboard
$Pages += New-UDPage -Name 'Home' -Content $Content
}

$Cache:Pages = $Pages

foreach($page in $Pages) {
New-UDEndpoint -Id "$($page.Name)" -Endpoint {
$page
Expand All @@ -40,5 +48,8 @@ function New-UDDashboard
footer = $Footer
navigation = $Navigation
theme = ConvertTo-UDThemeCss -Theme $Theme
navBarLogo = $NavBarLogo
navBarColor = $NavBarColor.HtmlColor
navBarFontColor = $NavBarFontColor.HtmlColor
}
}
4 changes: 2 additions & 2 deletions src/v2/Scripts/interactive/Set-Clipboard.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ function Set-UDClipboard
[Switch]$ToastOnError
)

$Data = @{
$cpData = @{
data = $Data
toastOnSuccess = $ToastOnSuccess.IsPresent
toastOnError = $ToastOnError.IsPresent
}

$DashboardHub.SendWebSocketMessage($ConnectionId, "clipboard", $Data)
$DashboardHub.SendWebSocketMessage($ConnectionId, "clipboard", $cpData)
}
1 change: 1 addition & 0 deletions src/v2/UniversalDashboard.Materialize.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ $TAType = [psobject].Assembly.GetType('System.Management.Automation.TypeAccelera
$TAtype::Add('DashboardColor', 'UniversalDashboard.Models.DashboardColor')
$TAtype::Add('Endpoint', 'UniversalDashboard.Models.Endpoint')
$TAtype::Add('FontAwesomeIcons', 'UniversalDashboard.Models.FontAwesomeIcons')
$TAtype::Add('Element', 'UniversalDashboard.Models.Basics.Element')

function Find-Object {
param(
Expand Down
Binary file modified src/v2/UniversalDashboard.psd1
Binary file not shown.
17 changes: 15 additions & 2 deletions src/v2/app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from 'react-router-dom'
import {getApiPath} from './config.jsx';
import Spinner from 'react-spinkit';
import ErrorCard from '../Components/error-card.jsx';

export default class App extends React.Component {

Expand All @@ -14,7 +15,9 @@ export default class App extends React.Component {

this.state = {
loading: true,
loadingMessage: 'Loading framework...'
loadingMessage: 'Loading framework...',
error: null,
errorInfo: null
}
}

Expand All @@ -32,8 +35,18 @@ export default class App extends React.Component {
})
}

componentDidCatch(error, errorInfo) {
this.setState({
error,
errorInfo
})
}

render () {
var regex = new RegExp('^dashboard(?!.*(\/login))(?!.*(\/license)).*$');

if (this.state.error) {
return <ErrorCard message={this.state.error && this.state.error.toString()} location={this.state.errorInfo.componentStack} />
}

if (this.state.loading) {
return <div style={{backgroundColor: '#FFFFFF'}} className="v-wrap">
Expand Down
6 changes: 4 additions & 2 deletions src/v2/app/basics/lazy-element.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {getApiPath} from './../config.jsx'
import {getApiPath, getDashboardId} from './../config.jsx'
import renderComponent from './../services/render-service.jsx';

export default class LazyElement extends React.Component {
Expand All @@ -12,11 +12,13 @@ export default class LazyElement extends React.Component {
}
}
componentWillMount() {
const dashboardId = getDashboardId();

var script = document.createElement('script');
script.onload = function() {
this.setState({loading:false});
}.bind(this)
script.src = getApiPath() + "/" + this.props.component.assetId;
script.src = getApiPath() + `/api/internal/javascript/${this.props.component.assetId}?dashboardId=${dashboardId}`;
document.head.appendChild(script);
}

Expand Down
2 changes: 1 addition & 1 deletion src/v2/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ task Stage {
Get-ChildItem "$PSScriptRoot\Scripts" -File -Recurse -Filter "*.ps1" | ForEach-Object {
Get-Content $_.FullName -Raw | Out-File "$PSScriptRoot\output\UniversalDashboard.Materialize.psm1" -Append -Encoding UTF8
}
Copy-Item "$PSScriptRoot\Themes" "$PSScriptRoot\output\Themes" -Container -Recurse
Copy-Item "$PSScriptRoot\themes" "$PSScriptRoot\output\Themes" -Container -Recurse
Copy-Item "$PSScriptRoot\UniversalDashboard.psd1" "$PSScriptRoot\output"

Pop-Location
Expand Down
17 changes: 15 additions & 2 deletions src/v2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PowerShell Universal Dashboard</title>
<style>
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
main {
flex: 1 0 auto;
}
.v-wrap{
height: 100% !important;
white-space: nowrap !important;
Expand All @@ -31,11 +39,16 @@
white-space: normal;
}
.ud-dashboard {
display: flex;
min-height: 100vh;
flex-direction: column;
}
.app {
display: flex;
min-height: 100vh;
flex-direction: column;
}

.ud-footer {
position: absolute;
left: 0;
right: 0;
bottom: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/v3/Components/appbar.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useState} from 'react'
import AppBar from '@material-ui/core/AppBar'
import Toolbar from '@material-ui/core/Toolbar'
import { withComponentFeatures } from './universal-dashboard'
import { withComponentFeatures } from 'universal-dashboard'
import { makeStyles } from '@material-ui/core/styles'
import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';
Expand Down
2 changes: 1 addition & 1 deletion src/v3/Components/autocomplete.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import TextField from '@material-ui/core/TextField';
import Autocomplete from '@material-ui/lab/Autocomplete';
import CircularProgress from '@material-ui/core/CircularProgress';
import {FormContext} from './form';
import { withComponentFeatures } from './universal-dashboard'
import { withComponentFeatures } from 'universal-dashboard'
import throttle from 'lodash/throttle';


Expand Down
2 changes: 1 addition & 1 deletion src/v3/Components/button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import classNames from 'classnames'
import Button from '@material-ui/core/Button'
import UdMuIcon from './icon'
import { withComponentFeatures } from './universal-dashboard'
import { withComponentFeatures } from 'universal-dashboard'
import { makeStyles } from '@material-ui/core/styles'

const useStyles = makeStyles(theme => ({
Expand Down
2 changes: 1 addition & 1 deletion src/v3/Components/checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CheckBoxIconBlank from "@material-ui/icons/CheckBoxOutlineBlank"
import FormControlLabel from "@material-ui/core/FormControlLabel"
import classNames from "classnames";
import {FormContext} from './form';
import {withComponentFeatures} from './universal-dashboard';
import {withComponentFeatures} from 'universal-dashboard';

const UDCheckboxWithContext = (props) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/v3/Components/container.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import Container from '@material-ui/core/Container';
import { withComponentFeatures } from './universal-dashboard'
import { withComponentFeatures } from 'universal-dashboard'

const UDContainer = props => {
return <Container>{props.render(props.children)}</Container>
Expand Down
2 changes: 1 addition & 1 deletion src/v3/Components/datepicker.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useEffect} from 'react';
import { withComponentFeatures } from './universal-dashboard';
import { withComponentFeatures } from 'universal-dashboard';
import {FormContext} from './form';

import 'date-fns';
Expand Down
Loading

0 comments on commit 39dbbfc

Please sign in to comment.