Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Adam Kučera
semanticBMS
Commits
54917e8f
Commit
54917e8f
authored
Jul 12, 2016
by
akucera
Browse files
trend working including UI
added link to the BMS added link to the BMS charts
parent
2731375d
Changes
20
Hide whitespace changes
Inline
Side-by-side
SemanticBMSClient/edit.html
View file @
54917e8f
...
...
@@ -50,45 +50,17 @@
var
p
=
new
SBMSPage
({
addresses
:
[],
fieldsType
:
"
field
.
insert.dataPoint
"
,
fieldsType
:
"
field
s/
insert.dataPoint
"
,
endpoint
:
"
datapoints
"
,
addressType
:
"
dataPoint
"
,
debug
:
true
,
//
debug : true,
init
:
function
()
{
if
(
window
.
location
.
hash
!=
null
&&
window
.
location
.
hash
!=
""
&&
window
.
location
.
hash
!=
"
#
"
)
{
var
panel
=
window
.
location
.
hash
.
substring
(
1
);
p
.
loadPanelFromFile
(
"
#nav
"
+
panel
);
}
else
{
p
.
loadPanelFromFile
(
"
li.opNav.active
"
);
}
/*
$(".opDiv").hide();
// loading divs
$(".opDiv").each(function() {
p.semaphore++;
$(this).load($(this).attr("data-incl-file"), function() { if(--p.semaphore == 0) { p.delayedInit(); } });
});
$("#" + $("li.opNav.active").attr("data-show-div")).show();
*/
p
.
initPanels
();
$
(
"
.opNav
"
).
click
(
function
()
{
p
.
loadPanelFromFile
(
$
(
this
));
}
);
//$("#kompasFrame").attr("src", p.mapURL);
},
loadPanelFromFile
:
function
(
srcSelector
)
{
var
src
=
$
(
srcSelector
);
p
.
switchTab
(
"
opNav
"
,
src
);
$
(
"
#content
"
).
load
(
src
.
attr
(
"
data-incl-file
"
),
function
()
{
p
[
src
.
attr
(
"
data-init-func
"
)]();
});
},
initInsertSingle
:
function
()
{
$
(
"
#selectorTree
"
).
hide
();
$
(
"
.selectorNav
"
).
click
(
...
...
@@ -110,7 +82,7 @@
}
});
p
.
loadList
(
"
field
.
insert.dataPoint
"
,
p
.
loadList
(
"
field
s/
insert.dataPoint
"
,
[
p
.
createParams
],
[
"
#params
"
,
...
...
@@ -138,21 +110,21 @@
},
initInsertTrends
:
function
()
{
p
.
fieldsType
=
"
field
.
insert.trend
"
;
p
.
fieldsType
=
"
field
s/
insert.trend
"
;
p
.
endpoint
=
"
trends
"
;
p
.
addressType
=
"
trend
"
;
p
.
initBatchCommon
();
},
initInsertPrograms
:
function
()
{
p
.
fieldsType
=
"
field
.
insert.usage
"
;
p
.
fieldsType
=
"
field
s/
insert.usage
"
;
p
.
endpoint
=
"
relations
"
;
p
.
addressType
=
"
algorithm
"
;
p
.
initBatchCommon
();
},
initInsertInfluence
:
function
()
{
p
.
fieldsType
=
"
field
.
insert.influence
"
;
p
.
fieldsType
=
"
field
s/
insert.influence
"
;
p
.
endpoint
=
"
relations
"
;
p
.
addressType
=
"
address
"
;
p
.
initBatchCommon
();
...
...
@@ -282,7 +254,9 @@
}
},
"
logBatch
"
,
"
batchOverallStatus
"
);
}
else
{
completeAction
();
p
.
toggleButtonFinishing
(
"
batchOverallStatus
"
);
// query to reopen the model
$
.
ajax
({
type
:
"
get
"
,
url
:
SBMSPage
.
prototype
.
sbmsURL
+
"
datapoints/
"
+
data
[
0
].
bmsId
}).
done
(
completeAction
);
}
},
...
...
@@ -305,6 +279,7 @@
var
query
=
p
.
sbmsURL
+
p
.
endpoint
;
var
d
=
{};
d
[
p
.
addressType
]
=
address
;
/*
if(p.debug) {
ba(overallStatusId);
$("#" + logId).append("\nDEBUG Mode - data are not sent. Data:\n" +
...
...
@@ -313,6 +288,7 @@
ca(overallStatusId, "success");
return;
}
*/
$
.
ajax
({
type
:
'
POST
'
,
cache
:
false
,
...
...
@@ -412,7 +388,7 @@
}
else
if
(
iA
<
assertions
.
length
)
{
p
.
removeAssertions
(
assertions
,
++
iA
,
ids
,
0
);
}
else
{
$
(
"
#
removeOverallStatus
"
)
.
html
(
$
.
t
(
"
Finishing...
"
))
;
p
.
toggleButtonFinishing
(
"
removeOverallStatus
"
);
// query to reopen the model
$
.
ajax
({
type
:
"
get
"
,
url
:
SBMSPage
.
prototype
.
sbmsURL
+
"
datapoints/
"
+
ids
[
0
]
}).
done
(
function
()
{
p
.
toggleButtonSuccess
(
"
removeOverallStatus
"
);
...
...
SemanticBMSClient/inclMenu.html
View file @
54917e8f
...
...
@@ -20,7 +20,7 @@
<li
data-page=
"sparql"
><a
href=
"sparql.html"
data-i18n=
"sparql"
>
SPARQL
</a></li>
</ul>
<form
id=
"login"
class=
"navbar-form navbar-right"
action=
"
insert.html
"
method=
"GET"
>
action=
"
#
"
method=
"GET"
>
<div
class=
"form-group"
>
<label
for=
"user"
class=
"sr-only"
data-i18n=
"user"
>
User
</label>
<input
type=
"text"
name=
"username"
id=
"user"
class=
"form-control"
...
...
SemanticBMSClient/inclQueryDP.html
0 → 100644
View file @
54917e8f
<div
class=
"row equal"
>
<div
class=
"col-lg-6 col-md-4"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
><h3
class=
"panel-title"
data-i18n=
"Filters"
>
Filters
</h3></div>
<div
class=
"panel-body"
>
<p
data-i18n=
"query.filters.text"
></p>
<div
class=
"row"
>
<div
id=
"params"
class=
"form-horizontal form-group"
></div>
</div>
</div>
</div>
</div>
<div
class=
"col-lg-3 col-md-3"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
><h3
class=
"panel-title"
data-i18n=
"Attributes"
>
Attributes
</h3></div>
<div
class=
"panel-body"
>
<p
data-i18n=
"query.attributes.text"
></p>
<div
class=
"btn-group btn-group-xs"
role=
"group"
>
<button
type=
"button"
id=
"selectAll"
class=
"btn btn-default"
data-i18n=
"Select All"
>
Select All
</button>
<button
type=
"button"
id=
"deselectAll"
class=
"btn btn-default"
data-i18n=
"Deselect All"
>
Deselect All
</button>
</div>
<div
class=
"row"
>
<div
id=
"fields"
class=
"form-horizontal form-group"
></div>
</div>
</div>
</div>
</div>
<div
class=
"col-lg-3 col-md-3"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
><h3
class=
"panel-title"
data-i18n=
"Grouping"
>
Grouping
</h3></div>
<div
class=
"panel-body"
>
<p
data-i18n=
"query.groups.text"
></p>
<div
class=
"row"
>
<div
id=
"groups"
class=
"form-horizontal form-group"
></div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
SemanticBMSClient/inclQueryRelations.html
0 → 100644
View file @
54917e8f
SemanticBMSClient/index.html
View file @
54917e8f
...
...
@@ -45,7 +45,7 @@
init
:
function
()
{
p
.
loadList
(
"
field
.data
"
,
function
(
headers
,
params
)
{
p
.
loadList
(
"
field
s/data.dataPoint
"
,
function
(
headers
,
params
)
{
dpId
=
p
.
getQueryVariable
(
"
bmsId
"
);
if
(
!
dpId
)
{
...
...
SemanticBMSClient/js/i18n.js
View file @
54917e8f
...
...
@@ -15,33 +15,50 @@ var translation = {
"
query.filters.text
"
:
"
Results have to meet the following criteria:
"
,
"
query.attributes.text
"
:
"
Resulting dataset will contain datapoints described by the following attributes:
"
,
"
query.groups.text
"
:
"
Result will be divided into groups according to the following criteria:
"
,
'
bmsId
'
:
'
bmsId
'
,
'
type
'
:
'
type
'
,
'
source.bimId
'
:
'
s
ource
.bimId
'
,
'
source.type
'
:
'
s
ource
.
type
'
,
'
source.location
'
:
'
s
ource
.
location
'
,
'
scope.bimId
'
:
'
s
cope
.bimId
'
,
'
scope.type
'
:
'
s
cope
.
type
'
,
'
scope.location
'
:
'
s
cope
.
location
'
,
'
sensing.type
'
:
'
s
ensing
.
type
'
,
'
sensing.window
'
:
'
s
ensing
.
window
'
,
'
property.domain
'
:
'
property
.
domain
'
,
'
property.quality
'
:
'
property
.
quality
'
,
'
influenced.scope.bimId
'
:
'
i
nfluenced
.scope.bimId
'
,
'
influenced.property.quality
'
:
'
i
nfluenced
.property.q
uality
'
,
'
influenced.property.domain
'
:
'
i
nfluenced
.property.d
omain
'
,
'
bmsId
'
:
'
BMS address
'
,
'
type
'
:
'
Object
type
'
,
'
source.bimId
'
:
'
S
ource
'
,
'
source.type
'
:
'
S
ource
type
'
,
'
source.location
'
:
'
S
ource
location
'
,
'
scope.bimId
'
:
'
S
cope
'
,
'
scope.type
'
:
'
S
cope
type
'
,
'
scope.location
'
:
'
S
cope
location
'
,
'
sensing.type
'
:
'
S
ensing
type
'
,
'
sensing.window
'
:
'
S
ensing
window
'
,
'
property.domain
'
:
'
O.
property
domain
'
,
'
property.quality
'
:
'
O.
property
quality
'
,
'
influenced.scope.bimId
'
:
'
I
nfluenced
– Scope
'
,
'
influenced.property.quality
'
:
'
I
nfluenced
– Q
uality
'
,
'
influenced.property.domain
'
:
'
I
nfluenced
– D
omain
'
,
'
publisher.bimId
'
:
'
Publisher device
'
,
'
noGrouping
'
:
'
noGrouping
'
,
'
scope.room
'
:
'
scope.room
'
,
'
scope.floor
'
:
'
scope.floor
'
,
'
scope.building
'
:
'
scope.building
'
,
'
scope.site
'
:
'
scope.site
'
,
'
source.room
'
:
'
source.room
'
,
'
source.floor
'
:
'
source.floor
'
,
'
source.building
'
:
'
source.building
'
,
'
source.site
'
:
'
source.site
'
,
'
datapoint.type
'
:
'
datapoint.type
'
,
'
UserDefined
'
:
'
User defined
'
,
'
dataPoint.bmsId
'
:
'
Sensor BMS address
'
,
'
dataPoint.type
'
:
'
Sensor Object type
'
,
'
dataPoint.source.bimId
'
:
'
Source
'
,
'
dataPoint.source.type
'
:
'
Source type
'
,
'
dataPoint.source.location
'
:
'
Source location
'
,
'
dataPoint.scope.bimId
'
:
'
Scope
'
,
'
dataPoint.scope.type
'
:
'
Scope type
'
,
'
dataPoint.scope.location
'
:
'
Scope location
'
,
'
dataPoint.sensing.type
'
:
'
Sensing type
'
,
'
dataPoint.sensing.window
'
:
'
Sensing window
'
,
'
dataPoint.property.domain
'
:
'
O. property domain
'
,
'
dataPoint.property.quality
'
:
'
O. property quality
'
,
'
dataPoint.influenced.scope.bimId
'
:
'
Influenced – Scope
'
,
'
dataPoint.influenced.property.quality
'
:
'
Influenced – Quality
'
,
'
dataPoint.influenced.property.domain
'
:
'
Influenced – Domain
'
,
'
dataPoint.publisher.bimId
'
:
'
Publisher device
'
,
'
noGrouping
'
:
'
No grouping
'
,
'
scope.room
'
:
'
Scope – Room
'
,
'
scope.floor
'
:
'
Scope – Floor
'
,
'
scope.building
'
:
'
Scope – Building
'
,
'
scope.site
'
:
'
Scope – Site
'
,
'
source.room
'
:
'
Source – Room
'
,
'
source.floor
'
:
'
Source – Floor
'
,
'
source.building
'
:
'
Source – Building
'
,
'
source.site
'
:
'
Source – Site
'
,
'
datapoint.type
'
:
'
Data Point Type
'
,
'
UserDefined
'
:
'
User defined
'
,
'
group
'
:
'
Group
'
}
},
...
...
@@ -85,6 +102,30 @@ var translation = {
"
influenced.property.quality
"
:
"
Ovlivňovaná veličina
"
,
"
influenced.property.domain
"
:
"
Ovlivňované Médium/Prostředí
"
,
'
publisher.bimId
'
:
'
Publikující zařízení
'
,
"
dataPoint.bmsId
"
:
"
Adresa senzoru v BMS
"
,
"
dataPoint.type
"
:
"
Typ objektu (senzor)
"
,
"
dataPoint.source.bimId
"
:
"
Zdrojové zařízení
"
,
"
dataPoint.source.type
"
:
"
Typ zdroj. zařízení
"
,
"
dataPoint.source.location
"
:
"
Poloha zdroje
"
,
"
dataPoint.source.room
"
:
"
Místnost (zdroj)
"
,
"
dataPoint.source.floor
"
:
"
Podlaží (zdroj)
"
,
"
dataPoint.source.building
"
:
"
Budova (zdroj)
"
,
"
dataPoint.source.site
"
:
"
Areál (zdroj)
"
,
"
dataPoint.scope.bimId
"
:
"
Předmět zájmu (PZ)
"
,
"
dataPoint.scope.type
"
:
"
Typ PZ
"
,
"
dataPoint.scope.location
"
:
"
Poloha PZ
"
,
"
dataPoint.scope.room
"
:
"
Místost (PZ)
"
,
"
dataPoint.scope.floor
"
:
"
Podlaží (PZ)
"
,
"
dataPoint.scope.building
"
:
"
Budova (PZ)
"
,
"
dataPoint.scope.site
"
:
"
Areál (PZ)
"
,
"
dataPoint.sensing.type
"
:
"
Typ měření
"
,
"
dataPoint.sensing.window
"
:
"
Období měření
"
,
"
dataPoint.property.domain
"
:
"
Médium/Prostředí
"
,
"
dataPoint.property.quality
"
:
"
Veličina
"
,
"
dataPoint.influenced.scope.bimId
"
:
"
Ovlivňovaný PZ
"
,
"
dataPoint.influenced.property.quality
"
:
"
Ovlivňovaná veličina
"
,
"
dataPoint.influenced.property.domain
"
:
"
Ovlivňované Médium/Prostředí
"
,
'
dataPoint.publisher.bimId
'
:
'
Publikující zařízení
'
,
'
temperature
'
:
'
Teplota
'
,
'
Input
'
:
'
Vstup
'
,
'
Output
'
:
'
Výstup
'
,
...
...
@@ -108,7 +149,11 @@ var translation = {
'
Water
'
:
'
Voda
'
,
'
TemperatureSensor
'
:
'
Teplotní čidlo
'
,
'
Room
'
:
'
Místnost
'
,
'
StatelessDirectSensing
'
:
'
Přímé měření
'
'
StatelessDirectSensing
'
:
'
Přímé měření
'
,
'
group
'
:
'
Skupina
'
,
'
Data Points
'
:
'
Datové body
'
,
'
Trends
'
:
'
Historická data
'
,
'
Relations
'
:
'
Vztahy
'
}
},
...
...
SemanticBMSClient/js/scripts.js
View file @
54917e8f
...
...
@@ -21,6 +21,7 @@ function SBMSPage(custom) {
if
(
SBMSPage
[
"
noAuth
"
])
{
$
(
"
#login
"
).
hide
();
}
SBMSPage
.
prototype
.
i18nInit
();
SBMSPage
.
prototype
.
savePassInit
();
initFunc
();
...
...
@@ -36,7 +37,13 @@ function SBMSPage(custom) {
SBMSPage
.
prototype
.
trees
=
{};
SBMSPage
.
prototype
.
mapURL
=
"
https://kompas.muni.cz/auth/
"
;
SBMSPage
.
prototype
.
sbmsURL
=
"
/sbms/v1/
"
;
SBMSPage
.
prototype
.
bmsChartsURL
=
"
https://bms.muni.cz/Charts/
"
;
SBMSPage
.
prototype
.
trendDBs
=
[
"
93
"
,
"
94
"
];
SBMSPage
.
prototype
.
bmsURL
=
"
https://bms.muni.cz/deltaweb/newlogin/?Referer=/deltaweb/navigator/index.asp&FrameSrc=%2Fdeltaweb%2Fnavigator%2FObject%5F{0}%2Easp%3FObjRef%3DBAC%2E{1}
"
;
// "https://bms.muni.cz/deltaweb/newlogin/?Referer=/deltaweb/navigator/index.asp&FrameSrc=%2Fdeltaweb%2Fnavigator%2FObject%5F{0}%2Easp%3FObjRef%3DBAC%2E{1}";
// http://bms.muni.cz/deltaweb/login.asp?Referer=%2Fdeltaweb%2Fnavigator%2FObject%5FAV%2Easp%3FObjRef%3DBAC%2E11304%2EAV202 &logoffReason=1
// https://bms.muni.cz/deltaweb/newlogin/?Referer=/deltaweb/navigator/index.asp&FrameSrc=%2Fdeltaweb%2Fnavigator%2FObject%5FAV%2Easp%3FObjRef%3DBAC%2E11304%2EAV202 &logoffReason=1
// https://bms.muni.cz/deltaweb/shibblogin/SSOLogin.aspx?Referer=/deltaweb/navigator/index.asp&FrameSrc=%2Fdeltaweb%2Fnavigator%2FObject%5FAV%2Easp%3FObjRef%3DBAC%2E11304%2EAV202%20&logoffReason=1
SBMSPage
.
prototype
.
setAuth
=
function
(
xhr
)
{
xhr
.
setRequestHeader
(
'
authorization
'
,
"
Basic
"
+
Base64
.
encode
(
$
(
"
#user
"
).
val
()
+
"
:
"
+
$
(
"
#pass
"
).
val
()));
};
...
...
@@ -66,13 +73,17 @@ function SBMSPage(custom) {
//$("#status").html("Completed with " + status);
$
(
"
.sendButton
"
).
removeAttr
(
"
disabled
"
);
};
SBMSPage
.
prototype
.
toggleButtonFinishing
=
function
(
id
)
{
$
(
"
#
"
+
id
).
html
(
$
.
t
(
"
Finishing...
"
));
};
SBMSPage
.
prototype
.
loadList
=
function
(
type
,
func
,
params
)
{
this
.
loadList
(
type
,
func
,
params
,
null
);
};
SBMSPage
.
prototype
.
loadList
=
function
(
type
,
func
,
params
,
member
)
{
var
query
=
this
.
sbmsURL
+
"
types/
"
+
type
;
var
query
=
this
.
sbmsURL
+
type
;
if
(
member
!=
null
&&
member
!=
""
)
{
query
+=
"
/
"
+
member
;
}
...
...
@@ -133,7 +144,7 @@ function SBMSPage(custom) {
$
.
ajax
({
type
:
'
GET
'
,
cache
:
true
,
url
:
SBMSPage
.
prototype
.
sbmsURL
+
"
types/
field
.
source
"
url
:
SBMSPage
.
prototype
.
sbmsURL
+
"
field
s/
source
"
}).
done
(
function
(
fieldsList
)
{
// saving to cache
SBMSPage
.
prototype
.
fieldCategories
=
fieldsList
;
...
...
@@ -196,7 +207,7 @@ function SBMSPage(custom) {
// filling lists
$
(
"
select
"
,
"
#params
"
).
each
(
function
(
key
,
selectEl
)
{
SBMSPage
.
prototype
.
loadList
(
SBMSPage
.
prototype
.
getField
(
selectEl
.
id
)
/*.replace("influenced.", "")*/
,
function
(
data
,
params
)
{
SBMSPage
.
prototype
.
loadList
(
"
types/
"
+
SBMSPage
.
prototype
.
getField
(
selectEl
.
id
)
/*.replace("influenced.", "")*/
,
function
(
data
,
params
)
{
var
select
=
$
(
"
#
"
+
params
[
0
]);
select
.
selectpicker
();
var
html
=
'
<option value=""></option>
'
;
...
...
@@ -230,7 +241,7 @@ function SBMSPage(custom) {
var
sid
=
"
#
"
+
id
;
var
field
=
SBMSPage
.
prototype
.
getField
(
id
);
// load the first level
SBMSPage
.
prototype
.
loadList
(
field
,
function
(
data
,
params
)
{
SBMSPage
.
prototype
.
loadList
(
"
types/
"
+
field
,
function
(
data
,
params
)
{
var
treeName
=
params
[
0
];
SBMSPage
.
prototype
.
trees
[
treeName
]
=
{
type
:
field
,
index
:
"
0
"
,
selectId
:
sid
};
SBMSPage
.
prototype
.
populateNode
(
SBMSPage
.
prototype
.
trees
[
treeName
],
data
);
...
...
@@ -313,7 +324,7 @@ function SBMSPage(custom) {
$
.
ajax
({
type
:
'
GET
'
,
cache
:
true
,
url
:
SBMSPage
.
prototype
.
sbmsURL
+
"
types/
field
.
source
"
url
:
SBMSPage
.
prototype
.
sbmsURL
+
"
field
s/
source
"
}).
done
(
function
(
fieldsList
)
{
this
.
fieldCategories
=
fieldsList
;
SBMSPage
.
prototype
.
enrichPVC
(
parent
,
fieldsList
,
callback
);
...
...
@@ -331,6 +342,18 @@ function SBMSPage(custom) {
if
(
fl
[
field
]
==
"
bim
"
)
{
$
(
this
).
append
(
'
<button type="button" class="btn btn-default btn-xs mapButton" data-field="
'
+
encodeURIComponent
(
field
)
+
'
" data-field-value="
'
+
encodeURIComponent
(
propVal
)
+
'
"><span class="glyphicon glyphicon-map-marker" aria-hidden="true"></span></button>
'
);
}
if
(
fl
[
field
]
==
"
bms
"
)
{
$
(
this
).
append
(
'
<button type="button" class="btn btn-default btn-xs bmsButton" data-field="
'
+
encodeURIComponent
(
field
)
+
'
" data-field-value="
'
+
encodeURIComponent
(
propVal
)
+
'
"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>
'
);
if
(
propVal
.
indexOf
(
"
.TL
"
)
>
-
1
)
{
for
(
var
i
=
0
;
i
<
SBMSPage
.
prototype
.
trendDBs
.
length
;
i
++
)
{
if
(
propVal
.
startsWith
(
SBMSPage
.
prototype
.
trendDBs
[
i
]))
{
$
(
this
).
append
(
'
<button type="button" class="btn btn-default btn-xs trendButton" data-field="
'
+
encodeURIComponent
(
field
)
+
'
" data-field-value="
'
+
encodeURIComponent
(
propVal
)
+
'
"><span class="glyphicon glyphicon-stats" aria-hidden="true"></span></button>
'
);
break
;
}
}
}
}
}
});
callback
();
...
...
@@ -365,6 +388,22 @@ SBMSPage.prototype.getQueryVariable = function(variable)
return
(
false
);
};
SBMSPage
.
prototype
.
initPanels
=
function
()
{
if
(
window
.
location
.
hash
!=
null
&&
window
.
location
.
hash
!=
""
&&
window
.
location
.
hash
!=
"
#
"
)
{
var
panel
=
window
.
location
.
hash
.
substring
(
1
);
p
.
loadPanelFromFile
(
"
#nav
"
+
panel
);
}
else
{
p
.
loadPanelFromFile
(
"
li.opNav.active
"
);
}
$
(
"
.opNav
"
).
click
(
function
()
{
p
.
loadPanelFromFile
(
$
(
this
));
}
);
};
SBMSPage
.
prototype
.
switchPanel
=
function
(
navClass
,
divClass
,
activeNav
,
activeDiv
)
{
$
(
"
.
"
+
divClass
).
hide
();
$
(
"
.
"
+
navClass
).
removeClass
(
"
active
"
);
...
...
@@ -377,6 +416,17 @@ SBMSPage.prototype.switchTab = function(navClass, activeNav) {
activeNav
.
addClass
(
"
active
"
);
};
SBMSPage
.
prototype
.
loadPanelFromFile
=
function
(
srcSelector
)
{
var
src
=
$
(
srcSelector
);
p
.
switchTab
(
"
opNav
"
,
src
);
$
(
"
#content
"
).
load
(
src
.
attr
(
"
data-incl-file
"
),
function
()
{
p
[
src
.
attr
(
"
data-init-func
"
)]();
$
(
"
#content
"
).
localize
();
$
(
'
a[data-sbms-tab-href="yes"]
'
).
attr
(
"
href
"
,
src
.
children
().
first
().
attr
(
"
href
"
));
});
};
SBMSPage
.
prototype
.
langPanelSetup
=
function
(
lang
)
{
$
(
"
#langIndicator
"
).
html
(
$
(
"
a.langChange[data-lang='
"
+
lang
+
"
']
"
).
attr
(
"
data-lang-indicator-abbrev
"
));
...
...
@@ -433,7 +483,11 @@ SBMSPage.prototype.showLoading = function() {
$
(
document
).
ajaxStop
(
function
()
{
$
(
"
#loading
"
).
dialog
(
"
close
"
);})
}
SBMSPage
.
prototype
.
savePassInit
=
function
()
{
var
creds
=
(
Cookies
.
get
(
"
sbms-login
"
)
!=
null
)
?
Cookies
.
get
(
"
sbms-login
"
).
split
(
"
:
"
)
:
[
""
,
""
];
$
(
"
#user
"
).
val
(
creds
[
0
]);
$
(
"
#pass
"
).
val
(
creds
[
1
]);
$
(
"
#login
"
).
submit
(
function
()
{
Cookies
.
set
(
"
sbms-login
"
,
$
(
"
#user
"
).
val
()
+
"
:
"
+
$
(
"
#pass
"
).
val
());
this
.
reset
();
});
};
...
...
SemanticBMSClient/query.html
View file @
54917e8f
...
...
@@ -51,19 +51,13 @@
var
p
=
new
SBMSPage
({
endpoint
:
"
datapoints/
"
,
init
:
function
()
{
$
(
"
#results
"
).
hide
();
$
(
"
#resultsJSON
"
).
hide
();
$
(
"
button#selectAll
"
).
click
(
function
()
{
$
(
'
input[name=fieldsC]
'
).
prop
(
"
checked
"
,
true
);
});
$
(
"
button#deselectAll
"
).
click
(
function
()
{
$
(
'
input[name=fieldsC]
'
).
prop
(
"
checked
"
,
false
);
});
$
(
"
#showJSON
"
).
click
(
function
()
{
p
.
switchPanel
(
"
resultsNav
"
,
"
resultsDiv
"
,
this
,
"
resultsJSON
"
);
});
...
...
@@ -72,7 +66,7 @@ var p = new SBMSPage ({
p
.
switchPanel
(
"
resultsNav
"
,
"
resultsDiv
"
,
this
,
"
resultsTable
"
);
});
$
(
"
#
map
Select
"
).
dialog
({
$
(
"
#
fs
Select
"
).
dialog
({
modal
:
true
,
width
:
$
(
window
).
width
()
-
40
,
height
:
$
(
window
).
height
()
-
40
,
...
...
@@ -83,26 +77,50 @@ var p = new SBMSPage ({
modal
:
true
,
width
:
800
,
maxHeight
:
800
,
position
:
{
my
:
"
center top
"
,
at
:
"
right
top
"
,
of
:
$
(
"
#
params
"
)
},
position
:
{
my
:
"
center top
"
,
at
:
"
center
top
"
,
of
:
$
(
"
#
content
"
)
},
autoOpen
:
false
});
$
(
"
button#send
"
).
click
(
p
.
sendQuery
);
p
.
loadList
(
"
field.data
"
,
[
p
.
createList
,
function
()
{
$
(
'
input[name=fieldsC]:eq(0)
'
).
prop
(
"
checked
"
,
true
);
}
],
[
"
#fields
"
,
"
checkbox
"
,
"
fieldsC
"
]);
p
.
loadList
(
"
grouping
"
,
p
.
createList
,
[
"
#groups
"
,
"
radio
"
,
"
groupsR
"
]);
p
.
loadList
(
"
field.filter
"
,
p
.
createParams
,
[
"
#params
"
,
true
,
function
()
{
$
(
"
#treeSelect
"
).
dialog
(
"
open
"
)
},
function
()
{
$
(
"
#treeSelect
"
).
dialog
(
"
close
"
)
},
function
()
{
$
(
"
#mapSelect
"
).
dialog
(
"
open
"
)
},
function
()
{
},
"
kompasFrame
"
,
"
tree
"
]);
p
.
initPanels
();
},
initQueryDP
:
function
()
{
p
.
endpoint
=
"
datapoints/
"
;
p
.
initQueryAddress
(
"
dataPoint
"
);
},
initQueryTrends
:
function
()
{
p
.
endpoint
=
"
trends/
"
p
.
initQueryAddress
(
"
trend
"
);
},
initQueryAddress
:
function
(
addressType
)
{
$
(
"
button#selectAll
"
).
click
(
function
()
{
$
(
'
input[name=fieldsC]
'
).
prop
(
"
checked
"
,
true
);
});
$
(
"
button#deselectAll
"
).
click
(
function
()
{
$
(
'
input[name=fieldsC]
'
).
prop
(
"
checked
"
,
false
);
});
$
(
"
button#send
"
).
click
(
p
.
sendQuery
);
p
.
loadList
(
"
fields/data.
"
+
addressType
,
[
p
.
createList
,
function
()
{
$
(
'
input[name=fieldsC]:eq(0)
'
).
prop
(
"
checked
"
,
true
);
}
],
[
"
#fields
"
,
"
checkbox
"
,
"
fieldsC
"
]);
p
.
loadList
(
"
fields/grouping
"
,
p
.
createList
,
[
"
#groups
"
,
"
radio
"
,
"
groupsR
"
]);
p
.
loadList
(
"
fields/filter.
"
+
addressType
,
p
.
createParams
,
[
"
#params
"
,
true
,
function
()
{
$
(
"
#treeSelect
"
).
dialog
(
"
open
"
)
},
function
()
{
$
(
"
#treeSelect
"
).
dialog
(
"
close
"
)
},
function
()
{
$
(
"
#fsSelect
"
).
dialog
(
"
open
"
)
},
function
()
{
},
"
extFrame
"
,
"
tree
"
]);
},
initQueryRelations
:
function
()
{
},
makeTableFromJSON
:
function
(
data
,
fieldsSelector
,
target
)
{
var
html
=
"
<table id='jsonTable' class='table table-bordered table-hover'><thead><tr><th>group</th>
"
;
...
...
@@ -156,11 +174,23 @@ var p = new SBMSPage ({
// adding actions to buttons
$
(
target
+
"
.mapButton
"
).
click
(
function
()
{
//$("#kompasFrame").attr("src", mapURL + "?code=" + decodeURIComponent(this.id.substring(6)));
$
(
"
#kompasFrame
"
).
attr
(
"
src
"
,
p
.
mapURL
+
"
?code=
"
+
$
(
this
).
attr
(
"
data-field-value
"
));
$
(
"
#mapSelect
"
).
dialog
(
"
open
"
);
$
(
"
#extFrame
"
).
attr
(
"
src
"
,
p
.
mapURL
+
"
?code=
"
+
$
(
this
).
attr
(
"
data-field-value
"
));
$
(
"
#fsSelect
"
).
dialog
(
"
open
"
);
});
$
(
target
+
"
.trendButton
"
).
click
(
function
()
{
//$("#kompasFrame").attr("src", mapURL + "?code=" + decodeURIComponent(this.id.substring(6)));
$
(
"
#extFrame
"
).
attr
(
"
src
"
,
p
.
bmsChartsURL
+
"
?tl=
"
+
$
(
this
).
attr
(
"
data-field-value
"
));
$
(
"
#fsSelect
"
).
dialog
(
"
open
"
);
});
$
(
target
+
"
.bmsButton
"
).
click
(
function
()
{
//$("#kompasFrame").attr("src", mapURL + "?code=" + decodeURIComponent(this.id.substring(6)));
var
propVal
=
$
(
this
).
attr
(
"
data-field-value
"
);
$
(
"
#extFrame
"
).
attr
(
"
src
"
,
SBMSPage
.
prototype
.
bmsURL
.
replace
(
"
{0}
"
,
propVal
.
replace
(
/
[
0-9
\.]
/g
,
""
)).
replace
(
"
{1}
"
,
propVal
));
$
(
"
#fsSelect
"
).
dialog
(
"
open
"
);
});
});
},
...
...
@@ -180,7 +210,7 @@ var p = new SBMSPage ({
data
[
p
.
getField
(
this
.
id
)]
=
$
(
this
).
val
();
}
});
var
query
=
p
.
sbmsURL
+
"
data
point
s/
"
;
//+ qs;
var
query
=
p
.
sbmsURL
+
p
.
end
point
;
//+ qs;
$
.
ajax
({
type
:
'
GET
'
,
cache
:
false
,
...
...
@@ -232,6 +262,11 @@ var p = new SBMSPage ({
.no-close
.ui-dialog-titlebar-close
{
display
:
none
;
}