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

Commit

Permalink
Merge 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdriscoll committed Jun 16, 2020
1 parent 6552474 commit fb9c732
Show file tree
Hide file tree
Showing 36 changed files with 284 additions and 690 deletions.
2 changes: 1 addition & 1 deletion src/v2/Components/ud-input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class Input extends React.Component {
super(props);

this.state = {
fields: props.fields,
fields: Array.isArray(props.fields) ? props.fields : [props.fields],
newContent: [],
loading: false,
canSubmit: !props.validate
Expand Down
Binary file modified src/v2/UniversalDashboard.psd1
Binary file not shown.
2 changes: 2 additions & 0 deletions src/v2/app/services/fetch-service.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const fetchGet = function(url, success, history) {
return text;
}
}).then(success);
} else if (response.status == 401) {
window.location.href = `/login?returnurl=${window.location.pathname}`
} else {
throw new Error(response.statusText);
}
Expand Down
10 changes: 10 additions & 0 deletions src/v2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
vertical-align: middle;
white-space: normal;
}
.ud-dashboard {
min-height: 100vh;
}

.ud-footer {
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
</style>
</head>
<body>
Expand Down
4 changes: 2 additions & 2 deletions src/v3/Components/appbar.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/** @jsx jsx */
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 { makeStyles } from '@material-ui/core/styles'
import { jsx } from 'theme-ui'
import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';
import ToggleColorModes from './framework/togglecolormodes';

const useStyles = makeStyles(theme => ({
button: {
Expand Down Expand Up @@ -49,6 +48,7 @@ const UDAppBar = props => {
<Toolbar>
{drawerButton}
{props.render(props.children)}
<ToggleColorModes />
</Toolbar>
</AppBar>,
drawer
Expand Down
4 changes: 1 addition & 3 deletions src/v3/Components/avatar.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
/** @jsx jsx */
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import Avatar from '@material-ui/core/Avatar';
import classNames from 'classnames'
import {jsx} from 'theme-ui'

function UDMuAvatar(props) {

const { classes } = props;

return (
<Avatar id={props.id} alt={props.alt} src={props.image} className={classNames(props.className, "ud-mu-avatar")} sx={{ variant: `avatars.${props.variant}` }}/>
<Avatar id={props.id} alt={props.alt} src={props.image} className={classNames(props.className, "ud-mu-avatar")}/>
);
}

Expand Down
2 changes: 0 additions & 2 deletions src/v3/Components/button.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/** @jsx jsx */
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 { makeStyles } from '@material-ui/core/styles'
import { jsx } from 'theme-ui'

const useStyles = makeStyles(theme => ({
button: {
Expand Down
3 changes: 0 additions & 3 deletions src/v3/Components/card.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsx jsx */
import React, { Fragment } from "react";
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
Expand All @@ -10,7 +9,6 @@ import UDCardBody from "./card-body";
import UDCardExpand from "./card-expand";
import UDCardFooter from "./card-footer";
import UDCardMedia from './card-media';
import {jsx} from 'theme-ui'

const styles = theme => ({
root: {
Expand Down Expand Up @@ -76,7 +74,6 @@ export class UDMuCard extends React.Component {
onMouseEnter={this.onMouseEnterEvent}
onMouseLeave={this.onMouseLeaveEvent}
style={{ ...style }}
//sx={{ bg: 'background', color: 'text'}}
>

{toolbar !== null && showToolBar ?
Expand Down
4 changes: 1 addition & 3 deletions src/v3/Components/checkbox.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsx jsx */
import React, {useEffect} from "react";
import Checkbox from "@material-ui/core/Checkbox";
import CheckBoxIcon from "@material-ui/icons/CheckBox"
Expand All @@ -7,7 +6,6 @@ import FormControlLabel from "@material-ui/core/FormControlLabel"
import classNames from "classnames";
import {FormContext} from './form';
import {withComponentFeatures} from './universal-dashboard';
import {jsx} from 'theme-ui'

const UDCheckboxWithContext = (props) => {
return (
Expand Down Expand Up @@ -49,7 +47,7 @@ const UDCheckbox = (props) => {
color="default"
icon={ props.icon ? props.render(props.icon) : <CheckBoxIconBlank/> }
checkedIcon={ props.checkedIcon ? props.render(props.checkedIcon) : <CheckBoxIcon/> }
sx={{ color: 'primary' }}/>
/>
}
label={!props.label ? null : props.label}
labelPlacement={props.labelPlacement}
Expand Down
2 changes: 0 additions & 2 deletions src/v3/Components/drawer.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/** @jsx jsx */
import React from 'react'
import Drawer from '@material-ui/core/Drawer'
import { withComponentFeatures } from './universal-dashboard'
import { makeStyles } from '@material-ui/core/styles'
import { jsx } from 'theme-ui'

const useStyles = makeStyles(theme => ({
button: {
Expand Down
28 changes: 28 additions & 0 deletions src/v3/Components/framework/togglecolormodes.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import IconButton from '@material-ui/core/IconButton';
import DarkIcon from '@material-ui/icons/Brightness7';
import LightIcon from '@material-ui/icons/Brightness4';
import {AppContext} from './../../app/app-context';

export default props => {
return (
<AppContext.Consumer>
{context => {
return (
<IconButton
{...props}
onClick={e => {
const next = context.theme === 'dark' ? 'light' : 'dark'
sessionStorage.setItem('theme', next);
context.setTheme(next)
}}
>
{context.theme === 'dark' ? <DarkIcon/> : <LightIcon />}
</IconButton>
)

}}
</AppContext.Consumer>

)
}
4 changes: 1 addition & 3 deletions src/v3/Components/framework/ud-footer.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/** @jsx jsx */
import React from 'react';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Link from '@material-ui/core/Link';
import { makeStyles } from '@material-ui/core/styles';
import {jsx} from 'theme-ui'

const useStyles = makeStyles(theme => ({
appBar: {
Expand All @@ -18,7 +16,7 @@ const UDFooter = (props) => {
const classes = useStyles();

return (
<AppBar position="sticky" className={classes.appBar} sx={{bg: 'primary', color: 'text'}}>
<AppBar position="sticky" className={classes.appBar}>
<Toolbar><Link color="inherit" href="http://www.poshud.com">Created with PowerShell Universal Dashboard</Link></Toolbar>
</AppBar>
)
Expand Down
8 changes: 3 additions & 5 deletions src/v3/Components/framework/ud-navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/** @jsx jsx */
import React, {useState, useEffect} from 'react';
import { makeStyles } from '@material-ui/core/styles';
import ToggleColorMode from './togglecolormodes'
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
Expand All @@ -10,13 +8,12 @@ import MenuIcon from '@material-ui/icons/Menu';

import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';

import Drawer from '@material-ui/core/Drawer';
import {jsx} from 'theme-ui'

import { withComponentFeatures } from './../universal-dashboard'
import ToggleColorMode from './togglecolormodes.jsx';

const useStyles = makeStyles({
list: {
Expand Down Expand Up @@ -76,14 +73,15 @@ const UdNavbar = (props) => {

return [
drawer,
<AppBar position="static" sx={{bg: 'primary', color: 'text'}}>
<AppBar position="static">
<Toolbar>
{menuButton}
<Typography variant="h6">
{props.title}
</Typography>
<ToggleColorMode />
{children}

</Toolbar>
</AppBar>
]
Expand Down
9 changes: 2 additions & 7 deletions src/v3/Components/framework/ud-page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ErrorCard from './error-card.jsx';
import ReactInterval from 'react-interval';
import {withComponentFeatures} from '../universal-dashboard';
import Skeleton from '@material-ui/lab/Skeleton';
import UdNavBar from './ud-navbar';

const UDPage = (props) => {

Expand Down Expand Up @@ -74,13 +75,7 @@ const UDPage = (props) => {
else
{
return [
props.render({
type: 'ud-navbar',
pages: props.pages,
title: props.name,
history: props.history,
id: "defaultNavbar"
}),
<UdNavBar pages={props.pages} title={props.name} history={props.history} id="defaultNavbar" />,
childComponents,
<ReactInterval timeout={props.refreshInterval * 1000} enabled={props.autoRefresh} callback={loadData}/>,
// <UDFooter />
Expand Down
5 changes: 2 additions & 3 deletions src/v3/Components/icon.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/** @jsx jsx */

import React from 'react'
import classNames from "classnames"
import {jsx} from 'theme-ui'

export default class UDIcon extends React.Component {
render(){
return UniversalDashboard.renderComponent({
className: classNames(this.props.className, "ud-mu-icon"),
style: {...this.props.style},
...this.props,
sx: {color: 'primary'},
type: 'icon'
})
}
Expand Down
3 changes: 0 additions & 3 deletions src/v3/Components/paper.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/** @jsx jsx */
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import Paper from "@material-ui/core/Paper";
import classNames from "classnames"
import {jsx} from 'theme-ui'
import { withComponentFeatures } from './universal-dashboard';

const useStyles = makeStyles(theme => ({
Expand Down Expand Up @@ -36,7 +34,6 @@ const UdPaper = (props) => {
height={height}
width={width}
square={square}
sx={{ bg: 'primary', color: 'text'}}
>
{props.render(props.children)}
</Paper>
Expand Down
4 changes: 1 addition & 3 deletions src/v3/Components/progress.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/** @jsx jsx */
import React from 'react';
import CircularProgress from '@material-ui/core/CircularProgress';
import LinearProgress from '@material-ui/core/LinearProgress';
import {jsx} from 'theme-ui'

export default function Progress(props) {

if (props.circular) {
return <CircularProgress id={props.id} sx={{ color: 'primary'}}/>
}

return <LinearProgress variant={props.variant} value={props.percentComplete} id={props.id} sx={{ bg: 'primary'}}/>
return <LinearProgress variant={props.variant} value={props.percentComplete} id={props.id}/>
}
3 changes: 0 additions & 3 deletions src/v3/Components/radio.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/** @jsx jsx */

import React, {useEffect} from 'react';
import { withComponentFeatures } from './universal-dashboard';
import {FormContext} from './form';
import {jsx} from 'theme-ui'
import RadioGroup from '@material-ui/core/RadioGroup';
import Radio from '@material-ui/core/Radio';
import FormControlLabel from '@material-ui/core/FormControlLabel';
Expand Down
6 changes: 1 addition & 5 deletions src/v3/Components/select.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsx jsx */
import React, {useEffect} from 'react';

import { makeStyles } from '@material-ui/core/styles';
Expand All @@ -10,7 +9,6 @@ import FormControl from '@material-ui/core/FormControl';
import Select from '@material-ui/core/Select';
import { withComponentFeatures } from './universal-dashboard';
import {FormContext} from './form';
import {jsx} from 'theme-ui'

const useStyles = makeStyles(theme => ({
formControl: {
Expand Down Expand Up @@ -74,9 +72,7 @@ const UDSelect = (props) => {
}, true)

return (
<FormControl className={classes.formControl} key={props.id}
//sx={{bg: 'background', color: 'text'}}
>
<FormControl className={classes.formControl} key={props.id} >
<InputLabel htmlFor={props.id}>{props.label}</InputLabel>
<Select
defaultValue={defaultValue}
Expand Down
2 changes: 0 additions & 2 deletions src/v3/Components/slider.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/** @jsx jsx */
import React, { useEffect } from 'react';
import {withComponentFeatures} from './universal-dashboard';
import Slider from '@material-ui/core/Slider';
import {FormContext} from './form';
import {jsx} from 'theme-ui'

const UDSliderWithContext = (props) => {
return (
Expand Down
3 changes: 0 additions & 3 deletions src/v3/Components/switch.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/** @jsx jsx */
import React, {useEffect} from 'react';
import Switch from '@material-ui/core/Switch';
import { withComponentFeatures } from './universal-dashboard';
import {FormContext} from './form';
import {jsx} from 'theme-ui'

const UDSwitchWithContext = (props) => {
return (
Expand Down Expand Up @@ -38,7 +36,6 @@ const UDSwitch = (props) => {
checked={props.checked}
onChange={event => onChange(event)}
disabled={props.disabled}
sx={{ color: 'primary' }}
/>
)
}
Expand Down
2 changes: 0 additions & 2 deletions src/v3/Components/textbox.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/** @jsx jsx */
import React, { useEffect } from 'react';
import {withComponentFeatures} from './universal-dashboard';
import TextField from '@material-ui/core/TextField';
import {FormContext} from './form';
import {jsx} from 'theme-ui'

const UDTextFieldWithContext = (props) => {
return (
Expand Down
Loading

0 comments on commit fb9c732

Please sign in to comment.