X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=static%2Fsrc%2Futils.js;h=79d88c2acadb6c77e281c5f15c08f73ba71a8c4d;hb=refs%2Fchanges%2F70%2F9870%2F1;hp=6d5e820d46d810fcf85a0f287a4a5d10a49c08c0;hpb=fb37bca4b7e8178c65df2f1496afe372c1d55e78;p=osm%2FLW-UI.git
diff --git a/static/src/utils.js b/static/src/utils.js
index 6d5e820..79d88c2 100644
--- a/static/src/utils.js
+++ b/static/src/utils.js
@@ -2,14 +2,14 @@ function generateUID() {
return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4)
}
-function openProject(pId) {
- window.location.href = '/projects/' + pId;
+function moveToLogin(next) {
+ window.location.href = (next) ? "/auth/?next="+next : '/auth/';
}
-function openDescriptorView(project_id, descriptor_type, descriptor_id) {
- console.log("openDescriptorView", project_id, descriptor_type, descriptor_id);
- window.location.href = '/projects/' + project_id + '/descriptors/' + descriptor_type + '/' + descriptor_id;
+function openDescriptorView( descriptor_type, descriptor_id) {
+ console.log("openDescriptorView", descriptor_type, descriptor_id);
+ window.location.href = '/projects/descriptors/' + descriptor_type + '/' + descriptor_id;
}
@@ -29,20 +29,19 @@ function savePositions(el) {
function buildPalette(args) {
$("#paletteContainer").empty();
var type_property = graph_editor.getTypeProperty();
+
if (args.length > 0) {
- args.forEach(function (category) {
+ $('#paletteContainer').append('
');
+ args.forEach(function (category) {
var category_id = "category_" + category.category_name.replace(/[\s.*+?^${}()\/|[\]\\]/g, "_");//.replace(/\s/g, '');
var content_id = "palette-content-" + category.category_name.replace(/[\s.*+?^${}()\/|[\]\\]/g, "_");//.replace(/\s/g, '');
- $("#paletteContainer").append('' +
+ $("#paletteContainer").append('
');
+
category.types.forEach(function (type) {
console.log(graph_editor.get_name_from_d3_symbol(d3.symbolCircle))
var type_id = type.id.replace(/[\s.*+?^${}()|[\]\\]/g, "_");
@@ -66,7 +65,7 @@ function buildPalette(args) {
'
' +
palette_node_icon +
'
' +
- '
'
+ '';
$("#" + content_id).append(html_to_append);
});
@@ -74,12 +73,11 @@ function buildPalette(args) {
}
togglePaletteSpinner(true);
-
}
function handlePaletteCat(item) {
console.log("handlePaletteContainer")
- var category_id = $(item).attr("category_id")
+ var category_id = $(item).attr("category_id");
$('#' + category_id).toggleClass("palette-close");
}
@@ -90,11 +88,11 @@ function togglePaletteSpinner(addOrRemove) {
function showAlert(msg) {
// modal_alert_text
- var alert_msg = ""
- if (typeof msg == "string")
- alert_msg = msg
+ var alert_msg = "";
+ if (typeof msg === "string")
+ alert_msg = msg;
else
- alert_msg = JSON.stringify(msg)
+ alert_msg = JSON.stringify(msg);
$('#modal_alert_text').text(alert_msg);
$('#modal_alert').modal('show');
}
@@ -113,25 +111,17 @@ function buildHtmlShape(args) {
switch (mySymbol) {
case d3.symbolCircle:
return '';
- break;
case d3.symbolSquare:
return '';
- break;
case d3.symbolDiamond:
return '';
- ;
- break;
+
case d3.symbolTriangle:
return '';
- break;
case d3.symbolStar:
return '';
- ;
- break;
case d3.symbolCross:
return '';
- ;
- break;
default:
// if the string is not recognized
return "unknown";
@@ -145,7 +135,7 @@ if (!String.format) {
String.format = function (format) {
var args = Array.prototype.slice.call(arguments, 1);
return format.replace(/{(\d+)}/g, function (match, number) {
- return typeof args[number] != 'undefined' ?
+ return typeof args[number] !== 'undefined' ?
args[number] :
match;
});