Skip to content

Commit

Permalink
Revert "Add sign-out event handling and panel HTML refresh for CloudP…
Browse files Browse the repository at this point in the history
…anel (#1789)"

This reverts commit e9cf5b9.
  • Loading branch information
sourishkrout committed Nov 20, 2024
1 parent fe23039 commit 0f76025
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 44 deletions.
4 changes: 0 additions & 4 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,6 @@ export class RunmeExtension {
} else {
const settingsDefault = getServerLifecycleIdentity()
await commands.executeCommand('runme.lifecycleIdentitySelection', settingsDefault)
kernel.emitPanelEvent('runme.cloud', 'onCommand', {
name: 'signOut',
panelId: 'runme.cloud',
})
}
kernel.updateFeatureContext('statefulAuth', !!session)
})
Expand Down
16 changes: 0 additions & 16 deletions src/extension/kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
type ExtensionName,
type FeatureContext,
FeatureName,
SyncSchema,
} from '../types'
import {
ClientMessages,
Expand Down Expand Up @@ -244,21 +243,6 @@ export class Kernel implements Disposable {
return getEnvProps(ext)
}

emitPanelEvent<K extends keyof SyncSchema>(
panelId: string,
eventName: K,
payload: SyncSchema[K],
) {
const panel = this.panelManager.getPanel(panelId)

if (!panel) {
log.error(`Panel ${panelId} not found`)
return
}

panel.getBus()?.emit(eventName, payload)
}

useMonitor() {
return this.monitor$.asObservable()
}
Expand Down
27 changes: 3 additions & 24 deletions src/extension/panels/cloud.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { ExtensionContext, WebviewView, window, ColorThemeKind, Uri, env } from 'vscode'
import { from } from 'rxjs'
import { take, withLatestFrom } from 'rxjs/operators'

import { fetchStaticHtml, resolveAppToken } from '../utils'
import { IAppToken } from '../services/runme'
Expand Down Expand Up @@ -96,11 +94,10 @@ export default class CloudPanel extends TanglePanel {
protected registerSubscribers(bus: SyncSchemaBus) {
return [
bus.on('onCommand', (cmdEvent) => {
if (cmdEvent?.name === 'signIn') {
this.onSignIn(bus)
} else if (cmdEvent?.name === 'signOut') {
this.onSignOut(bus)
if (cmdEvent?.name !== 'signIn') {
return
}
this.onSignIn(bus)
}),
bus.on('onArchiveCell', async (cmdEvent) => {
const answer = await window.showInformationMessage(
Expand Down Expand Up @@ -154,24 +151,6 @@ export default class CloudPanel extends TanglePanel {
try {
const appToken = await this.getAppToken(true)
bus.emit('onAppToken', appToken!)
from(this.getHydratedHtml())
.pipe(withLatestFrom(this.webview), take(1))
.subscribe(([html, recentWebview]) => {
recentWebview.html = html
})
} catch (err: any) {
log.error(err?.message || err)
}
}

private async onSignOut(bus: SyncSchemaBus) {
try {
bus.emit('onAppToken', { token: 'EMPTY' })
from(this.getHydratedHtml())
.pipe(withLatestFrom(this.webview), take(1))
.subscribe(([html, recentWebview]) => {
recentWebview.html = html
})
} catch (err: any) {
log.error(err?.message || err)
}
Expand Down

0 comments on commit 0f76025

Please sign in to comment.