Skip to content

Commit a0ddc81

Browse files
authored
fix(ang-905): fixed create component affiliations issue (#547)
1 parent 3a13cd7 commit a0ddc81

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
<input pInputText id="component-title" type="text" [formControlName]="ComponentFormControls.Title" />
77
</div>
88

9-
@if (currentProject()?.affiliatedInstitutions?.length) {
9+
@if (areUserInstitutionsLoading() || userInstitutions().length) {
1010
<div>
11-
<h3 class="font-normal mb-2">
11+
<h3 class="font-normal mbx-2">
1212
{{ 'myProjects.createProject.affiliation.title' | translate }}
1313
</h3>
1414

1515
<osf-affiliated-institution-select
16-
[institutions]="currentProject()?.affiliatedInstitutions || []"
17-
[selectedInstitutions]="currentProject()?.affiliatedInstitutions || []"
16+
[institutions]="userInstitutions()"
17+
[selectedInstitutions]="userInstitutions()"
18+
[isLoading]="areUserInstitutionsLoading()"
1819
(selectedInstitutionsChange)="setSelectedInstitutions($event)"
1920
/>
2021
</div>

src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { CustomValidators } from '@osf/shared/helpers';
2020
import { ComponentForm, Institution } from '@osf/shared/models';
2121
import { ToastService } from '@osf/shared/services';
2222
import { FetchRegions, RegionsSelectors } from '@osf/shared/stores';
23+
import { FetchUserInstitutions, InstitutionsSelectors } from '@osf/shared/stores/institutions';
2324

2425
import { CreateComponent, GetComponents, ProjectOverviewSelectors } from '../../store';
2526

@@ -51,11 +52,14 @@ export class AddComponentDialogComponent implements OnInit {
5152
currentProject = select(ProjectOverviewSelectors.getProject);
5253
areRegionsLoading = select(RegionsSelectors.areRegionsLoading);
5354
isSubmitting = select(ProjectOverviewSelectors.getComponentsSubmitting);
55+
userInstitutions = select(InstitutionsSelectors.getUserInstitutions);
56+
areUserInstitutionsLoading = select(InstitutionsSelectors.areUserInstitutionsLoading);
5457

5558
actions = createDispatchMap({
5659
createComponent: CreateComponent,
5760
getComponents: GetComponents,
5861
getRegions: FetchRegions,
62+
fetchUserInstitutions: FetchUserInstitutions,
5963
});
6064

6165
componentForm = new FormGroup<ComponentForm>({
@@ -96,6 +100,7 @@ export class AddComponentDialogComponent implements OnInit {
96100

97101
ngOnInit(): void {
98102
this.actions.getRegions();
103+
this.actions.fetchUserInstitutions();
99104
}
100105

101106
setSelectedInstitutions(institutions: Institution[]) {

src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@if (isLoading()) {
2-
<p-skeleton width="100%" height="3rem" />
2+
<p-skeleton width="100%" height="3.2rem" />
33
} @else {
44
<div class="flex flex-column gap-2">
55
<div class="relative">

0 commit comments

Comments
 (0)