@finos/legend-application-studio 20.0.7 → 20.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,6 +31,7 @@ import {
31
31
  assertErrorThrown,
32
32
  guaranteeNonNullable,
33
33
  hashArray,
34
+ ActionState,
34
35
  } from '@finos/legend-shared';
35
36
  import type { EditorSDLCState } from '../EditorSDLCState.js';
36
37
  import {
@@ -123,28 +124,28 @@ export class ProjectConfigurationEditorState extends EditorState {
123
124
  latestProjectStructureVersion: ProjectStructureVersion | undefined;
124
125
  dependencyInfo: ProjectDependencyInfo | undefined;
125
126
  dependencyInfoModalType: DEPENDENCY_INFO_TYPE | undefined;
126
- isUpdatingConfiguration = false;
127
- isQueryingProjects = false;
127
+ fetchingDependencyInfoState = ActionState.create();
128
+ updatingConfigurationState = ActionState.create();
129
+ fetchingProjectVersionsState = ActionState.create();
128
130
  associatedProjectsAndVersionsFetched = false;
129
- isFetchingAssociatedProjectsAndVersions = false;
130
131
 
131
132
  constructor(editorStore: EditorStore, sdlcState: EditorSDLCState) {
132
133
  super(editorStore);
133
134
 
134
135
  makeObservable(this, {
135
136
  originalProjectConfiguration: observable,
136
- isUpdatingConfiguration: observable,
137
+ updatingConfigurationState: observable,
137
138
  projectConfiguration: observable,
138
139
  selectedTab: observable,
139
140
  isReadOnly: observable,
140
141
  projects: observable,
141
142
  queryHistory: observable,
142
- isQueryingProjects: observable,
143
143
  associatedProjectsAndVersionsFetched: observable,
144
- isFetchingAssociatedProjectsAndVersions: observable,
144
+ fetchingProjectVersionsState: observable,
145
145
  latestProjectStructureVersion: observable,
146
146
  dependencyInfo: observable,
147
147
  dependencyInfoModalType: observable,
148
+ fetchingDependencyInfoState: observable,
148
149
  originalConfig: computed,
149
150
  setOriginalProjectConfiguration: action,
150
151
  setProjectConfiguration: action,
@@ -208,7 +209,7 @@ export class ProjectConfigurationEditorState extends EditorState {
208
209
  }
209
210
 
210
211
  *fectchAssociatedProjectsAndVersions(): GeneratorFn<void> {
211
- this.isFetchingAssociatedProjectsAndVersions = true;
212
+ this.fetchingProjectVersionsState.inProgress();
212
213
  try {
213
214
  (
214
215
  (yield this.editorStore.depotServerClient.getProjects()) as PlainObject<ProjectData>[]
@@ -244,12 +245,13 @@ export class ProjectConfigurationEditorState extends EditorState {
244
245
  `Can't get project dependencies data. Error:\n${error.message}`,
245
246
  );
246
247
  } finally {
247
- this.isFetchingAssociatedProjectsAndVersions = false;
248
+ this.fetchingProjectVersionsState.complete();
248
249
  }
249
250
  }
250
251
 
251
252
  *fetchDependencyInfo(): GeneratorFn<void> {
252
253
  try {
254
+ this.fetchingDependencyInfoState.inProgress();
253
255
  this.dependencyInfo = undefined;
254
256
  if (this.projectConfiguration?.projectDependencies) {
255
257
  const dependencyCoordinates = (yield flowResult(
@@ -268,8 +270,10 @@ export class ProjectConfigurationEditorState extends EditorState {
268
270
  } else {
269
271
  this.dependencyInfo = new ProjectDependencyInfo();
270
272
  }
273
+ this.fetchingDependencyInfoState.complete();
271
274
  } catch (error) {
272
275
  assertErrorThrown(error);
276
+ this.fetchingDependencyInfoState.fail();
273
277
  this.dependencyInfo = undefined;
274
278
  this.editorStore.applicationStore.log.error(
275
279
  LogEvent.create(LEGEND_STUDIO_APP_EVENT.DEPOT_MANAGER_FAILURE),
@@ -282,7 +286,7 @@ export class ProjectConfigurationEditorState extends EditorState {
282
286
  updateConfigurationCommand: UpdateProjectConfigurationCommand,
283
287
  ): GeneratorFn<void> {
284
288
  try {
285
- this.isUpdatingConfiguration = true;
289
+ this.updatingConfigurationState.inProgress();
286
290
  yield this.editorStore.sdlcServerClient.updateConfiguration(
287
291
  this.editorStore.sdlcState.activeProject.projectId,
288
292
  this.editorStore.sdlcState.activeWorkspace,
@@ -317,7 +321,7 @@ export class ProjectConfigurationEditorState extends EditorState {
317
321
  );
318
322
  this.editorStore.applicationStore.notifyError(error);
319
323
  } finally {
320
- this.isUpdatingConfiguration = false;
324
+ this.updatingConfigurationState.complete();
321
325
  }
322
326
  }
323
327
 
@@ -345,7 +349,7 @@ export class ProjectConfigurationEditorState extends EditorState {
345
349
  // TODO: we will probably need to remove this in the future when we have a better strategy for change detection and persistence of project config
346
350
  // See https://github.com/finos/legend-studio/issues/952
347
351
  *updateConfigs(): GeneratorFn<void> {
348
- this.isUpdatingConfiguration = true;
352
+ this.updatingConfigurationState.inProgress();
349
353
  this.editorStore.applicationStore.setBlockingAlert({
350
354
  message: `Updating project configuration...`,
351
355
  prompt: `Please do not reload the application`,
@@ -395,7 +399,7 @@ export class ProjectConfigurationEditorState extends EditorState {
395
399
  );
396
400
  this.editorStore.applicationStore.notifyError(error);
397
401
  } finally {
398
- this.isUpdatingConfiguration = false;
402
+ this.updatingConfigurationState.complete();
399
403
  this.editorStore.applicationStore.setBlockingAlert(undefined);
400
404
  }
401
405
  }