Spaces:
Running
Running
Update flare-ui/src/app/dialogs/version-edit-dialog/version-edit-dialog.component.ts
Browse files
flare-ui/src/app/dialogs/version-edit-dialog/version-edit-dialog.component.ts
CHANGED
@@ -361,6 +361,33 @@ export default class VersionEditDialogComponent implements OnInit {
|
|
361 |
});
|
362 |
}
|
363 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
async saveVersion() {
|
365 |
if (this.versionForm.invalid || !this.selectedVersion) {
|
366 |
this.snackBar.open('Please fix all validation errors', 'Close', { duration: 3000 });
|
|
|
361 |
});
|
362 |
}
|
363 |
|
364 |
+
async loadVersions() {
|
365 |
+
this.loading = true;
|
366 |
+
try {
|
367 |
+
const project = await this.apiService.getProject(this.project.id).toPromise();
|
368 |
+
if (project) {
|
369 |
+
this.project = project;
|
370 |
+
this.versions = project.versions || [];
|
371 |
+
|
372 |
+
// Re-select current version if it still exists
|
373 |
+
if (this.selectedVersion) {
|
374 |
+
const currentVersion = this.versions.find(v => v.id === this.selectedVersion!.id);
|
375 |
+
if (currentVersion) {
|
376 |
+
this.loadVersion(currentVersion);
|
377 |
+
} else if (this.versions.length > 0) {
|
378 |
+
this.loadVersion(this.versions[0]);
|
379 |
+
}
|
380 |
+
} else if (this.versions.length > 0) {
|
381 |
+
this.loadVersion(this.versions[0]);
|
382 |
+
}
|
383 |
+
}
|
384 |
+
} catch (error) {
|
385 |
+
this.snackBar.open('Failed to reload versions', 'Close', { duration: 3000 });
|
386 |
+
} finally {
|
387 |
+
this.loading = false;
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
async saveVersion() {
|
392 |
if (this.versionForm.invalid || !this.selectedVersion) {
|
393 |
this.snackBar.open('Please fix all validation errors', 'Close', { duration: 3000 });
|