Browse Source

Merge branch 'develop' of jmacura/polirural-attractiveness-clustering into master

merge develop into master
jmacura 5 years ago
parent
commit
96998a598c
9 changed files with 1060 additions and 212 deletions
  1. 15 0
      .editorconfig
  2. 960 146
      package-lock.json
  3. 23 21
      package.json
  4. 4 3
      src/adjuster/adjuster-sidebar-btn.directive.html
  5. 33 22
      src/adjuster/adjuster.directive.html
  6. 9 8
      src/app.js
  7. 12 8
      src/index.html
  8. 1 3
      webpack.common.js
  9. 3 1
      webpack.dev.js

+ 15 - 0
.editorconfig

@@ -0,0 +1,15 @@
+
+# EditorConfig is awesome: https://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+# Newline ending every file
+[*]
+insert_final_newline = true
+
+# 2 space indentation and set default charset
+[*.js]
+indent_style = space
+indent_size = 2
+charset = utf-8

File diff suppressed because it is too large
+ 960 - 146
package-lock.json


+ 23 - 21
package.json

@@ -5,10 +5,10 @@
   "main": "build/index.html",
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1",
-    "build": "node node_modules/hslayers-ng/scripts/bootstrap-isolate.js && npx webpack --config ./webpack.prod.js --progress",
-    "build-dev": "node node_modules/hslayers-ng/scripts/bootstrap-isolate.js && npx webpack --config ./webpack.dev.js --progress",
-    "start": "npx http-server ./static -p 8080",
-    "start-dev": "npx webpack-dev-server --config ./webpack.dev.js --watch"
+    "build": "node node_modules/hslayers-ng/scripts/bootstrap-isolate.js && webpack --config ./webpack.prod.js --progress",
+    "build-dev": "node node_modules/hslayers-ng/scripts/bootstrap-isolate.js && webpack --config ./webpack.dev.js --progress",
+    "start": "http-server ./build -p 8080",
+    "start-dev": "webpack-dev-server --config ./webpack.dev.js --watch"
   },
   "repository": {
     "type": "git",
@@ -19,41 +19,43 @@
     "attractiveness"
   ],
   "author": "Jan Macura",
-  "contributors": ["Raitis Bērziņš"],
+  "contributors": [
+    "Raitis Bērziņš"
+  ],
   "license": "MIT",
   "dependencies": {
     "csvtojson": "^2.0.10",
-    "hslayers-ng": "^1.16.0",
-    "http-server": "^0.12.1"
+    "hslayers-ng": "^1.20.2",
+    "http-server": "^0.12.3"
   },
   "devDependencies": {
-    "@babel/core": "^7.9.0",
+    "@babel/core": "^7.9.6",
     "@babel/plugin-syntax-dynamic-import": "^7.8.3",
     "babel-loader": "^8.1.0",
     "babel-plugin-angularjs-annotate": "^0.10.0",
-    "clean-webpack-plugin": "^2.0.2",
-    "css-loader": "^2.1.1",
-    "eslint": "^6.8.0",
+    "clean-webpack-plugin": "^3.0.0",
+    "css-loader": "^3.5.3",
+    "eslint": "^7.0.0",
     "eslint-config-standard": "^14.1.1",
     "eslint-plugin-import": "^2.20.2",
     "eslint-plugin-node": "^11.1.0",
     "eslint-plugin-promise": "^4.2.1",
     "eslint-plugin-standard": "^4.0.1",
-    "extract-loader": "^3.1.0",
-    "file-loader": "^3.0.1",
-    "html-loader": "^0.5.5",
-    "html-webpack-plugin": "^3.2.0",
-    "mini-css-extract-plugin": "^0.6.0",
+    "extract-loader": "^5.0.1",
+    "file-loader": "^6.0.0",
+    "html-loader": "^1.1.0",
+    "html-webpack-plugin": "^4.3.0",
+    "mini-css-extract-plugin": "^0.9.0",
     "ng-cache-loader": "0.0.26",
     "npm-run-all": "^4.1.5",
     "optimize-css-assets-webpack-plugin": "^5.0.3",
-    "postcss": "^7.0.27",
+    "postcss": "^7.0.30",
     "postcss-prefix-selector": "^1.7.1",
-    "style-loader": "^0.23.1",
-    "url-loader": "^2.1.0",
-    "webpack": "^4.42.1",
+    "style-loader": "^1.2.1",
+    "url-loader": "^4.1.0",
+    "webpack": "^4.43.0",
     "webpack-cli": "^3.3.11",
-    "webpack-dev-server": "^3.10.3",
+    "webpack-dev-server": "^3.11.0",
     "webpack-merge": "^4.2.2"
   }
 }

+ 4 - 3
src/adjuster/adjuster-sidebar-btn.directive.html

@@ -1,4 +1,5 @@
-<a href="#" class="sidebar-item list-group-item" ng-if="Core.exists('pra.adjuster')" ng-click="setMainPanel('adjuster')"  title="{{'Adjust factors'|translate}}" ng-class="{active: Core.mainpanel == 'adjuster'}">
-    <span class="menu-icon icon-alertpay"></span>
-    <span class="sidebar-item-title" translate>Adjust factors</span>
+<a href="#" class="sidebar-item list-group-item" ng-if="Core.exists('pra.adjuster')" ng-click="setMainPanel('adjuster')"
+  title="{{'Adjust factors'|translate}}" ng-class="{active: Core.mainpanel == 'adjuster'}">
+  <span class="menu-icon icon-alertpay"></span>
+  <span class="sidebar-item-title" translate>Adjust factors</span>
 </a>

+ 33 - 22
src/adjuster/adjuster.directive.html

@@ -1,26 +1,37 @@
 <div class="card card-default mainpanel">
-    <hs.layout.panel-header panel-name="adjuster" panel-title="'Adjust factors'||translate"></hs.layout.panel-header>
-    <style>
-        .weather-table>tbody>tr>td,
-        .table-condensed>tbody>tr>th,
-        .table-condensed>tfoot>tr>td,
-        .table-condensed>tfoot>tr>th,
-        .table-condensed>thead>tr>td,
-        .table-condensed>thead>tr>th {
-            padding: 2px;
-        }
-    </style>
+  <hs.layout.panel-header panel-name="adjuster" panel-title="'Adjust factors'||translate"></hs.layout.panel-header>
+  <style>
+    .weather-table>tbody>tr>td,
+    .table-condensed>tbody>tr>th,
+    .table-condensed>tfoot>tr>td,
+    .table-condensed>tfoot>tr>th,
+    .table-condensed>thead>tr>td,
+    .table-condensed>thead>tr>th {
+      padding: 2px;
+    }
+  </style>
+  <div class="card-body">
     <div class="card-body">
-        <div class="card-body">
-                <div ng-repeat="factor in adjusterService.factors">
-                    <div class="d-flex flex-row">
-                        <div class="p-2 flex-grow-1">
-                            <label>{{factor.factor}}</label>
-                        </div>
-                        <div class="p-2">{{(factor.weight * 100).toFixed(0)}}%</div>
-                    </div>                   
-                    <input type="range" class="custom-range" ng-change="adjusterService.apply()" ng-model="factor.weight" min="0" max="1.0" step="0.05">
-                </div>
+      <div ng-repeat="factor in adjusterService.factors">
+        <div class="d-flex flex-row">
+          <div class="p-2 flex-grow-1">
+            <label>{{factor.factor}}</label>
+          </div>
+          <div class="p-2">{{(factor.weight * 100).toFixed(0)}}&nbsp;%</div>
         </div>
+        <input type="range" class="custom-range" ng-change="adjusterService.apply()" ng-model="factor.weight" min="0"
+          max="1.0" step="0.05">
+        <span class="glyphicon" ng-class="datasetlistVisible ? 'icon-chevron-down' : 'icon-chevron-right'"
+          ng-click="datasetlistVisible = !datasetlistVisible"></span>
+        <div ng-init="datasetlistVisible = false" ng-show="datasetlistVisible">
+          <div ng-repeat="dataset in factor.datasets">
+            <button type="button" class="btn btn-sm btn-light hs-lm-item-visibility"
+              ng-click="dataset.included = !dataset.included;adjusterService.apply();$event.stopPropagation()"
+              ng-class="dataset.included ? 'hs-checkmark' : 'hs-uncheckmark'"></button>
+            <label>{{dataset.name}}</label>
+          </div>
+        </div>
+      </div>
     </div>
-</div>
+  </div>
+</div>

+ 9 - 8
src/app.js

@@ -37,9 +37,9 @@ const module = angular.module('hs', [
 module.directive('hs', ['config', 'Core', function (config, Core) {
   return {
     template: Core.hslayersNgTemplate,
-    link: function (scope, element) {
+    /* link: function (scope, element) {
       Core.fullScreenMap(element);
-    }
+     } */
   };
 }]);
 
@@ -66,7 +66,7 @@ function perc2color (perc) {
     r = Math.round(510 - 5.10 * perc);
   }
   // eslint-disable-next-line no-unused-vars
-  const h = r * 0x10000 + g * 0x100 + b * 0x1;
+  // const h = r * 0x10000 + g * 0x100 + b * 0x1;
   return `rgba(${r}, ${g}, ${b}, 0.7)`;
 }
 
@@ -135,18 +135,19 @@ module.value('config', {
   },
   panelWidths: {
   },
+  // allowAddExternalDatasets: false,
   panelsEnabled: {
-    language: false,
     composition_browser: false,
     legend: false,
-    ows: false,
+    draw: false,
     info: false,
     saveMap: false,
-    draw: false
+    language: false
   },
   searchProvider: (q) => {
     return `/app/jupyter-test/8085/search/?q=${q}`;
-  }
+  },
+  sizeMode: 'fullscreen'
 });
 
 module.controller('Main', ['$scope', 'Core', '$compile', 'hs.layout.service', 'pra.adjuster.service',
@@ -155,7 +156,7 @@ module.controller('Main', ['$scope', 'Core', '$compile', 'hs.layout.service', 'p
     $scope.panelVisible = layoutService.panelVisible;
     layoutService.sidebarRight = false;
     // layoutService.sidebarToggleable = false;
-    Core.singleDatasources = true;
+    // Core.singleDatasources = true;
     layoutService.sidebarButtons = true;
     layoutService.setDefaultPanel('adjuster');
     $scope.$on('scope_loaded', function (event, args) {

+ 12 - 8
src/index.html

@@ -1,20 +1,24 @@
 <!DOCTYPE html>
 <html>
+
 <head>
   <meta charset="utf-8">
   <title>Rural attractiveness</title>
-  <meta name="description" content="Rural attractiveness calculation and visualization application developed in PoliRural project. 2020">
+  <meta name="description"
+    content="Rural attractiveness calculation and visualization application developed in PoliRural project. 2020">
   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
   <meta name="apple-mobile-web-app-capable" content="yes" />
-  <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
+  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
   <% for (var css in htmlWebpackPlugin.files.css) { %>
     <link href="<%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
-    <% } %>
+  <% } %>
 </head>
-<body >
-    <div hs ng-app="hs" ng-controller="Main" style="height: 100vh;"></div>
-    <% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
-      <script type="application/javascript" src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
-    <% } %>
+
+<body>
+  <div hs ng-app="hs" ng-controller="Main" style="height: 100vh;"></div>
+  <% for (var js in htmlWebpackPlugin.files.js) { %>
+    <script type="application/javascript" src="<%= htmlWebpackPlugin.files.js[js] %>"></script>
+  <% } %>
 </body>
+
 </html>

+ 1 - 3
webpack.common.js

@@ -10,15 +10,13 @@
  *   `'ngInject';` or `@ngInject` in comments. See https://docs.angularjs.org/guide/di
  */
 const path = require('path');
-const CleanWebpackPlugin = require('clean-webpack-plugin');
+const { CleanWebpackPlugin } = require('clean-webpack-plugin');
 const HtmlWebpackPlugin = require('html-webpack-plugin');
 const hslPaths = require(path.join(__dirname, './node_modules/hslayers-ng/common_paths'));
 
 module.exports = {
   entry: { main: './src/app.js' },
   output: {
-    // Path where bundled files will be output
-    path: path.resolve(__dirname, './static'),
     // Path at which output assets will be served
     publicPath: ''
   },

+ 3 - 1
webpack.dev.js

@@ -31,11 +31,13 @@ module.exports = merge(common, {
   },
   output: {
     // see https://webpack.js.org/guides/build-performance#output-without-path-info
+    // Path where bundled files will be output
+    path: path.resolve(__dirname, './static'),
     pathinfo: false,
     filename: '[name].bundle.js'
   },
   devServer: {
-    contentBase: './static',
+    contentBase: path.resolve(__dirname, './static'),
     hot: false,
     host: '0.0.0.0',
     port: env.HTTP_PORT || 8082

Some files were not shown because too many files changed in this diff