Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homepage tweaks #1164

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 4 additions & 8 deletions ui/src/app/home/home.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<div class="row h-100">
<div class="col-md-12">
<div class="h-100">
<div class="d-flex flex-column h-100">
<div class="alert alert-success mt-3">{{ loggedInMessage }}</div>
<router-outlet></router-outlet>
</div>
</div>
<div class="d-flex flex-column h-100">
<div class="alert alert-success mt-3">{{ loggedInMessage }}</div>
<div class="h-100 pb-3">
<router-outlet></router-outlet>
</div>
</div>
9 changes: 9 additions & 0 deletions ui/src/app/home/home.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ export const routes: Routes = [
},
canActivate: [ManageMemberGuard],
},
{
path: 'manage/:id',
component: MemberInfoComponent,
data: {
authorities: ['ROLE_USER', 'ROLE_CONSORTIUM_LEAD'],
pageTitle: 'home.title.string',
},
canActivate: [AuthGuard],
},
],
},
]
4 changes: 2 additions & 2 deletions ui/src/app/home/member-info/member-info.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div *ngIf="memberData || memberData === null" class="h-100 home-container mb-3">
<div *ngIf="memberData || memberData === null" class="h-100 home-container">
<!-- UNABLE TO RETRIEVE MEMBER DATA -->
<div *ngIf="memberData === null" class="p-4 d-flex">
<div>
Expand All @@ -24,7 +24,7 @@ <H1 class="mb-4">Something has gone wrong...</H1>
<div class="logo-container mb-40">
<img
src="{{ memberData.logoUrl }}"
onerror="this.src='../content/images/member-logo-placeholder.svg'"
onerror="this.src='./content/images/member-logo-placeholder.svg'"
alt="Member logo"
/>
</div>
Expand Down
68 changes: 33 additions & 35 deletions ui/src/app/member/service/member.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class MemberService {
this.getIsConsortiumLead(salesforceId),
])
}),
tap((res) => {
tap(() => {
this.fetchingMemberDataState = false
}),
catchError(() => {
Expand All @@ -184,21 +184,19 @@ export class MemberService {
}

getSFMemberData(salesforceId: string): Observable<SFMemberData> {
return this.http
.get<ISFRawMemberData>(`${this.resourceUrl}/members/${salesforceId}/member-details`, { observe: 'response' })
.pipe(
catchError((err) => {
return of(err)
}),
map((res: HttpResponse<ISFRawMemberData>) => this.convertToSalesforceMemberData(res)),
switchMap((value) => {
if (value && !value.id) {
return throwError(value)
} else {
return of(value)
}
})
)
return this.http.get<ISFRawMemberData>(`${this.resourceUrl}/members/${salesforceId}/member-details`).pipe(
catchError((err) => {
return of(err)
}),
map((res: ISFRawMemberData) => this.convertToSalesforceMemberData(res)),
switchMap((value) => {
if (value && !value.id) {
return throwError(value)
} else {
return of(value)
}
})
)
}

getMemberOrgIds(salesforceId: string): Observable<SFMemberOrgIds> {
Expand Down Expand Up @@ -242,28 +240,28 @@ export class MemberService {
return of(null)
}

private convertToSalesforceMemberData(res: HttpResponse<ISFRawMemberData>): SFMemberData {
if (res.body) {
private convertToSalesforceMemberData(res: ISFRawMemberData): SFMemberData {
if (res && res['Id']) {
return {
...new SFMemberData(),
id: res.body.Id,
consortiaMember: res.body.Consortia_Member__c,
consortiaLeadId: res.body.Consortium_Lead__c,
name: res.body.Name,
publicDisplayName: res.body.Public_Display_Name__c,
website: res.body.Website,
billingCountry: res.body.BillingCountry,
memberType: res.body.Research_Community__c,
publicDisplayDescriptionHtml: res.body.Public_Display_Description__c,
logoUrl: res.body.Logo_Description__c,
publicDisplayEmail: res.body.Public_Display_Email__c,
membershipStartDateString: res.body.Last_membership_start_date__c,
membershipEndDateString: res.body.Last_membership_end_date__c,
consortiumMembers: res.body.consortiumOpportunities
? this.convertToConsortiumMembers(res.body.consortiumOpportunities)
id: res.Id,
consortiaMember: res.Consortia_Member__c,
consortiaLeadId: res.Consortium_Lead__c,
name: res.Name,
publicDisplayName: res.Public_Display_Name__c,
website: res.Website,
billingCountry: res.BillingCountry,
memberType: res.Research_Community__c,
publicDisplayDescriptionHtml: res.Public_Display_Description__c,
logoUrl: res.Logo_Description__c,
publicDisplayEmail: res.Public_Display_Email__c,
membershipStartDateString: res.Last_membership_start_date__c,
membershipEndDateString: res.Last_membership_end_date__c,
consortiumMembers: res.consortiumOpportunities
? this.convertToConsortiumMembers(res.consortiumOpportunities)
: undefined,
billingAddress: res.body.BillingAddress,
trademarkLicense: res.body.Trademark_License__c,
billingAddress: res.BillingAddress,
trademarkLicense: res.Trademark_License__c,
}
} else {
return new SFMemberData()
Expand Down
1 change: 1 addition & 0 deletions ui/src/content/scss/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Bootstrap tweaks
===============================================================*/
app-root {
height: 100%;
min-height: 100vh;
display: flex;
flex-direction: column;
Expand Down
Loading