This repository has been archived by the owner on Jan 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Upgrade materialize. * Navigation done. * Inputs. * Update. * Fix modal. * Fix inputs. * Fix grid tests. * Fix grid tests. * Fix page tests. * CHeckbox and collapsible. * Select * Fix select. * Fix table tests. * Try fix page tests. * Design console.
- Loading branch information
1 parent
a7a49aa
commit af6cda3
Showing
54 changed files
with
2,734 additions
and
1,206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/UniversalDashboard.Materialize/Components/ud-checkbox.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import {Checkbox} from 'react-materialize'; | ||
|
||
export default class UDCheckbox extends React.Component { | ||
|
||
onChanged(e) { | ||
if (this.props.onChange == null) { | ||
return | ||
} | ||
|
||
var val = e.target.checked; | ||
|
||
UniversalDashboard.publish('element-event', { | ||
type: "clientEvent", | ||
eventId: this.props.onChange, | ||
eventName: 'onChange', | ||
eventData: val.toString() | ||
}); | ||
} | ||
|
||
render() { | ||
return <Checkbox | ||
checked={this.props.checked} | ||
label={this.props.label} | ||
id={this.props.id} | ||
filledIn={this.props.filledIn} | ||
disabled={this.props.disabled} | ||
onChange={this.onChanged.bind(this)} /> | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
src/UniversalDashboard.Materialize/Components/ud-collapsible.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React from 'react'; | ||
import {Collapsible} from 'react-materialize'; | ||
import cx from 'classnames'; | ||
import UDIcon from './ud-icon'; | ||
import ReactInterval from 'react-interval'; | ||
|
||
export default class UDCollapsible extends React.Component { | ||
render() { | ||
|
||
var style = { | ||
color: this.props.color, | ||
backgroundColor: this.props.backgroundColor | ||
} | ||
|
||
var children = this.props.items.map(x => <UDCollapsibleItem {...x}/>); | ||
|
||
return ( | ||
<Collapsible | ||
id={this.props.id} | ||
accordion={this.props.accordion} | ||
popout={this.props.popout} | ||
className="ud-collapsible" | ||
style={style} | ||
> | ||
{children} | ||
</Collapsible> | ||
) | ||
} | ||
} | ||
|
||
class UDCollapsibleItem extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
content: props.content, | ||
error: null | ||
} | ||
} | ||
|
||
loadData() { | ||
if (this.props.endpoint) { | ||
UniversalDashboard.get("/api/internal/component/element/" + this.props.id, function(data) { | ||
if (data.error) { | ||
this.setState({ | ||
content: data.error.message | ||
}) | ||
return; | ||
} | ||
|
||
this.setState({ | ||
content: data, | ||
error: null | ||
}); | ||
}.bind(this)); | ||
} | ||
} | ||
|
||
componentWillMount() { | ||
this.loadData(); | ||
} | ||
|
||
render() { | ||
|
||
var style = { | ||
color: this.props.color, | ||
backgroundColor: this.props.backgroundColor | ||
} | ||
|
||
return [ | ||
<li className={cx(this.props.className, { active: this.props.active })} {...this.props} style={style}> | ||
<div | ||
className={cx('collapsible-header', { active: this.props.active })} | ||
> | ||
{this.props.icon && <UDIcon icon={this.props.icon}/>} | ||
{this.props.title} | ||
</div> | ||
<div className="collapsible-body">{UniversalDashboard.renderComponent(this.state.content)}</div> | ||
</li>, | ||
<ReactInterval timeout={this.props.refreshInterval * 1000} enabled={this.props.autoRefresh} callback={this.loadData.bind(this)}/> | ||
] | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/UniversalDashboard.Materialize/Components/ud-designer.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import UdIcon from './ud-icon.jsx'; | ||
import UdTerminal from './ud-terminal'; | ||
import M from 'materialize-css'; | ||
|
||
export default class UDDesigner extends React.Component { | ||
|
||
constructor() { | ||
super(); | ||
|
||
this.state = { | ||
open : false | ||
} | ||
} | ||
|
||
componentDidMount() { | ||
this.modalInstance = M.Modal.init(this.modal); | ||
} | ||
|
||
componentWillUnmount() { | ||
this.modalInstance.destroy(); | ||
} | ||
|
||
toggleTerminal() { | ||
if (this.state.open) { | ||
this.modalInstance.close(); | ||
} else { | ||
this.modalInstance.open(); | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
[ | ||
<div className="fixed-action-btn"> | ||
<a className="btn-floating btn-large red" onClick={this.toggleTerminal.bind(this)} id='btnDesignTerminal'> | ||
<i className="large fa fa-terminal"></i> | ||
</a> | ||
</div>, | ||
<div ref={modal => this.modal = modal} className="modal bottom-sheet"> | ||
<div className="modal-content"> | ||
<h4><UdIcon icon={'terminal'}/> Design Terminal</h4> | ||
<UdTerminal /> | ||
</div> | ||
</div> | ||
] | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.