Merge pull request #3173 from mabashian/workflow-403

Adds proper error handling to workflow save related promises

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-02-07 19:25:40 +00:00 committed by GitHub
commit 11b26c199b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 5 deletions

View File

@ -221,6 +221,7 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService
$scope.promptModalMissingReqFields = false;
}
}
watchForPromptChanges();
$scope.nodeFormDataLoaded = true;
} else if (
_.get($scope, 'nodeConfig.node.fullUnifiedJobTemplateObject.unified_job_type') === 'job_template' ||

View File

@ -5,12 +5,12 @@
*************************************************/
export default ['$scope', 'TemplatesService',
'ProcessErrors', 'CreateSelect2', '$q', 'JobTemplateModel',
'Empty', 'PromptService', 'Rest', 'TemplatesStrings', 'WorkflowChartService',
'ProcessErrors', '$q',
'PromptService', 'TemplatesStrings', 'WorkflowChartService',
'Wait', '$state',
function ($scope, TemplatesService,
ProcessErrors, CreateSelect2, $q, JobTemplate,
Empty, PromptService, Rest, TemplatesStrings, WorkflowChartService,
ProcessErrors, $q,
PromptService, TemplatesStrings, WorkflowChartService,
Wait, $state
) {
@ -159,6 +159,11 @@ export default ['$scope', 'TemplatesService',
});
});
}
}).catch(({ data, status }) => {
Wait('stop');
ProcessErrors($scope, data, status, null, {
hdr: $scope.strings.get('error.HEADER')
});
}));
} else if (nodeRef[workflowMakerNodeId].isEdited) {
editPromises.push(TemplatesService.editWorkflowNode({
@ -360,14 +365,26 @@ export default ['$scope', 'TemplatesService',
.then(() => {
Wait('stop');
$scope.closeDialog();
}).catch(({ data, status }) => {
Wait('stop');
ProcessErrors($scope, data, status, null, {
hdr: $scope.strings.get('error.HEADER')
});
});
}).catch(({
data,
status
}) => {
Wait('stop');
ProcessErrors($scope, data, status, null, {});
ProcessErrors($scope, data, status, null, {
hdr: $scope.strings.get('error.HEADER')
});
});
}).catch(({ data, status }) => {
Wait('stop');
ProcessErrors($scope, data, status, null, {
hdr: $scope.strings.get('error.HEADER')
});
});
} else {
@ -381,6 +398,11 @@ export default ['$scope', 'TemplatesService',
Wait('stop');
$scope.closeDialog();
$state.transitionTo('templates');
}).catch(({ data, status }) => {
Wait('stop');
ProcessErrors($scope, data, status, null, {
hdr: $scope.strings.get('error.HEADER')
});
});
}
};