Skip to content

Commit

Permalink
Lot's of fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdriscoll committed Jun 2, 2020
1 parent 4bf85d5 commit c786ab1
Show file tree
Hide file tree
Showing 54 changed files with 1,239 additions and 211 deletions.
2 changes: 1 addition & 1 deletion src/UniversalDashboard.Community.psm1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Write-Warning -Message "This module is no longer supported. Universal Dashboard functionality has been moved into PowerShell Universal. To learn more, visit: https://www.ironmansoftware.com/powershell-universal"
Write-Warning -Message "This module is no longer supported. Universal Dashboard functionality has been moved into PowerShell Universal. You can still host your UD Community dashboards for free within PowerShell Universal. To learn more, visit: https://www.ironmansoftware.com/powershell-universal"
# SIG # Begin signature block
# MIIXvwYJKoZIhvcNAQcCoIIXsDCCF6wCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
Expand Down
20 changes: 17 additions & 3 deletions src/v2/Components/ud-button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,23 @@ export default class UDButton extends React.Component {
}

var icon = null;
var content = this.state.text;
if (this.state.icon) {
icon = <UdIcon icon={this.state.icon} style={{marginRight: this.state.floating || !this.state.text ? 'unset' : '5px'}}/>

var style = {}
const margin = this.state.floating || !this.state.text ? 'unset' : '5px';
if (margin === '5px' && this.props.iconAlignment === "left")
{
style["marginRight"] = margin;
}

if (margin === '5px' && this.props.iconAlignment === "right")
{
style["marginLeft"] = margin;
}

icon = <UdIcon icon={this.state.icon} style={style}/>
content = this.props.iconAlignment === "left" ? [icon, content] : [content, icon];
}

return <Button
Expand All @@ -77,8 +92,7 @@ export default class UDButton extends React.Component {
floating={this.state.floating}
style={this.state.style}
>
{icon}
{this.state.text}
{content}
</Button>
}
}
13 changes: 9 additions & 4 deletions src/v2/Components/ud-footer.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
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 className="page-footer ud-footer" style={{backgroundColor: this.props.backgroundColor, color: this.props.fontColor}}>
return <footer id="ud-footer" style={style} 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 @@ -15,21 +21,20 @@ export default class UdFooter extends React.Component {
var links = null;
if (this.props.footer.links) {
links = this.props.footer.links.map(function(x, i) {
return <UdLink {...x} key={x.url} className="grey-text text-lighten-4"/>
return <p><UdLink {...x} key={x.url} className="grey-text text-lighten-4"/></p>
});
}

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 className="page-footer ud-footer" style={{backgroundColor: backgroundColor, color: fontColor}}>
return <footer id="ud-footer" style={style} 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}
<div className="right">
{links}
</div>
<a className="grey-text text-lighten-4 right" href="http://www.poshud.com">Created with PowerShell Universal Dashboard</a>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion src/v2/Components/ud-input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default class Input extends React.Component {
formData.append(x.name + "_type", x.type)
})

UniversalDashboard.postFormData(`/api/internal/component/input/${this.props.id}`, formData, res => {
UniversalDashboard.postFormData(`/api/internal/component/element/${this.props.id}`, formData, res => {
if (res.error) {

UniversalDashboard.toaster.error({message: res.error.message})
Expand Down
12 changes: 6 additions & 6 deletions src/v2/Components/ud-monitor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,25 +243,25 @@ export default class UdMonitor extends React.Component {
}

var chart = null;
switch(this.props.chartType) {
switch(this.props.chartType.toLowerCase()) {
// Bar
case 0:
case "bar":
chart = this.renderBar(data, options);
break;
// Line
case 1:
case "line":
chart = this.renderLine(data, options);
break;
// Area
case 2:
case "area":
chart = this.renderArea(data, options);
break;
// Doughnut
case 3:
case "doughnut":
chart = this.renderDoughnut(data, options);
break;
// Radar
case 3:
case "radar":
chart = this.renderRadar(data, options);
break;
}
Expand Down
17 changes: 17 additions & 0 deletions src/v2/Scripts/error.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function New-UDError {
param(
[Parameter(Mandatory)]
[string]$Message,
[Parameter()]
[string]$Title
)

@{
type = "error"
isPlugin = $true
assetId = $AssetId

message = $Message
title = $Title
}
}
23 changes: 23 additions & 0 deletions src/v2/Scripts/footer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function New-UDFooter {
param(
[Parameter()]
[Hashtable[]]$Links,
[Parameter()]
[string]$Copyright,
[Parameter()]
[DashboardColor]$BackgroundColor,
[Parameter()]
[DashboardColor]$FontColor
)

@{
type = "ud-footer"
isPlugin = $true
assetId = $AssetId

links = $Links
copyright = $Copyright
backgroundColor = $BackgroundColor.HtmlColor
fontColor = $FontColor.HtmlColor
}
}
Loading

0 comments on commit c786ab1

Please sign in to comment.