Skip to content

Commit

Permalink
RSM-3717 add protected pages list
Browse files Browse the repository at this point in the history
  • Loading branch information
cakr322 committed Jul 4, 2024
1 parent b5b0e3c commit f22907b
Show file tree
Hide file tree
Showing 24 changed files with 258 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<app-collection-list [collection]="protectedArticles"></app-collection-list>
<app-collection-list [collection]="protectedCapabilities"></app-collection-list>
<app-collection-list [collection]="protectedCaseStudies"></app-collection-list>
<app-collection-list [collection]="protectedEquipment"></app-collection-list>
<app-collection-list [collection]="protectedEvents"></app-collection-list>
<app-collection-list [collection]="protectedFunding"></app-collection-list>
<app-collection-list [collection]="protectedServices"></app-collection-list>
<app-collection-list [collection]="protectedSoftware"></app-collection-list>
<app-collection-list [collection]="protectedSubHub"></app-collection-list>
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { AllProtectedArticlesGQL, ArticleCollection,
AllProtectedCapabilitiesGQL, CapabilityCollection,
AllProtectedCaseStudiesGQL, CaseStudyCollection,
AllProtectedEquipmentGQL, EquipmentCollection,
AllProtectedEventsGQL, EventCollection,
AllProtectedFundingGQL,FundingCollection,
AllProtectedServicesGQL, ServiceCollection,
AllProtectedSoftwareGQL, SoftwareCollection,
AllProtectedSubHubGQL, SubHubCollection
} from '@app/graphql/schema';
import { Observable, Subscription } from 'rxjs';
import { map } from 'rxjs/operators';
import { PageTitleService } from '@services/page-title.service';

@Component({
selector: 'app-protected-pages-list',
templateUrl: './protected-pages-list.component.html',
styleUrls: ['./protected-pages-list.component.scss']
})
export class ProtectedPagesListComponent implements OnInit, OnDestroy {
public protectedPages: any;
public protectedArticles: any;
public protectedCapabilities: any;
public protectedCaseStudies: any;
public protectedEquipment: any;
public protectedEvents: any;
public protectedFunding: any;
public protectedServices: any;
public protectedSoftware: any;
public protectedSubHub: any;
public title: string = 'Protected Pages Collection';

private subscription = new Subscription();

constructor(
private allProtectedArticlesGQL: AllProtectedArticlesGQL,
private allProtectedCapabilitiesGQL: AllProtectedCapabilitiesGQL,
private allProtectedCaseStudiesGQL: AllProtectedCaseStudiesGQL,
private allProtectedEquipmentGQL: AllProtectedEquipmentGQL,
private allProtectedEventsGQL: AllProtectedEventsGQL,
private allProtectedFundingGQL: AllProtectedFundingGQL,
private allProtectedServicesGQL: AllProtectedServicesGQL,
private allProtectedSoftwareGQL: AllProtectedSoftwareGQL,
private allProtectedSubHubGQL: AllProtectedSubHubGQL,
public pageTitleService: PageTitleService
) { }

ngOnInit(): void {
this.pageTitleService.title = this.title;
this.subscription.add(
this.loadArticles().subscribe((collection) => this.protectedArticles = collection)
);
this.subscription.add(
this.loadCapabilities().subscribe((collection) => this.protectedCapabilities = collection)
);
this.subscription.add(
this.loadCaseStudies().subscribe((collection) => this.protectedCaseStudies = collection)
);
this.subscription.add(
this.loadEquipment().subscribe((collection) => this.protectedEquipment = collection)
);
this.subscription.add(
this.loadEvents().subscribe((collection) => this.protectedEvents = collection)
);
this.subscription.add(
this.loadFunding().subscribe((collection) => this.protectedFunding = collection)
);
this.subscription.add(
this.loadServices().subscribe((collection) => this.protectedServices = collection)
);
this.subscription.add(
this.loadSoftware().subscribe((collection) => this.protectedSoftware = collection)
);
this.subscription.add(
this.loadSubHub().subscribe((collection) => this.protectedSubHub = collection)
);
}

public loadArticles(): Observable<ArticleCollection> {
return this.allProtectedArticlesGQL.fetch().pipe(
map((result) => result.data.articleCollection as ArticleCollection)
)
}

public loadCapabilities(): Observable<CapabilityCollection> {
return this.allProtectedCapabilitiesGQL.fetch().pipe(
map((result) => result.data.capabilityCollection as CapabilityCollection)
)
}

public loadCaseStudies(): Observable<CaseStudyCollection> {
return this.allProtectedCaseStudiesGQL.fetch().pipe(
map((result) => result.data.caseStudyCollection as CaseStudyCollection)
)
}

public loadEquipment(): Observable<EquipmentCollection> {
return this.allProtectedEquipmentGQL.fetch().pipe(
map((result) => result.data.equipmentCollection as EquipmentCollection)
)
}

public loadEvents(): Observable<EventCollection> {
return this.allProtectedEventsGQL.fetch().pipe(
map((result) => result.data.eventCollection as EventCollection)
)
}

public loadFunding(): Observable<FundingCollection> {
return this.allProtectedFundingGQL.fetch().pipe(
map((result) => result.data.fundingCollection as FundingCollection)
)
}

public loadServices(): Observable<ServiceCollection> {
return this.allProtectedServicesGQL.fetch().pipe(
map((result) => result.data.serviceCollection as ServiceCollection)
)
}

public loadSoftware(): Observable<SoftwareCollection> {
return this.allProtectedSoftwareGQL.fetch().pipe(
map((result) => result.data.softwareCollection as SoftwareCollection)
)
}

public loadSubHub(): Observable<SubHubCollection> {
return this.allProtectedSubHubGQL.fetch().pipe(
map((result) => result.data.subHubCollection as SubHubCollection)
)
}

ngOnDestroy(): void {
this.subscription.unsubscribe();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ProtectedPagesListComponent } from './protected-pages-list/protected-pages-list.component';

const routes: Routes = [
{ path: 'list', component: ProtectedPagesListComponent }
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ProtectedPagesRoutingModule { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ProtectedPagesRoutingModule } from './protected-pages-routing.module';
import { SharedModule } from '@components/shared/app.shared.module';
import { NgxContentfulRichTextModule } from 'ngx-contentful-rich-text';
import { ProtectedPagesListComponent } from './protected-pages-list/protected-pages-list.component';
import { CardsModule } from '../cards/cards.module';


@NgModule({
declarations: [
ProtectedPagesListComponent
],
imports: [
CommonModule,
ProtectedPagesRoutingModule,
SharedModule,
NgxContentfulRichTextModule,
CardsModule
]
})
export class ProtectedPagesModule { }
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query AllArticles {
articleCollection(limit: 250) {
articleCollection(limit: 1000) {
items {
...PublicFields
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query AllCapabilities {
capabilityCollection(limit: 250) {
capabilityCollection(limit: 1000) {
items {
...PublicFields
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query AllCaseStudies {
caseStudyCollection(limit: 250) {
caseStudyCollection(limit: 1000) {
items {
...PublicFields
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query AllEquipment {
equipmentCollection(limit: 250) {
equipmentCollection(limit: 1000) {
items {
...PublicFields
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query AllEvents {
eventCollection(limit: 250) {
eventCollection(limit: 1000) {
items {
...PublicFields
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query AllFunding {
fundingCollection(limit: 250) {
fundingCollection(limit: 1000) {
items {
...PublicFields
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
query AllProtectedArticles {
articleCollection(limit: 1000, where: {ssoProtected: true}) {
items {
...PublicFields
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
query AllProtectedCapabilities {
capabilityCollection(limit: 1000, where: {ssoProtected: true}) {
items {
...PublicFields
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
query AllProtectedCaseStudies {
caseStudyCollection(limit: 1000, where: {ssoProtected: true}) {
items {
...PublicFields
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
query AllProtectedEquipment {
equipmentCollection(limit: 1000, where: {ssoProtected: true}) {
items {
...PublicFields
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
query AllProtectedEvents {
eventCollection(limit: 1000, where: {ssoProtected: true}) {
items {
...PublicFields
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
query AllProtectedFunding {
fundingCollection(limit: 1000, where: {ssoProtected: true}) {
items {
...PublicFields
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
query AllProtectedServices {
serviceCollection(limit: 1000, where: {ssoProtected: true}) {
items {
...PublicFields
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
query AllProtectedSoftware {
softwareCollection(limit: 1000, where: {ssoProtected: true}) {
items {
...PublicFields
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
query AllProtectedSubHub {
subHubCollection(limit: 1000, where: {ssoProtected: true}) {
items {
...PublicFields
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query AllServices {
serviceCollection(limit: 250) {
serviceCollection(limit: 1000) {
items {
...PublicFields
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query AllSoftware {
softwareCollection(limit: 250) {
softwareCollection(limit: 1000) {
items {
...PublicFields
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query AllSubHub {
subHubCollection(limit: 250) {
subHubCollection(limit: 1000) {
items {
...PublicFields
}
Expand Down
4 changes: 4 additions & 0 deletions research-hub-web/src/app/routing/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ export const appRoutes: Routes = [
{
path: 'capability',
loadChildren: () => import('@components/capabilitys/capabilitys.module').then(m => m.CapabilitysModule)
},
{
path: 'protected-pages',
loadChildren: () => import('@components/protected-pages/protected-pages.module').then(m => m.ProtectedPagesModule)
}
]
},
Expand Down

0 comments on commit f22907b

Please sign in to comment.