Please review the new App Developer Kit guide on how to build a basic extension app with added buttons and handlers.
https://docs.developers.symphony.com/dev-tools/app-developer-kit/build-a-basic-extension-app
Answered
How to add a button to the window that appears when hashtag is focused
To add a button when the mouse cursor is focused on a hashtag, I created an Extension app with the command yo @finos/symphony
and changed the following code snippet in controller.js.
I have not modified any files other than controller.js.
But when I launch the symphony app and focus the mouse cursor on the hashtag, the button is not added.
I would like to know the cause of this problem.
let appControllerService = SYMPHONY.services.register("app:controller")
let navService
let appId = 'test-extension'
let authenticate = () => {
return $.post({
url: '/bdk/v1/app/auth',
success: res => $.when(res)
})
}
let register = data => {
let appToken = data["appToken"]
return SYMPHONY.application.register(
{
appId: appId,
tokenA: data["appToken"]
},
['modules', 'applications-nav', 'extended-user-info'],
['app:controller']
).then(res => {
res["tokenA"] = appToken
let modulesService = SYMPHONY.services.subscribe("modules")
let uiService = SYMPHONY.services.subscribe('ui');
uiService.registerExtension(
'hashtag',
'hello-im',
"app:controller",
{
label: 'hashtag Button',
data: {}
}
);
navService = SYMPHONY.services.subscribe("applications-nav")
navService.add('show-module', 'test-extension-app', 'app:controller')
appControllerService.implement({
select: id => {
if (id === 'show-module') {
modulesService.show("test-app", {title: "test-extension-app"}, "app:controller", "https://localhost:10443/app.html")
}
},
trigger: function(uiClass, id, payload, data) {
if (uiClass == "hashtag") {
console.log('hashtag button was registered on ' + data.datetime + '.');
}
}
})
return $.when(res)
})
}
SYMPHONY.remote.hello()
.then(authenticate)
.then(register)
9K Views
1
Answer
one year ago
one year ago