Skip to content

Commit

Permalink
Restore apps link
Browse files Browse the repository at this point in the history
  • Loading branch information
nwmac committed Nov 13, 2020
1 parent 834ad4f commit 17f67fd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ function cfShortcuts(id: string) {
icon: 'organization',
iconFont: 'stratos-icons'
},
{
title: 'View Applications',
link: ['/applications', id],
icon: 'apps'
},
{
title: 'Deploy an Application',
link: ['/applications', 'new', id],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DatePipe } from '@angular/common';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute } from '@angular/router';

import { TabNavService } from '../../../../../core/src/tab-nav.service';
import { generateCfBaseTestModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper';
Expand All @@ -24,6 +25,14 @@ describe('ApplicationWallComponent', () => {
DatePipe,
TabNavService,
CloudFoundryService,
{
provide: ActivatedRoute,
useValue: {
snapshot: {
params: {},
}
}
}
]
})
.compileComponents();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
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 { map } from 'rxjs/operators';
Expand All @@ -12,6 +13,7 @@ import { CfAppsDataSource } from '../../../shared/components/list/list-types/app
import { CfOrgSpaceDataService, initCfOrgSpaceService } 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';

@Component({
selector: 'app-application-wall',
Expand Down Expand Up @@ -48,7 +50,15 @@ export class ApplicationWallComponent implements OnDestroy {
public cloudFoundryService: CloudFoundryService,
private store: Store<CFAppState>,
private cfOrgSpaceService: CfOrgSpaceDataService,
activatedRoute: ActivatedRoute,
) {
// If we have an endpoint ID, select it and redirect
const { endpointId } = activatedRoute.snapshot.params;
if (endpointId) {
goToAppWall(this.store, endpointId);
return;
}

this.cfIds$ = cloudFoundryService.cFEndpoints$.pipe(
map(endpoints => endpoints.map(endpoint => endpoint.guid)),
);
Expand All @@ -65,6 +75,8 @@ export class ApplicationWallComponent implements OnDestroy {
}

ngOnDestroy(): void {
this.initCfOrgSpaceService.unsubscribe();
if (this.initCfOrgSpaceService) {
this.initCfOrgSpaceService.unsubscribe();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ const applicationsRoutes: Routes = [
extensionsActionsKey: StratosActionType.Applications
}
},
{
path: ':endpointId',
component: ApplicationWallComponent,
pathMatch: 'full'
},
{
path: ':endpointId/:id',
component: ApplicationBaseComponent,
Expand Down

0 comments on commit 17f67fd

Please sign in to comment.