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

Use side nav instead of top tabs throughout Stratos. #3289

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'v2-master' into tabs-layout-change
* v2-master: (415 commits)
  CC Fix
  CC Fixed and copy change
  Update fetch all users max pagination
  Merge fixes
  Minor text change
  Small text change
  Minor change to the invite table header
  Update invite users text
  Update the docs guide
  Update docs
  Fix unit test
  Fix imports
  Publish release pipeline fix (#3404)
  Re-instate setup mode
  Weekly update
  Ensure we don't add invalid state when reseting pagination
  Add create-many-users script
  Automated test script improvements and fixes (#3402)
  Fixed date --> data typo
  Remove TODOs for now
  ...
  • Loading branch information
KlapTrap committed Feb 19, 2019
commit e2f41a1c653e873fbfb14a1a35abc17af6efe81c
5 changes: 4 additions & 1 deletion src/frontend/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ import { EndpointModel } from './store/types/endpoint.types';
import { IRequestDataState } from './store/types/entity.types';
import { IEndpointFavMetadata, IFavoriteMetadata, UserFavorite } from './store/types/user-favorites.types';
import { XSRFModule } from './xsrf.module';
import { initEndpointExtensions } from './features/endpoints/endpoint-helpers';
import { TabNavService } from './tab-nav.service';
import { recentlyVisitedSelector } from './store/selectors/recently-visitied.selectors';
import { SetRecentlyVisitedEntityAction } from './store/actions/recently-visited.actions';
import { CustomReuseStrategy } from './route-reuse-stragegy';


// Create action for router navigation. See
// - https://github.com/ngrx/platform/issues/68
Expand Down
6 changes: 2 additions & 4 deletions src/frontend/app/app.routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ const appRoutes: Routes = [
path: 'home', component: HomePageComponent,
data: {
stratosNavigation: {
label: 'Dashboard',
matIcon: 'assessment',
// Experimental - only show in development
hidden: observableOf(environment.production),
text: 'Home',
matIcon: 'home',
position: 10
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/frontend/app/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import { UserService } from './user.service';
import { UtilsService } from './utils.service';
import { WindowRef } from './window-ref/window-ref.service';
import { PortalModule } from '@angular/cdk/portal';
import { EntityFavoriteStarComponent } from './entity-favorite-star/entity-favorite-star.component';
import { RecentEntitiesComponent } from '../shared/components/recent-entities/recent-entities.component';
import { MomentModule } from 'ngx-moment';


@NgModule({
imports: [
Expand All @@ -47,7 +51,9 @@ import { PortalModule } from '@angular/cdk/portal';
DotContentComponent,
ButtonBlurOnClickDirective,
PageNotFoundComponentComponent,
PortalModule
PortalModule,
EntityFavoriteStarComponent,
RecentEntitiesComponent
],
providers: [
AuthGuardService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
<app-page-header [breadcrumbs]="breadcrumbs$ | async" [tabs]="tabLinks" tabsHeader="Applications">
<app-page-header [breadcrumbs]="breadcrumbs$ | async" [tabs]="tabLinks" tabsHeader="Applications"
[favorite]="favorite$ | async">
<h1>{{ (applicationService.application$ | async)?.app?.entity?.name }} </h1>
<div class="page-header-right">
<a class="app-page-header__anchor" mat-icon-button *ngIf="(applicationService.applicationUrl$ | async) != null && (applicationService.application$ | async)?.app.entity.state === 'STARTED'"
<a class="app-page-header__anchor" mat-icon-button
*ngIf="(applicationService.applicationUrl$ | async) != null && (applicationService.application$ | async)?.app.entity.state === 'STARTED'"
href="{{applicationService.applicationUrl$ | async}}" target="_blank" matTooltip="Visit">
<mat-icon>launch</mat-icon>
</a>
<span *ngIf="isBusyUpdating$ | async as busy">
<span *ngIf="applicationService.appSpace$ | async as space">
<span class="manage-application-actions" *appUserPermission="manageAppPermission;spaceGuid:space.metadata.guid;endpointGuid:this.applicationService.cfGuid">
<button mat-icon-button name="edit" *ngIf="(this.applicationService.applicationState$ | async)" routerLink="/applications/{{applicationService.cfGuid}}/{{applicationService.appGuid}}/edit"
<span class="manage-application-actions"
*appUserPermission="manageAppPermission;spaceGuid:space.metadata.guid;endpointGuid:this.applicationService.cfGuid">
<button mat-icon-button name="edit" *ngIf="(this.applicationService.applicationState$ | async)"
routerLink="/applications/{{applicationService.cfGuid}}/{{applicationService.appGuid}}/edit"
matTooltip="Edit">
<mat-icon>edit</mat-icon>
</button>
<button mat-icon-button name="delete" (click)="redirectToDeletePage()" matTooltip="Delete">
<mat-icon>delete</mat-icon>
</button>
<div *ngIf="applicationService.applicationState$ | async as appState" class="app-page-header__actions">
<button mat-icon-button name="restart" [disabled]="busy.updating || !appState.actions.restart" (click)="restartApplication()"
matTooltip="Restart">
<button mat-icon-button name="restart" [disabled]="busy.updating || !appState.actions.restart"
(click)="restartApplication()" matTooltip="Restart">
<mat-icon>settings_backup_restore</mat-icon>
</button>
<button mat-icon-button name="stop" [disabled]="busy.updating" *ngIf="appState.actions.stop;else startButton"
(click)="stopApplication()" matTooltip="Stop">
<button mat-icon-button name="stop" [disabled]="busy.updating"
*ngIf="appState.actions.stop;else startButton" (click)="stopApplication()" matTooltip="Stop">
<mat-icon>stop</mat-icon>
</button>
<ng-template #startButton>
<button mat-icon-button name="start" [disabled]="busy.updating || !appState.actions.start && !appState.actions.stop"
<button mat-icon-button name="start"
[disabled]="busy.updating || !appState.actions.start && !appState.actions.stop"
(click)="startApplication()" matTooltip="Start">
<mat-icon>play_arrow</mat-icon>
</button>
</ng-template>
<button mat-icon-button name="restage" [disabled]="busy.updating || !appState.actions.restage" (click)="restageApplication()"
matTooltip="Restage">
<button mat-icon-button name="restage" [disabled]="busy.updating || !appState.actions.restage"
(click)="restageApplication()" matTooltip="Restage">
<mat-icon>redo</mat-icon>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,10 @@ import { APIResource } from '../../../../store/types/api.types';
import { EndpointModel } from '../../../../store/types/endpoint.types';
import { ApplicationData, ApplicationService } from '../../application.service';
import { EndpointsService } from './../../../../core/endpoints.service';
import { RestageApplication } from '../../../../store/actions/application.actions';
import { ApplicationStateData } from '../../../../shared/components/application-state/application-state.service';
import { ActionState } from '../../../../store/reducers/api-request-reducer/types';
import {
getTabsFromExtensions,
StratosTabType,
StratosActionMetadata,
getActionsFromExtensions,
StratosActionType
} from '../../../../core/extension/extension-service';
import { IPageSideNavTab } from '../../../dashboard/page-side-nav/page-side-nav.component';
import { CurrentUserPermissions } from '../../../../core/current-user-permissions.config';
import { CurrentUserPermissionsService } from '../../../../core/current-user-permissions.service';
import { GitSCMService, GitSCMType } from './../../../../shared/data-services/scm/scm.service';
import { UserFavorite } from './../../../../store/types/user-favorites.types';
import { IAppFavMetadata } from '../../../../cf-favourite-types';
import { IPageSideNavTab } from '../../../dashboard/page-side-nav/page-side-nav.component';


// Confirmation dialogs
Expand Down Expand Up @@ -136,6 +124,26 @@ export class ApplicationTabsBaseComponent implements OnInit, OnDestroy {
map(can => !can)
);

this.tabLinks = [
{ link: 'summary', label: 'Summary', matIcon: 'description' },
{ link: 'instances', label: 'Instances', matIcon: 'library_books' },
{ link: 'routes', label: 'Routes', matIconFont: 'stratos-icons', matIcon: 'network_route' },
{ link: 'log-stream', label: 'Log Stream', matIcon: 'featured_play_list' },
{ link: 'services', label: 'Services', matIconFont: 'stratos-icons', matIcon: 'service' },
{ link: 'variables', label: 'Variables', matIcon: 'lock', hidden: appDoesNotHaveEnvVars$ },
{ link: 'events', label: 'Events', matIcon: 'watch_later' }
];

this.endpointsService.hasMetrics(applicationService.cfGuid).subscribe(hasMetrics => {
if (hasMetrics) {
this.tabLinks.push({
link: 'metrics',
label: 'Metrics',
matIcon: 'bar_chart'
});
}
});

// Add any tabs from extensions
this.tabLinks = this.tabLinks.concat(getTabsFromExtensions(StratosTabType.Application));

Expand Down Expand Up @@ -174,15 +182,7 @@ export class ApplicationTabsBaseComponent implements OnInit, OnDestroy {
update => update[this.autoRefreshString] || { busy: false }
));
header = 'Applications';
tabLinks: IPageSideNavTab[] = [
{ link: 'summary', label: 'Summary', matIcon: 'description' },
{ link: 'instances', label: 'Instances', matIcon: 'library_books' },
{ link: 'routes', label: 'Routes', matIconFont: 'stratos-icons', matIcon: 'network_route' },
{ link: 'log-stream', label: 'Log Stream', matIcon: 'featured_play_list' },
{ link: 'services', label: 'Services', matIconFont: 'stratos-icons', matIcon: 'service' },
{ link: 'variables', label: 'Variables', matIcon: 'lock' },
{ link: 'events', label: 'Events', matIcon: 'watch_later' }
];
tabLinks: IPageSideNavTab[];

private getBreadcrumbs(
application: IApp,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<app-page-header [tabs]="tabLinks" [tabsHeader]="tabsHeader">
<app-page-header [tabs]="tabLinks" [tabsHeader]="tabsHeader" [favorite]="favorite$ | async">
<h1>{{ (cfEndpointService.endpoint$ | async)?.entity.name }}</h1>
<div class="page-header-right">
<button mat-icon-button name="cli" routerLink="/cloud-foundry/{{cfEndpointService.cfGuid}}/cli" matTooltip="CLI Info">
<button mat-icon-button name="cli" routerLink="/cloud-foundry/{{cfEndpointService.cfGuid}}/cli"
matTooltip="CLI Info">
<mat-icon>keyboard</mat-icon>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
<app-page-header [breadcrumbs]="breadcrumbs$ | async" [tabs]="tabLinks" tabsHeader="Organization">
<app-page-header [breadcrumbs]="breadcrumbs$ | async" [tabs]="tabLinks" tabsHeader="Organization"
[favorite]="favorite$ | async">
<h1> {{ name$ | async }}</h1>
<div class="page-header-right">
<button mat-icon-button name="edit-org" *appUserPermission="permsOrgEdit;endpointGuid:cfEndpointService.cfGuid"
routerLink="/cloud-foundry/{{cfEndpointService.cfGuid}}/organizations/{{cfOrgService.orgGuid}}/edit-org"
matTooltip="Edit Organization">
<mat-icon>mode_edit</mat-icon>
</button>
<button mat-icon-button name="cli" routerLink="/cloud-foundry/{{cfEndpointService.cfGuid}}/organizations/{{cfOrgService.orgGuid}}/cli"
<button mat-icon-button name="cli"
routerLink="/cloud-foundry/{{cfEndpointService.cfGuid}}/organizations/{{cfOrgService.orgGuid}}/cli"
matTooltip="CLI Info">
<mat-icon>keyboard</mat-icon>
</button>
</div>
</app-page-header>
<app-loading-page [entityId]="cfOrgService.orgGuid" [entitySchema]="schema" deleteText="Deleting organization" [text]="'Retrieving organization'">
<app-loading-page [entityId]="cfOrgService.orgGuid" [entitySchema]="schema" deleteText="Deleting organization"
[text]="'Retrieving organization'">
<router-outlet></router-outlet>
</app-loading-page>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { IHeaderBreadcrumb } from '../../../../../shared/components/page-header/
import { CfUserService } from '../../../../../shared/data-services/cf-user.service';
import { entityFactory, EntitySchema, organizationSchemaKey } from '../../../../../store/helpers/entity-factory';
import { IPageSideNavTab } from '../../../../dashboard/page-side-nav/page-side-nav.component';
import { UserFavorite } from '../../../../../store/types/user-favorites.types';
import { getActiveRouteCfOrgSpaceProvider } from '../../../cf.helpers';
import { CloudFoundryEndpointService } from '../../../services/cloud-foundry-endpoint.service';
import { CloudFoundryOrganizationService } from '../../../services/cloud-foundry-organization.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<app-page-header [breadcrumbs]="breadcrumbs$ | async" [tabs]="tabLinks" tabsHeader="Space">
<app-page-header [breadcrumbs]="breadcrumbs$ | async" [tabs]="tabLinks" tabsHeader="Space"
[favorite]="favorite$ | async">
<h1> {{ name$ | async }}</h1>
<div class="page-header-right">
<button mat-icon-button name="rename" *appUserPermission="permsSpaceEdit;endpointGuid:cfOrgService.cfGuid;organizationGuid:cfOrgService.orgGuid;spaceGuid:cfSpaceService.spaceGuid"
<button mat-icon-button name="rename"
*appUserPermission="permsSpaceEdit;endpointGuid:cfOrgService.cfGuid;organizationGuid:cfOrgService.orgGuid;spaceGuid:cfSpaceService.spaceGuid"
routerLink="/cloud-foundry/{{cfEndpointService.cfGuid}}/organizations/{{cfSpaceService.orgGuid}}/spaces/{{cfSpaceService.spaceGuid}}/edit-space"
matTooltip="Edit Space">
<mat-icon>edit</mat-icon>
</button>
<button mat-icon-button name="delete" *appUserPermission="permsSpaceDelete;endpointGuid:cfOrgService.cfGuid;organizationGuid:cfOrgService.orgGuid;"
<button mat-icon-button name="delete"
*appUserPermission="permsSpaceDelete;endpointGuid:cfOrgService.cfGuid;organizationGuid:cfOrgService.orgGuid;"
(click)="deleteSpaceWarn()" matTooltip="Delete Space">
<mat-icon>delete</mat-icon>
</button>
<button mat-icon-button name="cli" routerLink="/cloud-foundry/{{cfEndpointService.cfGuid}}/organizations/{{cfOrgService.orgGuid}}/spaces/{{cfSpaceService.spaceGuid}}/cli"
<button mat-icon-button name="cli"
routerLink="/cloud-foundry/{{cfEndpointService.cfGuid}}/organizations/{{cfOrgService.orgGuid}}/spaces/{{cfSpaceService.spaceGuid}}/cli"
matTooltip="CLI Info">
<mat-icon>keyboard</mat-icon>
</button>
</div>
</app-page-header>
<app-loading-page [entityId]="cfSpaceService.spaceGuid" [entitySchema]="schema" deleteText="Deleting space" text="Retrieving space">
<app-loading-page [entityId]="cfSpaceService.spaceGuid" [entitySchema]="schema" deleteText="Deleting space"
text="Retrieving space">
<router-outlet></router-outlet>
</app-loading-page>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { CloudFoundryEndpointService } from '../../../../services/cloud-foundry-
import { CloudFoundryOrganizationService } from '../../../../services/cloud-foundry-organization.service';
import { CloudFoundrySpaceService } from '../../../../services/cloud-foundry-space.service';
import { IPageSideNavTab } from '../../../../../dashboard/page-side-nav/page-side-nav.component';
import { ISpaceFavMetadata } from '../../../../../../cf-favourite-types';

@Component({
selector: 'app-cloud-foundry-space-base',
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
<app-list></app-list>
<ng-template #noEntriesForCurrentFilter>
<app-no-content-message [icon]="'people'" [firstLine]="'There are no users for the current filter'" [secondLine]="{
text: ''
}"></app-no-content-message>
</ng-template>

<ng-template #noEntries>
<app-no-content-message [icon]="'people'" [firstLine]="'There are no users'" [secondLine]="{
text: ''
}"></app-no-content-message>
</ng-template>

<ng-template #noEntriesMaxedResults>
<app-no-content-message [icon]="'people'" [firstLine]="'There are too many users to show'" [secondLine]="{
text: 'Please navigate to an Organization or Space users list'
}"></app-no-content-message>
</ng-template>

<app-list [noEntries]="noEntries" [noEntriesForCurrentFilter]="noEntriesForCurrentFilter"
[noEntriesMaxedResults]="noEntriesMaxedResults"></app-list>
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { AfterContentInit, Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { MatDrawer } from '@angular/material';
import { ActivatedRoute, ActivatedRouteSnapshot, NavigationEnd, Route, Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { Subscription } from 'rxjs';
import { debounceTime, filter, withLatestFrom } from 'rxjs/operators';
import { filter, withLatestFrom } from 'rxjs/operators';
import { EndpointHealthCheck } from '../../../core/endpoints-health-checks';
import { EndpointsService } from '../../../core/endpoints.service';
import { GetCFInfo } from '../../../store/actions/cloud-foundry.actions';
import { GetCurrentUsersRelations } from '../../../store/actions/permissions.actions';
import { GetUserFavoritesAction } from '../../../store/actions/user-favourites-actions/get-user-favorites-action';
import { AppState } from '../../../store/app-state';
import { PageHeaderService } from './../../../core/page-header-service/page-header.service';
import { ChangeSideNavMode, CloseSideNav, OpenSideNav } from './../../../store/actions/dashboard-actions';
import { CloseSideNav } from './../../../store/actions/dashboard-actions';
import { DashboardState } from './../../../store/reducers/dashboard-reducer';
import { SideNavItem } from './../side-nav/side-nav.component';
import { EndpointHealthCheck } from '../../../core/endpoints-health-checks';
import { GetCFInfo } from '../../../store/actions/cloud-foundry.actions';
import { TabNavService } from '../../../tab-nav.service';


Expand All @@ -31,7 +28,6 @@ export class DashboardBaseComponent implements OnInit, OnDestroy, AfterContentIn
constructor(
public pageHeaderService: PageHeaderService,
private store: Store<AppState>,
private breakpointObserver: BreakpointObserver,
private router: Router,
private activatedRoute: ActivatedRoute,
private endpointsService: EndpointsService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
</ng-container>
</div>
<ng-content></ng-content>
<app-entity-favorite-star class="page-header__favorite" *ngIf="_favorite" [favorite]="_favorite">
</app-entity-favorite-star>
<div class="page-header__filler"></div>
<div #extensionRef>
<app-extension-buttons *ngIf="actionsKey" [type]="actionsKey"></app-extension-buttons>
Expand All @@ -30,6 +32,15 @@
">
|
</span>
<button *ngIf="showHistory" class="page-header__menu-button" mat-icon-button [matMenuTriggerFor]="history">
<mat-icon class="page-header__nav-toggle">history</mat-icon>
</button>
<mat-menu #history="matMenu" [overlapTrigger]="false" class="page-header__menu">
<div class="page-header__history">
<h3>Recent</h3>
<app-recent-entities class="page-header__history-list" history="true"></app-recent-entities>
</div>
</mat-menu>
<button *ngIf="!hideMenu" class="page-header__menu-button" mat-icon-button [matMenuTriggerFor]="menu">
<div class="page-header__menu-button-icon"> {{ userNameFirstLetter$ | async }} </div>
</button>
Expand All @@ -41,20 +52,19 @@
<div class="page-header__username-subtext">user</div>
<div>{{ username$ | async }}</div>
</div>
</div>
<div *ngIf="!logoutOnly">
<button mat-menu-item routerLink="/about">
<span>About</span>
</button>
<button mat-menu-item routerLink="/user-profile">
<span>Profile</span>
<div *ngIf="!logoutOnly">
<button mat-menu-item routerLink="/about">
<span>About</span>
</button>
<button mat-menu-item routerLink="/user-profile">
<span>Profile</span>
</button>
<div class="page-header__menu-separator"></div>
</div>
<button mat-menu-item (click)="logout()">
<span>Logout</span>
</button>
<div class="page-header__menu-separator"></div>
</div>
<button mat-menu-item (click)="logout()">
<span>Logout</span>
</button>
</div>
</mat-menu>
</mat-toolbar>
</div>
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.