Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0a0ff47
build(deps): bump the npm_and_yarn group across 1 directory with 6 up…
dependabot[bot] Apr 3, 2026
c0581e7
feat: add hybrid IndexedDB workspace persistence with migration
avinxshKD Apr 3, 2026
a84bad9
fix(sync): make server conflict resolution explicit
avinxshKD Apr 8, 2026
6fcc084
Merge pull request #382 from ControlCore-Project/dependabot/npm_and_y…
pradeeban Apr 12, 2026
591c8b9
Merge pull request #383 from avinxshKD/fix/indexeddb-workspace-persis…
pradeeban Apr 12, 2026
8002c3b
Merge pull request #385 from avinxshKD/fix/server-sync-conflict-flow
pradeeban Apr 12, 2026
fc6ed01
build(deps): bump the npm_and_yarn group across 1 directory with 7 up…
dependabot[bot] Apr 12, 2026
1f33fe4
Merge branch 'dev' into dependabot/npm_and_yarn/npm_and_yarn-79fa654eaf
pradeeban Apr 15, 2026
c5a6565
Merge pull request #386 from ControlCore-Project/dependabot/npm_and_y…
pradeeban Apr 15, 2026
e2acab0
build(deps): bump the npm_and_yarn group across 1 directory with 7 up…
dependabot[bot] Apr 15, 2026
96755da
Merge pull request #388 from ControlCore-Project/dependabot/npm_and_y…
pradeeban Apr 21, 2026
4d02bf1
build(deps): bump the npm_and_yarn group across 1 directory with 6 up…
dependabot[bot] Apr 23, 2026
fabecb6
Add explicit sync state and status panel
avinxshKD Apr 23, 2026
eccddfd
Merge pull request #391 from avinxshKD/feat/explicit-sync-state-panel
pradeeban Apr 24, 2026
21f2f94
auto-fill Contribute form from active graph metadata
GREENRAT-K405 Apr 24, 2026
941ad35
improve react hygine in contribute details section
GREENRAT-K405 Apr 24, 2026
69c0659
Merge pull request #392 from GREENRAT-K405/feat/autofill-contribute-d…
pradeeban Apr 24, 2026
b19d948
build(deps): bump python-dotenv
dependabot[bot] May 4, 2026
76453ed
Merge pull request #390 from ControlCore-Project/dependabot/npm_and_y…
pradeeban Jul 29, 2026
f66e6fb
Merge pull request #393 from ControlCore-Project/dependabot/pip/serve…
pradeeban Jul 29, 2026
477453d
build(deps): bump the npm_and_yarn group across 1 directory with 18 u…
dependabot[bot] Oct 6, 2026
b709c92
Merge branch 'dev' into dependabot/npm_and_yarn/npm_and_yarn-58edd32aac
pradeeban Nov 2, 2026
10d73b2
fix package-lock
pradeeban Nov 2, 2026
f256c4c
Merge pull request #395 from ControlCore-Project/dependabot/npm_and_y…
pradeeban Nov 2, 2026
e46d571
build(deps): bump the npm_and_yarn group across 1 directory with 17 u…
dependabot[bot] Nov 15, 2026
477b4d5
Merge branch 'dev' into dependabot/npm_and_yarn/npm_and_yarn-7bff1ea0a7
pradeeban Nov 27, 2026
249d0a2
Merge pull request #396 from ControlCore-Project/dependabot/npm_and_y…
pradeeban Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions DEV-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,41 @@ The file open size limit is configured in [src/toolbarActions/toolbarFunctions.j
- `MAX_FILE_SIZE` is derived from it as bytes.

To change the limit, update `MAX_FILE_SIZE_MB` only.

## Workspace persistence (hybrid storage)

Workspace persistence now uses a hybrid model:

- Files/binary artifacts (imports/exports) stay on the browser filesystem path.
- Graph/session metadata is stored in IndexedDB (`concore-editor-storage`) when available.
- Local storage is used as a fallback if IndexedDB is unavailable.

### IndexedDB schema (v1)

- `graphs` store (key: `id`): graph snapshot payloads used by autosave/recovery.
- `meta` store (key: `key`):
- `graph_order`
- `session`
- `author_name`
- `migrated_local_storage_v1`

### Migration behavior

On first successful IndexedDB init, legacy localStorage data is migrated once:

- all graph snapshots from `ALL_GRAPHS`
- session metadata from `SESSION_STATE` (if present)
- author metadata from `AUTHOR_NAME`

### Fallback behavior

If IndexedDB cannot be initialized, the app stays functional with localStorage fallback.
The same public storage manager API is used in both cases.

### Manual verification checklist

1. Open multiple graphs, switch active tab, reload page.
2. Confirm open tabs and active tab are restored.
3. Edit graphs and verify autosave keeps action history.
4. Corrupt one graph record manually and confirm app still loads remaining workspace.
5. Simulate IndexedDB unavailability and verify fallback load/save still works.
684 changes: 395 additions & 289 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"axios": "^1.13.5",
"axios": "^1.20.0",
"buffer": "^6.0.3",
"chokidar": "^3.5.3",
"cytoscape": "^3.19.0",
Expand All @@ -23,7 +23,7 @@
"konva": "^7.0.3",
"lucide-react": "^0.487.0",
"md5": "^2.3.0",
"moment": "^2.29.4",
"moment": "^2.31.0",
"png-chunk-text": "^1.0.0",
"png-chunks-encode": "^1.0.0",
"png-chunks-extract": "^1.0.0",
Expand Down
19 changes: 16 additions & 3 deletions server/controller/workflow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from model.workflows import WorkFlowModel
from flask import request, make_response, Blueprint
from flask import request, make_response, Blueprint, jsonify
import defusedxml.ElementTree as ET

workFlow = Blueprint('workflow', __name__)
Expand All @@ -26,6 +26,15 @@ def getAllActionHash(root):
return list(map(lambda ah: ah.find(f'{{{xmlns}}}hash').text, root.find(f'{{{xmlns}}}graph').findall(f'{{{xmlns}}}actionHistory')))


def syncConflict(message='Different History'):
return jsonify({'code': 'SYNC_CONFLICT', 'message': message}), 400


def isConflictMessage(message):
msg = (message or '').lower()
return 'latest changes' in msg or 'different history' in msg


@workFlow.route("/", methods=['POST'])
def postWorkflow():
try:
Expand All @@ -45,7 +54,7 @@ def getWorkflow(serverID):
latestHash = request.headers['X-Latest-Hash']
allHash = getAllActionHash(ET.fromstring(graphml))
if(latestHash not in allHash):
return 'Different History', 400
return syncConflict()
r = make_response(graphml)
r.headers.set('Content-Type', "application/xml")
return r
Expand All @@ -67,4 +76,8 @@ def updateWorkflow(serverID):
res = workFlowModel.forceUpdate(serverID, graphML, latestHash)
else:
res = workFlowModel.update(serverID, graphML, latestHash, allHash)
return res[1], 200 if res[0] else 400
if res[0]:
return res[1], 200
if isConflictMessage(res[1]):
return syncConflict(res[1])
return res[1], 400
2 changes: 1 addition & 1 deletion server/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dnspython==2.6.1
Flask==3.1.3
python-dotenv==0.19.0
python-dotenv==1.2.2
pymongo==4.6.3
gunicorn==23.0.0
flask-cors==6.0.0
Expand Down
21 changes: 20 additions & 1 deletion server/tests/test_workflow_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ def forceUpdate(self, serverID, graphml, latestHash):
return (True, latestHash)


class FakeWorkFlowModelUpdateMissing(FakeWorkFlowModel):
def update(self, serverID, graphml, latestHash, allHash):
return (False, 'serverID do not exists.')


class WorkflowControllerTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
Expand Down Expand Up @@ -62,6 +67,12 @@ def make_client(self, graph_response):
app.register_blueprint(self.workflow_module.workFlow, url_prefix='/workflow')
return app.test_client()

def make_client_with_model(self, model):
self.workflow_module.workFlowModel = model
app = Flask(__name__)
app.register_blueprint(self.workflow_module.workFlow, url_prefix='/workflow')
return app.test_client()

def test_missing_workflow_returns_404_for_none(self):
client = self.make_client(None)
response = client.get('/workflow/missing-id')
Expand All @@ -78,7 +89,8 @@ def test_hash_header_returns_400_for_different_history(self):
client = self.make_client(VALID_GRAPHML)
response = client.get('/workflow/existing-id', headers={'X-Latest-Hash': 'unknown-hash'})
self.assertEqual(response.status_code, 400)
self.assertEqual(response.get_data(as_text=True), 'Different History')
self.assertEqual(response.get_json()['code'], 'SYNC_CONFLICT')
self.assertEqual(response.get_json()['message'], 'Different History')

def test_hash_header_returns_200_for_matching_history(self):
client = self.make_client(VALID_GRAPHML)
Expand Down Expand Up @@ -117,6 +129,13 @@ def test_force_update_workflow_returns_200(self):
content_type='application/xml')
self.assertEqual(response.status_code, 200)

def test_update_workflow_non_conflict_error_returns_plain_400(self):
client = self.make_client_with_model(FakeWorkFlowModelUpdateMissing(None))
response = client.post('/workflow/test01', data=VALID_GRAPHML,
content_type='application/xml')
self.assertEqual(response.status_code, 400)
self.assertEqual(response.get_data(as_text=True), 'serverID do not exists.')


if __name__ == '__main__':
unittest.main()
67 changes: 60 additions & 7 deletions src/GraphWorkspace.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import ZoomComp from './component/ZoomSetter';
import ConfirmModal from './component/modals/ConfirmModal';
import SyncStatusPanel from './component/SyncStatusPanel';
import SearchPanel from './component/SearchPanel';
import { actionType as T } from './reducer';
import './graphWorkspace.css';
Expand All @@ -13,15 +14,65 @@ const GraphComp = (props) => {
const { dispatcher, superState } = props;

React.useEffect(() => {
const allIDs = localStorageManager.getAllGraphs();
const validIDs = allIDs.filter((id) => typeof id === 'string' && id && localStorageManager.get(id) !== null);
if (validIDs.length !== allIDs.length) {
allIDs.filter((id) => !validIDs.includes(id)).forEach((id) => localStorageManager.remove(id));
}
if (validIDs.length === 0) return;
dispatcher({ type: T.ADD_GRAPH_BULK, payload: validIDs.map((graphID) => ({ graphID })) });
let mounted = true;
const restoreWorkspace = async () => {
await localStorageManager.initialize();
if (!mounted) return;

const session = localStorageManager.getSession();
const allIDs = Array.isArray(session?.openGraphIDs) && session.openGraphIDs.length
? session.openGraphIDs
: localStorageManager.getAllGraphs();
const validIDs = allIDs.filter(
(id) => typeof id === 'string' && id && localStorageManager.get(id) !== null,
);
if (validIDs.length !== allIDs.length) {
allIDs.filter((id) => !validIDs.includes(id)).forEach((id) => localStorageManager.remove(id));
}

if (Array.isArray(session?.fileState)) {
dispatcher({ type: T.SET_FILE_STATE, payload: session.fileState });
}
if (typeof session?.uploadedDirName === 'string') {
dispatcher({ type: T.SET_DIR_NAME, payload: session.uploadedDirName });
}

if (validIDs.length === 0) return;
dispatcher({
type: T.ADD_GRAPH_BULK,
payload: {
graphs: validIDs.map((graphID) => ({ graphID })),
activeGraphID: session?.activeGraphID || null,
},
});
};
restoreWorkspace();

return () => {
mounted = false;
};
}, []);

React.useEffect(() => {
const openGraphIDs = superState.graphs
.map((graph) => graph.graphID)
.filter((graphID) => typeof graphID === 'string' && graphID);
const activeGraphID = superState.curGraphIndex >= 0 && superState.curGraphIndex < superState.graphs.length
? superState.graphs[superState.curGraphIndex].graphID
: null;
localStorageManager.saveSession({
openGraphIDs,
activeGraphID,
fileState: superState.fileState,
uploadedDirName: superState.uploadedDirName,
});
}, [
superState.graphs,
superState.curGraphIndex,
superState.fileState,
superState.uploadedDirName,
]);

// Remote server implementation - Not being used.
// useEffect(() => {
// if (!loadedFromStorage) return;
Expand Down Expand Up @@ -79,11 +130,13 @@ const GraphComp = (props) => {
))}
<SearchPanel superState={superState} dispatcher={dispatcher} />
<ZoomComp dispatcher={dispatcher} superState={superState} />
<SyncStatusPanel superState={superState} />
</div>
<ConfirmModal
isOpen={superState.confirmModal.open}
title="Confirm"
message={superState.confirmModal.message}
actions={superState.confirmModal.actions}
onConfirm={() => {
if (superState.confirmModal.onConfirm) superState.confirmModal.onConfirm();
dispatcher({ type: T.SET_CONFIRM_MODAL, payload: { open: false, message: '', onConfirm: null } });
Expand Down
82 changes: 82 additions & 0 deletions src/component/SyncStatusPanel.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import React from 'react';
import './syncStatusPanel.css';

const stateLabel = {
synced: 'Synced',
dirty: 'Dirty',
conflict: 'Conflict',
syncing: 'Syncing',
error: 'Error',
};

const SyncStatusPanel = ({ superState }) => {
if (superState.curGraphIndex === -1) return null;

const graph = superState.graphs[superState.curGraphIndex];
if (!graph) return null;

const syncStatus = graph.syncStatus || {};
const {
state = 'dirty',
localHash = '',
remoteHash = '',
lastResult = 'Not synced yet',
} = syncStatus;

const instance = superState.curGraphInstance;
const isConflict = state === 'conflict';

return (
<div className="sync-status-panel">
<div className="sync-status-header">
<strong>Sync</strong>
<span className={`sync-status-badge ${state}`}>{stateLabel[state] || state}</span>
</div>
<div className="sync-status-meta">
<div>
<span className="sync-key">Local:</span>
<span className="sync-value">{localHash || '-'}</span>
</div>
<div>
<span className="sync-key">Remote:</span>
<span className="sync-value">{remoteHash || '-'}</span>
</div>
</div>
<div className="sync-status-result">{lastResult}</div>
{isConflict && (
<div className="sync-status-actions">
<button
type="button"
className="confirm-btn"
onClick={() => instance && instance.forcePullFromServer()}
>
Pull remote
</button>
<button
type="button"
className="confirm-btn"
onClick={() => instance && instance.forcePushToServer()}
>
Force push local
</button>
<button
type="button"
className="cancel-btn"
onClick={() => instance && instance.openRemoteInNewTab()}
>
Open remote
</button>
<button
type="button"
className="cancel-btn"
onClick={() => instance && instance.cancelSyncConflict()}
>
Cancel
</button>
</div>
)}
</div>
);
};

export default SyncStatusPanel;
4 changes: 4 additions & 0 deletions src/component/fileBrowser.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ const LocalFileBrowser = ({ superState, dispatcher }) => {
}, [superState.fileState]);

const handleSelectFile = (data) => {
if (!data.fileObj) {
toast.info('File handle is not available after reload. Re-open the file/directory.');
return;
}
const fileExtensions = ['exe'];
const fileExt = data.fileObj.name.split('.').pop().toLowerCase();
if (fileExtensions.includes(fileExt)) {
Expand Down
26 changes: 23 additions & 3 deletions src/component/modals/ConfirmModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,34 @@ import ParentModal from './ParentModal';
import './confirmModal.css';

const ConfirmModal = ({
isOpen, title, message, onConfirm, onCancel,
isOpen, title, message, onConfirm, onCancel, actions,
}) => (
<ParentModal ModelOpen={isOpen} closeModal={onCancel} title={title}>
<div className="confirm-modal-content">
<div className="confirm-modal-message">{message}</div>
<div className="confirm-modal-actions">
<button type="button" className="confirm-btn" onClick={onConfirm}>Yes</button>
<button type="button" className="cancel-btn" onClick={onCancel}>No</button>
{
actions && actions.length
? actions.map((action) => (
<button
key={action.label}
type="button"
className={action.className || 'cancel-btn'}
onClick={() => {
if (action.onClick) action.onClick();
onCancel();
}}
>
{action.label}
</button>
))
: (
<>
<button type="button" className="confirm-btn" onClick={onConfirm}>Yes</button>
<button type="button" className="cancel-btn" onClick={onCancel}>No</button>
</>
)
}
</div>
</div>
</ParentModal>
Expand Down
Loading
Loading