mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
* bump version * Sample data source (#9501) * Added sample data populating script * added expand-collapse in add data soure menu * Sample database * Design changes * Added CTA to buttons and added design changes * Added code sanity fix for some services * changed configration for create sampke db and code sanity fix * Removed logs * Added xlsx in dependency * added migration for sample db * Added loggin for testing * Added await in migration * Replace excel sheet with JSON files * reverted package-lock file * Fixed issues * dependecy deletion * Added schedular * Added changes for bug fixes and typeorm query for creating sample db * Removed color.scss file import * Add logo in sample application * add documentation link for sample db * fixed migration issue for data queries creation * removed sample db intergration * bump version * Remove .env file and code sanity * deleted migration file --------- Co-authored-by: Kritagya <[email protected]> Co-authored-by: Kritagya Kumar <[email protected]> Co-authored-by: kriks7raptor <[email protected]> Co-authored-by: gsmithun4 <[email protected]> * Add data-cy for drag drop empty canvas card (#9513) * Add sample db condition on all components (#9516) * Add sample db condition on all components * Changed empty state for container * Condiiton on sample data source --------- Co-authored-by: kriks7raptor <[email protected]> * Release fix: subpath (#9535) * Add sample db condition on all components * Changed empty state for container * Condiiton on sample data source * fixed subpath issue for workspace setting and folders * Folder change handler in subpath --------- Co-authored-by: kriks7raptor <[email protected]> * fixed version * fixed version * fixed version * update server version * Bump version to v2.39.0 --------- Co-authored-by: kriks7iitk <[email protected]> Co-authored-by: Kritagya <[email protected]> Co-authored-by: Kritagya Kumar <[email protected]> Co-authored-by: kriks7raptor <[email protected]> Co-authored-by: Ajith KV <[email protected]> Co-authored-by: kriks7iitk <[email protected]> Co-authored-by: Adish M <[email protected]> Co-authored-by: Muhsin Shah <[email protected]>
59 lines
2.1 KiB
JavaScript
59 lines
2.1 KiB
JavaScript
import { create, zustandDevTools } from './utils';
|
|
import { datasourceService, globalDatasourceService } from '@/_services';
|
|
import { DATA_SOURCE_TYPE } from '@/_helpers/constants';
|
|
|
|
const initialState = {
|
|
dataSources: [],
|
|
loadingDataSources: true,
|
|
globalDataSources: [],
|
|
sampleDataSource: null,
|
|
globalDataSourceStatus: {
|
|
isSaving: false,
|
|
isEditing: false,
|
|
unSavedModalVisible: false,
|
|
action: null,
|
|
saveAction: null,
|
|
},
|
|
};
|
|
|
|
export const useDataSourcesStore = create(
|
|
zustandDevTools(
|
|
(set, get) => ({
|
|
...initialState,
|
|
actions: {
|
|
fetchDataSources: (appId) => {
|
|
set({ loadingDataSources: true });
|
|
datasourceService.getAll(appId).then((data) => {
|
|
set({
|
|
dataSources: data.data_sources,
|
|
loadingDataSources: false,
|
|
});
|
|
});
|
|
},
|
|
fetchGlobalDataSources: (organizationId) => {
|
|
globalDatasourceService.getAll(organizationId).then((data) => {
|
|
set({
|
|
globalDataSources: data.data_sources?.filter((source) => source?.type != DATA_SOURCE_TYPE.SAMPLE),
|
|
sampleDataSource: data.data_sources?.filter((source) => source?.type == DATA_SOURCE_TYPE.SAMPLE)[0],
|
|
});
|
|
});
|
|
},
|
|
setGlobalDataSourceStatus: (status) =>
|
|
set({
|
|
globalDataSourceStatus: {
|
|
...get().globalDataSourceStatus,
|
|
...status,
|
|
},
|
|
}),
|
|
},
|
|
}),
|
|
{ name: 'Data Source Store' }
|
|
)
|
|
);
|
|
|
|
export const useDataSources = () => useDataSourcesStore((state) => state.dataSources);
|
|
export const useGlobalDataSources = () => useDataSourcesStore((state) => state.globalDataSources);
|
|
export const useSampleDataSource = () => useDataSourcesStore((state) => state.sampleDataSource);
|
|
export const useLoadingDataSources = () => useDataSourcesStore((state) => state.loadingDataSources);
|
|
export const useDataSourcesActions = () => useDataSourcesStore((state) => state.actions);
|
|
export const useGlobalDataSourcesStatus = () => useDataSourcesStore((state) => state.globalDataSourceStatus);
|