Commit 97cead6b authored by Alberto Pascual's avatar Alberto Pascual
Browse files

added bower.json dependencies

parent 2be95ba6
<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-elk/google-chart.html">
<link rel="import" href="../../bower_components/paper-tabs/paper-tabs.html">
<link rel="import" href="../../bower_components/yasgui/yasgui.html">
<link rel="import" href="../../bower_components/reviews-table/reviews-table.html">
<link rel="import" href="../../bower_components/number-chart/number-chart.html">
<link rel="import" href="../../bower_components/leaflet-map/leaflet-map.html">
<dom-module id="dashboard-tourpedia">
<style is="custom-style">
@import url("../../styles/app-theme.html");
</style>
<link rel="import" type="css" href="dashboard-tourpedia.css">
<template>
<iron-ajax auto
url="queries.json"
handle-as="json"
last-response="{{queries}}"></iron-ajax>
<iron-ajax auto
url="/endpoint.json"
handle-as="json"
last-response="{{endpoint}}"></iron-ajax>
<template is="dom-repeat" items="{{ids}}" as="id">
<iron-ajax auto
url="{{getName(id)}}"
handle-as="json"
on-response="addPlace"></iron-ajax>
</template>
<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: 23%; margin-right: 2.6%; float: left">
<number-chart
index="tourpedia"
subindex="places"
fields='["category"]'
query="{{query}}"
icon="info"
filters="{{filters}}"
stylebg="bg-red">
</number-chart>
</div>
<div style="width: 23%; margin-right: 2.6%; float: left">
<number-chart
index="tourpedia"
subindex="places"
fields='["category"]'
query="{{query}}"
is-aggregated
field="category"
object="restaurant"
title="Restaurants"
filters="{{filters}}"
icon="maps:local-dining"
stylebg="bg-yellow">
</number-chart>
</div>
<div style="width: 23%; margin-right: 2.6%; float: left">
<number-chart
index="tourpedia"
subindex="places"
fields='["category"]'
query="{{query}}"
is-aggregated
field="category"
object="poi"
title="POIs"
filters="{{filters}}"
icon="social:whatshot"
stylebg="bg-green">
</number-chart>
</div>
<div style="width: 23%; float: left">
<number-chart
index="tourpedia"
subindex="places"
fields='["category"]'
query="{{query}}"
icon="maps:hotel"
is-aggregated
field="category"
filters="{{filters}}"
title="Accommodations"
object="accommodation"
stylebg="bg-aqua">
</number-chart>
</div>
</div>
<div style="width: 100%; display: inline-block">
<div class="chart_container" style="left: 0; float: left">
<google-chart
query="{{query}}"
index="tourpedia"
subindex="places"
field="category"
fields='["category", "location"]'
host='{{endpoint}}'
id='pie-chart3'
extra-id='pie-chart3'
type='pie'
filters="{{filters}}"
icon='room'
param="{{param}}"
options='{"title": "Different types of places"}'
cols='[{"label": "Sentiment", "type": "string"},{"label": "Count", "type": "number"}]'
rows='[ ["Jan", 31],["Feb", 28],["Mar", 31],["Apr", 30],["May", 31],["Jun", 30] ]'>
</google-chart>
</div>
<div class="chart_container" style="right: 0; float: right">
<google-chart
query="{{query}}"
index="tourpedia"
subindex="places"
field="location"
fields='["category", "location"]'
host='{{endpoint}}'
id='pie-chart4'
extra-id='pie-chart4'
type='pie'
filters="{{filters}}"
icon='maps:my-location'
param='{{param}}'
options='{"title": "Places at different cities"}'
cols='[{"label": "Place", "type": "string"},{"label": "Count", "type": "number"}]'
rows='[ ["Jan", 31],["Feb", 28],["Mar", 31],["Apr", 30],["May", 31],["Jun", 30] ]'>
</google-chart>
</div>
</div>
<div style="width: 100%">
<div class="chart_container" style="left: 0; float: left">
<google-chart
query="{{query}}"
index="tourpedia"
subindex="places"
field="numReviews"
fields='["category", "location"]'
host='{{endpoint}}'
id='column-chart1'
extra-id='column-chart1'
type='column'
filters="{{filters}}"
icon='maps:rate-review'
param='{{param}}'
optionsbi='{"legend": "none"}'
options='{"title": "Count of number of reviews"}'
cols='[{"label": "Reviews", "type": "number"},{"label": "Count", "type": "number"}]'
rows='[ [0, 31],[1, 28],[2, 31],[3, 30],[4, 30],[5, 31],[6, 30] ]'>
</google-chart>
</div>
<div class="chart_container" style="right: 0; float: right">
<google-chart
query="{{query}}"
index="tourpedia"
subindex="places"
field="polarity"
fields='["category", "location"]'
host='{{endpoint}}'
id='bar-chart3'
extra-id='bar-chart3'
type='bar'
filters="{{filters}}"
icon='maps:local-play'
param='{{param}}'
optionsbi='{"legend": "none"}'
options='{"title": "Count of different polarities"}'
cols='[{"label": "Polarity", "type": "number"},{"label": "Count", "type": "number"}]'
rows='[ ["Jan", 31],["Feb", 28],["Mar", 31],["Apr", 30],["May", 31],["Jun", 30] ]'>
</google-chart>
</div>
<div style="clear: both"></div>
</div>
<div style="width: 100%">
<div class="chart_container" style="left: 0; float: left">
<reviews-table
index="tourpedia"
subindex="places"
query="{{query}}"
filters="{{filters}}"
fields='["category", "location"]'
icon='social:people'>
</reviews-table>
</div>
<div class="chart_container" style="right: 0; float: right">
<leaflet-map fit-to-markers>
<template is="dom-repeat" items="[[getPoints(places.*)]]" as="place">
<leaflet-marker latitude="{{place.lat}}" longitude="{{place.lng}}" title="{{place.name}}">
<b>Name:</b>
<span>{{place.name}}</span>
</leaflet-marker>
</template>
</leaflet-map>
</div>
<div style="clear: both"></div>
</div>
</div>
<div>
<yasgui-ui
endpoint="http://lab.gsi.dit.upm.es:5050/tourpedia/sparql"
queries="{{queries}}">
</yasgui-ui>
</div>
</iron-pages>
</template>
<script>
var filtered = false;
Polymer({
is: 'dashboard-tourpedia',
properties: {
selected: {
type: Number,
value: 0
},
ids:{
type: Array,
value: []
},
query: {
type: String,
observer: '_queryChanged'
},
fields: {
type: Array,
value: function() { return []; }
},
places: {
type: Array,
notify: true,
value: []
},
filters: {
type: Array,
notify: true,
value: function() { return []; }
}
},
observers: [
'_filtersChange(filters.*)'
],
addPlace: function(event) {
this.set('places', this.places.concat(event.detail.response))
},
getName: function(id) {
return "http://tour-pedia.org/api/getPlaceDetails?id=" + id
},
getPoints: function(f) {
return f.base;
},
_queryChanged: function() {
this.query ? this.queryChange(this.query) : this.queryDefault();
},
queryChange: function(value) {
var client = new $.es.Client({
hosts: this.host
});
var id = this.extraId;
var doc = this;
client.search({
// undocumented params are appended to the query string
index: "tourpedia",
type: "places",
body: {
size: 10,
query: {
multi_match:{
query: this.query,
fields: ["category", "location"]
}
}
}
}).then(function (resp) {
var hits = resp.hits.hits;
doc.ids = [];
doc.places = [];
hits.forEach(function(entry) {
doc.push('ids',entry._id)
});
});
},
queryDefault: function() {
var client = new $.es.Client({
hosts: this.host
});
var id = this.extraId;
var doc = this;
client.search({
// undocumented params are appended to the query string
index: "tourpedia",
type: "places",
body: {
size: 10,
query: {
match_all: {}
}
}
}).then(function (resp) {
var hits = resp.hits.hits;
doc.ids = [];
doc.places = [];
hits.forEach(function(entry) {
doc.push('ids',entry._id)
});
filtered = true;
});
},
_filtersChange: function() {
if(filtered){
var client = new $.es.Client({
hosts: this.host
});
var id = this.extraId;
var doc = this;
client.search({
// undocumented params are appended to the query string
index: this.index,
type: this.subindex,
body: {
size: 10,
query: {
filtered: {
filter: {
bool: {
must: this.filters,
}
}
}
}
}
}).then(function (resp) {
var hits = resp.hits.hits;
doc.ids = [];
doc.places = [];
hits.forEach(function(entry) {
doc.push('ids',entry._id)
});
});
}
}
});
</script>
</dom-module>
Supports Markdown
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