How to add a button to the window that appears when hashtag is focused
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)
```
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: 'IM Button',
icon: './../img/square.svg',
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)
```
#
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: 'IM Button',
icon: './../img/square.svg',
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)
```