AgGrid angular: how to remove all data from `AgGrid` while using `TreeView` with `Server side row model` - ag-grid

Current behavior
I'm using grid as a tree-view with ssrm.
And case is, I need to REMOVE WHOLE TREE, and insert new data.
New data can have same nodes (same data) that old data had.
To remove data already loaded in grid I use:
for(const nodeRoute of nodes) { // `nodes` are list of group nodes
this.gridApi.applyServerSideTransaction({
route: nodeRoute, // route to particular group node in a tree
remove: childNodes // child nodes that belong to that particular group
});
}
When all nodes are removed - at list when AgGrid instance UI becomes empty and displays no nodes - I try to force it to load new data using:
this.gridApi.refreshServerSideStore({
purge: true
});
which triggers serverSideDatasource to load new data.
Once I'm trying to add new data after old data was removed - AgGrid spits tonns of warnings like AG Grid: duplicate node id NodeId_Goes_Here , logs those duplicate nodes ans UI becomes messed up.
Expected behavior
Expected behaviour is to not have any duplicates as I've removed all nodes starting from very leafs of tree, and UI should't be broken?
Maube there's some workaround this?
environment:
Windows 11 Pro, Visual Studio Code, npm, NodeJS
AG Grid version:
27.0.0 - unfortunatelly, I can't upgrade version.
Browser:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Language:
Typescript 4.0.2 / Angular 11.2.9

Related

How to read html files on Vapor with Leaf when not using the tau version?

There was a version of Leaf that I was using to load .html files instead of .leaf ones from my Vapor project, which would make syntax coloring for those same files done automatically.
The version of Leaf was 4.0.0-tau.1 and the one for LeafKit was 1.0.0-tau.1.1
When using this particular version, I could setup leaf in the configure.swift file this way:
/// Change the classic .leaf extension to .html for the syntax
/// coloring option of Xcode to work each time the app is being load up.
fileprivate func leaf(_ app: Application) {
if !app.environment.isRelease {
LeafRenderer.Option.caching = .bypass // Another issue from the update
}
let detected = LeafEngine.rootDirectory ?? app.directory.viewsDirectory
LeafEngine.rootDirectory = detected
LeafEngine.sources = .singleSource(
NIOLeafFiles(fileio: app.fileio,
limits: .default,
sandboxDirectory: detected,
viewDirectory: detected,
defaultExtension: "html"))
app.views.use(.leaf)
}
In this code, the LeafRenderer.Option.caching = .bypass and the code used with LeafEngine do not work anymore since having updated Leaf to 4.1.3 and LeafKit to 1.3.1.
How can I successfully make this code work as before with the updated Leaf and LeafKit frameworks?
You can use this Xcode plugin:
https://github.com/OmranK/VaporLeafPlugIn
It adds Vapor Leaf language support to Xcode IDE. Provides syntax highlighting for Leaf tags as well as HTML tags with auto-indentation all together.
At the moment the plugin supports Xcode up to 13.2 beta. Future Xcode versions will require small update (add new DVTPlugInCompatibilityUUID) but it can be easily handled even on already installed plugin.

Unable to rename existing edge relationships; Using UNSAFE fails

I cannot seem to rename an Edge. Is this possible with OrientDB?
I am running OrientDB in distributed mode on 3 servers.
Each server is configured as
OS: CentOS Linux release 7.5.1804 (Core)
OrientDB: 3.0.9
In the Studio web interface, To rename an Edge, I click the "rename" button adjacent to the Edge I want to rename.
I get this message at the bottom of the screen:
com.orientechnologies.orient.core.exception.OCommandExecutionException: Cannot alter class 'Transfer2' because is an Edge class and could break vertices. Use UNSAFE if you want to force it DB name="marksluser"
In the console, I execute
orientdb {db=marksluser}> ALTER CLASS Transfer2 NAME Transfer UNSAFE;
Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Invalid class name: ALTER CLASS Transfer2 NAME Transfer UNSAFE
DB name="marksluser"
DB name="marksluser"
Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Cannot alter class 'Transfer2' because is an Edge class and could break vertices. Use UNSAFE if you want to force it
DB name="marksluser"
I also tried to rename the in and out edges to the new name as described in Renaming existing edge relationships? however it still didn't work.
Am I doing something wrong?
I tried this again with a clean database running 3.0.9 and the issue remains. I tried it with the development version 3.1.0-M2 and using "UNSAFE" works!
Looks like I wil be working on the 3.1.0-M2 release.
So if you want to rename an edge from "Edge1" to "Edge2" and all your vertices are subclasses of V, execute:
ALTER CLASS Edge1 NAME Edge2 UNSAFE;
UPDATE V SET out_Edge2 = out_Edge1 where out_Edge1 is not null;
UPDATE V SET in_Edge2 = in_Edge1 where in_Edge1 is not null;
UPDATE V REMOVE out_Edge1 where out_Edge1 is not null;
UPDATE V REMOVE in_Edge1 where in_Edge1 is not null;

capybara: mysterious 'element at X no longer present in the DOM'

I have written cucumber test scenario's that are tested with webkit and a firefox driver. In firefox the tests all pass, but with webkit one of them fails with error
Element at 40 no longer present in the DOM (Capybara::Webkit::NodeNotAttachedError)
/home/r/project/share/support/actions.rb:64:in `block (2 levels) in follow_link_in_new_tab'
/home/r/project/duplo/share/support/actions.rb:10:in `with_scope'................
This happens during the execution of a routine that is triggered by test step 'When I follow "Linkname". Strangely enough, most of the times this code works perfect, but in one case I get this 'no longer present error'.
The routine performs this:
res = find( 'a', text: text, visible: true)
if ((res[:target] || '') == '_blank')
#win = window_opened_by { res.click }
else
res.click
end
I found out that if I change this to
find( 'a', text: text, visible: true).click
the message disappears and the scenario passes the test. Who can help me understanding what can be the problem here. Why is this failing when the find result is assigned to a variable and why is it only failing in only few situations?
I use ruby 2.4.0 and capybara-webkit 1.2.0
thanks, Ruud
You don't indicate exactly which line is generating the error (which one is line 64), however the error indicates that you're still using an element after it has been removed from the page, either by JS deleting the element or a new page being loaded.
Additionally the visible: true option really shouldn't be needed since that is normally the default value for the visible option (unless you've changed it which is a terrible idea when testing software, not as bad if just scraping sites)
Also - capybara-webkit 1.2.0 was released in July 2014 -- You REALLY want to update that to the latest release if you're testing anything even slightly modern, as well as probably updating your ruby to at least the latest 2.4.x release.

TYPO3 - cache tagging and flushing - more than one tag per request

I have following case:
Records are displayed both in single (showAction) and list view with pagination (listAction) and in some other actions also.
I would like to flush caches from within Scheduler for given single record - both on single view and on list view - only appropriate pages.
So in showAction there is:
public function showAction(...) {
...
$this->addCacheTags('RecordName_' . $item->getUid());
...
Then in Scheduler I can use something like that to remove caches:
$this->cacheManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager');
$this->cacheManager->getCache('cache_pages')->flushByTag('RecordName_' . $item->getUid());
$this->cacheManager->getCache('cache_pagesection')->flushByTag('RecordName_' . $item->getUid());
This will work fine for singleView but not for actions where there is more than one record to be tagged, since following in listAction will not work as desired in my case (only one tag per request can be addedd):
foreach($products as $product){
$this->addCacheTags('RecordName_' . $product->getUid());
}
Anyone has solution how to achieve that with use of TYPO3 core cache functionality?
If you really want to tag a list view with so many tags (which i do not suggest, see below), you can add multiple tags per request in TYPO3:
$GLOBALS['TSFE']->addCacheTags(['RecordName_1', 'RecordName_2', 'RecordName_3']);
The drawback of tagging a list view with record uid's is, that you'd still need another cache tag to properly cache-clear the list view for new records (as the tag for the new uid has not yet been added to the cache tags).
Therefore it's better to add tags that describe the current search query (which'd also fit your "only one tag per request" requirement):
// list view for records stored in pid 10
$GLOBALS['TSFE']->addCacheTags(['RecordName_pid_10']);
// list view by category with uid 30
$GLOBALS['TSFE']->addCacheTags(['RecordName_category_30']);
// single view for uid 1
$GLOBALS['TSFE']->addCacheTags(['RecordName_1']);
Now in your scheduler command you need to clear some more cache tags. You may use flushCachesInGroupByTag to not call flushByTags for cache_pages and cache_pagesection implicitly AND to support extensions that add custom page caches like EXT:nc_staticfilecache or EXT:nginx_cache.
$this->cacheManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager');
$this->cacheManager->flushCachesInGroupByTag('pages', 'RecordName_' . $item->getUid());
$this->cacheManager->flushCachesInGroupByTag('pages', 'RecordName_pid_' . $item->getPid());
Note: If you're already on TYPO3 8.5 you may use flushByTags(array)/flushCachesInGroupByTag(array) to flush multiple tags per cache at once. [1]
$this->cacheManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager');
$this->cacheManager->flushCachesInGroupByTags('pages', ['RecordName_' . $item->getUid(), 'RecordName_pid_' . $item->getPid()]);
[1] https://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff/b8621ebfe2b65826d25e80519209e5420df436a8?hp=e664996d6eb096555496774658093bf220566933
I would create the tag by using a ViewHelper which is then called in the List view

Replacing the duplicate function for the 'unique' plugin

I am trying to write my own $.jstree.defaults.unique.duplicate function and replace it.
I tried doing so in the following jsFiddle (line: 68):
$.jstree.defaults.unique.duplicate = function(name, counter){
return name + "_test";
};
Steps to test:
Select Devices
Create Node called Node1
Create Another node under Devices called Node1
It will use the jstree default method to replace it with the default node name vs what my function provides
http://jsfiddle.net/2mbq86at/
Am I doing something wrong? Thanks in advance.
In your code you specify text to use in course of creating a new node.
Take out the pre-defined text and things will start to work as desired for your function $.jstree.defaults.unique.duplicate !
self.createFileNode = function (data) {
//Below code only allows files to be created within folders.
//Structure it as per createFolder method to create files at root
var data = {
//'id': 'tempId',
//'text': 'iOS 8'
}
....
In that case of course a new node's text will be the default 'New node'.
The best is to set a unique node name right upfront on creating a new node, like "text" : "OS_" + (new Date).getTime().
Still for the case of renaming nodes and duplicates: using the unique plugin, on renaming and choosing a duplicate text the node's text will fall back to the original one. If that is not what is desired, things get more complicated as the rename_node.jstree event will not be fired in that case.