Commit a7996c09 authored by J. Fernando Sánchez's avatar J. Fernando Sánchez
Browse files

Refactor deployment, modify search

parent 4050cc2e
.*
*.db
__pycache__
\ No newline at end of file
......@@ -5,9 +5,7 @@ Installation
Clone this repository and change to lateral-demo branch:
git clone http://lab.cluster.gsi.dit.upm.es/sefarad/dashboard-somedi.git
git checkout -b lateral-demo
git pull origin lateral-demo
git clone https://lab.gsi.upm.es/sefarad/dashboard-somedi.git
Build and run the docker images:
......@@ -20,7 +18,7 @@ Loading backup data
Run this python script inside docker image to get backup data:
docker-compose exec gsicrawler python loaddatatoES.py
docker-compose exec gsicrawler python loadBackup.py
NOTE: This command may require sudo
......
......@@ -23,10 +23,10 @@ from scrapers.ElPaisScraper import retrieveElPaisNews
from analyzers.analysis import semanticAnalysis
from analyzers.analysis import genericAnalysis
ES_ENDPOINT = os.environ.get('ES_ENDPOINT')
ES_PORT = os.environ.get('ES_PORT')
FUSEKI_PORT = os.environ.get('FUSEKI_PORT')
FUSEKI_ENDPOINT = os.environ.get('FUSEKI_ENDPOINT')
ES_ENDPOINT = os.environ['ES_ENDPOINT']
ES_PORT = os.environ['ES_PORT']
FUSEKI_PORT = os.environ['FUSEKI_PORT']
FUSEKI_ENDPOINT = os.environ['FUSEKI_ENDPOINT']
print('ES connection: {} : {}'.format(ES_ENDPOINT, ES_PORT))
class ScrapyTask(luigi.Task):
......
from node:7.10.0
# Install gettext to get envsubst
RUN apt-get update && apt-get install -y gettext
ENV NODE_PATH=/tmp/node_modules APP_NAME=dashboard-somedi
# Install dependencies first to use cache
RUN npm install -g http-server bower
WORKDIR /usr/src/app/
RUN mkdir -p /etc/ssl/certs
COPY lab.cluster.gsi.dit.upm.es.crt /usr/local/share/ca-certificates/
RUN update-ca-certificates
ADD . /usr/src/app
CMD ["/usr/src/app/init.sh"]
......@@ -20,7 +20,7 @@
"iron-icons": "PolymerElements/iron-icons#^1.0.0",
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
"polymer": "Polymer/polymer#1.7.0",
"jquery": "jquery#^2.1.4",
"jquery": "^3.2.1",
"elasticsearchjs-import": "DigElements/elasticsearchjs-import#~1.0.0",
"elasticjs-import": "DigElements/elasticjs-import#~1.0.1",
"elastic-client": "DigElements/elastic-client#~1.0.1",
......@@ -29,15 +29,14 @@
"comment-chart": "comment-chart#*",
"paper-material": "paper-material#*",
"yasgui-polymer": "yasgui-polymer#*",
"paper-dialog":"paper-dialog#1.1.0",
"paper-dialog": "paper-dialog#1.1.0",
"iron-pages": "PolymerElements/iron-pages#1.0.2",
"paper-item": "paper-item#1.0.2",
"paper-menu": "paper-menu#1.0.1",
"iron-a11y-keys-behavior": "iron-a11y-keys-behavior#1.1.9",
"entities-chart": "entities-chart#*",
"iron-collapse": "iron-collapse#1.0.2",
"jquery": "^3.2.1",
"leaflet": "^1.0.3",
"leaflet": "^1.3.4",
"Leaflet.EasyButton": "^2.2.0",
"leaflet.markercluster": "^1.0.5",
"jqcloud2": "jqcloud2#2.0.3"
......@@ -45,7 +44,8 @@
"resolutions": {
"webcomponentsjs": "0.7.24",
"elastic.js": "^1.2.0",
"polymer":"1.7.0"
"polymer": "1.7.0",
"leaflet": "^1.3.4"
},
"license": "Apache-2.0",
"homepage": "https://lab.cluster.gsi.dit.upm.es/sefarad/dashboard-somedi"
......
Copyright (C) 2014 Daniel Montague
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# L.EasyButton
The easiest way to add buttons with Leaflet — so simple it fits in a gif:
![running demo](https://raw.githubusercontent.com/CliffCloud/Leaflet.EasyButton/dist/img/alert_example.gif)
### More [running examples and docs](http://danielmontague.com/projects/easyButton.js/v1/examples/)
-----------------------------------------------------------------------------------
## Boilerplate Examples
These use `YOUR_LEAFLET_MAP` as a placeholder;
remember to change it to the variable name of your map.
##### Hello World
open a popup
```javascript
var helloPopup = L.popup().setContent('Hello World!');
L.easyButton('fa-globe', function(btn, map){
helloPopup.setLatLng(map.getCenter()).openOn(map);
}).addTo( YOUR_LEAFLET_MAP );
```
##### Map State
set the map's center and use an `img` for the icon
```javascript
L.easyButton('<img src="/path/to/img/of/penguin.png">', function(btn, map){
var antarctica = [-77,70];
map.setView(antarctica);
}).addTo( YOUR_LEAFLET_MAP );
```
##### Button States
change the button's function and appearance
```javascript
var stateChangingButton = L.easyButton({
states: [{
stateName: 'zoom-to-forest', // name the state
icon: 'fa-tree', // and define its properties
title: 'zoom to a forest', // like its title
onClick: function(btn, map) { // and its callback
map.setView([46.25,-121.8],10);
btn.state('zoom-to-school'); // change state on click!
}
}, {
stateName: 'zoom-to-school',
icon: 'fa-university',
title: 'zoom to a school',
onClick: function(btn, map) {
map.setView([42.3748204,-71.1161913],16);
btn.state('zoom-to-forest');
}
}]
});
stateChangingButton.addTo( YOUR_LEAFLET_MAP );
```
-----------------------------------------------------------------------------------
## Download/Install
EasyButton version `2.x.x` and up expect Leaflet `1.x.x` or higher;
for Leaflet `0.7.x` use EasyButton `1.3.x`.
### jsDelivr
```
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.css">
<script src="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.js"></script>
```
### NPM
```
npm install --save leaflet-easybutton
```
### Bower
```
bower install --save Leaflet.EasyButton
```
### Icon Dependencies
If you haven't already, make sure to install/include the icon library of your
choice (your lib should have its own instructions)
&mdash; EasyButton should work with anything!
### Usage
L.easyButton(<icon:string>, <callback:function>);
L.easyButton(<options:object>);
#### `<icon:string>`
it can take many shapes
* `'fa-map-marker'` or another [font awesome](http://fortawesome.github.io/Font-Awesome/icons/) class
* `'glyphicon-globe'` or another [glyphicon](http://getbootstrap.com/components/#glyphicons-glyphs) class
* `'random assortment-of-classes'` for custom icons and other icon libraries
* `'<img alt="do this" src="icon.png"/>'` old fashioned html
#### `<callback:function>`
gets a reference to the button and its map
L.easyButton(<icon:string>, function( buttonArg, mapArg ){
buttonArg.doStuff();
mapArg.doStuff();
});
#### `<options:object>`
the options object looks like this:
L.easyButton({
id: 'id-for-the-button', // an id for the generated button
position: 'topleft', // inherited from L.Control -- the corner it goes in
type: 'replace', // set to animate when you're comfy with css
leafletClasses: true, // use leaflet classes to style the button?
states:[{ // specify different icons and responses for your button
stateName: 'get-center',
onClick: function(button, map){
alert('Map is centered at: ' + map.getCenter().toString());
},
title: 'show me the middle',
icon: 'fa-crosshairs'
}]
});
### More
`L.easyButton` now has a partner, `L.easyBar`
// start with an array of easy buttons
var buttons = [ L.easyButton(options),
L.easyButton(options2),
L.easyButton(options3)];
// build a toolbar with them
L.easyBar(buttons).addTo(map);
Buttons that preform related tasks (e.g. zooming in and out)
can be lumped into logical groups.
### Alternatives
* Follow Leaflet's [docs](http://leafletjs.com/reference.html)
* Browse around for [something](leafletjs.com/plugins.html) that already does what you want
* Copy one of [Leaflet's](https://github.com/Leaflet/Leaflet/tree/master/src/control) controls
### etc
Changes from v0:
* function signature
* now:
* friendly: `L.easyButton(<icon:string(see above)>,<callback:function>)`
* fancy: `L.easyButton(<options:object>)`
* was:
* `L.easyButton(<icon:fa or glyphicon class>,<callback:function>,<map:leaflet-map>,<button-title:string>,<button-id:string>)`
* The Constructor Name
* now: `L.Control.EasyButton ` (no trailing 's')
* was: `L.Control.EasyButtons` (trailing 's')
* The factory, `L.easyButton`, is unchanged
{
"name": "Leaflet.EasyButton",
"homepage": "https://github.com/CliffCloud/Leaflet.EasyButtons",
"authors": [
"atstp <dan.ll.montague@gmail.com>"
],
"description": "Easily add Font Awesome control buttons to Leaflet maps with attached callbacks",
"main": [
"src/easy-button.js",
"src/easy-button.css"
],
"dependencies": {
"leaflet": "~1.0.1"
},
"keywords": [
"Leaflet",
"map",
"button"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}
{
"name": "leaflet-easybutton",
"version": "2.3.0",
"description": "easily add control buttons to your leaflet maps with icon support",
"main": "src/easy-button.js",
"style": "src/easy-button.css",
"types": "src/easy-button.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/CliffCloud/Leaflet.EasyButton.git"
},
"keywords": [
"leaflet",
"font-awesome",
"glyphicon",
"button",
"control",
"map"
],
"author": "rocks.in.the.cloud+easybutton@gmail.com",
"license": "MIT",
"bugs": {
"url": "https://github.com/CliffCloud/Leaflet.EasyButton/issues"
},
"homepage": "https://github.com/CliffCloud/Leaflet.EasyButton",
"dependencies": {
"leaflet": "^1.0.1"
},
"devDependencies": {
"@types/leaflet": "^1.2.0"
}
}
.leaflet-bar button,
.leaflet-bar button:hover {
background-color: #fff;
border: none;
border-bottom: 1px solid #ccc;
width: 26px;
height: 26px;
line-height: 26px;
display: block;
text-align: center;
text-decoration: none;
color: black;
}
.leaflet-bar button {
background-position: 50% 50%;
background-repeat: no-repeat;
overflow: hidden;
display: block;
}
.leaflet-bar button:hover {
background-color: #f4f4f4;
}
.leaflet-bar button:first-of-type {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.leaflet-bar button:last-of-type {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom: none;
}
.leaflet-bar.disabled,
.leaflet-bar button.disabled {
cursor: default;
pointer-events: none;
opacity: .4;
}
.easy-button-button .button-state{
display: block;
width: 100%;
height: 100%;
position: relative;
}
.leaflet-touch .leaflet-bar button {
width: 30px;
height: 30px;
line-height: 30px;
}
import * as L from 'leaflet'
import {ControlPosition} from 'leaflet';
declare module 'leaflet' {
/**
* Creates a bar that holds a group of EasyButtons
* @param buttons array of EasyButtons that will be grouped together in the EasyBar
* @param options
*/
function easyBar(buttons: Control.EasyButton[], options?: EasyBarOptions): Control.EasyBar;
/**
* Creates a easyButton
* @param icon e.g. fa-globe
* @param onClick the button click handler
* @param title title on the button
* @param id an id to tag the button with
* @example
* var helloPopup = L.popup().setContent('Hello World!');
*
* L.easyButton('fa-globe', function(btn, map){
* helloPopup.setLatLng(map.getCenter()).openOn(map);
* }).addTo( YOUR_LEAFLET_MAP );
*/
function easyButton(icon: string,
onClick: (btn: Control.EasyButton, map: L.Map) => void,
title?: string,
id?: string): Control.EasyButton;
/**
* Creates a easyButton
* @param options the options object
* @example
*
*
* L.easyButton({
* position: 'topleft',
* leafletClasses: true,
* states: [
* {
* stateName: 'center',
* onClick: function(btn, map){},
* title: 'Get Center',
* icon: 'fa-globe'
* }
* ]
* }).addTo( YOUR_LEAFLET_MAP );
*/
function easyButton(options: EasyButtonOptions): Control.EasyButton;
interface EasyBarOptions {
position?: ControlPosition
id?: string
leafletClasses?: boolean
}
interface EasyButtonOptions {
position?: ControlPosition
id?: string
type?: 'replace' | 'animate'
states?: EasyButtonState[]
leafletClasses?: boolean
tagName?: string
}
interface EasyButtonState {
stateName: string
onClick: (btn: L.Control.EasyButton, map: L.Map) => void
title: string
icon: string
}
namespace Control {
class EasyButton extends L.Control {
constructor(options?: EasyButtonOptions)
state(stateName: string): EasyButton
enable(): void
disable(): void
}
class EasyBar extends L.Control {
constructor(options?: EasyBarOptions)
}
}
}
(function(){
// This is for grouping buttons into a bar
// takes an array of `L.easyButton`s and
// then the usual `.addTo(map)`
L.Control.EasyBar = L.Control.extend({
options: {
position: 'topleft', // part of leaflet's defaults
id: null, // an id to tag the Bar with
leafletClasses: true // use leaflet classes?
},
initialize: function(buttons, options){
if(options){
L.Util.setOptions( this, options );
}
this._buildContainer();
this._buttons = [];
for(var i = 0; i < buttons.length; i++){
buttons[i]._bar = this;
buttons[i]._container = buttons[i].button;
this._buttons.push(buttons[i]);
this.container.appendChild(buttons[i].button);
}
},
_buildContainer: function(){
this._container = this.container = L.DomUtil.create('div', '');
this.options.leafletClasses && L.DomUtil.addClass(this.container, 'leaflet-bar easy-button-container leaflet-control');
this.options.id && (this.container.id = this.options.id);
},
enable: function(){
L.DomUtil.addClass(this.container, 'enabled');
L.DomUtil.removeClass(this.container, 'disabled');
this.container.setAttribute('aria-hidden', 'false');
return this;
},
disable: function(){
L.DomUtil.addClass(this.container, 'disabled');
L.DomUtil.removeClass(this.container, 'enabled');
this.container.setAttribute('aria-hidden', 'true');
return this;
},
onAdd: function () {
return this.container;
},
addTo: function (map) {
this._map = map;
for(var i = 0; i < this._buttons.length; i++){
this._buttons[i]._map = map;
}
var container = this._container = this.onAdd(map),
pos = this.getPosition(),
corner = map._controlCorners[pos];
L.DomUtil.addClass(container, 'leaflet-control');
if (pos.indexOf('bottom') !== -1) {
corner.insertBefore(container, corner.firstChild);
} else {
corner.appendChild(container);
}
return this;
}
});
L.easyBar = function(){
var args = [L.Control.EasyBar];
for(var i = 0; i < arguments.length; i++){
args.push( arguments[i] );
}
return new (Function.prototype.bind.apply(L.Control.EasyBar, args));
};
// L.EasyButton is the actual buttons
// can be called without being grouped into a bar
L.Control.EasyButton = L.Control.extend({
options: {
position: 'topleft', // part of leaflet's defaults
id: null, // an id to tag the button with
type: 'replace', // [(replace|animate)]