Fixing terminal tab to display correct API type for network warning (#1747)

This commit is contained in:
vchske 2024-02-16 16:22:24 -08:00 committed by GitHub
parent f87611a39d
commit 5d80ecb462
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,6 +34,7 @@ class NotebookTerminalComponentAdapter implements ReactAdapter {
private getTabId: () => string, private getTabId: () => string,
private getUsername: () => string, private getUsername: () => string,
private isAllPublicIPAddressesEnabled: ko.Observable<boolean>, private isAllPublicIPAddressesEnabled: ko.Observable<boolean>,
private kind: ViewModels.TerminalKind,
) {} ) {}
public renderComponent(): JSX.Element { public renderComponent(): JSX.Element {
@ -42,7 +43,7 @@ class NotebookTerminalComponentAdapter implements ReactAdapter {
<QuickstartFirewallNotification <QuickstartFirewallNotification
messageType={MessageTypes.OpenPostgresNetworkingBlade} messageType={MessageTypes.OpenPostgresNetworkingBlade}
screenshot={FirewallRuleScreenshot} screenshot={FirewallRuleScreenshot}
shellName="PostgreSQL" shellName={this.getShellNameForDisplay(this.kind)}
/> />
); );
} }
@ -58,6 +59,18 @@ class NotebookTerminalComponentAdapter implements ReactAdapter {
<Spinner styles={{ root: { marginTop: 10 } }} size={SpinnerSize.large}></Spinner> <Spinner styles={{ root: { marginTop: 10 } }} size={SpinnerSize.large}></Spinner>
); );
} }
private getShellNameForDisplay(terminalKind: ViewModels.TerminalKind): string {
switch (terminalKind) {
case ViewModels.TerminalKind.Postgres:
return "PostgreSQL";
case ViewModels.TerminalKind.Mongo:
case ViewModels.TerminalKind.VCoreMongo:
return "MongoDB";
default:
return "";
}
}
} }
export default class TerminalTab extends TabsBase { export default class TerminalTab extends TabsBase {
@ -76,6 +89,7 @@ export default class TerminalTab extends TabsBase {
() => this.tabId, () => this.tabId,
() => this.getUsername(), () => this.getUsername(),
this.isAllPublicIPAddressesEnabled, this.isAllPublicIPAddressesEnabled,
options.kind,
); );
this.notebookTerminalComponentAdapter.parameters = ko.computed<boolean>(() => { this.notebookTerminalComponentAdapter.parameters = ko.computed<boolean>(() => {
if ( if (