iobroker.alias-manager
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -619,4 +619,4 @@ //Adapter-Manager - Copyright (c) by Sebatian Bormann | ||
aliasesMain = removeDuplicates(aliasesMain); | ||
aliasesMain = aliasesMain.filter(function(element){ //Filter for main Aliases (that are elements, that have sub-aliases) | ||
if(aliasesMain.filter(function(_element){ return (_element.indexOf(element + ".") == 0); }).length > 0) return true; else return false; | ||
aliasesMain = aliasesMain.filter(function(element){ //Filter for main Aliases (that are elements, that have sub-aliases OR that are direct childs of alias.0. [which means, lastIndexOf(".") == 7]) | ||
if(element.lastIndexOf(".") == 7 || aliasesMain.filter(function(_element){ return (_element.indexOf(element + ".") == 0); }).length > 0) return true; else return false; | ||
}); | ||
@@ -725,4 +725,9 @@ aliasesMain.sort(); | ||
$('#aliasesSelectedAlias').on('change', function(){ | ||
loadAlias($('#aliasesSelectedAlias').val()); | ||
}); | ||
//Load Alias | ||
function loadAlias(aliasId){ | ||
$('.aliasesDatapointSaveAll').hide(); | ||
aliasesSelectedAlias = $('#aliasesSelectedAlias').val(); | ||
aliasesSelectedAlias = aliasId; | ||
if(aliasesSelectedAlias){ | ||
@@ -762,5 +767,20 @@ //Fill Datapoint list | ||
$('.aliasesNothingSelectedDiv').show(); | ||
} | ||
} | ||
//Add function to Add Alias Button | ||
$('#aliasesNewAlias').on('click', function(){ | ||
var aliasId = prompt(_("Please enter ID of alias"), "alias.0.MyNewAlias"); | ||
if(!aliasId) return; | ||
if(aliasId.indexOf("alias.0.") !== 0) aliasId = "alias.0." + aliasId; | ||
if(aliasId.length < 9) return; | ||
if(aliases[aliasId] && !aliases[aliasId].UNSAVED_NEW){ | ||
alert("Error: This alias exists."); | ||
return; | ||
} | ||
$('#aliasesSelectedAlias').append("<option value='" + aliasId + "'>" + aliasId + " [" + _("NOT SAVED") + "]" + "</option>"); | ||
$('#aliasesSelectedAlias').val(aliasId); | ||
$('#aliasesSelectedAlias').select().trigger('change'); | ||
}); | ||
//Add function to Add Datapoint Button | ||
@@ -807,2 +827,3 @@ $('#aliasesNewDatapoint').on('click', function(){ | ||
var ids = []; | ||
ids.push(aliasesSelectedAlias); | ||
$('#aliasesDatapointList li').each(function(){ | ||
@@ -958,5 +979,5 @@ ids.push($(this).data('id')); | ||
initSelectId(function (sid) { | ||
sid.selectId('show', $('#' + $('#dialogSelectId').data('selectidfor').replace(/\./g, '\\.')).val(), {type: 'state'}, function (newId) { | ||
sid.selectId('show', $('#' + $('#dialogSelectId').data('selectidfor').replace(/\./g, '\\.').replace(/\ /g, '\\ ')).val(), {type: 'state'}, function (newId) { | ||
if (newId) { | ||
$('#' + $('#dialogSelectId').data('selectidfor').replace(/\./g, '\\.')).val(newId).trigger('change'); | ||
$('#' + $('#dialogSelectId').data('selectidfor').replace(/\./g, '\\.').replace(/\ /g, '\\ ')).val(newId).trigger('change'); | ||
} | ||
@@ -967,3 +988,3 @@ }); | ||
}); | ||
//Enhance type with function | ||
//Enhance type and role with function | ||
enhanceTextInputToCombobox('.aliasesDatapoint.val[data-id="' + alias + '"][data-setting="type"]', Object.keys(defaultDatapointRoles).join(";"), false); | ||
@@ -973,2 +994,3 @@ $('.aliasesDatapoint.val[data-id="' + alias + '"][data-setting="type"]').on('change init', function(){ | ||
}).trigger('init'); | ||
enhanceTextInputToCombobox('.aliasesDatapoint.val[data-id="' + alias + '"][data-setting="role"][data-main="true"]', defaultMainRoles.join(";"), false); | ||
} | ||
@@ -1061,5 +1083,5 @@ | ||
initSelectId(function (sid) { | ||
sid.selectId('show', $('#' + $('#dialogSelectId').data('selectidfor').replace(/\./g, '\\.')).val(), {type: 'state'}, function (newId) { | ||
sid.selectId('show', $('#' + $('#dialogSelectId').data('selectidfor').replace(/\./g, '\\.').replace(/\ /g, '\\ ')).val(), {type: 'state'}, function (newId) { | ||
if (newId) { | ||
$('#' + $('#dialogSelectId').data('selectidfor').replace(/\./g, '\\.')).val(newId).trigger('change'); | ||
$('#' + $('#dialogSelectId').data('selectidfor').replace(/\./g, '\\.').replace(/\ /g, '\\ ')).val(newId).trigger('change'); | ||
} | ||
@@ -1077,5 +1099,6 @@ }); | ||
var newObj = Object.assign({}, aliases[alias]); | ||
var isMain = $('.aliasesDatapoint.val[data-id="' + alias + '"][data-setting="name"]').data('main'); | ||
delete newObj.UNSAVED_NEW; | ||
if(!typeof newObj.common == "object") newObj.common = {}; | ||
if(!typeof newObj.common.alias == "object") newObj.common.alias = {}; | ||
if(typeof newObj.common != "object") newObj.common = {}; | ||
if(typeof newObj.common.alias != "object" && !isMain) newObj.common.alias = {}; | ||
$('.aliasesDatapoint.val[data-id="' + alias + '"]').each(function(){ | ||
@@ -1106,2 +1129,7 @@ $this = $(this); | ||
}); | ||
if(isMain){ //Update Id and Name in Selectbox | ||
var name = $('.aliasesDatapoint.val[data-id="' + alias + '"][data-setting="name"]').val() || alias; | ||
$('#aliasesSelectedAlias option[value="' + alias + '"]').html(alias + (name != alias ? " (" + name + ")" : " ")); | ||
$('#aliasesSelectedAlias').select(); | ||
} | ||
(function(){ //Closure--> (everything declared inside keeps its value as ist is at the time the function is created) | ||
@@ -1108,0 +1136,0 @@ var _ids = ids; |
{ | ||
"common": { | ||
"name": "alias-manager", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"news": { | ||
"0.0.4": {"en": "some fixes"}, | ||
"0.0.3": {"en": "some fixes"}, | ||
"0.0.5": { | ||
"en": "some fixes", | ||
"de": "einige Korrekturen", | ||
"ru": "некоторые исправления", | ||
"pt": "algumas correções", | ||
"nl": "enkele fixes", | ||
"fr": "quelques correctifs", | ||
"it": "alcune correzioni", | ||
"es": "algunas correcciones", | ||
"pl": "kilka poprawek", | ||
"zh-cn": "一些修复" | ||
}, | ||
"0.0.4": { | ||
"en": "some fixes", | ||
"de": "einige Korrekturen", | ||
"ru": "некоторые исправления", | ||
"pt": "algumas correções", | ||
"nl": "enkele fixes", | ||
"fr": "quelques correctifs", | ||
"it": "alcune correzioni", | ||
"es": "algunas correcciones", | ||
"pl": "kilka poprawek", | ||
"zh-cn": "一些修复" | ||
}, | ||
"0.0.3": { | ||
"en": "some fixes", | ||
"de": "einige Korrekturen", | ||
"ru": "некоторые исправления", | ||
"pt": "algumas correções", | ||
"nl": "enkele fixes", | ||
"fr": "quelques correctifs", | ||
"it": "alcune correzioni", | ||
"es": "algunas correcciones", | ||
"pl": "kilka poprawek", | ||
"zh-cn": "一些修复" | ||
}, | ||
"0.0.2": { | ||
@@ -9,0 +43,0 @@ "en": "added conversion for min and max to type number", |
{ | ||
"name": "iobroker.alias-manager", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Manages and creates aliases", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -21,3 +21,3 @@ ![Logo](admin/alias-manager.png) | ||
### 0.0.3 | ||
### 0.0.5 | ||
* (sbormann) some fixes | ||
@@ -24,0 +24,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
451456
1458