Saved views / <ENTITY>__views bug since UI v12.1.6/7?

Hello,

A few days ago I was working on a way of sharing within my organization my saved views such that my peers could easily view all the devices that answer certain tag criteria (356579).

Last week I got to a single-script working solution that could generate from scratch the LocalStorage value required for the <ENTITY>__views, and that could also manipulate a computer’s configuration files of Chrome | Firefox so the database (particularly the LocalStorage’s <ENTITY>__views entry) was updated with the new value.

This was working for sure up until last Friday, April 22nd. Today however, at my first attempts this week, selecting one of my saved views is not working anymore. Only views manually created and saved via the UI work now. I see you’ve released UI versions 12.1.6 and 12.1.7 yesterday and today, respectively. I don’t know if a bug was introduced in those versions?

What’s more, it seems that manually handling my browser’s LocalStorage <ENTITY>__views entry directly is slightly modifying the dictionary contents, namely going from:
[{"id":"<16-alphanumeric-long-string>","name":"<saved-view-name>","scope":null,"filters":[{"$id":"<other-16-alphanumeric-long-string>","anyOf":[{"title":"is","description":"{\"name\":\"Tag\",\"operator\":\"is\",\"value\":\"<tag-name> : <tag-value>\"}","type":"object","properties":{"device_tag":{"contains":{"title":"Tag","properties":{"tag_key":{"const":"<tag-name>"},"value":{"const":"<tag-value>"}}}}},"required":["device_tag"]}]}]}]
to:
[{"id":"<16-alphanumeric-long-string>","name":"<saved-view-name>","scope":null,"filters":[{"$id":"<other-16-alphanumeric-long-string>","anyOf":[{"title":"contains","description":"{\"name\":\"Tag\",\"operator\":\"contains\",\"value\":\"<tag-name> : <tag-value>\"}","type":"object","properties":{"device_tag":{"contains":{"title":"Tag","properties":{"tag_key":{"const":"<tag-name>"},"value":{"const":"<tag-value>"}}}}},"required":["device_tag"]}]}]}]
i.e. the is values in the anyOf key are being transformed into contains.

(P.S.: as you can probably tell, the only filter I wish to apply is one that highlights devices that have a Tag set to a particular Name and Value)

Am I missing something here?

Thanks in advance for your help!

Hello, thank you for opening this thread. We are aware of the issue and are working to resolve it. We will keep you updated on the status of the fix. Until then, if you urgently need any of these views please delete the old one and recreate it and save the new one.

Awesome, good to know! Will wait then for the fix :smiley:

Hi there,
thank you very much, all the information provided. I would like to inform you that we have released a fix for the views. Could you please confirm us if they all work for you now? Do not hesitate to contact us if there are still some broken views or for any other problem. Sorry again for the inconvenience.

1 Like

Hi,

Thanks for the notification! Sorry though for my late reply, I was off until today.

Indeed it seems to be in a much better state. It works just like it used to in Chrome. In Firefox however, even though I update the corresponding entry in the webappsstore.sqlite file, it doesn’t seem to correctly load the <ENTITY>__views entry, albeit inspecting the SQLite DB shows that it contains the expected new entry… Considering it is out of the scope of the Balena UI, I don’t think you’d know / if you’re aware of what could be the reason for that (in Firefox 99.0 for Linux), correct?

FWIW, the way I update the DB is by running an UPDATE webappsstore2 SET value=<new entry> WHERE key=<ENTITY>__views execution command and then committing. I also have just one profile in Firefox, even completely cleaned my entire Firefox installation, yet the issue persists.

Thanks already nonetheless for the quick Chrome fix!!

Hi there,
just to make sure, are you trying to move views you have in chrome to firefox localstorage ?
if that’s correct, and I understand correctly, I would suggest doing the following:

From Chrome - dashboard tab:

  1. Open browser console Option + ⌘ + J (on macOS), or Shift + CTRL + J (on Windows/Linux)
  2. copy and paste the following on the console and run (press enter) :

(SEE COMMENT TO COPY MORE VIEWS)

var views = ['device__views', 'application__views' ]; // CHANGE THIS ADDING ALL THE KEYS YOU WANT TO COPY
var storageToCopy = Object.keys(localStorage).filter(key => !!views.includes(key)).reduce((acc, key) => {
  return {...acc, [key]: JSON.parse(localStorage.getItem(key))};
}, {});
copy(storageToCopy);

this will generate an object and copy to clipboard

From Firefox - Dashboard tab:

  1. Open browser console Option + ⌘ + J (on macOS), or Shift + CTRL + J (on Windows/Linux)
  2. from the code below, replace <HERE DATA> with what is copied on clipboard,
  3. copy and paste the code below (with replaced <HERE DATA>) on the console and run (press the run button) :
var data = <HERE DATA>
Object.keys(data).forEach(function (k) {
  localStorage.setItem(k, JSON.stringify(data[k]));
});

You should now be able to use the same views on Firefox.