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

Invite users to an org or space #3377

Merged
merged 58 commits into from
Feb 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
8c86ef7
Merge remote-tracking branch 'origin/v2-master' into invite-users
nwmac Jan 25, 2019
366869b
WIP
nwmac Jan 25, 2019
04ad893
WIP - Add stepper with new step, routing and list button (tbd)
richard-cox Jan 25, 2019
b59bb53
WIP - Added stacked input & mostly fleshed out
richard-cox Jan 29, 2019
46ef39a
WIP - Flesh out step 1 with instructions, special case of space level
richard-cox Jan 29, 2019
28ea51c
Add email library
nwmac Jan 30, 2019
93cd3ed
v2/v3 api docs updates
richard-cox Jan 25, 2019
9c2b5dc
wire in perms, cleared many todos
richard-cox Jan 30, 2019
0bbc74b
Merge remote-tracking branch 'origin/invite-users' into invite-users-2
richard-cox Jan 31, 2019
d79cb13
WIP backend
nwmac Jan 31, 2019
292a79d
Merge remote-tracking branch 'origin/invite-users' into invite-users-2
richard-cox Jan 31, 2019
30b7396
Wire in request
richard-cox Jan 31, 2019
70f002f
Remove other steps, fix & tidy up
richard-cox Feb 1, 2019
66546a8
Fix dupe entries
richard-cox Feb 1, 2019
3602acf
Return + focus
richard-cox Feb 1, 2019
8a3d171
Tweaks
richard-cox Feb 4, 2019
1da601c
Tweaks
richard-cox Feb 4, 2019
a95f61e
Fix tests
richard-cox Feb 4, 2019
b9c1454
Merge remote-tracking branch 'origin/v2-master' into invite-users
richard-cox Feb 4, 2019
8585502
CC and lint fixes
richard-cox Feb 4, 2019
e9d53d9
Basic docs, test fixes
richard-cox Feb 4, 2019
4c909f7
MD lint fixes
richard-cox Feb 5, 2019
aece246
Only show invite configure button if cf admin, tweak message for non-…
richard-cox Feb 5, 2019
bc27492
Fix `other` suite e2e tests
richard-cox Feb 5, 2019
887aab0
Improve wait for users table
richard-cox Feb 5, 2019
42599f6
Fix backend test
richard-cox Feb 5, 2019
2944bc6
Fix unit test, allow more time for e2e loading users
richard-cox Feb 5, 2019
ad8eb90
Unit test tweak
richard-cox Feb 6, 2019
fa1855c
Doc fix, tweak for unit tests
richard-cox Feb 6, 2019
66219a7
To Revert - e2e debug
richard-cox Feb 6, 2019
adcc443
Revert "To Revert - e2e debug"
richard-cox Feb 7, 2019
8ceae43
Fix forever loading users list on systems with no smpt config
richard-cox Feb 7, 2019
0afc77e
CC Fixes
richard-cox Feb 7, 2019
501b77c
Add close option to config invite client snack bar
richard-cox Feb 7, 2019
e3fab3b
Add confirmation and error snackbar to disable user invite
richard-cox Feb 7, 2019
8551357
Check scopes and use token for creating user in CF
nwmac Feb 8, 2019
6cd885b
Merge remote-tracking branch 'origin/v2-master' into invite-users
nwmac Feb 12, 2019
93eead1
Update user invite to Echo V3 API
nwmac Feb 12, 2019
ca17c21
Unit test fix
nwmac Feb 12, 2019
086dcfe
Fix front-end unit test
nwmac Feb 12, 2019
9f72548
Add permission check
nwmac Feb 13, 2019
0b2ba30
Three changes
richard-cox Feb 12, 2019
cbf358f
Move invite users button to above user tables
richard-cox Feb 13, 2019
69c06a7
Fix doc readme cc warnings
richard-cox Feb 13, 2019
d442ee3
Minor tidy-ups
nwmac Feb 14, 2019
3fef4f6
Merge branch 'v2-master' into invite-users
KlapTrap Feb 15, 2019
40058aa
Fix imports
KlapTrap Feb 15, 2019
283b5a0
Update docs
KlapTrap Feb 15, 2019
159a5ef
Update the docs guide
KlapTrap Feb 18, 2019
db04bb3
Update invite users text
KlapTrap Feb 18, 2019
ecea0ad
Minor change to the invite table header
KlapTrap Feb 18, 2019
af6e698
Small text change
KlapTrap Feb 18, 2019
a55a88a
Minor text change
KlapTrap Feb 18, 2019
b108d71
Merge remote-tracking branch 'origin/v2-master' into invite-users
richard-cox Feb 18, 2019
73793bc
Merge fixes
richard-cox Feb 18, 2019
93d8719
Update fetch all users max pagination
richard-cox Feb 18, 2019
2090f70
CC Fixed and copy change
KlapTrap Feb 18, 2019
656e3ff
CC Fix
KlapTrap Feb 18, 2019
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
Tweaks
  • Loading branch information
richard-cox committed Feb 4, 2019
commit 1da601ceb7754102cd462dc5e9967bf4d521434e
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ import { CloudFoundryEndpointService } from '../services/cloud-foundry-endpoint.

const { proxyAPIVersion } = environment;

export interface UserInviteResponse {
export interface UserInviteBaseResponse {
error: boolean;
errorMessage?: string;
}

export interface UserInviteSendUaaResponse {
failed_invites: UserInviteSendUaaSectionResponse[];
new_invites: UserInviteSendUaaSectionResponse[];
export interface UserInviteResponseUaa {
failed_invites: UserInviteResponseUaaSection[];
new_invites: UserInviteResponseUaaSection[];
}

export interface UserInviteSendUaaSectionResponse {
export interface UserInviteResponseUaaSection {
email: string;
errorCode: string;
errorMessage: string;
Expand All @@ -34,7 +34,7 @@ export interface UserInviteSendUaaSectionResponse {
userid: string;
}

export interface UserInviteSendResponse extends UserInviteResponse, UserInviteSendUaaResponse {
export interface UserInviteSendResponse extends UserInviteBaseResponse, UserInviteResponseUaa {
}

export enum UserInviteSendSpaceRoles {
Expand All @@ -43,7 +43,7 @@ export enum UserInviteSendSpaceRoles {
manager = 'manager'
}

interface UserInviteSendRequest {
interface UserInviteSend {
org: string;
space: string;
spaceRoles: { [spaceRole: string]: boolean };
Expand Down Expand Up @@ -72,7 +72,7 @@ export class UserInviteService {
);
}

configure(cfGUID: string, clientID: string, clientSecret: string): Observable<UserInviteResponse> {
configure(cfGUID: string, clientID: string, clientSecret: string): Observable<UserInviteBaseResponse> {
const formData: FormData = new FormData();
formData.append('client_id', clientID);
formData.append('client_secret', clientSecret);
Expand Down Expand Up @@ -110,7 +110,7 @@ export class UserInviteService {
return obs$;
}

unconfigure(cfGUID: string): Observable<UserInviteResponse> {
unconfigure(cfGUID: string): Observable<UserInviteBaseResponse> {
const url = `/pp/${proxyAPIVersion}/invite/${cfGUID}`;
return this.http.delete(url).pipe(
map(v => {
Expand Down Expand Up @@ -151,7 +151,7 @@ export class UserInviteService {

invite(cfGuid: string, orgGuid: string, spaceGuid: string, spaceRole: UserInviteSendSpaceRoles, emails: string[]):
Observable<UserInviteSendResponse> {
const users: UserInviteSendRequest = {
const users: UserInviteSend = {
org: orgGuid,
space: spaceGuid,
spaceRoles: {
Expand All @@ -160,7 +160,7 @@ export class UserInviteService {
emails
};
return this.http.post(`/pp/${proxyAPIVersion}/invite/send/${cfGuid}`, users).pipe(
map((response: UserInviteSendUaaResponse) => ({
map((response: UserInviteResponseUaa) => ({
error: response.failed_invites.length > 0,
...response
})),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class InviteUsersCreateComponent implements OnInit {

// Mark all as processing
const processingState: StackedInputActionsState[] = [];
Object.entries(this.users.values).forEach(([key, value]) => {
Object.keys(this.users.values).forEach(key => {
processingState.push({
key,
result: StackedInputActionResult.PROCESSING,
Expand All @@ -113,10 +113,10 @@ export class InviteUsersCreateComponent implements OnInit {
Object.values(this.users.values)).pipe(
map(res => {
if (!res.error && res.failed_invites.length === 0) {
// Clear all paginations of type users for this endpoint
// Success! Clear all paginations of type users such that lists can be refetched with new user.s
this.store.dispatch(new ClearPaginationOfType(cfUserSchemaKey));
} else if (res.failed_invites.length > 0) {
// Push failures back into components
// One or more failed. Push failures back into components
const newState: StackedInputActionsState[] = [];
Object.entries(this.users.values).forEach(([key, email]) => {
// Update failed users
Expand All @@ -139,14 +139,14 @@ export class InviteUsersCreateComponent implements OnInit {
});
return;
}
// Can't find user for unknown reason, set to failed to can try again
// Can't find user for unknown reason, set to failed so it can be tried again
newState.push({
key,
result: StackedInputActionResult.FAILED,
message: 'No response for user found'
});
});
// We've just come from a valid state, so this should be valid again
// We've just come from a valid state, so form should be valid again
this.stepValid.next(true);
this.stateIn.next(newState);
res.errorMessage = 'Failed to invite one or more users. Please address per user message and try again';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ import { getRowMetadata } from '../../../cf.helpers';
import { CfRolesService } from '../cf-roles.service';
import { SpaceRolesListWrapperComponent } from './space-roles-list-wrapper/space-roles-list-wrapper.component';

/* tslint:disable:max-line-length */
/* tslint:enable:max-line-length */

interface Org { metadata: { guid: string }; }
interface CfUserWithWarning extends CfUser {
showWarning: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- // TODO: rc generic validation OR change name -->
<div class="input-action">
<form class="input-action__form stepper-form">
<mat-form-field class="">
Expand All @@ -15,12 +14,10 @@
</mat-form-field>
</form>
<div class="input-action__detail">
<div style="width: 24px;" *ngIf="showRemove">
<mat-icon class="input-action__detail__remove" [ngClass]="{'disabled': emailFormControl.disabled}" (click)="!emailFormControl.disabled && remove.emit()" [matTooltip]="'Remove'">indeterminate_check_box</mat-icon>
</div>
<div *ngIf="state" class="input-action__detail__result">
<app-boolean-indicator *ngIf="state.result === result.SUCCEEDED || state.result === result.FAILED" [isTrue]="state.result === result.SUCCEEDED" type="succeeded-failed" [subtle]="false" [showText]="false"></app-boolean-indicator>
<mat-icon *ngIf="showRemove" class="input-action__detail__remove" [ngClass]="{'disabled': emailFormControl.disabled}" (click)="!emailFormControl.disabled && remove.emit()" [matTooltip]="'Remove'">indeterminate_check_box</mat-icon>
<ng-container *ngIf="state && result && (state.result === result.SUCCEEDED || state.result === result.FAILED)" class="input-action__detail__result">
<app-boolean-indicator [isTrue]="state.result === result.SUCCEEDED" type="succeeded-failed" [subtle]="false" [showText]="false"></app-boolean-indicator>
<span>{{ state.message }}</span>
</div>
</ng-container>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
.input-action {
align-items: center;
display: flex;
// flex-direction: row;

> *, &__detail > *, &__detail__result app-boolean-indicator { // TODO: RC flatten
margin-right: 10px;
}
$margin: 10px;

&__form {
align-items: center;
flex: 1;
flex-direction: row;
margin-right: $margin;
}
&__detail {
align-items: center;
display: flex;
margin-top: 20px;
> * {
margin-right: $margin;
}

&__remove {
cursor: pointer;
Expand All @@ -25,13 +26,8 @@
}
}

&__result {
align-items: center;
display: flex;
app-boolean-indicator {
// margin-right: 10px;
}
app-boolean-indicator {
width: 20px;
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export interface StackedInputActionUpdate {
valid: boolean;
}

/**
* Individual email input field meant to be stacked amongst others of same type in a . Used in conjunction with StackedInputActionsComponent
*/
@Component({
selector: 'app-stacked-input-action',
templateUrl: './stacked-input-action.component.html',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export interface StackedInputActionsState {

export interface StackedInputActionsUpdate { values: { [key: string]: string }; valid: boolean; }

/**
* Host for a collection of StackedInputActionComponent components
*/
@Component({
selector: 'app-stacked-input-actions',
templateUrl: './stacked-input-actions.component.html',
Expand All @@ -55,7 +58,6 @@ export class StackedInputActionsComponent implements OnInit, OnDestroy {
update: StackedInputActionUpdate
}
} = {};
// private valueState: { [key: number]: StackedInputActionUpdate } = {};
private subs: Subscription[] = [];

constructor(
Expand Down