mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
Fix create app failure issue because TJDB is disabled (#9082)
Co-authored-by: Akshay <akshaysasidharan93@gmail.com>
This commit is contained in:
parent
c3d9b29b68
commit
91169cf6a7
2 changed files with 14 additions and 2 deletions
|
|
@ -337,9 +337,20 @@ const ToolJetDbOperations = ({ optionchanged, options, darkMode, isHorizontalLay
|
|||
]
|
||||
);
|
||||
|
||||
const triggerTooljetDBStatus = (key) => {
|
||||
if (window.public_config?.ENABLE_TOOLJET_DB == 'false') {
|
||||
toast('Tooljet database is not connected.', {
|
||||
icon: '⚠️',
|
||||
});
|
||||
} else if (key === 'addTJDBTable') {
|
||||
navigate(getPrivateRoute('database'));
|
||||
}
|
||||
};
|
||||
|
||||
const fetchTables = async () => {
|
||||
const { error, data } = await tooljetDatabaseService.findAll(organizationId);
|
||||
|
||||
triggerTooljetDBStatus();
|
||||
if (error) {
|
||||
toast.error(error?.message ?? 'Failed to fetch tables');
|
||||
return;
|
||||
|
|
@ -495,7 +506,7 @@ const ToolJetDbOperations = ({ optionchanged, options, darkMode, isHorizontalLay
|
|||
onChange={(value) => {
|
||||
value?.value && handleTableNameSelect(value?.value);
|
||||
}}
|
||||
onAdd={() => navigate(getPrivateRoute('database'))}
|
||||
onAdd={() => triggerTooljetDBStatus('addTJDBTable')}
|
||||
addBtnLabel={'Add new table'}
|
||||
value={generateListForDropdown(tables).find((val) => val?.value === selectedTableId)}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -53,8 +53,9 @@ export class ImportExportResourcesService {
|
|||
let tableNameMapping = {};
|
||||
const imports = { app: [], tooljet_database: [] };
|
||||
const importingVersion = importResourcesDto.tooljet_version;
|
||||
const isTJDBEnabled = process.env.ENABLE_TOOLJET_DB === 'true';
|
||||
|
||||
if (importResourcesDto.tooljet_database) {
|
||||
if (isTJDBEnabled && importResourcesDto.tooljet_database) {
|
||||
const res = await this.tooljetDbImportExportService.bulkImport(importResourcesDto, importingVersion, cloning);
|
||||
tableNameMapping = res.tableNameMapping;
|
||||
imports.tooljet_database = res.tooljet_database;
|
||||
|
|
|
|||
Loading…
Reference in a new issue