Files
Joshen Lim db0e6b761b Joshenlim/fe 4304 bring database connections out of feature preview (#50107)
## Context

As per PR title - we're bringing Database Connections out of feature
preview and it'll live on the dashboard by default 🙂
Also deprecating the existing Ongoing queries panel which Database
Connections now supercedes.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Database Connections is now available without feature-preview
activation.
* The SQL editor’s “View running queries” option now links directly to
Database Connections.

* **Bug Fixes**
* Query cancellation and session termination now refresh database
activity data.

* **Removed**
* Removed the in-editor ongoing queries panel and its termination
controls.
* Removed the Database Connections promotional banner, preview
messaging, settings, and related telemetry.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-08 17:26:24 +08:00

83 lines
2.3 KiB
TypeScript

import { LOCAL_STORAGE_KEYS as COMMON_LOCAL_STORAGE_KEYS, safeLocalStorage } from 'common'
import { type ConnectSheetSource } from 'common/telemetry-constants'
import { proxy, snapshot, useSnapshot } from 'valtio'
const getInitialState = () => {
return {
activeDocsSection: ['introduction'],
docsLanguage: 'js',
showProjectApiDocs: false,
showCreateBranchModal: false,
showAiSettingsModal: false,
mobileMenuOpen: false,
showSidebar: true,
showEditorPanel: false,
lastRouteBeforeVisitingAccountPage: '',
}
}
export const appState = proxy({
...getInitialState(),
activeDocsSection: ['introduction'],
docsLanguage: 'js' as 'js' | 'bash',
showProjectApiDocs: false,
setShowProjectApiDocs: (value: boolean) => {
appState.showProjectApiDocs = value
},
setActiveDocsSection: (value: string[]) => {
appState.activeDocsSection = value
},
setDocsLanguage: (value: 'js' | 'bash') => {
appState.docsLanguage = value
},
isOptedInTelemetry: false,
setIsOptedInTelemetry: (value: boolean | null) => {
appState.isOptedInTelemetry = value === null ? false : value
if (value !== null) {
safeLocalStorage.setItem(COMMON_LOCAL_STORAGE_KEYS.TELEMETRY_CONSENT, value.toString())
}
},
isMfaEnforced: false,
setIsMfaEnforced: (value: boolean) => {
appState.isMfaEnforced = value
},
showCreateBranchModal: false,
setShowCreateBranchModal: (value: boolean) => {
appState.showCreateBranchModal = value
},
showAiSettingsModal: false,
setShowAiSettingsModal: (value: boolean) => {
appState.showAiSettingsModal = value
},
showSidebar: true,
setShowSidebar: (value: boolean) => {
appState.showSidebar = value
},
mobileMenuOpen: false,
setMobileMenuOpen: (value: boolean) => {
appState.mobileMenuOpen = value
},
connectSheetSource: 'header_button' as ConnectSheetSource,
setConnectSheetSource: (value: ConnectSheetSource) => {
appState.connectSheetSource = value
},
lastRouteBeforeVisitingAccountPage: '',
setLastRouteBeforeVisitingAccountPage: (value: string) => {
appState.lastRouteBeforeVisitingAccountPage = value
},
})
export const getAppStateSnapshot = () => snapshot(appState)
export const useAppStateSnapshot = (options?: Parameters<typeof useSnapshot>[1]) =>
useSnapshot(appState, options)