Commit 8ecf1428 authored by militarpancho's avatar militarpancho
Browse files

Some changes in requests and environ variables

parent 6104b930
......@@ -11,4 +11,4 @@ elasticsearch
*.db
.*
/fuseki/*
dashboard-reddit.html
<link rel="import" href="/bower_components/polymer/polymer.html">
<link rel="import" href="/bower_components/material-search/material-search.html">
<link rel="import" href="/bower_components/paper-material/paper-material.html">
<link rel="import" href="/bower_components/google-chart-elasticsearch/google-chart.html">
<link rel="import" href="/bower_components/paper-tabs/paper-tabs.html">
<link rel="import" href="/bower_components/paper-tabs/paper-tab.html">
<link rel="import" href="/bower_components/number-chart/number-chart.html">
<link rel="import" href="/bower_components/comment-chart/comment-chart.html">
<link rel="import" href="/bower_components/paper-tabs/paper-tabs.html">
<link rel="import" href="/bower_components/yasgui-polymer/yasgui.html">
<link rel="import" href="/bower_components/iron-pages/iron-pages.html">
<link rel="import" href="/bower_components/paper-item/paper-item.html">
<link rel="import" href="/bower_components/paper-menu/paper-menu.html">
<link rel="import" href="/elements/news-chart/news-chart.html">
<dom-module id="dashboard-reddit">
<link rel="import" type="css" href="dashboard-tourpedia.css" type="css">
<link rel="import" href="/styles/app-theme.html" type="css">
<template>
<iron-ajax auto
url="queries.json"
handle-as="json"
last-response="{{queries}}"></iron-ajax>
<paper-tabs selected="{{selected}}">
<paper-tab>Dashboard</paper-tab>
<paper-tab>Sparql Editor</paper-tab>
</paper-tabs>
<iron-pages selected="{{selected}}">
<div>
<material-search search-value="{{query}}"></material-search>
<br>
<div style="width: 100%; display: inline-block">
<div style="width: 32%; margin-right: 2%; float: left">
<number-chart
icon="info"
stylebg="bg-red"
data="{{data}}">
</number-chart>
</div>
<div style="width: 32%; margin-right: 2%; float: left">
<number-chart
data="{{data}}"
object="cnn"
aggKey="creator"
title="CNN"
icon="icons:receipt"
stylebg="bg-yellow">
</number-chart>
</div>
<div style="width: 32%; float: left">
<number-chart
data="{{data}}"
object="The New York Times"
aggKey="creator"
title="The New York Times"
icon="icons:receipt"
aggkey="location"
stylebg="bg-green">
</number-chart>
</div>
</div>
<div style="width: 100%; display: inline-block">
<div class="chart_container" style="right: 0; float: right">
<google-chart
data="{{data}}"
field="about"
id='pie-chart4'
extra-id='pie-chart4'
type='pie'
filters="{{filters}}"
icon='icons:list'
param='{{param}}'
options='{"title": "Article Sections"}'
cols='[{"label": "articlesection", "type": "string"},{"label": "Count", "type": "number"}]'
</google-chart>
</div>
<div class="chart_container" style="left: 0; float: left">
<google-chart
field="creator"
data="{{data}}"
id='pie-chart3'
extra-id='pie-chart3'
type='pie'
filters="{{filters}}"
icon='icons:reorder'
options='{"title": "Newspapers"}'
cols='[{"label": "type", "type": "string"},{"label": "Count", "type": "number"}]'
</google-chart>
</div>
</div>
<div style="width: 100%">
<div class="chart_container" style="left: 0; float: left">
<google-chart
field="sentiment"
data="{{data}}"
id='pie-chart5'
extra-id='pie-chart5'
type='pie'
filters="{{filters}}"
icon='social:mood'
options='{"title": "Sentiments"}'
cols='[{"label": "Sentiment", "type": "string"},{"label": "Count", "type": "number"}]'
</google-chart>
</div>
<div class="chart_container" style="left: 0; float: right">
<google-chart
field="emotion"
data="{{data}}"
id='pie-chart5'
extra-id='pie-chart5'
type='pie'
filters="{{filters}}"
icon='social:sentiment-very-dissatisfied'
options='{"title": "Emotions"}'
cols='[{"label": "Sentiment", "type": "string"},{"label": "Count", "type": "number"}]'
</google-chart>
</div>
</div>
<div class="chart_container" style="left: 0; float: left; width: 100%">
<news-chart
datos = "{{data}}"
title="List of news"
filters="{{filters}}"
icon='icons:receipt'>
</news-chart>
</div>
</div>
</div>
<div>
<yasgui-ui
endpoint="http://${FUSEKI_ENPOINT_DASHBOARD}/gsicrawler/query"
queries="{{queries}}">
</yasgui-ui>
</div>
</iron-pages>
</template>
<script>
var ready = false;
Polymer({
is: 'dashboard-reddit',
properties: {
selected: {
type: Number,
value: 0
},
ids:{
type: Array
},
data:{
type: Object
},
client: {
type: Object,
notify: true,
observer: '_clientChanged'
},
fields: {
type: Array,
value: function() { return []; }
},
filters: {
type: Array,
notify: true,
value: function() { return []; }
}
},
observers: [
'_filtersChange(filters.*)'
],
ready: function(){
console.log("ready");
},
_clientChanged: function() {
console.log("ClientChanged");
ready = true;
this._query();
},
_filtersChange: function() {
this._query();
},
_query: function() {
console.log("_filtersChangedash")
var that = this;
console.log("Ready?: ", ready);
if(ready){
this.client.search({
// undocumented params are appended to the query string
index: "gsicrawler",
body: {
size: 10,
query: {
bool: {
must: this.filters,
}
},
aggs: {
type: {
terms: {
field: "@type.keyword",
order: {
_count: "desc"
}
}
},
creator: {
terms: {
field: "creator.keyword",
order: {
_count: "desc"
}
}
},
about: {
terms: {
field: "about.keyword",
order: {
_count: "desc"
}
}
},
sentiment: {
terms: {
field: "sentiments.marl:hasPolarity.keyword",
order: {
_count: "desc"
}
}
},
emotion: {
terms: {
field: "emotions.onyx:hasEmotion.onyx:hasEmotionCategory.keyword",
order: {
_count: "desc"
}
}
}
}
}
}).then(function (resp) {
var myids = []
resp.hits.hits.forEach(function(entry){myids.push(entry._id)})
that.ids = myids;
//console.log(that.ids)
that.data = resp;
console.log(that.data);
});
}
}
});
</script>
</dom-module>
......@@ -136,7 +136,7 @@
</div>
<div>
<yasgui-ui
endpoint="http://krusti.gsi:13030/gsicrawler/query"
endpoint="http://${FUSEKI_ENDPOINT_DASHBOARD}/gsicrawler/query"
queries="{{queries}}">
</yasgui-ui>
</div>
......
......@@ -70,4 +70,4 @@ networks:
driver: bridge
volumes:
esdata:
\ No newline at end of file
esdata:
......@@ -16,4 +16,5 @@ cd demo
bower link $APP_NAME --allow-root
envsubst < /usr/src/app/demo/index.env.html > /usr/src/app/demo/index.html || exit 1;
envsubst < /usr/src/app/dashboard-reddit.env.html > /usr/src/app/dasboard-reddit.html || exit 1;
http-server .
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