Azure DevOps extension using React: Can't stop navigating away from the page(beforeunload event) - azure-devops

The azure-devops-extension-sdk has events that can be listened to for work items like onLoaded, onRefreshed, onUnloaded etc. But there's no event to listen to while the web page itself is being refreshed(navigating away). I need to stop the navigation action in case there are unsaved changes in my custom UI element. Azure DevOps does this inherently only in those cases where a standard backend field is used. My custom UI element (installed using an extension I developed) doesn't use any backend fields.
window.addEventListener function doesn't seem to work and neither did the window.beforeunload function.

Seems you are using a hub extension. We could not use the window.beforeunload event of the browser which is not working in the case of an extension because it is running in an iframe.
After go through azure-devops-extension-api, didn't find any related interface. Afraid this is not available for a customized extension right now.

Related

How to add extension to apigee-emulator on local environment?

Recently we get the need for work on the same apigee proxy more than one developer. So we are trying to use the apigee-emulator to allow us to use git as version control
We already have everything setup for VScode as it says on the documentation.
The problem is with an `extension callout we have inside one of our proxies that we need to access to salesforce. When we try to push our proxies to the apigee-emulator we get this error
If we search for the callout we can see it's the one that try to access to salesforce
How can we add this extension to be used inside the apigee-emulator?
From the error it looks like you are using Apigee Edge ExtensionCallout policy.
The vscode extension and the emulator cater towards the features available in the X and hybrid versions of Apigee. More information here
The extensions feature you are using has been replaced by the Integration callout policy.
Hope that helps

Drag and Drop Behavior on Chrome DevTools Protocol

I am trying to write a tool that open's a website and interacts with and triggers the drag/drop behavior. I am seeing Input.dragIntercepted, Input.dispatchDragEvent functions in the documentation. But when I use these functions, I am getting a ... is not a function error. Probably, I am not using them in a proper way.
How can I use these functions to trigger drag and drop behavior of the web application? I did not find any example that shows usage of these functions.
First of all, Input.dragIntercepted really isn't a function. It's an event that will be fired, but only if you enable it, using Input.setInterceptDrags with enable set as true.
This is documented both here and here.

Google Actions CLI 3.1.0 version and actions.intent.TEXT

I want to be able to talk with Google Assistant, but connect the Actions project directly to an NLP service I already have running on my server. In other words, NOT use dialogflow.
All the following examples show how to do this.
With Rasa
https://blog.rasa.com/going-beyond-hey-google-building-a-rasa-powered-google-assistant/
With LUIS
https://www.grokkingandroid.com/using-the-actions-sdk/
https://dzone.com/articles/using-the-actions-sdk-for-google-assistant-develop
With Watson
https://www.youtube.com/watch?v=no0R0bSkHXc
They use the actions.intent.MAIN as the invocation and actions.intent.TEXT for all other utterances from the talker.
This is what I need. I don’t want to create a load of intents, with utterance phrases, inside the Action because I just want all the phrases spoken by the talker to be passed to my server, and for my NLP service to deal with them.
So I set up a new Action project, install the Actions CLI and then spend 3 days trying all possible combinations without success, because all these examples are using gactions cli 2.1.3 and Google have now moved on to gactions cli 3.1.0.
Not only have the commands changed, but so too has the file formats and structure.
It appears there is also a new Google Actions Console, and actions.intent.TEXT is no longer available.
My Action is webhook connected to my server, but I cannot figure out how to get the action.intent.TEXT included and working.
Everything I find, even here
Publishing Actions on google without Dialogflow
is pre version update and follows the same pattern.
Can anyone point to an up-to-date, v3.1.0, discussion, tutorial or example about how to send all talker phrases through to an NLP that isn’t dialogflow, or has Google closed that avenue?
Is it possible to somehow go back and use the 2.1 CLI either with the new Console or revert the console back. (I have both CLI versions, I can see how different their commands are)
Is it possible to go back and use 2.1?
There is no way to go back to AoG 2. You probably also don't want to do so - newer features aren't available with v2 and are only available with v3.
Can I use my own NLP with v3?
Yes, although it isn't as obvious, and there are some changes in semantics.
As an overview, what you'll need to do is:
Create a Type that can accept "Free form text". I usually call this type "Any".
In the console, it looks something like this:
Create a Custom Intent that has a single parameter of this Any Type and at least one phrase that captures everything for this parameter. (So you should add one training phrase, highlight the entire phrase, and set it for the parameter. Sometimes I also add additional phrases that includes words that I don't want to capture.) I usually call the Intent "matchAny" and the parameter "any".
In the console, it could be something like this:
Finally, you'll have a Scene that you transition to from the Main invocation. When it matches the "matchAny" Intent, it should call your webhook with a handler name. Your webhook will be called with the "any" parameter set with the user utterance. (Note that the JSON has also changed.
Again, the console might have it looking something like this:
That seems like a lot of work. Isn't there just some way to do all that from the command line?
Yes. You can do all of that in the configuration files that the CLI accesses and then upload it. (You can then also use the console to review the configuration, if necessary, to make sure they're configured as you expect. You can shift back and forth between them as appropriate.)
Google also has a github repository that contains most of the files pre-configured for this sort of setup.
You will need to update the configuration from the repository to handle the webhook correctly (it includes code to illustrate what is happening using the inline code editor) and to add your project ID.

Create new work item type using VSTS Extension

Based on the documentation https://learn.microsoft.com/en-us/vsts/extend/overview?view=vsts#what-makes-up-an-extension, a VSTS extension can be used to extend the work item form.
However, I would like my extension to automatically create a new work item type once it is installed. Is this something that is possible? I can't find any documentation online that suggests how to do it.
Theoretically this is possible, the extension has a "first load" call which you can use to use the rest api to create a custom process or update the existing custom process. The REST Api to change processes isn't public yet, so you'll have to work from using fiddler to watch how the web ui does it.
Due to the way processes are linked to projects, all projects with that process will get the new work item type.
I could not find a lot of documentation online for this, but the VSS web extensions SDK(https://www.npmjs.com/package/vss-web-extension-sdk) has a REST client called 'ProcessDefinitionsRestClient' declared in the typings/tfs.d.ts file. This client has a createWorkItemType method available that looks like this:
createWorkItemType(workItemType: ProcessDefinitionsContracts.WorkItemTypeModel, processId: string): IPromise<ProcessDefinitionsContracts.WorkItemTypeModel>;.
The 'ProcessRestClient' client has methods to create a new/inherited process to which the new WIT can be added.
I have not tried it out yet, and these APIs are still in preview, but maybe they can get you started on the right path.

Joomla! 2.5+: Abuse a system plugin to create an URI addressable view

As it is fairly simple to create frontend views into the content area using Joomla!'s component infrastructure and a menu item, I wonder if it is not possible to abuse a system plugin to achive the same goal. Reason: keep the code slim (A plugin can consist only of two files.)
Suppose having mydomain.com/myuri, the system plugin should catch myuri, than override the content by a special content using onAfterRender.
My approach is to set some class variable within the derived plugin class to true, if the URI was hit. How can this be done, and which onEvent should be used?