Fix UI in Twitter analytics - Hashtag widget
* under the License.
*/
-import React, {Component} from 'react';
+import React from 'react';
import Widget from '@wso2-dashboards/widget';
class Hashtag extends Widget {
constructor(props) {
super(props);
-
this.state = {
width: this.props.glContainer.width,
height: this.props.glContainer.height,
hashTag: [],
};
- this.handleResize = this.handleResize.bind(this);
- this.props.glContainer.on('resize', this.handleResize);
- this._handleDataReceived = this._handleDataReceived.bind(this);
+ this.props.glContainer.on('resize', () => {
+ this.setState({
+ width: this.props.glContainer.width,
+ height: this.props.glContainer.height
+ });
+ });
}
componentDidMount() {
super.getWidgetConfiguration(this.props.widgetID)
.then((message) => {
- super.getWidgetChannelManager().subscribeWidget(this.props.id, this._handleDataReceived, message.data.configs.providerConfig);
- })
+ super.getWidgetChannelManager()
+ .subscribeWidget(this.props.id, (data) => this.setState({ hashTag: data.data }),
+ message.data.configs.providerConfig);
+ });
}
componentWillUnmount() {
super.getWidgetChannelManager().unsubscribeWidget(this.props.id);
}
- handleResize() {
- this.setState({width: this.props.glContainer.width, height: this.props.glContainer.height});
- }
-
- _handleDataReceived(setData) {
- this.setState({
- hashTag: setData.data,
- });
- }
-
render() {
if (this.state.hashTag.length === 0) {
+ var url = 'https://github.com/wso2/product-sp/blob/master/modules/solutions/twitter-analytics/README.md';
return (
- <h1 style={{textAlign: "center", color: "#EF5350"}}>For the processing of "Twitter Analytics" please
- deploy the Siddhi app as per <a target="_blank"
- href="https://github.com/wso2/product-sp/blob/master/modules/solutions/twitter-analytics/README.md"
- style={{
- color: '#AB47BC',
- textDecoration: 'underline'
- }}>instruction</a>
- </h1>
+ <p style={{ textAlign: 'center' }}>
+ For the processing of "Twitter Analytics" please deploy the Siddhi app as per&nbsp;
+ <a
+ target="_blank"
+ href={url}
+ style={{ color: '#f00' }}>instructions.</a>
+ </p>
);
- } else {
+ }
+
return (
- <h1 style={{textAlign: "center"}}>{this.state.hashTag[0]}</h1>
+ <p style={{ textAlign: "center", fontSize: '24px' }}>{this.state.hashTag[0]}</p>
);
}
}
-}
global.dashboard.registerWidget('Hashtag', Hashtag);
