зеркало из https://github.com/mozilla/treeherder.git
Bug 1473167 - Fix 'Retrigger All' provides no feedback (#3766)
This commit is contained in:
Родитель
bc4e8a7b14
Коммит
057c3415cc
|
@ -21,7 +21,7 @@ export const formatModelError = function formatModelError(e, message) {
|
|||
}
|
||||
|
||||
// If there is nothing in the server message use the HTTP response status.
|
||||
const errorMessage = `${e.data.detail || e.status} ${e.statusText}`;
|
||||
const errorMessage = `${e.data && e.data.detail || e.status} ${e.statusText}`;
|
||||
return `${message}: ${errorMessage}`;
|
||||
|
||||
};
|
||||
|
|
|
@ -181,7 +181,20 @@ export default class PinBoard extends React.Component {
|
|||
retriggerAllPinnedJobs() {
|
||||
// pushing pinned jobs to a list.
|
||||
const jobIds = Object.keys(this.props.pinnedJobs);
|
||||
JobModel.retrigger(this.$rootScope.repoName, jobIds);
|
||||
const plurality = jobIds.length > 1 ? 's' : '';
|
||||
|
||||
JobModel.retrigger(this.$rootScope.repoName, jobIds)
|
||||
.then((resp) => {
|
||||
if (resp.ok) {
|
||||
this.thNotify.send(
|
||||
`Retrigger request sent for ${jobIds.length} pinned job${plurality}`,
|
||||
'success');
|
||||
} else {
|
||||
throw new Error(formatModelError(resp, `Unable to send retrigger${plurality}`));
|
||||
}
|
||||
})
|
||||
.catch(error => this.$timeout(this.thNotify.send(error, 'danger')))
|
||||
.finally(() => this.$rootScope.$apply());
|
||||
}
|
||||
|
||||
cancelAllPinnedJobsTitle() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче