Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Fix for dashboard indicator #2
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Nov 14, 2016
1 parent 34be3fb commit 762fbae
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 43 deletions.
4 changes: 4 additions & 0 deletions src/assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1615,6 +1615,10 @@ td.pulse-off input {
height:100%;
}

.indicator-hidden {
display: none;
}

.indicator iframe {
width: 100%;
height: 100%;
Expand Down
5 changes: 3 additions & 2 deletions src/components/app/MenuOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
pathRequest,
getWindowBreadcrumb
} from '../../actions/MenuActions';

class MenuOverlay extends Component {
constructor(props){
super(props);
Expand Down Expand Up @@ -245,10 +246,10 @@ class MenuOverlay extends Component {
</div>
:
<span
className="menu-overlay-link"
className="menu-overlay-header menu-overlay-header-spaced menu-overlay-header-main pointer"
onClick={() => dispatch(push("/"))}
>
Home
Dashboard
</span>
}
<div className="menu-overlay-root-body">
Expand Down
6 changes: 3 additions & 3 deletions src/components/table/TableContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ class TableContextMenu extends Component {
</div>
}

<div className="context-menu-item" onClick={this.handleDelete}>
<i className="meta-icon-edit" /> Delete
</div>
<div className="context-menu-item" onClick={this.handleOpenNewTab}>
<i className="meta-icon-file" /> Open in new tab
</div>
<div className="context-menu-item" onClick={this.handleDelete}>
<i className="meta-icon-edit" /> Delete
</div>
<Prompt
isOpen={prompt.open}
title={prompt.title}
Expand Down
36 changes: 33 additions & 3 deletions src/components/widget/DraggableWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import HTML5Backend from 'react-dnd-html5-backend';

import {
getUserDashboardWidgets,
setUserDashboardWidgets
setUserDashboardWidgets,
getUserDashboardIndicators
} from '../../actions/AppActions';

export class DraggableWrapper extends Component {
Expand All @@ -18,11 +19,22 @@ export class DraggableWrapper extends Component {
cards: [],
isVisible: true,
idMaximized: false,
indicators: []
};
}

componentDidMount = () => {
this.getDashboard();
this.getIndicators();
}

getIndicators = () => {
const {dispatch} = this.props;
dispatch(getUserDashboardIndicators()).then(response => {
this.setState(Object.assign({}, this.state, {
indicators: response.data.items
}));
});
}

getDashboard = () => {
Expand Down Expand Up @@ -70,10 +82,28 @@ export class DraggableWrapper extends Component {


render() {
const { cards, isVisible, idMaximized } = this.state;

const { cards, isVisible, idMaximized, indicators } = this.state;
return (
<div>
<div className={
"indicators-wrapper " +
(idMaximized !== false ? "indicator-hidden" : "")
}>
{indicators.map((indicator, id) =>
<div
className={
"indicator "
}
key={id}
>
<iframe
src={indicator.url}
scrolling="no"
frameBorder="no"
></iframe>
</div>
)}
</div>
{cards.map((card, i) => {
return (
(isVisible || (idMaximized===i)) &&
Expand Down
35 changes: 0 additions & 35 deletions src/containers/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,25 @@ import {
getRootBreadcrumb
} from '../actions/MenuActions';

import {
getUserDashboardIndicators
} from '../actions/AppActions';

export class Dashboard extends Component {
constructor(props){
super(props);

this.state = {
indicators: []
}
}

componentDidMount = () => {
const {dispatch} = this.props;
dispatch(getRootBreadcrumb());
this.getIndicators();
}

getIndicators = () => {
const {dispatch} = this.props;
dispatch(getUserDashboardIndicators()).then(response => {
this.setState(Object.assign({}, this.state, {
indicators: response.data.items
}));
});
}

render() {
const {breadcrumb} = this.props;
const {indicators} = this.state;
return (
<Container
breadcrumb={breadcrumb}
siteName = {"Dashboard"}
noMargin = {true}
>
<div className="container-fluid dashboard-wrapper">
<div className="indicators-wrapper">
{
indicators.map((indicator, id) =>
<div
className="indicator"
key={id}
>
<iframe
src={indicator.url}
scrolling="no"
frameBorder="no"
></iframe>
</div>
)
}
</div>
<DraggableWrapper/>
</div>

Expand Down

0 comments on commit 762fbae

Please sign in to comment.