Skip to content

Commit b31423a

Browse files
authored
Merge pull request #59 from vitruv-tools/refactor-api-vsum
Refactor api vsum
2 parents 9bcccb4 + bb7a01a commit b31423a

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

src/components/ui/SidebarTabs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ export const SidebarTabs: React.FC<SidebarTabsProps> = ({ width = 350, showBorde
4747
onMouseLeave={(e) => { if (active !== 'mml') Object.assign(e.currentTarget.style, tabBase); }}
4848
onClick={() => navigate('/mml')}
4949
>
50-
MML
50+
Meta Model
5151
</button>
5252
<button
5353
style={{ ...tabBase, ...(active === 'project' ? activeTab : {}) }}
5454
onMouseEnter={(e) => { if (active !== 'project') Object.assign(e.currentTarget.style, inactiveTabHover); }}
5555
onMouseLeave={(e) => { if (active !== 'project') Object.assign(e.currentTarget.style, tabBase); }}
5656
onClick={() => navigate('/project')}
5757
>
58-
Project
58+
Projects
5959
</button>
6060
</div>
6161
<div style={{ borderTop: '1px solid #e5e7eb', height: '100%', overflow: 'hidden' }}>

src/components/ui/VsumDetailsModal.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ export const VsumDetailsModal: React.FC<Props> = ({ isOpen, vsumId, onClose, onS
7676
setSaving(true);
7777
setError('');
7878
try {
79-
const currentMetaModelIds = (details.metaModels || []).map(m => m.id);
80-
await apiService.updateVsum(vsumId, { name: name.trim(), metaModelIds: currentMetaModelIds });
79+
await apiService.renameVsum(vsumId, { name: name.trim() });
8180
onSaved?.();
8281
onClose();
8382
} catch (e: any) {

src/components/ui/VsumsPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const VsumsPanel: React.FC = () => {
135135

136136
return (
137137
<div style={containerStyle}>
138-
<div style={titleStyle}>vSUMS</div>
138+
<div style={titleStyle}>Projects</div>
139139

140140
<CreateVsumModal
141141
isOpen={showCreate}
@@ -154,7 +154,7 @@ export const VsumsPanel: React.FC = () => {
154154
Create
155155
</button>
156156

157-
<div style={sectionStyle}>All vSUMs</div>
157+
<div style={sectionStyle}>All</div>
158158

159159
{loading && <div style={{ padding: 12, fontStyle: 'italic', color: '#5a6c7d' }}>Loading...</div>}
160160
{!loading && sorted.length === 0 && (

src/services/api.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,31 @@ class ApiService {
413413
});
414414
}
415415

416+
// inside ApiService class
417+
async renameVsum(id: number | string, data: { name: string }): Promise<ApiResponse<any>> {
418+
return this.authenticatedRequest(`/api/v1/vsums/${id}`, {
419+
method: 'PUT',
420+
body: JSON.stringify(data),
421+
});
422+
}
423+
424+
/**
425+
* vSUMS: Sync changes with relationship data
426+
*/
427+
async syncVsumChanges(id: number | string, data: {
428+
metaModelIds: number[];
429+
metaModelRelationRequests: Array<{
430+
sourceId: number;
431+
targetId: number;
432+
reactionFileId: number;
433+
}>;
434+
}): Promise<ApiResponse<any>> {
435+
return this.authenticatedRequest(`/api/v1/vsums/${id}/sync-changes`, {
436+
method: 'PUT',
437+
body: JSON.stringify(data),
438+
});
439+
}
440+
416441
/**
417442
* vSUMS: Get details
418443
*/
@@ -517,4 +542,5 @@ export interface UserSearchItem {
517542
firstName?: string;
518543
lastName?: string;
519544
email: string;
520-
}
545+
}
546+

0 commit comments

Comments
 (0)