Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Persist list settings over refresh #4405

Merged
merged 29 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b078bc6
WIP
richard-cox Jun 26, 2020
0c36ad7
Merge remote-tracking branch 'origin/master' into sticky-lists
richard-cox Jul 3, 2020
d87bd68
Add list reset button & list button tooltips
richard-cox Jul 3, 2020
3cd2ed7
Merge remote-tracking branch 'origin/master' into sticky-lists
richard-cox Jul 7, 2020
f157cb1
Merge remote-tracking branch 'origin/master' into sticky-lists
richard-cox Jul 31, 2020
ee41b63
Few tidy ups, add clear local storage feature
richard-cox Jul 31, 2020
0454718
Tweak profile settings section
richard-cox Jul 31, 2020
b72bd2e
WIP
richard-cox Jul 31, 2020
e735ea2
WIP
richard-cox Jul 7, 2020
5987bfb
Merge remote-tracking branch 'origin/master' into sticky-lists
richard-cox Nov 27, 2020
33c5d76
only store pagination sections from lists
richard-cox Nov 27, 2020
c67c007
Fix clear and auto select multi filter/s on reset
richard-cox Nov 27, 2020
0cdd286
Ingore invalid values
richard-cox Nov 30, 2020
4ac77ba
Super basic encryption of pag section
richard-cox Nov 30, 2020
59d9a53
fix reset
richard-cox Nov 30, 2020
a09d86a
Fix max list count & multi-entity selectors stickyness
richard-cox Nov 30, 2020
8a18011
tidying up
richard-cox Nov 30, 2020
e5a0962
Fix linting
richard-cox Dec 1, 2020
6d58bac
Merge remote-tracking branch 'origin/master' into sticky-lists
richard-cox Dec 2, 2020
aaf2254
Fix unit tests
richard-cox Dec 2, 2020
84e123a
Changes following review #1
richard-cox Dec 2, 2020
77b27a2
Changes following review #2
richard-cox Dec 2, 2020
9cd43dd
Changes following review no. 3
richard-cox Dec 3, 2020
704f2f3
Merge remote-tracking branch 'origin/master' into sticky-lists
richard-cox Dec 3, 2020
1760dbd
Fix warning on first load
richard-cox Dec 3, 2020
2b6d681
Fix show org/space e2e failures
richard-cox Dec 4, 2020
9b5841a
improve delete service e2e tests
richard-cox Dec 4, 2020
e44d6ea
Ensure list is card mode before waiting to find a card
richard-cox Dec 4, 2020
b40b054
Remove stray line
richard-cox Dec 4, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ <h1>Applications</h1>
</ng-template>

<app-list class="app-wall" [noEntries]="noEntries" [noEntriesForCurrentFilter]="noEntriesForCurrentFilter"
(initialised)="cfOrgSpaceService.enableAutoSelectors()"
*ngIf="!!(cloudFoundryService.hasRegisteredCFEndpoints$ | async) && !!(cloudFoundryService.hasConnectedCFEndpoints$ | async)">
</app-list>
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ import { animate, query, style, transition, trigger } from '@angular/animations'
import { Component, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store';
import { Observable, Subscription } from 'rxjs';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { CFAppState } from '../../../../../cloud-foundry/src/cf-app-state';
import { applicationEntityType } from '../../../../../cloud-foundry/src/cf-entity-types';
import { ListConfig } from '../../../../../core/src/shared/components/list/list.component.types';
import { CfAppConfigService } from '../../../shared/components/list/list-types/app/cf-app-config.service';
import { CfAppsDataSource } from '../../../shared/components/list/list-types/app/cf-apps-data-source';
import { CfOrgSpaceDataService, initCfOrgSpaceService } from '../../../shared/data-services/cf-org-space-service.service';
import { CfOrgSpaceDataService } from '../../../shared/data-services/cf-org-space-service.service';
import { CloudFoundryService } from '../../../shared/data-services/cloud-foundry.service';
import { CfCurrentUserPermissions } from '../../../user-permissions/cf-user-permissions-checkers';
import { goToAppWall } from '../../cf/cf.helpers';
Expand All @@ -22,13 +20,13 @@ import { goToAppWall } from '../../cf/cf.helpers';
animations: [
trigger(
'cardEnter', [
transition('* => *', [
query(':enter', [
style({ opacity: 0, transform: 'translateY(10px)' }),
animate('150ms ease-out', style({ opacity: 1, transform: 'translateY(0)' }))
], { optional: true })
])
]
transition('* => *', [
query(':enter', [
style({ opacity: 0, transform: 'translateY(10px)' }),
animate('150ms ease-out', style({ opacity: 1, transform: 'translateY(0)' }))
], { optional: true })
])
]
)
],
providers: [{
Expand All @@ -40,7 +38,6 @@ import { goToAppWall } from '../../cf/cf.helpers';
})
export class ApplicationWallComponent implements OnDestroy {
public cfIds$: Observable<string[]>;
private initCfOrgSpaceService: Subscription;

public canCreateApplication: string;

Expand All @@ -49,7 +46,7 @@ export class ApplicationWallComponent implements OnDestroy {
constructor(
public cloudFoundryService: CloudFoundryService,
private store: Store<CFAppState>,
private cfOrgSpaceService: CfOrgSpaceDataService,
public cfOrgSpaceService: CfOrgSpaceDataService,
activatedRoute: ActivatedRoute,
) {
// If we have an endpoint ID, select it and redirect
Expand All @@ -67,16 +64,8 @@ export class ApplicationWallComponent implements OnDestroy {
this.haveConnectedCf$ = cloudFoundryService.connectedCFEndpoints$.pipe(
map(endpoints => !!endpoints && endpoints.length > 0)
);

this.initCfOrgSpaceService = initCfOrgSpaceService(this.store,
this.cfOrgSpaceService,
applicationEntityType,
CfAppsDataSource.paginationKey).subscribe();
}

ngOnDestroy(): void {
if (this.initCfOrgSpaceService) {
this.initCfOrgSpaceService.unsubscribe();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Subscription } from 'rxjs';
import { filter, first, tap } from 'rxjs/operators';

import { CFAppState } from '../../../../../cloud-foundry/src/cf-app-state';
import { applicationEntityType } from '../../../../../cloud-foundry/src/cf-entity-types';
import { selectCfPaginationState } from '../../../../../cloud-foundry/src/store/selectors/pagination.selectors';
import { applicationEntityType } from '../../../cf-entity-types';
import { CfAppsDataSource } from '../../../shared/components/list/list-types/app/cf-apps-data-source';
import { CfOrgSpaceDataService } from '../../../shared/data-services/cf-org-space-service.service';
import { selectCfPaginationState } from '../../../store/selectors/pagination.selectors';

@Component({
selector: 'app-create-application',
Expand All @@ -22,14 +22,16 @@ export class CreateApplicationComponent implements OnInit, OnDestroy {

ngOnInit() {
// We will auto select endpoint/org/space that have been selected on the app wall.
this.cfOrgSpaceService.enableAutoSelectors();
// FIXME: This has been broken for a while (setting cf will clear org + space after org and space has been set)
// With new tools (set initial/enable auto) this should be easier to fix
const appWallPaginationState = this.store.select(selectCfPaginationState(applicationEntityType, CfAppsDataSource.paginationKey));
this.paginationStateSub = appWallPaginationState.pipe(filter(pag => !!pag), first(), tap(pag => {
const { cf, org, space } = pag.clientPagination.filter.items;
if (cf) {
this.cfOrgSpaceService.cf.select.next(cf);
}
if (cf && org) {

this.cfOrgSpaceService.org.select.next(org);
}
if (cf && org && space) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ <h1>Services</h1>
</ng-template>

<app-list class="services-wall" [noEntries]="noEntries" [noEntriesForCurrentFilter]="noEntriesForCurrentFilter"
(initialised)="cfOrgSpaceService.enableAutoSelectors()"
*ngIf="!!(cloudFoundryService.hasRegisteredCFEndpoints$ | async) && !!(cloudFoundryService.hasConnectedCFEndpoints$ | async)">
</app-list>
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import { Component, OnDestroy } from '@angular/core';
import { Component } from '@angular/core';
import { Store } from '@ngrx/store';
import { Observable, Subscription } from 'rxjs';
import { map } from 'rxjs/operators';

import { CFAppState } from '../../../../../cloud-foundry/src/cf-app-state';
import { serviceInstancesEntityType } from '../../../../../cloud-foundry/src/cf-entity-types';
import {
ServiceInstancesWallListConfigService,
} from '../../../../../cloud-foundry/src/shared/components/list/list-types/services-wall/service-instances-wall-list-config.service';
import {
CfOrgSpaceDataService,
initCfOrgSpaceService,
} from '../../../../../cloud-foundry/src/shared/data-services/cf-org-space-service.service';
import { CfOrgSpaceDataService } from '../../../../../cloud-foundry/src/shared/data-services/cf-org-space-service.service';
import { CloudFoundryService } from '../../../../../cloud-foundry/src/shared/data-services/cloud-foundry.service';
import { ListConfig } from '../../../../../core/src/shared/components/list/list.component.types';
import { CSI_CANCEL_URL } from '../../../shared/components/add-service-instance/csi-mode.service';
Expand All @@ -29,7 +25,7 @@ import { CfCurrentUserPermissions } from '../../../user-permissions/cf-user-perm
CfOrgSpaceDataService
]
})
export class ServicesWallComponent implements OnDestroy {
export class ServicesWallComponent {

public haveConnectedCf$: Observable<boolean>;

Expand All @@ -41,7 +37,7 @@ export class ServicesWallComponent implements OnDestroy {
constructor(
public cloudFoundryService: CloudFoundryService,
public store: Store<CFAppState>,
private cfOrgSpaceService: CfOrgSpaceDataService) {
public cfOrgSpaceService: CfOrgSpaceDataService) {

this.canCreateServiceInstance = CfCurrentUserPermissions.SERVICE_INSTANCE_CREATE;
this.cfIds$ = cloudFoundryService.cFEndpoints$.pipe(
Expand All @@ -51,11 +47,6 @@ export class ServicesWallComponent implements OnDestroy {
)
);

this.initCfOrgSpaceService = initCfOrgSpaceService(this.store,
this.cfOrgSpaceService,
serviceInstancesEntityType,
'all').subscribe();

this.haveConnectedCf$ = cloudFoundryService.connectedCFEndpoints$.pipe(
map(endpoints => !!endpoints && endpoints.length > 0)
);
Expand All @@ -64,8 +55,4 @@ export class ServicesWallComponent implements OnDestroy {
[CSI_CANCEL_URL]: `/services`
};
}

ngOnDestroy(): void {
this.initCfOrgSpaceService.unsubscribe();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class CreateApplicationStep1Component implements OnInit, AfterContentInit
space: this.cfOrgSpaceService.space.select.getValue()
}));
return of({ success: true });
}
};

ngOnInit() {
if (this.route.root.snapshot.queryParams.endpointGuid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ export class CfAppConfigService extends ListConfig<APIResource> implements IList

// Apply the initial cf guid to the data source. Normally this is done via applying the selection to the filter... however this is too
// late for maxedResult world
this.initialised$ = this.cfOrgSpaceService.cf.loading$.pipe(
this.initialised$ = this.cfOrgSpaceService.isLoading$.pipe(
filter(isLoading => !isLoading),
switchMap(() => this.cfOrgSpaceService.cf.list$),
first(),
map(cfs => {
const cfGuid = cfs.length === 1 ? cfs[0].guid : null;
this.appsDataSource = new CfAppsDataSource(this.store, this, undefined, undefined, undefined, cfGuid);
this.cfOrgSpaceService.setInitialValuesFromAction(this.appsDataSource.action, 'cf', 'org', 'space');
return true;
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ import {
import { APIResource } from '../../../../../../../store/src/types/api.types';
import { CloudFoundryEndpointService } from '../../../../../features/cf/services/cloud-foundry-endpoint.service';
import { CfCurrentUserPermissions } from '../../../../../user-permissions/cf-user-permissions-checkers';
import {
CfOrgSpaceDataService,
createCfOrgSpaceFilterConfig,
initCfOrgSpaceService,
} from '../../../../data-services/cf-org-space-service.service';
import { CfOrgSpaceDataService, createCfOrgSpaceFilterConfig } from '../../../../data-services/cf-org-space-service.service';
import { CfRoutesDataSource } from './cf-routes-data-source';
import { ListCfRoute } from './cf-routes-data-source-base';
import { CfRoutesListConfigBase } from './cf-routes-list-config-base';
Expand Down Expand Up @@ -76,10 +72,6 @@ export class CfRoutesListConfigService extends CfRoutesListConfigBase implements
createCfOrgSpaceFilterConfig('org', 'Organization', cfOrgSpaceService.org),
];
this.getMultiFiltersConfigs = () => multiFilterConfigs;
initCfOrgSpaceService(store, cfOrgSpaceService,
this.dataSource.masterAction.entityType,
this.dataSource.masterAction.paginationKey).subscribe();
cfOrgSpaceService.cf.select.next(cfService.cfGuid);

this.getInitialised = () => combineLatest(
cfOrgSpaceService.cf.list$,
Expand All @@ -89,5 +81,7 @@ export class CfRoutesListConfigService extends CfRoutesListConfigBase implements
map(loading => !loading),
startWith(true)
);

cfOrgSpaceService.cf.select.next(cfService.cfGuid);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class ServiceInstancesWallListConfigService extends CfServiceInstancesLis
breadcrumbs: 'service-wall'
};

this.cfOrgSpaceService.setInitialValuesFromAction(this.dataSource.masterAction, 'cf', 'org', 'space');
this.getInitialised = () => combineLatest(
cfOrgSpaceService.cf.list$,
cfOrgSpaceService.org.list$,
Expand Down
Loading