Now with external links

This commit is contained in:
uwap 2017-11-01 14:17:11 +01:00
parent 2d79cc68aa
commit b8160b3a55
3 changed files with 35 additions and 2 deletions

View file

@ -306,6 +306,15 @@ const config : Config = {
},
icon: "radio",
enableCondition: (a, b, state) => state.onkyo_inputs == "netzwerk"
},
{
type: "section",
text: "External"
},
{
type: "link",
link: "http://mpd.rzl/mpd/player/index.php",
text: "Open MPD Interface"
}
]
},
@ -328,7 +337,13 @@ const config : Config = {
position: [455,350],
icon: "swap_vert",
iconColor: state => state.door_status == "on" ? "#00FF00" : "#FF0000",
ui: []
ui: [
{
type: "link",
link: "http://s.rzl.so",
text: "Open Status Page"
}
]
},
infoscreen: {
name: "Infoscreen",
@ -341,6 +356,11 @@ const config : Config = {
text: "Infoscreen",
topic: "infoscreen",
icon: "power_settings_new"
},
{
type: "link",
link: "http://cashdesk.rzl:3030/rzl",
text: "Open Infoscreen"
}
]
}

View file

@ -18,6 +18,8 @@ import List, {
ListItemText,
ListSubheader,
} from 'material-ui/List';
import Button from 'material-ui/Button';
import withStyles from 'material-ui/styles/withStyles';
const enabled = (props: ControlUI, state: State) => {
if (props.enableCondition == null) return true;
@ -122,3 +124,11 @@ export const slider = (state: State, props: ControlUI) => (
export const section = (state: State, props: ControlUI) => (
<ListSubheader>{props.text}</ListSubheader>
);
export const link = (state: State, props: ControlUI) => (
<ListItem>
<Button raised onClick={() => window.open(props.link, '_blank')} color="primary">
{props.text}
</Button>
</ListItem>
)

View file

@ -16,7 +16,10 @@ declare type ControlUI = {
icon?: string,
enableCondition?: (internal: string, actual: any) => boolean,
// LINK optiona properties
link?: string,
// TOGGLE optional properties
on?: string, // on override for toggle
off?: string, // off override for toggle