How can I set an Item as Default in Variant-Management's manage dialogue? - sapui5

I'm using:
SAP UI5 version 1.38.8
sap.ui.comp.variants.VariantManagement
My problem is that I can't set an item programmatically so that the item is shown as 'selected' in the management dialog.
It works in the select dialogue (or popup), as shown below:
However, it doesn't work in the "variants manage" dialog, as you can see in here
Unfortunately, I need to use version 1.38.8 (because of restrictions by customer's environment). Any ideas how to solve this problem?

Solution:
variantManagment.setDefaultVariantKey(item.VariantId);
after Variants were loaded.
I don't know why it didn't work at my first tries.

Related

Opening the VSC settings window from code

I'm working on a Visual Studio Code extension, where some settings are required for it to work properly. Right now, in case the user has forgotten something, I'm showing a warning message indicating this, and telling them to fix this property in the settings. I would, however, like to add a button that opens the settings page of that property.
However, after looking around for over an hour, I can't seem to find any support for this in the Api, or anyone else asking this question (which I find a bit weird?). If it really doesn't exist, I'd still expect at least 1 other person asking this somewhere, but as far as I can see there's absolutely nothing.
Is it possible to open the settings window (preferably even filtering them down to only my extension's properties/the one property that has to be filled in) from code?
Thanks in advance
I found it out myself after digging through the keybinds window. You can use the following to open the settings:
vscode.commands.executeCommand("workbench.action.openSettings2");
I did not, however, find how to pass a search query into it to open a specific place in the settings.
EDIT: You can use openSettings & add the search query as an extra argument to executeCommand. For example - if your property is defined as my.extension.property in package.json, you can use this:
vscode.commands.executeCommand("workbench.action.openSettings", "my.extension.property");

manifest.json display property has invalid option of browser

The documentation seems to state that there are four options for the "display" property within a manifest.json: fullscreen, standalone, minimal-ui and browser
I decided upon 'browser' for one of my apps, but the message from Chrome (Version 76) says "Manifest 'display' property must be one of 'standalone', 'fullscreen' or 'minimal-ui'". The message also appears if I leave 'display' undefined.
Is 'browser' an obsolete option or has it just not made it into the latest Chrome version yet?
(I probably should mention that the message appears in Chrome DevTools>application>manifest).
Valid options for display are fullscreen, standalone, minimal-ui and browser according to https://developer.mozilla.org/en-US/docs/Web/Manifest/display.
In order to show the Add to Home Screen Prompt, display must be set to must be one of: fullscreen, standalone, or minimal-ui, see https://developers.google.com/web/fundamentals/app-install-banners/
browser display option is like leaving the field empty.
When you use standalone it looks like native app. When you use fullscreen there is no status bar etc. Probably you want to use standalone, because fullscreen has very specific use-case (e.g. gaming).
I finally got around to reporting it as a bug.
https://bugs.chromium.org/p/chromium/issues/detail?id=1330323
The immediate response was...
The behaviour is seen from M-85.This is is a non regression issue
hence marking it as untriaged and requesting some one from dev team to
look into the issue.

In CQ5, my responsive emulator devices list is empty

To start, I followed these directions exactly as it's stated: http://dev.day.com/docs/en/cq/5-6/developing/mobile/responsive.html
The problem is, despite all of that, my Devices dropdown on the sidekick in preview mode is empty.
The list works without issue in the Geometrixx Media without issue.
I made sure I set the cq:deviceGroups and the sling:OsgiConfig as required, and also included the simulator.js in the head tags.
Edit: I have found that if I set the resourceType on the root level page to geometrixx-media/components/page, which is their working demo, it works. I have completely removed all jsp and config items from that component page and it still continues to work anyways.
Does anyone know of something that is missing from the documents, and how to fix the issue?
Thanks.
This is what I did to resolve this issue:
I am going to assume your application name is jason-riis
In CRXDE|Lite create a config folder in /apps/jason-riis/
Now create a node of:
TYPE=sling:OsgiConfig
NAME=com.day.cq.wcm.mobile.core.impl.MobileEmulatorProvider-<*alias>
*alias could be anything, I gave my application name. What it does is it will get you a unique PID when you look at it in configuration Manager
If you go to your configuration manager now, you should be able to see two MobileEmulatorProvider config settings.
Add a node property to node you just created:
NAME=mobile.resourceTypes
TYPE=String[] (you have to click multi at the end of the value textbox)
VALUE=jason-riis/components/<*page>
*page is all the components that has sling:resourceSuperType of foundation/components/page and it is a multi array so it should look like this
jason-riis/components/page, jason-riis/components/widepage, jason-riis/components/newspage
I assume you already have the cq:include for simulation in your header. This makes the devices button appear in preview mode.
Last thing is, go to your website root page's jcr:content [/content/jason-riis/jcr:content] and add node property
NAME=cq:deviceGroups
TYPE=String[]
*VALUE=/etc/mobile/groups/touch, /etc/mobile/groups/smart
*If you go to this etc path in CRXDE|Lite; you will see more relevant information in jcr:content node. This will help you in creating your own custom emulator list.
You should be able to see the dropdown now, with options of iPhone and iPad and all. I know AEM docs are frustrating, let me know if there is any confusion.

Eclipse RCP : how to get currently selected node in preference dialog

I have added a new preference page in my application. and performing some task when user press ok button. problem is my code is executing even other node(preference page) is selected in the preference dialog.now i need to check whether currently selected node is my preference page before executing my code inside ok button. any help will be appreciated.
Sorry to say, but I think your problem have started a bit earlier. If done without too many hooks and nooks, you should only be called when necessary, so it sounds a bit odd to me.
I can usually just override performOk or in some cases performApply without these problems.
Have a look at the docs, just in case

Dynamically loaded javascript doesn't show in sources panel?

For example, I have an ajax request and it returns <script src='buggy.js'></script>.
Problem is, it doesn't show up in sources or resources panel. That means I can't do all the cool stuffs like adding breakpoint and inspecting the elements as they run.
I could only see the source of the js file under the Network panel.
Is there anyway to make chrome add them to the sources panel?
Or how do you guys go about debugging dynamically added scripts?
Using Canary.
I was having the same problem, and I found a workaround that is better than the deliberate exception. It does still require changing the code as opposed to just setting a breakpoint inside the chrome dev tools.
I tried using the "//# sourceURL=dynamicScript.js" that was suggested as a workaround by the OP, but it still wasn't showing up for me unless it already existed in my tabs from a previous time when it produced an exception.
Coding a "debugger;" line forced it to break at that location. Then once it was in my tabs in the Sources panel, I could set breakpoints like normal and remove the "debugger;" line.
Please refer to https://developer.chrome.com/devtools/docs/javascript-debugging#breakpoints-dynamic-javascript
(Original link is broken-- archived link below)
http://web.archive.org/web/20141016164821/https://developer.chrome.com/devtools/docs/javascript-debugging#breakpoints-dynamic-javascript ("Breakpoints in Dynamic JavaScript").