Skip to content

Commit

Permalink
Migrate Status and Event to Universal API #2160
Browse files Browse the repository at this point in the history
  • Loading branch information
anatol-sialitski committed Nov 15, 2024
1 parent 46097fa commit 5d946ad
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/main/resources/admin/tools/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ function getConfigAsJson() {
application: app.name,
api: 'i18n',
}),
}
},
eventApiUrl: portal.apiUrl({
application: 'admin',
api: 'event',
}),
statusApiUrl: portal.apiUrl({
application: 'admin',
api: 'status',
}),
}, null, 4).replace(/<(\/?script|!--)/gi, "\\u003C$1");
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/admin/tools/main/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
<api>permissionReport</api>
<api>com.enonic.xp.app.main:launcher</api>
<api>com.enonic.xp.app.main:i18n</api>
<api>admin:status</api>
<api>admin:event</api>
</apis>
</tool>
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {UsersServerEventsTranslator} from './UsersServerEventsTranslator';
export class UsersServerEventsListener
extends ServerEventsListener {

constructor(applications: Application[]) {
super(applications);
constructor(applications: Application[], eventApiUrl: string) {
super(applications, eventApiUrl);

this.setServerEventsTranslator(new UsersServerEventsTranslator());
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/js/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function getApplication(): Application {
function startLostConnectionDetector() {
ConnectionDetector.get()
.setAuthenticated(true)
.setStatusUrl(CONFIG.getString('statusApiUrl'))
.setSessionExpireRedirectUrl(CONFIG.getString('toolUri'))
.setNotificationMessage(i18n('notify.connection.loss'))
.startPolling(true);
Expand All @@ -65,7 +66,7 @@ function startApplication() {
new ChangeUserPasswordDialog();
application.setLoaded(true);

const serverEventsListener = new UsersServerEventsListener([application]);
const serverEventsListener = new UsersServerEventsListener([application], CONFIG.getString('eventApiUrl'));
serverEventsListener.start();

startLostConnectionDetector();
Expand Down

0 comments on commit 5d946ad

Please sign in to comment.