From 77e67618a908acdd1a22df41573537cda7685ecb Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Fri, 1 Jul 2016 08:25:32 +0200 Subject: [PATCH] rewrite --- .gitignore | 3 + Gruntfile.js | 45 +++++++++++++ bower.json | 10 +-- config.json.example | 4 ++ css/style.css | 123 +++++++++++++++++++++++++++++++++++ css/styles.css | 41 ------------ html/index.html | 14 ++++ html/map.html | 1 + html/statistics.html | 1 + index.html | 102 +++-------------------------- js/app.js | 13 ++++ js/controller/map.js | 136 +++++++++++++++++++++++++++++++++++++++ js/controller/nodes.js | 13 ++++ js/controller/sidebar.js | 99 ++++++++++++++++++++++++++++ js/editModel.js | 98 ---------------------------- js/global.js | 25 ------- js/{ => helper}/lib.js | 9 +-- js/helper/router.js | 85 ++++++++++++++++++++++++ js/helper/storage.js | 62 ++++++++++++++++++ js/init.js | 26 -------- js/main.js | 32 +++++++++ js/menu.js | 42 ++++++++++++ js/route/aliases.js | 35 ---------- js/route/map.js | 3 - js/route/nodes.js | 93 -------------------------- js/route/statistic.js | 3 - js/router.js | 16 ----- js/store.js | 40 ------------ package.json | 33 ++++++++++ 29 files changed, 725 insertions(+), 482 deletions(-) create mode 100644 Gruntfile.js create mode 100644 css/style.css delete mode 100644 css/styles.css create mode 100644 html/index.html create mode 100644 html/map.html create mode 100644 html/statistics.html create mode 100644 js/app.js create mode 100644 js/controller/map.js create mode 100644 js/controller/nodes.js create mode 100644 js/controller/sidebar.js delete mode 100644 js/editModel.js delete mode 100644 js/global.js rename js/{ => helper}/lib.js (90%) create mode 100644 js/helper/router.js create mode 100644 js/helper/storage.js delete mode 100644 js/init.js create mode 100644 js/main.js create mode 100644 js/menu.js delete mode 100644 js/route/aliases.js delete mode 100644 js/route/map.js delete mode 100644 js/route/nodes.js delete mode 100644 js/route/statistic.js delete mode 100644 js/router.js delete mode 100644 js/store.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 7d959fc..58586b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ +data/ +api/ +node_modules/ bower_components config.json diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..cbe92a5 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,45 @@ +'use strict'; +module.exports = function (grunt) { + // Load grunt tasks automatically, when needed + require('jit-grunt')(grunt, { + useminPrepare: 'grunt-usemin', + }); + require('time-grunt')(grunt); + + grunt.initConfig({ + open: { + public: { + url: 'http://localhost:8080' + } + }, + connect:{ + public:{ + options:{ + port:8080, + hostname:'*', + base:['.'] + } + } + }, + jshint: { + files: ['Gruntfile.js', 'js/**/*.js'], + options: { + reporter: require('jshint-stylish') + } + }, + watch: { + livereload: { + files: [ + 'js/**/*.js', + 'css/**/*.css', + ], + options: { + livereload: true + } + } + } + }); + + grunt.registerTask('default', ['connect:public','open:public','watch']); + +}; diff --git a/bower.json b/bower.json index f8bc401..13d80ab 100644 --- a/bower.json +++ b/bower.json @@ -16,10 +16,12 @@ "tests" ], "dependencies": { - "material-design-lite": "^1.1.3", + "tablesort": "https://github.com/tristen/tablesort.git#v3.0.2", "dialog-polyfill": "^0.4.3", - "Leaflet.label": "~0.2.1", - "leaflet": "~0.7.3", - "moment": "~2.9.0" + "Leaflet.label": "~0.2.1", + "leaflet": "~0.7.3", + "moment": "~2.9.0", + "requirejs": "^2.2.0", + "font-awesome": "^4.6.3" } } diff --git a/config.json.example b/config.json.example index 8e730e6..cee7fbb 100644 --- a/config.json.example +++ b/config.json.example @@ -3,6 +3,10 @@ "reload":60000, "map":"http://localhost:8080/meshviewer", "editmap":{ + "icon":{ + "warn":{"wifi24":20,"wifi5":20}, + "crit":{"wifi24":30,"wifi5":30} + }, "view":[53.0702,8.815], "zoom":16, "geojson":"/data/meshviewer.geojson", diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..c1da5b7 --- /dev/null +++ b/css/style.css @@ -0,0 +1,123 @@ +@font-face { + font-family: 'FontAwesome'; + src: url('../bower_components/font-awesome/fonts/fontawesome-webfont.eot?v=4.6.3'); + src: url('../bower_components/font-awesome/fonts/fontawesome-webfont.eot?#iefix&v=4.6.3') format('embedded-opentype'), url('../bower_components/font-awesome/fonts/fontawesome-webfont.woff2?v=4.6.3') format('woff2'), url('../bower_components/font-awesome/fonts/fontawesome-webfont.woff?v=4.6.3') format('woff'), url('../bower_components/font-awesome/fonts/fontawesome-webfont.ttf?v=4.6.3') format('truetype'), url('../bower_components/font-awesome/fonts/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular') format('svg'); + font-weight: normal; + font-style: normal; +} + + +body{ + margin: 0px; + padding: 0px; + border: 0px; + outline: 0px; + background: rgba(0, 0, 0, 0.12); +} +.content, .content > .map{ + width:100%; + height:100%; + position: absolute; +} +header.menu{ + position: absolute;; + top:12px; + right:12px; + z-index: 3000; +} +i.icon{ + font: normal normal normal 12px/1 FontAwesome; +} +header.menu .icons i{ + cursor: pointer; + display: inline-block; + padding: 0.4em 0 0 0.4em; + margin-left: 12pt; + border-radius: 0.9em; + background: rgba(255,255,255,0.7); + border: none; + height: 1.4em; + width: 1.4em; + box-shadow: 0 1px 3px rgba(0,0,0,0.12),0 1px 2px rgba(0,0,0,0.24); + font: normal normal normal 24px/1 FontAwesome; +} +header.menu .icons i span{ + font-size: 12px; + position: relative; + top:12px; + left:-24px; + display: inline-block; + white-space: nowrap; + overflow-x: visible; + width: 0px; + height: 0px; +} +.sidebar.hidden{ + display: none; +} +.sidebar .icon i{ + cursor: pointer; + position: absolute; + top: 12px; + right: 12px; + width: 1.6em; + z-index: 3000; + color: black; + font: normal normal normal 24px/1 FontAwesome; +} +.sidebar{ + background: rgba(255, 255, 255, 0.9); + z-index: 2000; + position: absolute; + left: 0px; + height: 100%; + box-shadow: 0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23); + width: 320pt; +} +@media screen and (max-width: 630pt){ + .sidebar{ + top: 500px; + width: 100%; + } +} +.nodeicon{ + background-color: rgba(0,255,0,0.5); + border: 2px solid white; + border-radius: 10px; + width:3px; + height: 3px; +} +.nodeicon-label{ + font-size: 12px; + font-weight: lighter; +} +.nodeicon-label table{ +} +.nodeicon.offline{ + background-color: rgba(255,0,0,0.5); +} +.nodeicon.select{ + background-color: green; +} +.nodeicon.select.offline{ + background-color: red; + border-color: black; +} +.nodeicon.client24{ + border-left: 3px solid blue; +} +.nodeicon.client5{ + border-right: 3px solid blue; +} +.nodeicon.client24-warn{ + border-left: 3px solid yellow; +} +.nodeicon.client5-warn{ + border-right: 3px solid yellow; +} +.nodeicon.client24-crit{ + border-left: 3px solid red; +} +.nodeicon.client5-crit{ + border-right: 3px solid red; +} diff --git a/css/styles.css b/css/styles.css deleted file mode 100644 index 896f60d..0000000 --- a/css/styles.css +++ /dev/null @@ -1,41 +0,0 @@ -html, body { - font-family: 'Roboto', 'Helvetica', sans-serif; -} - -/* -.logo { - width: 48px; - height: 48px; - border-radius: 24px; -}*/ - -#container > iframe{ - border: 0 solid #000; - margin: 0; - padding: 0; - height: 100%; - width: 100%; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; -} - -.nodes-table.mdl-data-table td, .nodes-table.mdl-data-table tr{ - height: 12px; - padding-top: 0px; - padding-bottom: 0px; -} -.nodes-table.mdl-data-table .mdl-textfield{ - /*padding:20px 0 20px 0;*/ - padding:20px 0 0; - margin:0px; -} - -#dialog-editNode{ - min-width:75%; -} -#dialog-editNode-map{ - height:300px; -} diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..2f183be --- /dev/null +++ b/html/index.html @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/html/map.html b/html/map.html new file mode 100644 index 0000000..94a5711 --- /dev/null +++ b/html/map.html @@ -0,0 +1 @@ +