-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warning for admin maxed world org/space
- Admins at org/space level with maxed users cannot see users without roles - Add a warning so they don't search for them
- Loading branch information
1 parent
ad90d91
commit dc128b2
Showing
10 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...res/cloud-foundry/tabs/cf-admin-add-user-warning/cf-admin-add-user-warning.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<mat-card *ngIf="show$ | async" class="user-warning"> | ||
<mat-icon class="user-warning__icon">warning</mat-icon>There are too many users to show those without roles. To add a user to this {{isOrg ? 'organization' : 'space'}} please use another tool such as the Cloud Foundry CLI | ||
</mat-card> |
12 changes: 12 additions & 0 deletions
12
...res/cloud-foundry/tabs/cf-admin-add-user-warning/cf-admin-add-user-warning.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.user-warning { | ||
align-items: center; | ||
display: flex; | ||
font-size: 14px; | ||
margin-bottom: 12px; | ||
padding: 12px 22px; | ||
|
||
&__icon { | ||
font-size: 22px; | ||
margin-right: 13px; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
.../cloud-foundry/tabs/cf-admin-add-user-warning/cf-admin-add-user-warning.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { CfAdminAddUserWarningComponent } from './cf-admin-add-user-warning.component'; | ||
|
||
describe('CfAdminAddUserWarningComponent', () => { | ||
let component: CfAdminAddUserWarningComponent; | ||
let fixture: ComponentFixture<CfAdminAddUserWarningComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ CfAdminAddUserWarningComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CfAdminAddUserWarningComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
7 changes: 7 additions & 0 deletions
7
...oud-foundry/tabs/cf-admin-add-user-warning/cf-admin-add-user-warning.component.theme.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@mixin cf-admin-add-user-warning($theme, $app-theme) { | ||
$status-colors: map-get($app-theme, status); | ||
$warning: map-get($status-colors, warning); | ||
.user-warning { | ||
background-color: lighten($warning, 45%); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...tures/cloud-foundry/tabs/cf-admin-add-user-warning/cf-admin-add-user-warning.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Component } from '@angular/core'; | ||
import { Store } from '@ngrx/store'; | ||
import { Observable } from 'rxjs'; | ||
import { filter, map, switchMap } from 'rxjs/operators'; | ||
|
||
import { CfUserService } from '../../../../shared/data-services/cf-user.service'; | ||
import { GetAllUsersAsAdmin } from '../../../../store/actions/users.actions'; | ||
import { AppState } from '../../../../store/app-state'; | ||
import { ActiveRouteCfOrgSpace } from '../../cf-page.types'; | ||
import { waitForCFPermissions } from '../../cf.helpers'; | ||
|
||
@Component({ | ||
selector: 'app-cf-admin-add-user-warning', | ||
templateUrl: './cf-admin-add-user-warning.component.html', | ||
styleUrls: ['./cf-admin-add-user-warning.component.scss'] | ||
}) | ||
export class CfAdminAddUserWarningComponent { | ||
|
||
isOrg: boolean; | ||
show$: Observable<boolean>; | ||
|
||
constructor( | ||
store: Store<AppState>, | ||
activeRouteCfOrgSpace: ActiveRouteCfOrgSpace, | ||
cfUserService: CfUserService | ||
) { | ||
this.isOrg = !activeRouteCfOrgSpace.spaceGuid; | ||
this.show$ = waitForCFPermissions( | ||
store, | ||
activeRouteCfOrgSpace.cfGuid | ||
).pipe( | ||
filter(cf => cf.global.isAdmin), | ||
switchMap(cf => cfUserService.createPaginationAction( | ||
cf.global.isAdmin, | ||
activeRouteCfOrgSpace.cfGuid, | ||
activeRouteCfOrgSpace.orgGuid, | ||
activeRouteCfOrgSpace.spaceGuid)), | ||
map(fetchUsersAction => { | ||
return !GetAllUsersAsAdmin.is(fetchUsersAction); | ||
}) | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters