-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Admin 5.0.3 - React UI - Archivierung der Datenpunkte #692
Comments
Yes, adapters with custom_m/custom needs to be adjusted! List is:
|
4th Question: |
There is no autocomplete control yet. Do you need it? Autocomplete is automatically ON by text/number if you edit more than one object, but is it not the autocomplete what you can use in your controls |
Hi, I need a combobox: A selectbox with options, but also the ability to enter free text. |
Sensational, thank you very much! I can't believe how busy you guys are right now. Thanks to all the developers who are pushing ioBroker forward! Is there already a solution idea for the JSON table? |
Check that here: https://github.com/ioBroker/ioBroker.admin/blob/master/admin/jsonConfig.json#L285
|
Is it possible to insert an objectTable that accepts an object instead of an array? The first column would then be the key, the remaining columns the corresponding object. Otherwise, already existing custom-settings would become invalid and could no longer be edited by the users. |
How such a table could looks like? I guess, no. Why a table is an object and not array?? |
In my case i made the common.states-object editable. This is defined as an object, not as an table. If i write a objectToArray and ArrayToObject-Function, could you then extend the table-component with an option that these conversion-functions are used? Im not familiar with react and i don't understand the syntax of ConfigTable.js enough, but i guess, adding conversion-functions isn't such a big deal, if you are familiar with it, or? |
Please give me an example |
function objectToArray(object, nameOfFirstCol){
nameOfFirstCol = nameOfFirstCol || "key";
var array = [];
var keys = Object.keys(object);
keys.forEach(function(key){
var firstCol = {};
firstCol[nameOfFirstCol] = key;
array.push(Object.assign(firstCol, object[key]));
});
return array;
}
function arrayToObject(array, nameOfFirstCol){
nameOfFirstCol = nameOfFirstCol || "key";
var object = {};
array.forEach(function(row){
var key = row[nameOfFirstCol];
delete row[nameOfFirstCol];
object[key] = row;
});
return object;
}
//++++ Example: ++++
var dataObject = {
"192.168.1.1": {delay: "1A", enabled: "1B"},
"192.168.1.2": {delay: "2A", enabled: "2B"}
};
//this is the given value (as object, not as array)
var array = objectToArray(dataObject, "ip");
// array = [{ip: "192.168.1.1", delay: "1A", enabled: "1B"},
// {ip: "192.168.1.2", delay: "2A", enabled: "2B"}]
// use that array to build the table
var returnDataObject = arrayToObject(array, "ip");
// newDataObject = {
// "192.168.1.1": {delay: "1A", enabled: "1B"},
// "192.168.1.2": {delay: "2A", enabled: "2B"}
// }
// use that as return value when the table has changed |
After looking exactly i have two different data formats: Therefore i overworked and extended my code from above. I think, this should work. function objectToArray(object, nameOfFirstCol, nameOfSecondCol, valueIsNotAnObject){
console.log("OTA");
nameOfFirstCol = nameOfFirstCol || "key";
nameOfSecondCol = nameOfSecondCol || "value";
var array = [];
var keys = Object.keys(object);
keys.forEach(function(key){
var firstCol = {};
firstCol[nameOfFirstCol] = key;
if(valueIsNotAnObject){
var secondCol = {};
secondCol[nameOfSecondCol] = object[key];
array.push(Object.assign(firstCol, secondCol));
} else {
array.push(Object.assign(firstCol, object[key]));
}
});
return array;
}
function arrayToObject(array, nameOfFirstCol, nameOfSecondCol, valueIsNotAnObject){
console.log("ATO");
nameOfFirstCol = nameOfFirstCol || "key";
nameOfSecondCol = nameOfSecondCol || "value";
var object = {};
array.forEach(function(row){
var key = row[nameOfFirstCol];
delete row[nameOfFirstCol];
if(valueIsNotAnObject){
object[key] = row[nameOfSecondCol];
} else {
object[key] = row;
}
});
return object;
}
//valueIsNotAnObject
//true, if table has only two cols and data is in format {key: "value", ...} instead of {key: {col1: "value1", col2: "value2", ...}, ...}
//++++ Example: ++++
var dataObject = {
"192.168.1.1": {delay: 1000, enabled: true},
"192.168.1.2": {delay: 2000, enabled: false}
};
//this is the given value (as object, not as array)
var valueIsNotAnObject = (typeof dataObject[Object.keys(dataObject)[0]] != "object");
//false
var dataArray = objectToArray(dataObject, "ip", "delay", valueIsNotAnObject);
// array = [{ip: "192.168.1.1", delay: 1000, enabled: true},
// {ip: "192.168.1.2", delay: 2000, enabled: false}]
// use that array to build the table
var returnDataObject = arrayToObject(dataArray, "ip", "delay", valueIsNotAnObject);
// newDataObject = {
// "192.168.1.1": {delay: 1000, enabled: true},
// "192.168.1.2": {delay: 2000, enabled: false}
// }
// use that as return value when the table has changed
//++++ Second Example where value is not an object: ++++
var dataObject2 = {
"192.168.1.1": "value1",
"192.168.1.2": "value2"
};
var valueIsNotAnObject2 = (typeof dataObject2[Object.keys(dataObject2)[0]] != "object");
//true
var dataArray2 = objectToArray(dataObject2, "ip", "value", valueIsNotAnObject2);
// array = [{ip: "192.168.1.1", value: "value1"},
// {ip: "192.168.1.2", value: "value2"}]
var returnDataObject2 = arrayToObject(dataArray2, "ip", "value", valueIsNotAnObject2);
// newDataObject = {
// "192.168.1.1": "value1",
// "192.168.1.2": "value2"
// } |
Hey, i have seen, you already implemented it! Great! But im sorry to say, there are some little bugs left: |
Sorry for late response. the whole jsonCustom file can be found here: My Findings: AutoComplete from type
dynamic label:
works if using Type
Value of property Feature: Dynamic label for type
I also need a dynamic label for the header Feature: dynamic
I need to build the Question: How i can access default icons (mdi?):
|
i also need an option to hide some menu entries of select element:
|
@Scrounger are trying to build a submarine???? Why do need all the stuff. :( |
Just trying to migrate the custom dialog from linkeddevices... Unfortunately, the design of the new custom dialog is no longer as flexible, so I can't implement these functions directly. |
What the default icons? In Admin? There are no icons any more. Please use base64 |
Could use something like that in lovelace, too. Currently I did duplicate the attribute / select and use the hidden option there. But it makes the json and backend code much more complex (because I need to handle different attribute names which otherwise could be the same). |
All features requested by @Scrounger are implemented in 5.1.6 |
@GermanBluefox the current jsonCustom file can be found here: My Findings: AutoComplete from type autocompleteSendTo:
It works if the custom settings is not enabled: Change event only fired if you hit the dynamic
Question |
@GermanBluefox |
@GermanBluefox Still needed |
@GermanBluefox |
tut sich bei dem Problem noch was? |
@DocGame69 Zum anderen müsste ja, wenn sich an den linkeddevices nichts ändert, trotzdem der neue admin genutzt werden können. Ggf macht es dann Sinn auf den neuen admin umzustellen und für etwaige Änderungen an linkeddevices, einen alten als zweite Instanz in der Hinterhand zu haben. |
Wollte mal fragen ob sich was tut beim linked device Adapter und der neuen Ui. Warte schon täglich :-) |
@GermanBluefox |
das nicht immer gleich alles umgesetzt werden kann ist schon klar aber wenn ich die Foren anschauen warten eigentlich alle nur auf eine Aussage ob der Adapter LinkedDevice im neuen Admin UI angegangen wird oder nicht. Ich selber auch, ein klasse Adapter den ich als Anfänger eifrig nutze. Solch Dingen führen dann wieder dazu das die Leute weniger updaten und immer mehr aus dem "normalen" laufen. So bei mir auch... Ich bin kein Verfechter von Zwangsgewöhnung auf anderes wenn mal mal seinen Weg gefunden hat in den vielen Möglichkeiten. |
Für ein PR bin ich immer froh. |
I fixed an error in AutocompleteSendTo. And implemented dynamic staticLink. @Scrounger Your case is most complex custom settings what I know. And if it is so important, I would appreciate some help. |
Any news on this? Never change a winning team. Linkeddevices is one of the 10 most important adapters in iobroker. |
In fact I alsos asked that in the LinkedDevices ticket some days ago ... |
Any news on that? Can't believe this doesnt get fixed. |
@Pittini: |
installiere telegramm adapter
installiere sql
setze ein Object auf protokollierung
The text was updated successfully, but these errors were encountered: