Commit 4aeb0926 authored by MaxSol1's avatar MaxSol1
Browse files

tab link option

parent bfcf0618
......@@ -44,6 +44,13 @@ const dashboardReducer = (state, action) => {
return {...state, background: action.background};
case 'setGlobalMute':
return {...state, globalMute: action.globalMute};
case 'setGlobalTabLink':
if (state.hasOwnProperty('tabLink')){
return {...state, tabLink: action.tabLink};
} else {
Object.assign(state, {tabLink: action.tabLink});
return state;
}
case 'addElement':
console.log('Adding new element')
const newElement = {
......@@ -425,7 +432,7 @@ function SidePanelSettings({dashboardDispatch, dashboard}) {
<label class="status-font-size">Mute Status Alerts</label>
<input type="checkbox" defaultChecked={dashboard.globalMute} onChange={e => muteAlerts(e)} class="form-control mute-sounds"/>
<br/>
<button class="rounded btn-primary btn-large" onClick={onClickAdvanced}>{showAdvanced ? 'Hide Options' : 'Global Alert Options'}</button>
<button class="rounded btn-primary btn-large" onClick={onClickAdvanced}>{showAdvanced ? 'Hide Options' : 'Global Options'}</button>
<AdvancedAlertOptions dashboardDispatch={dashboardDispatch} display={showAdvanced} dashboard={dashboard}/>
</Fragment>
}
......@@ -445,6 +452,7 @@ const AdvancedAlertOptions = ({dashboardDispatch, display, dashboard}) => {
}
}
const audioControls = src => {
if(src) {
return <Fragment>
......@@ -455,6 +463,9 @@ const AdvancedAlertOptions = ({dashboardDispatch, display, dashboard}) => {
}
return <div style={{display: display ? '' : 'none'}}>
<br/>
<label class="new-tab">Open links in new tab</label>
<input type="checkbox" defaultChecked={dashboard.tabLink} onChange={e => dashboardDispatch({type: 'setGlobalTabLink', tabLink: e.target.checked})} class="form-control new-tab"/>
<br/>
<label for="soundFile">Ok Alert Sound {audioControls(dashboard.okSound)}
<a onClick={e => dashboardDispatch({type: 'setGlobalOk', okSound: "/dashboards-data/ok.mp3"})}>default</a>
......
......@@ -429,24 +429,30 @@ export function alertSounds(checkState, options, dashboard) {
}
export function linkHelper(element, ele){
export function linkHelper(element, ele, dashboard){
let target = null;
if (dashboard.tabLink) {
target = 'blank';
}
if (element.options.linkURL && element.type === 'static-text') {
if (element.options.linkURL.includes('http') ) {
ele = <a id="text-link" href={element.options.linkURL} target="_blank">{ele}</a>
ele = <a id="text-link" href={element.options.linkURL} target={target}>{ele}</a>
} else {
ele = <a id="text-link" href={`https://${element.options.linkURL}`} target="_blank">{ele}</a>
ele = <a id="text-link" href={`https://${element.options.linkURL}`} target={target}>{ele}</a>
}
} if (element.options.linkURL && element.type === 'dynamic-text') {
if (element.options.linkURL.includes('http') ) {
ele = <a id="text-link" href={element.options.linkURL} target="_blank">{ele}</a>
ele = <a id="text-link" href={element.options.linkURL} target={target}>{ele}</a>
} else {
ele = <a id="text-link" href={`https://${element.options.linkURL}`} target="_blank">{ele}</a>
ele = <a id="text-link" href={`https://${element.options.linkURL}`} target={target}>{ele}</a>
}
} else if (element.options.linkURL) {
if (element.options.linkURL.includes('http') ) {
ele = <a id="a-link" href={element.options.linkURL} target="_blank">{ele}</a>
ele = <a id="a-link" href={element.options.linkURL} target={target}>{ele}</a>
} else {
ele = <a id="a-link" href={`https://${element.options.linkURL}`} target="_blank">{ele}</a>
ele = <a id="a-link" href={`https://${element.options.linkURL}`} target={target}>{ele}</a>
}
}
......
......@@ -64,14 +64,14 @@ export function Viewer({slug, dashboardReducer}) {
if(element.type === 'iframe-video') { ele = <IframeVideo options={element.options}/> }
if(element.type === 'audio-stream') { ele = <AudioStream options={element.options}/> }
ele = linkHelper(element, ele);
ele = linkHelper(element, ele, dashboard);
if (element.type === 'static-ticker'){
return <div class="view-ticker" style={{left: 0, top: top, width: "100vw" , height: height, transform: rotation}}>
{ele}
</div>
{ele}
</div>
}
return <div class="check" style={{left: left, top: top, width: width, height: height, transform: rotation}}>
{ele}
</div>
......
......@@ -687,6 +687,13 @@ input[type=checkbox].form-control.bold-static-text {
position: absolute;
}
input[type=checkbox].form-control.new-tab{
float: right;
margin-left: 12em;
margin-top: -2.9em;
position: absolute;
}
input[type=checkbox].form-control.perf-data-mode {
margin-left: 14em;
margin-top: -2em;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment