appdevdesigns / appdev-opsportal

(plugin) A portal that allows us to plug in common operational tools.
GNU General Public License v3.0
0 stars 7 forks source link

App Builder questions #159

Open appdevdesigns opened 8 years ago

appdevdesigns commented 8 years ago

A

When a new object is created, it is immediately saved to the DB on the server. When a new column is created, it is not saved immediately but cached in local storage instead. What's the reasoning for this?

B

When columns are cached in local storage, they are given temp IDs as the primary key. For columns that link to objects, the temp ID of the linked column is also stored into the setting.linkVia property.

  1. Would it be easier to just save the column to the server first, and then use the real ID instead of generating a temp ID?
  2. Since we are using temp IDs, does it resolve all the temp IDs into real IDs when it saves to the server? Does that include the setting.linkVia property? And if so, where is the code that does this?

C

There are multiple places where columns get saved. It seems like the same column gets saved twice sometimes.

BuildApp/controllers/ObjectWorkspace.js :: showTable() :: registerSaveFieldEvent():

BuildApp/controllers/ObjectPage.js :: syncObjectFields(): BuildApp/controllers/ObjectPage.js :: createLinkColumn():

wongpratan commented 8 years ago

A

When a new object is created, it is immediately saved to the DB on the server. When a new column is created, it is not saved immediately but cached in local storage instead. What's the reasoning for this?

Previously, I intended to allow users insert/update columns when system is synchronizing (without lock loading screen). And ABColumn data are used in Interface components too. If we save immediately ABColumn data, then all components can render columns that are not synchronized.

B

When columns are cached in local storage, they are given temp IDs as the primary key. For columns that link to objects, the temp ID of the linked column is also stored into the setting.linkVia property.

  1. Would it be easier to just save the column to the server first, and then use the real ID instead of generating a temp ID?

Yes, It is easier to save columns data. But I have to add a new flag to mark the columns are synced or not. When users add new record of objects. It decides which save to database or cache them.

  1. Since we are using temp IDs, does it resolve all the temp IDs into real IDs when it saves to the server? Does that include the setting.linkVia property?

Yes, It does.

And if so, where is the code that does this?

In assets/opstools/AppBuilder/controllers/ObjectPage.js, at syncObjectFields function

At the moment, we uses the lock loading screen when system is syncing. The column caching is not necessary. So, I think it better and makes less complicated. I created a issue (https://github.com/appdevdesigns/appdev-opsportal/issues/160), then I'm going to change it.