diff --git a/Gruntfile.js b/Gruntfile.js index c91cd0993..a8b499ce2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -10,7 +10,7 @@ module.exports = function(grunt) { ], "ooiui/static/js/partials/compiled/home.js": [ "ooiui/static/js/partials/home/array_content/ArrayContentSummaryItem.html", - "ooiui/static/js/partials/home/array_content/ArrayStatusSummaryItem.html", + //"ooiui/static/js/partials/home/array_content/ArrayStatusSummaryItem.html", "ooiui/static/js/partials/home/array_content/PlatformTable.html", "ooiui/static/js/partials/home/array_content/PlatformTableItem.html" ], @@ -966,6 +966,7 @@ module.exports = function(grunt) { 'ooiui/static/js/models/asset_management/PlatformDeploymentModel.js', 'ooiui/static/js/models/science/ArrayModel.js', 'ooiui/static/js/models/science/ArrayStatusModel.js', + 'ooiui/static/js/models/asset_management/SiteStatusModel.js', 'ooiui/static/js/models/science/StreamModel.js', 'ooiui/static/js/models/common/MessageModel.js', 'ooiui/static/js/models/common/LoginModel.js', @@ -1914,6 +1915,7 @@ module.exports = function(grunt) { ], "ooiui/static/js/compiled/genericPlatFormsStatus.js": [ 'ooiui/static/js/models/asset_management/PlatformStatusModel.js', + 'ooiui/static/js/models/asset_management/PlatformsStatusModel.js', 'ooiui/static/js/models/science/StreamStatusModel.js', 'ooiui/static/js/views/platforms/GenericPlatFormStatusView.js', 'ooiui/static/js/views/platforms/GenericPlatFormTableView.js' diff --git a/bower.json b/bower.json index 93c219cff..a48dc077e 100644 --- a/bower.json +++ b/bower.json @@ -19,7 +19,7 @@ "jquery": "~2.1.1", "d3": "~3.4.13", "bootstrap": "~3.3.1", - "leaflet": "~0.7.3", + "leaflet": "~1.0.3", "Leaflet.awesome-markers": "~2.0.2", "holderjs": "~2.4.1", "leaflet.markercluster": "~0.4.0", @@ -47,7 +47,7 @@ "bootstrap-table": "1.6.0", "jquery.browser": "~0.0.7", "bootstrap-editable-table": "~1.0.1", - "jqtree": "~1.0.0", + "jqtree": "~1.3.7", "x-editable": "~1.5.1", "showdown": "~0.5.0", "leaflet.wms": "https://github.com/cgalvarino/leaflet.wms.git#62b489f0f9b83f375f330f0ed60adbc0ce40918c", @@ -56,7 +56,6 @@ "nuxeo": "~0.5.1", "highcharts": "4.1.6", "highchart-export-csv": "*", - "Leaflet.EasyButton": "~1.1.0", "bootstrap-validator": "~0.9.0", "jquery-sticky-table-headers": "https://github.com/jmosbech/StickyTableHeaders.git", "slick-carousel": "~1.5.9", @@ -66,7 +65,13 @@ "requirejs": "~2.2.0", "moment-range": "^2.2.0", "jQRangeSlider": "https://github.com/maka-io/jQRangeSlider.git#master", - "visavail": "https://github.com/flrs/visavail.git#master" + "visavail": "https://github.com/flrs/visavail.git#master", + "mapbox-gl-js": "https://github.com/mapbox/mapbox-gl-js.git#0.17.0", + "mapbox.js": "~3.0.1", + "leaflet-plugins": "~3.0.0", + "Leaflet.Coordinates" : "https://github.com/MrMufflon/Leaflet.Coordinates.git#v0.1.5", + "Leaflet.Rrose" : "https://github.com/erictheise/rrose.git#v0.2.0", + "leaflet-omnivore" : "~v0.3.4" }, "resolutions": { "jquery": "~2.1.1", diff --git a/ooiui/core/routes/common.py b/ooiui/core/routes/common.py index 0d5d31c07..68560f461 100644 --- a/ooiui/core/routes/common.py +++ b/ooiui/core/routes/common.py @@ -202,6 +202,10 @@ def statusUI(): def statusN(): return render_template('common/statusN.html', tracking=app.config['GOOGLE_ANALYTICS']) +@app.route('/statustree') +def statusTree(): + return render_template('common/statusTree.html', tracking=app.config['GOOGLE_ANALYTICS']) + @app.route('/api/organization', methods=['GET']) def get_organization(): @@ -651,13 +655,15 @@ def send_ses(fromaddr, subject, body, recipient): return ex.message -@app.route('/api/data_availability', methods=['GET']) -def get_data_availability(): +@app.route('/api/data_availability/', methods=['GET']) +def get_data_availability(ref_des): # Mocked services response based on https://ooi.visualocean.net/instruments/view/RS01SBPD-DP01A-01-CTDPFL104#stats - stats_data = {"operational_status":[["2014-11-01",1,"2014-12-01"],["2014-12-01",1,"2015-01-01"],["2015-01-01",1,"2015-02-01"],["2015-02-01",0,"2015-03-01"],["2015-03-01",0,"2015-04-01"],["2015-04-01",0,"2015-05-01"],["2015-05-01",0,"2015-06-01"],["2015-06-01",0,"2015-07-01"],["2015-07-01",0,"2015-08-01"],["2015-08-01",1,"2015-09-01"],["2015-09-01",1,"2015-10-01"],["2015-10-01",1,"2015-11-01"],["2015-11-01",1,"2015-12-01"],["2015-12-01",1,"2016-01-01"],["2016-01-01",1,"2016-02-01"],["2016-02-01",0,"2016-03-01"],["2016-03-01",0,"2016-04-01"],["2016-04-01",0,"2016-05-01"],["2016-05-01",0,"2016-06-01"],["2016-06-01",0,"2016-07-01"],["2016-07-01",0,"2016-08-01"],["2016-08-01",0,"2016-09-01"],["2016-09-01",0,"2016-10-01"],["2016-10-01",0,"2016-11-01"]], - "cassandra_ts":[["2014-11-01",0,"2014-12-01"],["2014-12-01",0,"2015-01-01"],["2015-01-01",0,"2015-02-01"],["2015-02-01",0,"2015-03-01"],["2015-03-01",0,"2015-04-01"],["2015-04-01",0,"2015-05-01"],["2015-05-01",0,"2015-06-01"],["2015-06-01",0,"2015-07-01"],["2015-07-01",0,"2015-08-01"],["2015-08-01",0,"2015-09-01"],["2015-09-01",0,"2015-10-01"],["2015-10-01",0,"2015-11-01"],["2015-11-01",0,"2015-12-01"],["2015-12-01",0,"2016-01-01"],["2016-01-01",0,"2016-02-01"],["2016-02-01",0,"2016-03-01"],["2016-03-01",0,"2016-04-01"],["2016-04-01",0,"2016-05-01"],["2016-05-01",0,"2016-06-01"],["2016-06-01",0,"2016-07-01"],["2016-07-01",0,"2016-08-01"],["2016-08-01",0,"2016-09-01"],["2016-09-01",0,"2016-10-01"],["2016-10-01",0,"2016-11-01"]], - "cassandra_rec":[["2014-11-01",0,"2014-12-01"],["2014-12-01",0,"2015-01-01"],["2015-01-01",0,"2015-02-01"],["2015-02-01",0,"2015-03-01"],["2015-03-01",0,"2015-04-01"],["2015-04-01",0,"2015-05-01"],["2015-05-01",0,"2015-06-01"],["2015-06-01",0,"2015-07-01"],["2015-07-01",1,"2015-08-01"],["2015-08-01",1,"2015-09-01"],["2015-09-01",1,"2015-10-01"],["2015-10-01",1,"2015-11-01"],["2015-11-01",0,"2015-12-01"],["2015-12-01",0,"2016-01-01"],["2016-01-01",0,"2016-02-01"],["2016-02-01",0,"2016-03-01"],["2016-03-01",0,"2016-04-01"],["2016-04-01",0,"2016-05-01"],["2016-05-01",0,"2016-06-01"],["2016-06-01",0,"2016-07-01"],["2016-07-01",0,"2016-08-01"],["2016-08-01",0,"2016-09-01"],["2016-09-01",0,"2016-10-01"],["2016-10-01",0,"2016-11-01"]] - } - status_code = 200 - response = jsonify({'ref_des': "RS01SBPD-DP01A-01-CTDPFL104", 'stats_data': stats_data}) - return response, status_code + # stats_data = {"operational_status":[["2014-11-01",1,"2014-12-01"],["2014-12-01",1,"2015-01-01"],["2015-01-01",1,"2015-02-01"],["2015-02-01",0,"2015-03-01"],["2015-03-01",0,"2015-04-01"],["2015-04-01",0,"2015-05-01"],["2015-05-01",0,"2015-06-01"],["2015-06-01",0,"2015-07-01"],["2015-07-01",0,"2015-08-01"],["2015-08-01",1,"2015-09-01"],["2015-09-01",1,"2015-10-01"],["2015-10-01",1,"2015-11-01"],["2015-11-01",1,"2015-12-01"],["2015-12-01",1,"2016-01-01"],["2016-01-01",1,"2016-02-01"],["2016-02-01",0,"2016-03-01"],["2016-03-01",0,"2016-04-01"],["2016-04-01",0,"2016-05-01"],["2016-05-01",0,"2016-06-01"],["2016-06-01",0,"2016-07-01"],["2016-07-01",0,"2016-08-01"],["2016-08-01",0,"2016-09-01"],["2016-09-01",0,"2016-10-01"],["2016-10-01",0,"2016-11-01"]], + # "cassandra_ts":[["2014-11-01",0,"2014-12-01"],["2014-12-01",0,"2015-01-01"],["2015-01-01",0,"2015-02-01"],["2015-02-01",0,"2015-03-01"],["2015-03-01",0,"2015-04-01"],["2015-04-01",0,"2015-05-01"],["2015-05-01",0,"2015-06-01"],["2015-06-01",0,"2015-07-01"],["2015-07-01",0,"2015-08-01"],["2015-08-01",0,"2015-09-01"],["2015-09-01",0,"2015-10-01"],["2015-10-01",0,"2015-11-01"],["2015-11-01",0,"2015-12-01"],["2015-12-01",0,"2016-01-01"],["2016-01-01",0,"2016-02-01"],["2016-02-01",0,"2016-03-01"],["2016-03-01",0,"2016-04-01"],["2016-04-01",0,"2016-05-01"],["2016-05-01",0,"2016-06-01"],["2016-06-01",0,"2016-07-01"],["2016-07-01",0,"2016-08-01"],["2016-08-01",0,"2016-09-01"],["2016-09-01",0,"2016-10-01"],["2016-10-01",0,"2016-11-01"]], + # "cassandra_rec":[["2014-11-01",0,"2014-12-01"],["2014-12-01",0,"2015-01-01"],["2015-01-01",0,"2015-02-01"],["2015-02-01",0,"2015-03-01"],["2015-03-01",0,"2015-04-01"],["2015-04-01",0,"2015-05-01"],["2015-05-01",0,"2015-06-01"],["2015-06-01",0,"2015-07-01"],["2015-07-01",1,"2015-08-01"],["2015-08-01",1,"2015-09-01"],["2015-09-01",1,"2015-10-01"],["2015-10-01",1,"2015-11-01"],["2015-11-01",0,"2015-12-01"],["2015-12-01",0,"2016-01-01"],["2016-01-01",0,"2016-02-01"],["2016-02-01",0,"2016-03-01"],["2016-03-01",0,"2016-04-01"],["2016-04-01",0,"2016-05-01"],["2016-05-01",0,"2016-06-01"],["2016-06-01",0,"2016-07-01"],["2016-07-01",0,"2016-08-01"],["2016-08-01",0,"2016-09-01"],["2016-09-01",0,"2016-10-01"],["2016-10-01",0,"2016-11-01"]] + # } + # status_code = 200 + # response = jsonify({'ref_des': "RS01SBPD-DP01A-01-CTDPFL104", 'stats_data': stats_data}) + # return response, status_code + resp = requests.get('http://uframe-test.intra.oceanobservatories.org:9000/available/'+ref_des, params=request.args) + return resp.text, resp.status_code diff --git a/ooiui/core/routes/science.py b/ooiui/core/routes/science.py index 91838dd68..077818815 100644 --- a/ooiui/core/routes/science.py +++ b/ooiui/core/routes/science.py @@ -158,10 +158,10 @@ def getUframeMultiStreamInterp(): ''' try: # Parse the parameters - stream1 = request.args['stream1'] - stream2 = request.args['stream2'] - instr1 = request.args['instrument1'] - instr2 = request.args['instrument2'] + ref_des1 = request.args['ref_des1'] + ref_des2 = request.args['ref_des2'] + instr1 = request.args['instr1'] + instr2 = request.args['instr2'] var1 = request.args['var1'] var2 = request.args['var2'] startdate = request.args['startdate'] @@ -169,7 +169,11 @@ def getUframeMultiStreamInterp(): # Build the URL params = '?startdate=%s&enddate=%s' % (startdate, enddate) - data_url = "/".join([app.config['SERVICES_URL'], 'uframe/get_multistream', stream1, stream2, instr1, instr2, var1, var2 + params]) + # http://localhost:4000/uframe/get_multistream/CP05MOAS-GL340-03-CTDGVM000/CP05MOAS-GL340-02-FLORTM000/telemetered_ctdgv_m_glider_instrument/ + # telemetered_flort_m_glider_instrument/sci_water_pressure/sci_flbbcd_chlor_units?startdate=2015-05-07T02:49:22.745Z&enddate=2015-06-28T04:00:41.282Z + data_url = "/".join([app.config['SERVICES_URL'], 'uframe/get_multistream', ref_des1, ref_des2, instr1, instr2, var1, var2 + params]) + + print data_url # Get the response response = requests.get(data_url, params=request.args) @@ -239,20 +243,39 @@ def array_proxy(): @app.route('/api/uframe/status/arrays') def status_arrays(): - response = requests.get(app.config['SERVICES_URL'] + '/uframe/status/arrays', params=request.args) - return response.text, response.status_code + try: + response = requests.get(app.config['SERVICES_URL'] + '/uframe/status/arrays', params=request.args) + return response.text, response.status_code + except Exception, e: + print "error" + e.message + return "Error getting array status from services", 400 @app.route('/api/uframe/status/sites/') def status_sites(array_code): + if request.args: + array_code = request.args['node'] + response = requests.get(app.config['SERVICES_URL'] + '/uframe/status/sites/%s' % array_code, params=request.args) + return response.text, response.status_code + + +@app.route('/api/uframe/status/sites') +def status_sites_tree(): + if request.args: + array_code = request.args['node'] + else: + return "Bad node parameter", 400 response = requests.get(app.config['SERVICES_URL'] + '/uframe/status/sites/%s' % array_code, params=request.args) return response.text, response.status_code @app.route('/api/uframe/status/platforms/') def status_platforms(array_code): - response = requests.get(app.config['SERVICES_URL'] + '/uframe/status/platforms/%s' % array_code, params=request.args) - return response.text, response.status_code + if array_code: + response = requests.get(app.config['SERVICES_URL'] + '/uframe/status/platforms/%s' % array_code, params=request.args) + return response.text, response.status_code + else: + return "No platform status response.", 500 @app.route('/api/uframe/status/instrument/') diff --git a/ooiui/static/css/common/assets.css b/ooiui/static/css/common/assets.css index dcea1ad53..7136f1241 100644 --- a/ooiui/static/css/common/assets.css +++ b/ooiui/static/css/common/assets.css @@ -25,6 +25,7 @@ tr.highlight-row { } div.panel { + width: 100%; } div.panel-heading { diff --git a/ooiui/static/css/common/newEvent.css b/ooiui/static/css/common/newEvent.css index e848a2ffd..b7d08ae08 100644 --- a/ooiui/static/css/common/newEvent.css +++ b/ooiui/static/css/common/newEvent.css @@ -62,7 +62,7 @@ text-decoration: none; } div.image { - content: url(/img/modal/OOI_Banner.png); + content: url("/img/modal/OOI_Banner.svg"); margin-left: auto; margin-right: auto; margin-top: -20px; diff --git a/ooiui/static/css/common/platform.css b/ooiui/static/css/common/platform.css index 3222edf4c..721ce433a 100644 --- a/ooiui/static/css/common/platform.css +++ b/ooiui/static/css/common/platform.css @@ -1,11 +1,11 @@ .platform-page {} .platform-page #platform-view-content h2 { - padding-top: 20px; + padding-top: 25px; } .platform-page #platform-view-content .panel { - padding: 0 20px 0 20px; + padding: 0 25px 0 25px; } div#wrapper.platform-page { @@ -79,17 +79,25 @@ div#wrapper.platform-page { } .mooringIcon{ - border-radius: 38px; + border-radius: 48px; + background: orange; + border: 2px solid #000; + opacity: 1; +} + +.otherMooringIcon{ + border-radius: 48px; background: teal; border: 2px solid #000; opacity: 0.85; } -.otherMooringIcon{ +.otherSitesIcon{ border-radius: 48px; - background: yellow; + background: green; border: 2px solid #000; opacity: 0.85; + z-index: -100000; } .centered { @@ -99,3 +107,59 @@ div#wrapper.platform-page { /* bring your own prefixes */ transform: translate(-50%, -50%); } +/*dark gray Not Operational 96 96 96 606060 +gray Unavailable 160 160 160 A0A0A0 +light gray Pending 224 224 224 E0E0E0 +blue Not Evaluated 0 76 153 004C00 +orange Suspect 204 102 0 CC6600 +red Fail 204 0 0 CC0000 +green Pass 0 204 0 00CC00 +dark green Good 0 102 0 006600*/ + +.fa.fa-circle.failed { + color: #CC0000; + font-size: 16px; + float: left; +} + +.fa.fa-circle.degraded { + color: #CC6600; + font-size: 16px; + float: left; +} + +.fa.fa-circle.removedFromService { + color: #606060; + font-size: 16px; + float: left; +} + +.fa.fa-circle.notTracked { + color: blue; + font-size: 16px; + float: left; +} + +.fa.fa-circle.fetchingStatusFailed { + color: #A0A0A0; + font-size: 16px; + float: left; +} + +.fa.fa-circle.noStatusReturned { + color: #A0A0A0; + font-size: 16px; + float: left; +} + +.fa.fa-circle.operational { + color: #00CC00; + font-size: 16px; + float: left; +} + +.fa.fa-circle.unknownStatusResult { + color: #A0A0A0; + font-size: 16px; + float: left; +} \ No newline at end of file diff --git a/ooiui/static/css/common/plotting.css b/ooiui/static/css/common/plotting.css index 0093f09b3..62d988ec2 100644 --- a/ooiui/static/css/common/plotting.css +++ b/ooiui/static/css/common/plotting.css @@ -7,10 +7,10 @@ /*******************/ div#plottingBody { - margin-left: 20px; - padding-right: 50px; + margin-left: 5px; + padding-right: 5px; max-height: 700px; - max-width: 1560px; + max-width: 100%; min-width: 881px; } /* ~vertical buttons on sidebar~ */ diff --git a/ooiui/static/css/common/scienceLayout.css b/ooiui/static/css/common/scienceLayout.css index dcf2a734d..cec761b29 100755 --- a/ooiui/static/css/common/scienceLayout.css +++ b/ooiui/static/css/common/scienceLayout.css @@ -174,7 +174,7 @@ body { } .navbar-top-links li:last-child { - margin-right: 15px; + /*margin-right: 15px;*/ } .navbar-top-links li a { diff --git a/ooiui/static/css/common/toc_menu.css b/ooiui/static/css/common/toc_menu.css index 61aad8377..aaf93d754 100644 --- a/ooiui/static/css/common/toc_menu.css +++ b/ooiui/static/css/common/toc_menu.css @@ -140,9 +140,12 @@ label.platform > font, label.assembly > font, label.instrument > font { padding-left: 0px; margin-right: 0px; margin-left: 0px; - width: 1520px; + /*width: 1520px;*/ + max-width: 100% !important; + width: auto !important; border-color: transparent; background-color: transparent; + min-height: 600px; } label.instrument > span { display: block; diff --git a/ooiui/static/css/custom/custom.css b/ooiui/static/css/custom/custom.css index 8adf721a7..606d84888 100644 --- a/ooiui/static/css/custom/custom.css +++ b/ooiui/static/css/custom/custom.css @@ -46,11 +46,11 @@ li { /* ~panel style~ */ .panel { - border: none; + /*border: none;*/ } .panel-body { - border: none; + /*border: none;*/ } .panel-heading.panel-search.pull-right { @@ -175,6 +175,7 @@ color: #000; text-decoration: none; line-height: .9; font-weight: 300; + white-space: normal; } .btn-default:hover { @@ -308,4 +309,160 @@ div#events-scroll-body { /* alt light blue #D1DAF5 rgb(209,218,245) */ /* alt light blue2 #7F9BDA */ +.jqtree-notTracked { + background-color: transparent; + /*cursor: pointer;*/ + color: #000; +} +.jqtree-notTracked:hover { + border:2px solid; + color: black; +} + +.scrollable-jqtree { + max-height: 700px; + border: 2px solid #fff; + overflow: auto; +} + +.scrollable-visavail { + width: 65%; + max-height: 700px; + border: 2px solid #fff; + overflow: auto; +} + +/*.jqtree-failed { + background-color: indianred; + cursor: pointer; +}*/ + +.ui-jqgrid .ui-jqgrid-htable th div +{ + height: auto; + overflow: hidden; + padding-right: 4px; + padding-top: 2px; + position: relative; + vertical-align: text-top; + white-space: normal !important; +} + +th.ui-th-column div { + white-space: normal !important; + height: auto !important; + padding: 2px; +} + +#filterScrollContainer { + white-space: normal !important; + max-width: 33% !important; +} + +div.ui-rangeSlider-label-value { + font-size: 10pt; +} + +a.back-to-top { + display: none; + width: 30px; + height: 30px; + text-indent: -9999px; + font-size: 20pt; + position: fixed; + z-index: 999; + right: 5px; + bottom: 90px; + background: #27AE61 url("/img/uparrow.png") no-repeat center 10%; + -webkit-border-radius: 30px; + -moz-border-radius: 30px; + border-radius: 30px; + background-size: contain; +} + +a.back-to-bottom { + display: none; + width: 30px; + height: 30px; + text-indent: -9999px; + font-size: 20pt; + position: fixed; + z-index: 999; + right: 5px; + bottom: 20px; + background: #27AE61 url("/img/uparrow.png") no-repeat center 10%; + -webkit-transform: rotate(180deg); + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -o-transform: rotate(180deg); + transform: rotate(180deg); + -webkit-border-radius: 30px; + -moz-border-radius: 30px; + border-radius: 30px; + background-size: contain; +} + +#infoArrayMap { + display: none; + width: auto !important; + overflow: hidden; + overflow-wrap: break-word; + white-space: normal !important; + height: auto !important; + padding: 2px; + font-size: 14pt; + position: fixed; + /*right: 5px;*/ + /*bottom: 35px;*/ + -webkit-border-radius: 20px; + -moz-border-radius: 20px; + border-radius: 20px; +} + +span.labelFirst { + margin-top: 3px; +} + +div.innerTableTitle { + position: relative; + bottom: 25px; + left: 150px; + font-size: 10pt; + font-weight: 400; + vertical-align: text-top; +} + +div.leaflet-control-coordinates.leaflet-control{ + position: absolute; + left: 40px; + top: 5px; + padding-top: 10px; + padding-left: 5px; +} + +.leaflet-popup-content h2{ + background: white; + font-size: 12px; + text-align: center; +} + +.leaflet-popup-content{ + background: white; +} + +.leaflet-popup-content-wrapper{ + min-width: 125px; + min-height: 30px; + background: white; + font-size: 12px; + text-align: center; +} + +.leaflet-popup-tip-container{ + visibility: hidden; +} + +.leaflet-popup-close-button{ + visibility: hidden; +} diff --git a/ooiui/static/css/custom/navbar.css b/ooiui/static/css/custom/navbar.css index f083aa576..0533361e6 100644 --- a/ooiui/static/css/custom/navbar.css +++ b/ooiui/static/css/custom/navbar.css @@ -175,7 +175,7 @@ banner header for active/inactive } .navbar-top-links-new li:last-child { - margin-right: 15px; + /*margin-right: 15px;*/ } .navbar-top-links-new li a { diff --git a/ooiui/static/css/data_catalog/data_catalog.css b/ooiui/static/css/data_catalog/data_catalog.css index a93638dd8..e1ad4c28c 100644 --- a/ooiui/static/css/data_catalog/data_catalog.css +++ b/ooiui/static/css/data_catalog/data_catalog.css @@ -1,7 +1,7 @@ body, html { - margin: 0; - /* overflow: hidden; */ - height:100%; + margin: 0; + /* overflow: hidden; */ + height:100%; } #element::-webkit-scrollbar { display: none; diff --git a/ooiui/static/css/home/home.css b/ooiui/static/css/home/home.css index 404dd7da5..300b40a78 100644 --- a/ooiui/static/css/home/home.css +++ b/ooiui/static/css/home/home.css @@ -3,7 +3,8 @@ body, html { overflow: hidden; height:100%; } -#element::-webkit-scrollbar { + +#map::-webkit-scrollbar { display: none; } @@ -17,8 +18,8 @@ body, html { #right { padding: 0; - right: 0px; - position: absolute; + right: 0; + position: fixed; } #wrapper{ @@ -26,7 +27,9 @@ body, html { overflow-y: scroll; } - +.row{ + overflow: hidden; +} .home-page .js-array:hover{ } @@ -42,7 +45,7 @@ body, html { .home-page .js-array .panel-heading h4 { position: relative; - background-color: #5c9ccc; + /*background-color: #5c9ccc;*/ display: inline-block; width: 100%; padding: 5px; @@ -75,10 +78,10 @@ body, html { } -.home-page .fade { - opacity: 0; - transition: all 1; -} +/*.home-page .fade {*/ + /*opacity: 0;*/ + /*transition: all 1s;*/ +/*}*/ .mydivicon{ border-radius: 58px; diff --git a/ooiui/static/css/home/vector_map/vector_map.css b/ooiui/static/css/home/vector_map/vector_map.css index 9a58234c5..7339095f5 100644 --- a/ooiui/static/css/home/vector_map/vector_map.css +++ b/ooiui/static/css/home/vector_map/vector_map.css @@ -5,6 +5,11 @@ bottom: 0; position: absolute; } + +#map::-webkit-scrollbar { + display: none; +} + div#wrapper.home-page { width: 100%; } diff --git a/ooiui/static/img/down-arrow.png b/ooiui/static/img/down-arrow.png new file mode 100644 index 000000000..bc0db4f38 Binary files /dev/null and b/ooiui/static/img/down-arrow.png differ diff --git a/ooiui/static/img/logos-banners/iris_logo_shadow.png b/ooiui/static/img/logos-banners/iris_logo_shadow.png new file mode 100644 index 000000000..14311d08c Binary files /dev/null and b/ooiui/static/img/logos-banners/iris_logo_shadow.png differ diff --git a/ooiui/static/img/uparrow.png b/ooiui/static/img/uparrow.png new file mode 100644 index 000000000..6d8bbea49 Binary files /dev/null and b/ooiui/static/img/uparrow.png differ diff --git a/ooiui/static/js/models/asset_management/PlatformsStatusModel.js b/ooiui/static/js/models/asset_management/PlatformsStatusModel.js new file mode 100644 index 000000000..bd6a2685c --- /dev/null +++ b/ooiui/static/js/models/asset_management/PlatformsStatusModel.js @@ -0,0 +1,174 @@ +/* Created by Jim Case + * + * @defaults + * id: The full object identification path. may be left out in response. + * name: The name of the document + * url: The downlaod URL of the ojbect. + * + */ + +/*{ + "platforms": [ + { + "header": { + "code": "SF", + "status": "degraded", + "title": "Shallow Profiler" + }, + "items": [ + { + "depth": null, + "display_name": "CTD", + "end": "2017-01-19T00:35:00.965Z", + "latitude": 44.52897, + "longitude": -125.38966, + "maxdepth": 200.0, + "mindepth": 5.0, + "reason": null, + "reference_designator": "RS01SBPS-SF01A-2A-CTDPFA102", + "start": "2017-01-18T00:00:00.474Z", + "status": "notTracked", + "uid": "ATAPL-66662-00002", + "waterDepth": null + }, + { + "depth": null, + "display_name": "3-Wavelength Fluorometer", + "end": "2017-01-08T23:59:58.407Z", + "latitude": 44.52897, + "longitude": -125.38966, + "maxdepth": 200.0, + "mindepth": 5.0, + "reason": null, + "reference_designator": "RS01SBPS-SF01A-3A-FLORTD101", + "start": "2017-01-08T00:00:00.759Z", + "status": "notTracked", + "uid": "ATAPL-58322-00009", + "waterDepth": null + } + ] + } + ] + }*/ + +var PlatformsHeaderModel = Backbone.Model.extend({ + defaults: { + code: "", + status: "", + title: "" + } +}); + +var PlatformsInstrumentModel = Backbone.Model.extend({ + defaults: { + depth: null, + display_name: "", + end: "", + latitude: null, + longitude: null, + maxdepth: null, + mindepth: null, + reason: "", + reference_designator: "", + start: "", + status: "", + uid: "", + waterDepth: null + } +}); +var PlatformsStatusModel = Backbone.Model.extend({ + defaults: { + header: PlatformsHeaderModel, + items: PlatformsInstrumentModel + }, + toGeoJSON: function() { + // console.log('in toGeoJSON'); + // console.log(this.attributes); + var items = _.clone(this.attributes); + var geoJSONArray = []; + _.each(this.attributes.items, function(attrs) { + // console.log('attrs'); + // console.log(attrs); + var newArray = [attrs.longitude.toFixed(5), attrs.latitude.toFixed(5)]; + + var geoJSON = { + "type": "Feature", + "properties": { + "description": ""+attrs.display_name+"", + "code": attrs.reference_designator, + "title": attrs.display_name, + "marker-symbol": (attrs.reference_designator.indexOf('GL') > -1) ? 'airfield_icon' : 'harbor_icon', + "depth": attrs.depth, + "status": attrs.status + }, + "geometry": { + "type": "Point", + "coordinates": newArray + } + + }; + geoJSONArray.push(geoJSON); + }); + + + + + return geoJSONArray; + } +}); + + +var PlatformsStatusCollection = Backbone.Collection.extend({ + model: PlatformsStatusModel, + + toGeoJSON: function() { + var geoJSONified = this.map(function(model) { + return model.toGeoJSON(); + }); + return geoJSONified; + }, + parse: function(response) { + // console.log(response); + 'use strict'; + // if the response is valid, return the results object + if (response) { return response.platforms; } else { return []; } + }, + sortByField: function(field, direction){ + var sorted = _.sortBy(this.models, function(model){ + return model.get(field); + }); + + if(direction === 'descending'){ + sorted = sorted.reverse() + } + + this.models = sorted; + }, + byGliders: function() { + var filtered = this.filter(function (platform) { + if (platform.get('reference_designator') !== "") { + return platform.get('reference_designator').indexOf('GL') > -1; + } + }); + return new PlatformCollection(filtered); + }, + byMoorings: function() { + var filtered = this.filter(function (platform) { + if (platform.get('reference_designator') !== "" && platform.get('reference_designator').length === 8) { + return platform.get('reference_designator').indexOf('GL') < 0; + } + }); + return new PlatformCollection(filtered); + }, + byArray: function(array) { + var filtered = this.filter(function (platform) { + if (platform.get('reference_designator') !== "" && (platform.get('reference_designator').length === 14 || + platform.get('reference_designator').indexOf('GL') > -1) || platform.get('reference_designator').length === 8) { + return platform.get('reference_designator').substr(0,2) === array; + } + }); + return new PlatformCollection(filtered); + }, + initialize: function () { + } +}); diff --git a/ooiui/static/js/models/asset_management/SiteStatusModel.js b/ooiui/static/js/models/asset_management/SiteStatusModel.js new file mode 100644 index 000000000..f2b553b76 --- /dev/null +++ b/ooiui/static/js/models/asset_management/SiteStatusModel.js @@ -0,0 +1,125 @@ +/* Created by Jim Case + * + * @defaults + * id: The full object identification path. may be left out in response. + * name: The name of the document + * url: The downlaod URL of the ojbect. + * + */ + +/* { + "depth": null, + "display_name": "Oregon Slope Base Shallow Profiler Mooring", + "latitude": 44.52897, + "longitude": -125.38966, + "maxdepth": 2905.0, + "mindepth": 5.0, + "reason": null, + "reference_designator": "RS01SBPS", + "status": "notTracked", + "uid": "ATAPL-68870-001-0143", + "waterDepth": null + },*/ +var SiteStatusModel = Backbone.Model.extend({ + defaults: { + depth: null, + display_name: "", + latitude: null, + longitude: null, + maxdepth: null, + mindepth: null, + reason: null, + reference_designator: "", + status: "", + uid: "", + waterDepth: null + }, + toGeoJSON: function() { + var attrs = _.clone(this.attributes), + newArray = [attrs.longitude.toFixed(5), attrs.latitude.toFixed(5)]; + + var geoJSON = { + "type": "Feature", + "properties": { + "description": ""+attrs.display_name+"", + "code": attrs.reference_designator, + "title": attrs.display_name, + "marker-symbol": (attrs.reference_designator.indexOf('GL') > -1) ? 'airfield_icon' : 'harbor_icon', + "depth": attrs.depth, + "status": attrs.status + }, + "geometry": { + "type": "Point", + "coordinates": newArray + } + + }; + return geoJSON; + } +}); + +/* Created by M@Campbell + * + * Simple collection. + * + */ + +var SiteStatusCollection = Backbone.Collection.extend({ + model: SiteStatusModel, +/* url: function(reference_designator) { + // if the constructor contains a searchId, modify the url. + var url = '/api/uframe/status/sites/'; + console.log(this); + return (reference_designator) ? url + reference_designator || "" : url; + },*/ + toGeoJSON: function() { + var geoJSONified = this.map(function(model) { + return model.toGeoJSON(); + }); + return geoJSONified; + }, + parse: function(response) { + // console.log(response); + 'use strict'; + // if the response is valid, return the results object + if (response) { return response.sites; } else { return []; } + }, + sortByField: function(field, direction){ + var sorted = _.sortBy(this.models, function(model){ + return model.get(field); + }); + + if(direction === 'descending'){ + sorted = sorted.reverse() + } + + this.models = sorted; + }, + // byGliders: function() { + // var filtered = this.filter(function (platform) { + // if (platform.get('reference_designator') !== "") { + // return platform.get('reference_designator').indexOf('GL') > -1; + // } + // }); + // return new PlatformCollection(filtered); + // }, + // byMoorings: function() { + // var filtered = this.filter(function (platform) { + // if (platform.get('reference_designator') !== "" && platform.get('reference_designator').length === 8) { + // return platform.get('reference_designator').indexOf('GL') < 0; + // } + // }); + // return new PlatformCollection(filtered); + // }, + // byArray: function(array) { + // var filtered = this.filter(function (platform) { + // if (platform.get('reference_designator') !== "" && (platform.get('reference_designator').length === 14 || + // platform.get('reference_designator').indexOf('GL') > -1) || platform.get('reference_designator').length === 8) { + // return platform.get('reference_designator').substr(0,2) === array; + // } + // }); + // return new PlatformCollection(filtered); + // }, + initialize: function () { + } +}); diff --git a/ooiui/static/js/models/common/DataAvailabilityModel.js b/ooiui/static/js/models/common/DataAvailabilityModel.js index ad3af5bb6..9b4e32444 100644 --- a/ooiui/static/js/models/common/DataAvailabilityModel.js +++ b/ooiui/static/js/models/common/DataAvailabilityModel.js @@ -18,8 +18,9 @@ var DataAvailabilityModel = Backbone.Model.extend({ urlRoot: '/api/data_availability', defaults: { - ref_des: "", - stats_data: {} + categories: {}, + data: [], + measure: "" } }); @@ -28,7 +29,7 @@ var DataAvailabilityCollection = Backbone.Collection.extend({ model: DataAvailabilityModel, parse: function(response) { if(response) { - return response; + return response.availability; } return []; } diff --git a/ooiui/static/js/models/common/LoginModel.js b/ooiui/static/js/models/common/LoginModel.js index 4465bd20f..49a39e01d 100644 --- a/ooiui/static/js/models/common/LoginModel.js +++ b/ooiui/static/js/models/common/LoginModel.js @@ -54,6 +54,9 @@ var LoginModel = Backbone.Model.extend({ return output; }, loggedIn: function() { + // console.log('loggedIn check'); + // console.log(this); + // console.log(this.get('token') != ''); if(this.get('token') != '') { return true; } diff --git a/ooiui/static/js/models/common/UserFormModel.js b/ooiui/static/js/models/common/UserFormModel.js index 2259a8b5a..b3410102a 100644 --- a/ooiui/static/js/models/common/UserFormModel.js +++ b/ooiui/static/js/models/common/UserFormModel.js @@ -4,54 +4,63 @@ * 411, 0, or 1 so exclude numbers like that. */ _.extend(Backbone.Validation.patterns, { - phoneRegex: /^\(?(?![94]11)([2-9]\d{2})\)?[-. ]?(\d{3})[-. ]?(\d{4})(?: ?[Xx] ?(\d+))?$/ + phoneRegex: /^\(?(?![94]11)([2-9]\d{2})\)?[-. ]?(\d{3})[-. ]?(\d{4})(?: ?[Xx] ?(\d+))?$/, + passwordRegex: /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/ }); _.extend(Backbone.Validation.messages, { - usPhone: 'Invalid US phone number' + usPhone: 'Invalid US phone number', + passwordRegex: 'Password must be at least 8 characters and contain at least one number and one upper case letter.' }); // Define a model with some validation rules var SignUpModel = Backbone.Model.extend({ - defaults: { - role_name: "Science User", - organization: "Other", - role_id: 3, - active: true - }, - url: "/api/user/", + defaults: { + role_name: "Science User", + organization: "Other", + role_id: 3, + active: true, + email: "" + }, + url: "/api/user/", + validatePassword: function(model, key, attr, computed) { // Check to see if user is using email, first or last name inside password + if (attr.password != undefined && attr.email != undefined && attr.password.toLowerCase().includes(attr.email.toLowerCase())) { + return "Password cannot contain email address"; + } + }, - validation: { - first_name: { - required: true - }, - last_name: { - required: true - }, - email: { - required: true, - pattern: 'email' - }, - password: { - minLength: 8 - }, - repeatPassword: { - equalTo: 'password', - msg: 'The passwords does not match' - }, - organization:{ - required: false - }, - other_organization:{ - required: true - }, - phone_primary: { - required: true - //pattern: 'phoneRegex' - }, - phone_alternate: { - required: false - //pattern: 'phoneRegex' - } + validation: { + first_name: { + required: true + }, + last_name: { + required: true + }, + email: { + required: true, + pattern: 'email' + }, + password: { + pattern: 'passwordRegex', + fn: 'validatePassword' + }, + repeatPassword: { + equalTo: 'password', + msg: 'The passwords does not match' + }, + organization:{ + required: false + }, + other_organization:{ + required: true + }, + phone_primary: { + required: true + //pattern: 'phoneRegex' + }, + phone_alternate: { + required: false + //pattern: 'phoneRegex' } + } }); diff --git a/ooiui/static/js/models/science/ArrayStatusModel.js b/ooiui/static/js/models/science/ArrayStatusModel.js index 5faf1e912..7fe2388cb 100644 --- a/ooiui/static/js/models/science/ArrayStatusModel.js +++ b/ooiui/static/js/models/science/ArrayStatusModel.js @@ -1,6 +1,6 @@ "use strict"; /* - * ooiui/static/js/models/science/ArrayModel.js + * ooiui/static/js/models/science/ArrayStatusModel.js * Model definitions for Arrays * * Dependencies @@ -12,236 +12,238 @@ * Usage */ -var GetArrayStatus = function(array_code) { - //console.log(array_code); - //console.log(platform_ref_des); - var output = "Fetching Status Failed"; - $.ajax('/api/uframe/status/arrays', { - type: 'GET', - dataType: 'json', - timeout: 5000, - async: false, - success: function (resp) { - console.log('Success getting array status'); - console.log(resp); - var result = $.grep(resp.arrays, function(e){ return e.reference_designator == array_code; }); - //console.log('result'); - //console.log(result); - if (result.length == 0) { - //console.log('No Status Returned'); - output = "No Status Returned"; - } else if (result.length == 1) { - // access the foo property using result[0].foo - //console.log('Found: ' + platform_ref_des); - //console.log(result[0].status); - output = result[0].status.legend; - } else { - // multiple items found - //console.log('Multiple Status Returned'); - output = 'Multiple Status Returned'; - } - }, - - error: function( req, status, err ) { - console.log(req); - } - }); - return output; +/*var GetArrayStatus = function(array_code) { + //console.log(array_code); + //console.log(platform_ref_des); + var output = "Fetching Status Failed"; + $.ajax('/api/uframe/status/arrays', { + type: 'GET', + dataType: 'json', + timeout: 5000, + async: false, + success: function (resp) { + // console.log('Success getting array status'); + // console.log(resp); + var result = $.grep(resp.arrays, function(e){ return e.reference_designator == array_code; }); + //console.log('result'); + //console.log(result); + if (result.length == 0) { + //console.log('No Status Returned'); + output = "No Status Returned"; + } else if (result.length == 1) { + // access the foo property using result[0].foo + //console.log('Found: ' + platform_ref_des); + //console.log(result[0].status); + output = result[0].status.legend; + } else { + // multiple items found + //console.log('Multiple Status Returned'); + output = 'Multiple Status Returned'; + } + }, + + error: function( req, status, err ) { + console.log(req); + } + }); + return output; }; var GetPlatformStatus = function(array_code, platform_ref_des) { - //console.log(array_code); - //console.log(platform_ref_des); - var output = {"status": "Fetching Status Failed", "mindepth": 0.0, "maxdepth": 0.0}; - $.ajax('/api/uframe/status/sites/' + array_code, { - type: 'GET', - dataType: 'json', - timeout: 5000, - async: false, - success: function (resp) { - //console.log('success getting platform status: ' + platform_ref_des); - //console.log(resp); - //console.log(resp.sites); - //var theStatus = $.map(resp.sites, function(val) { - // return val.reference_designator == platform_ref_des ? val.status : 'No Status Returned'; - //}); - //console.log(theStatus); - //return theStatus - var result = $.grep(resp.sites, function(e){ return e.reference_designator == platform_ref_des; }); - //console.log('result'); - //console.log(result); - if (result.length == 0) { - //console.log('No Status Returned'); - output.status = "No Status Returned"; - output.mindepth = "Unavailable"; - output.maxdepth = "Unavailable"; - } else if (result.length == 1) { - // access the foo property using result[0].foo - //console.log('Found: ' + platform_ref_des); - //console.log(result[0].status); - output.status = result[0].status; - output.mindepth = result[0].mindepth; - output.maxdepth = result[0].maxdepth; - } else { - // multiple items found - //console.log('Multiple Status Returned'); - output.status = 'Multiple Status Returned'; - output.mindepth = "Unavailable"; - output.maxdepth = "Unavailable"; - } - - }, - - error: function( req, status, err ) { - console.log(req); - } - }); - return output; + //console.log(array_code); + //console.log(platform_ref_des); + var output = {"status": "Fetching Status Failed", "mindepth": 0.0, "maxdepth": 0.0}; + $.ajax('/api/uframe/status/sites/' + array_code, { + type: 'GET', + dataType: 'json', + timeout: 5000, + async: false, + success: function (resp) { + var result = $.grep(resp.sites, function(e){ return e.reference_designator == platform_ref_des; }); + + if (result.length == 0) { + //console.log('No Status Returned'); + output.status = "No Status Returned"; + output.mindepth = "Unavailable"; + output.maxdepth = "Unavailable"; + } else if (result.length == 1) { + // access the foo property using result[0].foo + //console.log('Found: ' + platform_ref_des); + //console.log(result[0].status); + output.status = result[0].status; + output.mindepth = result[0].mindepth; + output.maxdepth = result[0].maxdepth; + } else { + // multiple items found + //console.log('Multiple Status Returned'); + output.status = 'Multiple Status Returned'; + output.mindepth = "Unavailable"; + output.maxdepth = "Unavailable"; + } + }, + + error: function( req, status, err ) { + console.log(req); + } + }); + return output; }; var GetSitesStatus = function(array_code) { - //console.log(array_code); - //console.log(platform_ref_des); - - var allSitesStatus = []; - - $.ajax('/api/uframe/status/sites/' + array_code, { - type: 'GET', - dataType: 'json', - timeout: 500, - async: false, - success: function (resp) { - - // console.log('resp'); - // console.log(resp); - var theSites = resp.sites; - _.each(theSites, function(site){ - var output = {}; - output.geometry = {}; - output.geometry.coordinates = [null,null]; - output.geometry.type = "Point"; - output.properties = {}; - // console.log('site'); - // console.log(site); - output.geometry.coordinates = [site.longitude, site.latitude]; - output.properties['code'] = site.reference_designator; - output.properties['depth'] = site.depth; - output.properties['waterDepth'] = site.waterDepth; - output.properties['mindepth'] = site.mindepth; - output.properties['maxdepth'] = site.maxdepth; - output.properties['description'] = site.display_name; - output.properties['marker-symbol'] = "harbor_icon"; - output.properties['title'] = site.display_name; - output.properties['status'] = site.status; - - // console.log('output before push'); - // console.log(output); - - allSitesStatus.push(output); - // console.log('allSitesStatus'); - // console.log(allSitesStatus); - }); - - }, - - error: function( req, status, err ) { - console.log(req); - } - }); - return allSitesStatus; -}; + //console.log(array_code); + //console.log(platform_ref_des); + + var allSitesStatus = []; + + $.ajax('/api/uframe/status/sites/' + array_code, { + type: 'GET', + dataType: 'json', + timeout: 500, + async: false, + success: function (resp) { + + // console.log('resp'); + // console.log(resp); + var theSites = resp.sites; + _.each(theSites, function(site){ + var output = {}; + output.geometry = {}; + output.geometry.coordinates = [null,null]; + output.geometry.type = "Point"; + output.properties = {}; + // console.log('site'); + // console.log(site); + output.geometry.coordinates = [site.longitude, site.latitude]; + output.properties['code'] = site.reference_designator; + output.properties['depth'] = site.depth; + output.properties['waterDepth'] = site.waterDepth; + output.properties['mindepth'] = site.mindepth; + output.properties['maxdepth'] = site.maxdepth; + output.properties['description'] = site.display_name; + output.properties['marker-symbol'] = "harbor_icon"; + output.properties['title'] = site.display_name; + output.properties['status'] = site.status; + + output.type = "Feature"; + + // console.log('output before push'); + // console.log(output); + + allSitesStatus.push(output); + // console.log('allSitesStatus'); + // console.log(allSitesStatus); + }); -var ArrayStatusModel = OOI.RelationalModel.extend({ - urlRoot: '/api/array', - defaults: { - id: null, - array_code: null, - array_name: null, - display_name: null, - geo_location: [], - description: null - }, - parse: function(data) { - // we have the cabled array at the same location as the coastal endurance, - // the cabled array is a bit farther off set from the endurance. - var attrs = _.clone(data), - cabledArray = [[[45.8305, -128.7533]]]; - - if (attrs.array_code.indexOf('RS') > -1) { - attrs.geo_location.coordinates = cabledArray; - } - return data; }, - // geoJSON - toGeoJSON: function() { - var attrs = _.clone(this.attributes), - coorArray = attrs.geo_location.coordinates, - newArray = [coorArray[0][0][1], coorArray[0][0][0]], - polyArray = []; - - - - // mapbox GL expects lng, lat - if (coorArray[0][0].length > 0) { - _.each(coorArray[0], function(item) { - polyArray.push([item[1], item[0]]); - }); - } - - if (attrs.array_code.indexOf('RS') > -1) { - newArray = [-128.7533, 45.8305]; - } - - if (!attrs.platforms) { - attrs.platforms = []; - } else { - _.each(attrs.platforms, function(platform) { - platform.properties.title = platform.properties.title.replace(attrs.display_name, ''); - var statusReturn = GetPlatformStatus(attrs.array_code, platform.properties.code); - //console.log(statusReturn); - platform.properties.status = statusReturn.status; - platform.properties.mindepth = statusReturn.mindepth; - platform.properties.maxdepth = statusReturn.maxdepth; - }); - } - - //console.log(attrs.platforms); - - var geoJSON = { - "type": "Feature", - "properties": { - "description": ""+attrs.array_name+"", - "code": attrs.array_code, - "title": attrs.array_name, - "marker-symbol": 'dot', - "platforms": attrs.platforms, - "status": GetArrayStatus(attrs.array_code) - }, - "geometry": { - "type": "Point", - "coordinates": newArray - } - - }; - return geoJSON; + + error: function( req, status, err ) { + console.log(req); } + }); + return allSitesStatus; +};*/ + + +/* { + "display_name": "Global Southern Ocean", + "latitude": -54.0814, + "longitude": -89.6652, + "reason": null, + "reference_designator": "GS", + "status": { + "count": 0, + "legend": { + "degraded": 0, + "failed": 0, + "notTracked": 0, + "operational": 0, + "removedFromService": 0 + } + } + },*/ +var ArrayStatusModel = OOI.RelationalModel.extend({ + urlRoot: '/api/uframe/status/arrays', + defaults: { + display_name: "", + latitude: null, + longitude: null, + reason: "", + reference_designator: "", + status: {}, + count: null, + legend: {}, + platforms: [] + }, + parse: function(data) { + // we have the cabled array at the same location as the coastal endurance, + // the cabled array is a bit farther off set from the endurance. + var attrs = _.clone(data), + cabledArrayLat = 45.8305, + cabledArrayLon = -128.7533; + + if (attrs.reference_designator.indexOf('RS') > -1) { + attrs.latitude = cabledArrayLat; + attrs.longtiude = cabledArrayLon; + } + + attrs.code = attrs.reference_designator; + return data; + }, + // geoJSON + toGeoJSON: function() { + var attrs = _.clone(this.attributes), + newArray = [attrs.longitude, attrs.latitude]; + + if (attrs.reference_designator.indexOf('RS') > -1) { + newArray = [-128.7533, 45.8305]; + } + + var geoJSON = { + "type": "Feature", + "properties": { + "description": ""+attrs.display_name+"", + "code": attrs.reference_designator, + "title": attrs.display_name, + "marker-symbol": 'dot', + "platforms": attrs.platforms + //"platforms": GetSitesStatus(attrs.reference_designator) + }, + "geometry": { + "type": "Point", + "coordinates": newArray + } + + }; + return geoJSON; + } }); var ArrayStatusCollection = Backbone.Collection.extend({ - url: '/api/array', - model: ArrayStatusModel, - parse: function(response) { - if (response) { - return response.arrays; - } - return []; - }, - toGeoJSON: function() { - var geoJSONified = this.map(function(model) { - return model.toGeoJSON(); - }); - return geoJSONified; + url: '/api/uframe/status/arrays', + model: ArrayStatusModel, + parse: function(response) { + if (response) { + return response.arrays; + } + return []; + }, + toGeoJSON: function() { + var geoJSONified = this.map(function(model) { + return model.toGeoJSON(); + }); + return geoJSONified; + }, + sortByField: function(field, direction){ + var sorted = _.sortBy(this.models, function(model){ + return model.get(field); + }); + + if(direction === 'descending'){ + sorted = sorted.reverse() } + + this.models = sorted; + } }); diff --git a/ooiui/static/js/models/science/SeriesModel.js b/ooiui/static/js/models/science/SeriesModel.js index c546d9329..e28a865d7 100644 --- a/ooiui/static/js/models/science/SeriesModel.js +++ b/ooiui/static/js/models/science/SeriesModel.js @@ -1,4 +1,4 @@ - "use strict"; +"use strict"; /* * ooiui/static/js/models/science/SeriesModel.js * Model definition for a series that fits into the Highcharts time series charts @@ -6,8 +6,8 @@ * - d3 */ /* -used to manage data in high charts -*/ + used to manage data in high charts + */ var SeriesModel = Backbone.Model.extend({ urlRoot: '#', formatter: d3.format(".2f"), @@ -34,8 +34,8 @@ var SeriesCollection = Backbone.Collection.extend({ }); /* - Data structures that come from uframe -*/ + Data structures that come from uframe + */ var DataSeriesModel = Backbone.Model.extend({ urlRoot: '#', initialize: function(){ @@ -117,23 +117,72 @@ var DataSeriesCollection = Backbone.Collection.extend({ }); var InterpolatedDataSeriesCollection = Backbone.Collection.extend({ - instr1:"telemetered_ctdgv_m_glider_instrument", - instr2:"telemetered_flort_m_glider_instrument", - ref_des1:"CP05MOAS-GL340-03-CTDGVM000", - ref_des2:"CP05MOAS-GL340-02-FLORTM000", - startdate:"2015-05-07T02:49:22.745Z", - enddate:"2015-06-28T04:00:41.282Z", - var1:"sci_water_pressure", - var2:"sci_flbbcd_chlor_units", - xaxislabel: "", - yaxislabel: "", - subtitle: "", + /* instr1:"telemetered_ctdgv_m_glider_instrument", + instr2:"telemetered_flort_m_glider_instrument", + ref_des1:"CP05MOAS-GL340-03-CTDGVM000", + ref_des2:"CP05MOAS-GL340-02-FLORTM000", + startdate:"2013-05-07T02:49:22.745Z", + enddate:"2016-06-28T04:00:41.282Z", + var1:"sci_water_pressure", + var2:"sci_flbbcd_chlor_units", + xaxislabel: "", + yaxislabel: "", + subtitle: "",*/ + +/* defaults: { + instr1:"", + instr2:"", + ref_des1:"", + ref_des2:"", + startdate:"", + enddate:"", + var1:"", + var2:"", + displayName:"", + stream_display_name:"" + },*/ + + initialize: function(models,options) { + console.log('initialize options'); + console.log(options); + if (options && options.instr1){ + this.instr1 = options.instr1; + } + if (options && options.instr2){ + this.instr2 = options.instr2; + } + if (options && options.ref_des1){ + this.ref_des1 = options.ref_des1; + } + if (options && options.ref_des2){ + this.ref_des2 = options.ref_des2; + } + if (options && options.startdate){ + this.startdate = options.startdate; + } + if (options && options.enddate){ + this.enddate = options.enddate; + } + if (options && options.var1){ + this.var1 = options.var1; + } + if (options && options.var2){ + this.var2 = options.var2; + } + if (options && options.displayName){ + this.displayName = options.displayName; + } + if (options && options.stream_display_name){ + this.stream_display_name = options.stream_display_name; + } + }, + url: function() { - var durl = ('/api/get_multistream?instrument1='+ this.instr1 + '&instrument2=' + this.instr2 + - "&stream1=" + this.ref_des1 + "&stream2=" + this.ref_des2 + "&var1=" + this.var1 + - "&var2=" + this.var2 + "&startdate=" + this.startdate + "&enddate=" + this.enddate); - //console.log(durl); + var durl = ('/api/get_multistream?instr1='+ this.instr1 + '&instr2=' + this.instr2 + + "&ref_des1=" + this.ref_des1 + "&ref_des2=" + this.ref_des2 + "&var1=" + this.var1 + + "&var2=" + this.var2 + "&startdate=" + this.startdate + "&enddate=" + this.enddate); + console.log(durl); return durl; }, //eg url: '/api/get_data?instrument=CE05MOAS-GL382-05-CTDGVM000&stream=telemetered_ctdgv_m_glider_instrument&xvars=time,time&yvars=sci_water_pressure,sci_water_cond&startdate=2015-01-21T22:01:48.103Z&enddate=2015-01-22T22:01:48.103Z', @@ -159,6 +208,8 @@ var InterpolatedDataSeriesCollection = Backbone.Collection.extend({ return this.plottype; }, parse: function(response, options) { + console.log('response'); + console.log(response); this.units = response.units; this.title = response.title; this.subtitle = response.subtitle; diff --git a/ooiui/static/js/models/science/StreamModel.js b/ooiui/static/js/models/science/StreamModel.js index 1391408b2..174b6b99c 100644 --- a/ooiui/static/js/models/science/StreamModel.js +++ b/ooiui/static/js/models/science/StreamModel.js @@ -39,7 +39,11 @@ var StreamModel = Backbone.Model.extend({ longitude: "", depth: "", freshness: "", - reference_designator_first14chars:"" + reference_designator_first14chars:"", + iris_enabled: false, + iris_link: "", + rds_enabled: false, + rds_link: "" }, getURL: function(type) { diff --git a/ooiui/static/js/models/science/StreamStatusModel.js b/ooiui/static/js/models/science/StreamStatusModel.js index 5a284ce04..ec8c76af4 100644 --- a/ooiui/static/js/models/science/StreamStatusModel.js +++ b/ooiui/static/js/models/science/StreamStatusModel.js @@ -15,7 +15,7 @@ var GetInstrumentStatus = function(ref_des) { //console.log(array_code); //console.log(platform_ref_des); - var output = {"status": "Fetching Status Failed", "depth": "Unknown"}; + var output = {"status": "fetchingStatusFailed", "depth": "Unknown"}; $.ajax('/api/uframe/status/instrument/' + ref_des, { type: 'GET', dataType: 'json', @@ -34,7 +34,7 @@ var GetInstrumentStatus = function(ref_des) { //console.log(result); if (result.length == 0) { //console.log('No Status Returned'); - output = {"status": "No Status Returned", "depth": "Unknown"}; + output = {"status": "noStatusReturned", "depth": "Unknown"}; } else if (result.length == 1) { // access the foo property using result[0].foo //console.log('Found: ' + platform_ref_des); diff --git a/ooiui/static/js/partials/DropdownUserLoggedOut.html b/ooiui/static/js/partials/DropdownUserLoggedOut.html index 72c493efc..a20eed4c7 100644 --- a/ooiui/static/js/partials/DropdownUserLoggedOut.html +++ b/ooiui/static/js/partials/DropdownUserLoggedOut.html @@ -5,7 +5,7 @@