Skip to content

Commit

Permalink
dbeaver/pro#2589 Project reference fix (#2460)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadelessFox authored Mar 12, 2024
1 parent e13368d commit b736de0
Showing 1 changed file with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
import io.cloudbeaver.model.session.WebSession;
import io.cloudbeaver.server.CBApplication;
import io.cloudbeaver.server.CBPlatform;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.app.DBPPlatform;
import org.jkiss.dbeaver.model.app.DBPProject;
import org.jkiss.dbeaver.model.auth.SMSession;
import org.jkiss.dbeaver.model.websocket.event.WSEventType;
import org.jkiss.dbeaver.model.websocket.event.datasource.WSDataSourceEvent;
Expand All @@ -46,22 +48,23 @@ public WebDataSourceMonitorJob(DBPPlatform platform) {
protected void doJob() {
Collection<BaseWebSession> allSessions = CBPlatform.getInstance().getSessionManager().getAllActiveSessions();
allSessions.parallelStream().forEach(s -> {
checkDataSourceAliveInWorkspace(s.getWorkspace(), s::getLastAccessTimeMillis);
checkDataSourceAliveInWorkspace(s.getWorkspace(), s.getLastAccessTimeMillis());
});

}

@Override
public void showNotification(DBPDataSource dataSource, DBPDataSourceContainer dsDescriptor, SMSession smSession) {
if (smSession instanceof WebSession webSession) {
webSession.addSessionEvent( //TODO: Add new event for disconnect datasource
WSDataSourceEvent.update(
webSession.getSessionId(),
webSession.getUserId(),
dsDescriptor.getProject().getId(),
List.of(dsDescriptor.getId()),
WSDataSourceProperty.CONFIGURATION)
);
protected void showNotification(@NotNull DBPDataSource dataSource) {
final DBPProject project = dataSource.getContainer().getProject();
if (project.getWorkspaceSession() instanceof WebSession webSession) {
// TODO: Add new event for disconnect datasource
webSession.addSessionEvent(WSDataSourceEvent.update(
webSession.getSessionId(),
webSession.getUserId(),
project.getId(),
List.of(dataSource.getContainer().getId()),
WSDataSourceProperty.CONFIGURATION
));
}
}
}

0 comments on commit b736de0

Please sign in to comment.