Skip to content

Commit

Permalink
Surface publish errors (e.g. fetching github orgs) to the UI. Fixes #652
Browse files Browse the repository at this point in the history


Signed-off-by: Eric Wittmann <eric.wittmann@gmail.com>
  • Loading branch information
EricWittmann committed Mar 12, 2019
1 parent e2fc93f commit 3c5a32b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
5 changes: 5 additions & 0 deletions front-end/studio/src/app/components/page-error.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

.card-pf-error .card-pf-title .fa {
color: red;
margin-right: 3px;
}

.card-pf-error .card-pf-body .details {
Expand All @@ -12,3 +13,7 @@
max-height: 350px;
overflow-y: auto;
}

.card-pf-error .card-pf-body .actions > .btn {
margin-right: 5px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class BitbucketResourceComponent implements OnInit {
@Input() value: any;
@Output() onChange = new EventEmitter<any>();
@Output() onValid = new EventEmitter<boolean>();
@Output() onError = new EventEmitter<any>();

public model: any = {
team: null,
Expand Down Expand Up @@ -98,9 +99,8 @@ export class BitbucketResourceComponent implements OnInit {
this.updateRepos();
}
}).catch( error => {
// TODO handle an error in some way!
this.gettingTeams = false;
console.error(error);
this.onError.emit(error);
});
}

Expand Down Expand Up @@ -142,9 +142,8 @@ export class BitbucketResourceComponent implements OnInit {
this.updateBranches();
}
}).catch(error => {
// TODO handle an error!
this.gettingRepos = false;
console.error(error);
this.onError.emit(error);
});
}

Expand Down Expand Up @@ -180,9 +179,8 @@ export class BitbucketResourceComponent implements OnInit {
this.onValid.emit(true);
}
}).catch(error => {
// TODO handle an error!
this.gettingBranches = false;
console.error(error);
this.onError.emit(error);
});

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class GitHubResourceComponent implements OnInit {
@Input() value: any;
@Output() onChange = new EventEmitter<any>();
@Output() onValid = new EventEmitter<boolean>();
@Output() onError = new EventEmitter<any>();

public model: any = {
org: null,
Expand Down Expand Up @@ -96,9 +97,8 @@ export class GitHubResourceComponent implements OnInit {
this.updateRepos();
}
}).catch( error => {
// TODO handle an error in some way!
this.gettingOrgs = false;
console.error(error);
this.onError.emit(error);
});
}

Expand Down Expand Up @@ -140,9 +140,8 @@ export class GitHubResourceComponent implements OnInit {
this.updateBranches();
}
}).catch(error => {
// TODO handle an error!
this.gettingRepos = false;
console.error(error);
this.onError.emit(error);
});
}

Expand Down Expand Up @@ -178,9 +177,8 @@ export class GitHubResourceComponent implements OnInit {
this.onValid.emit(true);
}
}).catch(error => {
// TODO handle an error!
this.gettingBranches = false;
console.error(error);
this.onError.emit(error);
});

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class GitLabResourceComponent implements OnInit {
@Input() value: any;
@Output() onChange = new EventEmitter<any>();
@Output() onValid = new EventEmitter<boolean>();
@Output() onError = new EventEmitter<any>();

public model: GitLabEventData = {
group: null,
Expand Down Expand Up @@ -105,9 +106,8 @@ export class GitLabResourceComponent implements OnInit {
this.updateProjects();
}
}).catch( error => {
// TODO handle an error in some way!
this.gettingGroups = false;
console.error(error);
this.onError.emit(error);
});
}

Expand Down Expand Up @@ -147,9 +147,8 @@ export class GitLabResourceComponent implements OnInit {
this.model.project = projects[0];
}
}).catch(error => {
// TODO handle an error!
this.gettingProjects = false;
console.error(error);
this.onError.emit(error);
});
}

Expand Down Expand Up @@ -185,9 +184,8 @@ export class GitLabResourceComponent implements OnInit {
this.onValid.emit(true);
}
}).catch(error => {
// TODO handle an error!
this.gettingBranches = false;
console.error(error);
this.onError.emit(error);
});

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@ <h2>Publish API "{{ api.name }}"?</h2>
</div>
</div>

<github-resource *ngIf="isSelected('GitHub')" [value]="model" (onChange)="setModel($event)" (onValid)="modelValid = $event"></github-resource>
<gitlab-resource *ngIf="isSelected('GitLab')" [value]="model" (onChange)="setModel($event)" (onValid)="modelValid = $event"></gitlab-resource>
<bitbucket-resource *ngIf="isSelected('Bitbucket')" [value]="model" (onChange)="setModel($event)" (onValid)="modelValid = $event"></bitbucket-resource>
<github-resource *ngIf="isSelected('GitHub')" [value]="model" (onChange)="setModel($event)"
(onError)="error($event)"
(onValid)="modelValid = $event"></github-resource>
<gitlab-resource *ngIf="isSelected('GitLab')" [value]="model" (onChange)="setModel($event)"
(onError)="error($event)"
(onValid)="modelValid = $event"></gitlab-resource>
<bitbucket-resource *ngIf="isSelected('Bitbucket')" [value]="model" (onChange)="setModel($event)"
(onError)="error($event)"
(onValid)="modelValid = $event"></bitbucket-resource>

<div class="form-group" *ngIf="_selectedType">
<label class="col-sm-2 control-label required" for="gh-resource">Resource</label>
Expand Down

0 comments on commit 3c5a32b

Please sign in to comment.