-
-
- Current Version
-
-
-
- {versions.length >= 2 ? (
-
-
- Other Versions
-
- {versions.map((version) => {
- if (version.id !== currentVersion?.id) {
- return (
-
- );
+ useEffect(() => {
+ async function fetchAppVersions() {
+ try {
+ const fetchVersions = await appsService.getVersions(app.id);
+ const { versions } = fetchVersions;
+ setVersions(versions);
+ } catch (error) {
+ toast.error('Could not fetch the versions.', {
+ position: 'top-center',
+ });
+ closeModal();
+ }
+ }
+ async function fetchAppTables() {
+ try {
+ const fetchTables = await appsService.getTables(app.id); // this is used to get all tables
+ const { tables } = fetchTables;
+ const tbl = await appsService.getAppByVersion(app.id, versionId) // this is used to get particular App by version
+ const { dataQueries } = tbl
+ const extractedIdData = [];
+ dataQueries.forEach(item => {
+ if (item.kind === "tooljetdb") {
+ const joinOptions = item.options?.join_table?.joins ?? [];
+ (joinOptions || []).forEach((join) => {
+ const { table, conditions } = join;
+ if (table) extractedIdData.push(table);
+ conditions?.conditionsList?.forEach((condition) => {
+ const { leftField, rightField } = condition;
+ if (leftField?.table) {
+ extractedIdData.push(leftField?.table);
+ }
+ if (rightField?.table) {
+ extractedIdData.push(rightField?.table);
+ }
+ });
+ });
}
- })}
-
- ) : (
-
- No other versions found
-
- )}
-
-