diff --git a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx index 33631e31d0..645fd6e7db 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx +++ b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx @@ -16,7 +16,13 @@ import { useService } from '@cloudbeaver/core-di'; import { ITabData, Tab, TabIcon, TabTitle } from '@cloudbeaver/core-ui'; import { CaptureViewContext } from '@cloudbeaver/core-view'; import type { TabHandlerTabComponent } from '@cloudbeaver/plugin-navigation-tabs'; -import { DATA_CONTEXT_SQL_EDITOR_STATE, getSqlEditorName, ISqlEditorTabState, SqlDataSourceService } from '@cloudbeaver/plugin-sql-editor'; +import { + DATA_CONTEXT_SQL_EDITOR_STATE, + ESqlDataSourceFeatures, + getSqlEditorName, + ISqlEditorTabState, + SqlDataSourceService, +} from '@cloudbeaver/plugin-sql-editor'; import { DATA_CONTEXT_SQL_EDITOR_TAB } from './DATA_CONTEXT_SQL_EDITOR_TAB'; import sqlEditorTabStyles from './SqlEditorTab.m.css'; @@ -24,13 +30,13 @@ import sqlEditorTabStyles from './SqlEditorTab.m.css'; export const SqlEditorTab: TabHandlerTabComponent = observer(function SqlEditorTab({ tab, onSelect, onClose, style }) { const viewContext = useContext(CaptureViewContext); const tabMenuContext = useDataContext(viewContext); - + tabMenuContext.set(DATA_CONTEXT_SQL_EDITOR_TAB, true); tabMenuContext.set(DATA_CONTEXT_SQL_EDITOR_STATE, tab.handlerState); - + const sqlDataSourceService = useService(SqlDataSourceService); const connectionInfo = useService(ConnectionInfoResource); - + const translate = useTranslate(); const dataSource = sqlDataSourceService.get(tab.handlerState.editorId); @@ -44,6 +50,7 @@ export const SqlEditorTab: TabHandlerTabComponent = observer const name = getSqlEditorName(tab.handlerState, dataSource, connection); const icon = dataSource?.icon ?? '/icons/sql_script_m.svg'; const saved = dataSource?.isSaved !== false; + const isScript = dataSource?.hasFeature(ESqlDataSourceFeatures.script); const isReadonly = Boolean(dataSource?.isReadonly()); const hasUnsavedMark = !saved && !isReadonly; @@ -54,7 +61,9 @@ export const SqlEditorTab: TabHandlerTabComponent = observer {name} - {isReadonly && } + {isReadonly && isScript && ( + + )} {hasUnsavedMark && } , );