Added request to distill endpoint, but CORS issue may persist
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/commit/d603c631 Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/tree/d603c631 Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/diff/d603c631 Branch: refs/heads/tapdocker Commit: d603c6313db7c801248133fa3f4a5516636aef91 Parents: 40f7cfb Author: Arthi Vezhavendan <arthi...@gmail.com> Authored: Wed Aug 9 07:23:58 2017 -0400 Committer: Arthi Vezhavendan <arthi...@gmail.com> Committed: Wed Aug 9 07:23:58 2017 -0400 ---------------------------------------------------------------------- docker/tap/Dockerfile | 2 +- package.json | 4 +- public/components/AppResults.jsx | 84 ++++++++++++++++---- .../components/visualizations/HorizontalBar.jsx | 2 +- public/components/visualizations/SankeyPlot.jsx | 16 +++- .../components/visualizations/VerticalBar.jsx | 2 +- 6 files changed, 88 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/d603c631/docker/tap/Dockerfile ---------------------------------------------------------------------- diff --git a/docker/tap/Dockerfile b/docker/tap/Dockerfile index 24f7291..51d2413 100644 --- a/docker/tap/Dockerfile +++ b/docker/tap/Dockerfile @@ -60,4 +60,4 @@ ADD neon_graph.js /usr/src/app/public RUN gulp build # Export port -EXPOSE 8000 +EXPOSE 8010 http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/d603c631/package.json ---------------------------------------------------------------------- diff --git a/package.json b/package.json index df9329d..de741e0 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "react-redux": "^4.4.5", "react-router": "^2.5.2", "redux": "^3.5.2", - "semantic-ui": "^2.2.6" + "semantic-ui": "^2.2.6", + "react-iframe": "1.0.7", + "axios": "0.16.2" }, "devDependencies": { "babel-core": "^6.10.4", http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/d603c631/public/components/AppResults.jsx ---------------------------------------------------------------------- diff --git a/public/components/AppResults.jsx b/public/components/AppResults.jsx index df5c592..8e3100f 100644 --- a/public/components/AppResults.jsx +++ b/public/components/AppResults.jsx @@ -14,10 +14,13 @@ // limitations under the License. import React, { Component, PropTypes } from 'react'; +import Iframe from 'react-iframe'; +import axios from 'axios'; import Counts from './visualizations/Counts'; import GraphMetrics from './visualizations/GraphMetrics'; import SankeyPlot from './visualizations/SankeyPlot'; +//import sankeyhtml from './visualizations/sankeyhtml'; class AppResults extends Component { constructor(props) { @@ -84,18 +87,56 @@ class AppResults extends Component { } render() { + console.log("is an app defined here?"); + console.log(this.props.app); + const { name, results } = this.props.app; + + // get graph data from distill + var url = 'http://distill:8090/sankey/userale?from=now-15m&to=now&size=20'; + var url = 'http://localhost:8090'; + axios.get(url) + .then( (response) => { + console.log("response", response); + var sankeyhtml = response.data; + // this.setState({ + // fetchUser: response.data + // }); + //console.log("fetchUser", this.state.fetchUser); + }) + .catch( (error) => { + console.log(error); + }); + var sankeyhtml = ""; + + // var url = 'http://distill:8090/sankey/userale?from=now-15m&to=now&size=20'; + // var url = 'http://localhost:8090'; + // console.log('clicked'); + // $.get( url, function(data) { + // //As soon as the browser finished downloading, this function is called. + // console.log('url was: ' + url); + // console.log('data: ' + data); + // //$('#demo').html(); + // }); + + + + return( + <div className='ui container'> <div className='ui large header'> - Log Analysis for {name} + Log Analysis for Demo + {//name + } </div> <div className='ui padded grid'> - <div className='four wide column'> + <div className='three wide column'> <div id='results-controls' className='ui vertical fluid accordion menu'> + <div className='item'> <a id='counts' className='active main-controls title'> <i className='dropdown icon'></i> @@ -215,7 +256,7 @@ class AppResults extends Component { </div> - <div className='twelve wide column'> + <div className='thirteen wide column'> <div className='ui basic row segment'> {(() => { switch (this.state.result) { @@ -232,32 +273,41 @@ class AppResults extends Component { } </div> ); - case 'counts': - return <Counts filters={this.state} data={results.counts} />; case 'sankey': - default: return ( <div> - <SankeyPlot metric={this.state.metric} element='sankey-plot-viz' data={results.graph} /> - {this.state.graphAb ? - <SankeyPlot - metric='betweenness_cent_dir_weighted' - element='sankey-plot-viz-b' - data={results.graph} - /> : null - } + <iframe srcDoc={sankeyhtml} height="300px" width="700px" style={{border: '0px'}}/> </div> ); + case 'counts': + default: + return <Counts filters={this.state} data={results.counts} />; + // case 'countsandbowie': + // return ( + // <div> + // <CountsAndBowie metric={this.state.metric} element='graph-metrics-viz' data={results.graph} /> + // {this.state.graphAb ? + // <CountsAndBowie + // metric='betweenness_cent_dir_weighted' + // element='graph-metrics-viz-b' + // data={results.graph} + // /> : null + // } + // </div> + // ); } })()} - </div> </div> </div> </div> - ); + + ); } -} +}; + + + AppResults.propTypes = { app : PropTypes.object, http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/d603c631/public/components/visualizations/HorizontalBar.jsx ---------------------------------------------------------------------- diff --git a/public/components/visualizations/HorizontalBar.jsx b/public/components/visualizations/HorizontalBar.jsx index fb2b897..90d0d47 100644 --- a/public/components/visualizations/HorizontalBar.jsx +++ b/public/components/visualizations/HorizontalBar.jsx @@ -35,7 +35,7 @@ class HorizontalBar extends Component { left : 40, }; this.fullWidth = 300; - this.fullHeight = 600; + this.fullHeight = 500; this.width = this.fullWidth - this.margin.left - this.margin.right; this.height = this.fullHeight - this.margin.top - this.margin.bottom; http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/d603c631/public/components/visualizations/SankeyPlot.jsx ---------------------------------------------------------------------- diff --git a/public/components/visualizations/SankeyPlot.jsx b/public/components/visualizations/SankeyPlot.jsx index 29e37d0..f49c22a 100644 --- a/public/components/visualizations/SankeyPlot.jsx +++ b/public/components/visualizations/SankeyPlot.jsx @@ -1,4 +1,17 @@ -// THIS IS EXAMPLE CODE - COPIED FROM GRAPHMETRICS.JSX +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. import React, { Component, PropTypes } from 'react'; import * as d3 from 'd3'; @@ -217,6 +230,7 @@ class SankeyPlot extends Component { this.circles.style('fill-opacity', 0.75); this.arcs.style('fill-opacity', 1); } + } http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/d603c631/public/components/visualizations/VerticalBar.jsx ---------------------------------------------------------------------- diff --git a/public/components/visualizations/VerticalBar.jsx b/public/components/visualizations/VerticalBar.jsx index 5aabad0..e491fcd 100644 --- a/public/components/visualizations/VerticalBar.jsx +++ b/public/components/visualizations/VerticalBar.jsx @@ -33,7 +33,7 @@ class VerticalBar extends Component { bottom : 30, left : 40, }; - this.fullWidth = 600; + this.fullWidth = 500; this.fullHeight = 400; this.width = this.fullWidth - this.margin.left - this.margin.right; this.height = this.fullHeight - this.margin.top - this.margin.bottom;