Repository: ambari Updated Branches: refs/heads/branch-2.5 ab5749a99 -> 523247aaf
Revert "AMBARI-20050. Issue while importing workflow with insufficient permissions.(Madhan Mohan Reddy via gauravn7)" This reverts commit ab5749a99e02643dd0808f6baf0c6c3c91e88fa9. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/523247aa Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/523247aa Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/523247aa Branch: refs/heads/branch-2.5 Commit: 523247aaf24b9b766927e97e35cb2f9e5e790fbf Parents: ab5749a Author: Gaurav Nagar <grv...@gmail.com> Authored: Thu Feb 23 19:19:34 2017 +0530 Committer: Gaurav Nagar <grv...@gmail.com> Committed: Thu Feb 23 19:19:34 2017 +0530 ---------------------------------------------------------------------- .../apache/oozie/ambari/view/OozieDelegate.java | 12 +- .../ambari/view/OozieProxyImpersonator.java | 381 ++++++++++++------- .../oozie/ambari/view/assets/AssetResource.java | 93 ++--- .../WorkflowsManagerResource.java | 36 +- .../ui/app/components/bundle-config.js | 8 +- .../resources/ui/app/components/coord-config.js | 6 +- .../ui/app/components/designer-errors.js | 49 --- .../ui/app/components/flow-designer.js | 69 +++- .../src/main/resources/ui/app/styles/app.less | 13 +- .../app/templates/components/bundle-config.hbs | 4 +- .../app/templates/components/coord-config.hbs | 2 +- .../templates/components/designer-errors.hbs | 17 - .../app/templates/components/flow-designer.hbs | 18 +- 13 files changed, 378 insertions(+), 330 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieDelegate.java ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieDelegate.java b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieDelegate.java index 6f3c4d2..55c4312 100644 --- a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieDelegate.java +++ b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieDelegate.java @@ -32,8 +32,6 @@ import javax.ws.rs.core.Response; import org.apache.ambari.view.ViewContext; import org.apache.commons.io.IOUtils; -import org.apache.oozie.ambari.view.exception.ErrorCode; -import org.apache.oozie.ambari.view.exception.WfmException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -92,16 +90,10 @@ public class OozieDelegate { LOGGER.info("Resp from oozie status entity==" + serviceResponse.getEntity()); - String oozieResp=null; if (serviceResponse.getEntity() instanceof String) { - oozieResp= (String) serviceResponse.getEntity(); + return (String) serviceResponse.getEntity(); } else { - oozieResp= serviceResponse.getEntity().toString(); - } - if (oozieResp != null && oozieResp.trim().startsWith("{")) { - return oozieResp; - }else{ - throw new WfmException(oozieResp,ErrorCode.OOZIE_SUBMIT_ERROR); + return "success"; } } http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java index c4e5bbd..6603a9c 100644 --- a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java +++ b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java @@ -49,10 +49,9 @@ import javax.ws.rs.core.UriInfo; import org.apache.ambari.view.ViewContext; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.exception.ExceptionUtils; +import org.apache.hadoop.security.AccessControlException; import org.apache.oozie.ambari.view.assets.AssetResource; -import org.apache.oozie.ambari.view.exception.ErrorCode; -import org.apache.oozie.ambari.view.exception.WfmException; -import org.apache.oozie.ambari.view.exception.WfmWebException; import org.apache.oozie.ambari.view.workflowmanager.WorkflowManagerService; import org.apache.oozie.ambari.view.workflowmanager.WorkflowsManagerResource; import org.slf4j.Logger; @@ -84,7 +83,30 @@ public class OozieProxyImpersonator { private final OozieUtils oozieUtils = new OozieUtils(); private final AssetResource assetResource; + private enum ErrorCodes { + OOZIE_SUBMIT_ERROR("error.oozie.submit", "Oozie Submit error"), OOZIE_IO_ERROR( + "error.oozie.io", "Oozie I/O error"), FILE_ACCESS_ACL_ERROR( + "error.file.access.control", + "Access Error to file due to access control"), FILE_ACCESS_UNKNOWN_ERROR( + "error.file.access", "Error accessing file"), WORKFLOW_PATH_EXISTS( + "error.workflow.path.exists", "Workflow Path exists"), WORKFLOW_XML_DOES_NOT_EXIST( + "error.workflow.xml.not.exists", "Workflow Xml does not exist"); + private String errorCode; + private String description; + + ErrorCodes(String errorCode, String description) { + this.errorCode = errorCode; + this.description = description; + } + + public String getErrorCode() { + return errorCode; + } + public String getDescription() { + return description; + } + } private static enum WorkflowFormat{ XML("xml"), DRAFT("draft"); @@ -117,23 +139,15 @@ public class OozieProxyImpersonator { @GET @Path("hdfsCheck") public Response hdfsCheck(){ - try { - hdfsFileUtils.hdfsCheck(); - return Response.ok().build(); - }catch (Exception e){ - throw new WfmWebException(e); - } + hdfsFileUtils.hdfsCheck(); + return Response.ok().build(); } @GET @Path("homeDirCheck") public Response homeDirCheck(){ - try{ - hdfsFileUtils.homeDirCheck(); - return Response.ok().build(); - }catch (Exception e){ - throw new WfmWebException(e); - } + hdfsFileUtils.homeDirCheck(); + return Response.ok().build(); } @Path("/fileServices") @@ -175,89 +189,57 @@ public class OozieProxyImpersonator { @QueryParam("projectId") String projectId, @DefaultValue("false") @QueryParam("overwrite") Boolean overwrite, @QueryParam("description") String description, - @QueryParam("jobType") String jobTypeString) { + @QueryParam("jobType") String jobType) { LOGGER.info("submit workflow job called"); - JobType jobType = JobType.valueOf(jobTypeString); - if (StringUtils.isEmpty(appPath)) { - throw new WfmWebException(ErrorCode.INVALID_EMPTY_INPUT); - } - appPath = workflowFilesService.getWorkflowFileName(appPath.trim(), jobType); - try { - if (!overwrite) { - boolean fileExists = hdfsFileUtils.fileExists(appPath); - if (fileExists) { - throw new WfmWebException(ErrorCode.WORKFLOW_PATH_EXISTS); - } - } - postBody = utils.formatXml(postBody); - - String filePath = workflowFilesService.createFile(appPath, postBody, overwrite); - LOGGER.info(String.format("submit workflow job done. filePath=[%s]", filePath)); - - if (PROJ_MANAGER_ENABLED) { - String name = oozieUtils.deduceWorkflowNameFromXml(postBody); - workflowManagerService.saveWorkflow(projectId, appPath, jobType, - null, viewContext.getUsername(), name); - } - String response = oozieDelegate.submitWorkflowJobToOozie(headers, - appPath, ui.getQueryParameters(), jobType); - return Response.status(Status.OK).entity(response).build(); - } catch (WfmWebException ex) { - throw ex; - } catch(WfmException ex){ - throw new WfmWebException(ex,ex.getErrorCode()); - } catch(Exception ex) { - throw new WfmWebException(ex); - } + return submitJobInternal(postBody, headers, ui, appPath, overwrite, + JobType.valueOf(jobType), projectId, description); } @POST @Path("/saveWorkflow") @Consumes({MediaType.TEXT_PLAIN + "," + MediaType.TEXT_XML}) public Response saveWorkflow(String postBody, @Context HttpHeaders headers, - @Context UriInfo ui, @QueryParam("app.path") String appPath, - @QueryParam("jobType") String jobTypeStr, + @Context UriInfo ui, @QueryParam("app.path") String appPath, @QueryParam("jobType") String jobTypeStr, @DefaultValue("false") @QueryParam("overwrite") Boolean overwrite) { LOGGER.info("save workflow called"); if (StringUtils.isEmpty(appPath)) { - throw new WfmWebException(ErrorCode.INVALID_EMPTY_INPUT); + throw new RuntimeException("app path can't be empty."); } JobType jobType = StringUtils.isEmpty(jobTypeStr) ? JobType.WORKFLOW : JobType.valueOf(jobTypeStr); String workflowFilePath = workflowFilesService.getWorkflowFileName(appPath.trim(), jobType); - try { - if (!overwrite) { - boolean fileExists = hdfsFileUtils.fileExists(workflowFilePath); - if (fileExists) { - throw new WfmWebException(ErrorCode.WORKFLOW_PATH_EXISTS); - } + if (!overwrite) { + boolean fileExists = hdfsFileUtils.fileExists(workflowFilePath); + if (fileExists) { + return getFileExistsResponse(); } + } + + try { if (utils.isXml(postBody)) { saveWorkflowXml(jobType, appPath, postBody, overwrite); } else { saveDraft(jobType, appPath, postBody, overwrite); } if (PROJ_MANAGER_ENABLED) { - workflowManagerService.saveWorkflow(null, workflowFilePath, jobType, null, + workflowManagerService.saveWorkflow(null, workflowFilePath, + jobType, null, viewContext.getUsername(), getWorkflowName(postBody)); } - } catch (WfmWebException ex) { - throw ex; - } catch (Exception ex) { - throw new WfmWebException(ex); + } catch (IOException ex) { + return getRespCodeForException(ex); } + return Response.ok().build(); } - - private String getWorkflowName(String postBody) { + private String getWorkflowName(String postBody){ if (utils.isXml(postBody)) { return oozieUtils.deduceWorkflowNameFromXml(postBody); - } else { + }else{ return oozieUtils.deduceWorkflowNameFromJson(postBody); } } - private void saveWorkflowXml(JobType jobType, String appPath, String postBody, - Boolean overwrite) throws IOException { + private void saveWorkflowXml(JobType jobType, String appPath, String postBody, Boolean overwrite) throws IOException { appPath = workflowFilesService.getWorkflowFileName(appPath.trim(), jobType); postBody = utils.formatXml(postBody); workflowFilesService.createFile(appPath, postBody, overwrite); @@ -285,47 +267,49 @@ public class OozieProxyImpersonator { @DefaultValue("false") @QueryParam("overwrite") Boolean overwrite) { LOGGER.info("publish asset called"); if (StringUtils.isEmpty(uploadPath)) { - throw new WfmWebException(ErrorCode.INVALID_EMPTY_INPUT); + throw new RuntimeException("upload path can't be empty."); } uploadPath = uploadPath.trim(); - try { - Map<String, String> validateAsset = assetResource.validateAsset(headers, postBody, - ui.getQueryParameters()); - if (!STATUS_OK.equals(validateAsset.get(STATUS_KEY))) { - WfmWebException wfmEx=new WfmWebException(ErrorCode.INVALID_ASSET_INPUT); - wfmEx.setAdditionalDetail(validateAsset.get(MESSAGE_KEY)); - throw wfmEx; - } - return saveAsset(postBody, uploadPath, overwrite); - } catch (WfmWebException ex) { - throw ex; - } catch (Exception ex) { - throw new WfmWebException(ex); + Map<String, String> validateAsset = assetResource.validateAsset(headers, postBody, + ui.getQueryParameters()); + if (!STATUS_OK.equals(validateAsset.get(STATUS_KEY))) { + return Response.status(Status.BAD_REQUEST).entity( + validateAsset.get(MESSAGE_KEY)).build(); } + return saveAsset(postBody, uploadPath, overwrite); } - private Response saveAsset(String postBody, String uploadPath, Boolean overwrite) throws IOException { + private Response saveAsset(String postBody, String uploadPath, + Boolean overwrite) { uploadPath = workflowFilesService.getAssetFileName(uploadPath); if (!overwrite) { boolean fileExists = hdfsFileUtils.fileExists(uploadPath); if (fileExists) { - throw new WfmWebException(ErrorCode.WORKFLOW_PATH_EXISTS); + return getFileExistsResponse(); } } postBody = utils.formatXml(postBody); - String filePath = workflowFilesService.createAssetFile(uploadPath, postBody, overwrite); - LOGGER.info(String.format("publish asset job done. filePath=[%s]", filePath)); - return Response.ok().build(); + try { + String filePath = workflowFilesService.createAssetFile(uploadPath, + postBody, overwrite); + LOGGER.info(String.format("publish asset job done. filePath=[%s]", + filePath)); + return Response.ok().build(); + } catch (Exception ex) { + LOGGER.error(ex.getMessage(), ex); + return getRespCodeForException(ex); + } } - @GET @Path("/readAsset") - public Response readAsset(@QueryParam("assetPath") String assetPath) { + public Response readAsset( + @QueryParam("assetPath") String assetPath) { if (StringUtils.isEmpty(assetPath)) { - throw new WfmWebException(ErrorCode.INVALID_EMPTY_INPUT); + throw new RuntimeException("assetPath can't be empty."); } try { - final InputStream is = workflowFilesService.readAssset(assetPath); + final InputStream is = workflowFilesService + .readAssset(assetPath); StreamingOutput streamer = new StreamingOutput() { @Override public void write(OutputStream os) throws IOException, @@ -336,16 +320,17 @@ public class OozieProxyImpersonator { } }; return Response.ok(streamer).status(200).build(); - } catch (IOException ex) { - throw new WfmWebException(ex); + } catch (IOException e) { + return getRespCodeForException(e); } } + @GET @Path("/readWorkflowDraft") public Response readDraft(@QueryParam("workflowXmlPath") String workflowPath) { if (StringUtils.isEmpty(workflowPath)) { - throw new WfmWebException(ErrorCode.INVALID_EMPTY_INPUT); + throw new RuntimeException("workflowXmlPath can't be empty."); } try { final InputStream is = workflowFilesService.readDraft(workflowPath); @@ -359,37 +344,113 @@ public class OozieProxyImpersonator { } }; return Response.ok(streamer).status(200).build(); - } catch (IOException ex) { - throw new WfmWebException(ex); + } catch (IOException e) { + return getRespCodeForException(e); } } @POST @Path("/discardWorkflowDraft") public Response discardDraft( - @QueryParam("workflowXmlPath") String workflowPath) { + @QueryParam("workflowXmlPath") String workflowPath) + throws IOException { + workflowFilesService.discardDraft(workflowPath); + return Response.ok().build(); + } + + private Response submitJobInternal(String postBody, HttpHeaders headers, + UriInfo ui, String appPath, Boolean overwrite, JobType jobType, + String projectId, String description) { + if (StringUtils.isEmpty(appPath)) { + throw new RuntimeException("app path can't be empty."); + } + appPath = workflowFilesService.getWorkflowFileName(appPath.trim(), jobType); + if (!overwrite) { + boolean fileExists = hdfsFileUtils.fileExists(appPath); + if (fileExists) { + return getFileExistsResponse(); + } + } + postBody = utils.formatXml(postBody); try { - workflowFilesService.discardDraft(workflowPath); - return Response.ok().build(); - } catch (IOException ex) { - throw new WfmWebException(ex); + String filePath = workflowFilesService.createFile(appPath, postBody, + overwrite); + LOGGER.info(String.format( + "submit workflow job done. filePath=[%s]", filePath)); + } catch (Exception ex) { + LOGGER.error(ex.getMessage(), ex); + return getRespCodeForException(ex); + + } + if (PROJ_MANAGER_ENABLED) { + String name = oozieUtils.deduceWorkflowNameFromXml(postBody); + workflowManagerService.saveWorkflow(projectId, appPath, jobType, + "todo description", viewContext.getUsername(), name); + } + + String response = oozieDelegate.submitWorkflowJobToOozie(headers, + appPath, ui.getQueryParameters(), jobType); + if (response != null && response.trim().startsWith("{")) { + // dealing with oozie giving error but with 200 response. + return Response.status(Response.Status.OK).entity(response).build(); + } else { + HashMap<String, String> resp = new HashMap<String, String>(); + resp.put("status", ErrorCodes.OOZIE_SUBMIT_ERROR.getErrorCode()); + resp.put("message", response); + return Response.status(Response.Status.BAD_REQUEST).entity(resp) + .build(); } + + } + + private Response getRespCodeForException(Exception ex) { + if (ex instanceof AccessControlException) { + HashMap<String, String> errorDetails = getErrorDetails( + ErrorCodes.FILE_ACCESS_ACL_ERROR.getErrorCode(), + ErrorCodes.FILE_ACCESS_ACL_ERROR.getDescription(), ex); + return Response.status(Response.Status.BAD_REQUEST) + .entity(errorDetails).build(); + } else if (ex instanceof IOException) { + HashMap<String, String> errorDetails = getErrorDetails( + ErrorCodes.FILE_ACCESS_UNKNOWN_ERROR.getErrorCode(), + ErrorCodes.FILE_ACCESS_UNKNOWN_ERROR.getDescription(), ex); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(errorDetails).build(); + } else { + HashMap<String, String> errorDetails = getErrorDetails( + ErrorCodes.FILE_ACCESS_UNKNOWN_ERROR.getErrorCode(), + ErrorCodes.FILE_ACCESS_UNKNOWN_ERROR.getDescription(), ex); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(errorDetails).build(); + } + + } + + private Response getFileExistsResponse() { + HashMap<String, String> resp = new HashMap<String, String>(); + resp.put("status", ErrorCodes.WORKFLOW_PATH_EXISTS.getErrorCode()); + resp.put("message", ErrorCodes.WORKFLOW_PATH_EXISTS.getDescription()); + return Response.status(Response.Status.BAD_REQUEST).entity(resp) + .build(); } @GET @Path("/readWorkflow") public Response readWorkflow( @QueryParam("workflowPath") String workflowPath, @QueryParam("jobType") String jobTypeStr) { - try { - String workflowFileName = workflowFilesService.getWorkflowFileName(workflowPath, JobType.valueOf(jobTypeStr)); - if (!hdfsFileUtils.fileExists(workflowFileName)) { - throw new WfmWebException(ErrorCode.WORKFLOW_XML_DOES_NOT_EXIST); - } - WorkflowFileInfo workflowDetails = workflowFilesService - .getWorkflowDetails(workflowPath, JobType.valueOf(jobTypeStr)); - if (workflowPath.endsWith(Constants.WF_DRAFT_EXTENSION) || workflowDetails.getIsDraftCurrent()) { - String filePath = workflowFilesService.getWorkflowDraftFileName(workflowPath, JobType.valueOf(jobTypeStr)); + String workflowFileName=workflowFilesService.getWorkflowFileName(workflowPath, JobType.valueOf(jobTypeStr)); + if (!hdfsFileUtils.fileExists(workflowFileName)){ + HashMap<String,String> response=new HashMap<>(); + response.put("status", ErrorCodes.WORKFLOW_XML_DOES_NOT_EXIST.getErrorCode()); + response.put("message", ErrorCodes.WORKFLOW_XML_DOES_NOT_EXIST.getDescription()); + return Response.status(Status.BAD_REQUEST).entity(response).build(); + } + WorkflowFileInfo workflowDetails = workflowFilesService + .getWorkflowDetails(workflowPath, JobType.valueOf(jobTypeStr)); + if (workflowPath.endsWith(Constants.WF_DRAFT_EXTENSION) || workflowDetails.getIsDraftCurrent()) { + String filePath = workflowFilesService.getWorkflowDraftFileName(workflowPath, JobType.valueOf(jobTypeStr)); + try { InputStream inputStream = workflowFilesService.readWorkflowXml(filePath); String stringResponse = IOUtils.toString(inputStream); if (!workflowFilesService.isDraftFormatCurrent(stringResponse)) { @@ -398,35 +459,36 @@ public class OozieProxyImpersonator { } else { return Response.ok(stringResponse).header(RESPONSE_TYPE, WorkflowFormat.DRAFT.getValue()).build(); } - } else { - String filePath = workflowFilesService.getWorkflowFileName(workflowPath, JobType.valueOf(jobTypeStr)); - return getWorkflowResponse(filePath, WorkflowFormat.XML.getValue(), false); + } catch (IOException e) { + return getRespCodeForException(e); } - } catch (WfmWebException ex) { - throw ex; - } catch (Exception ex) { - throw new WfmWebException(ex); + } else { + String filePath = workflowFilesService.getWorkflowFileName(workflowPath, JobType.valueOf(jobTypeStr)); + return getWorkflowResponse(filePath, WorkflowFormat.XML.getValue(), false); } } - private Response getWorkflowResponse(String filePath, String responseType, - boolean olderFormatDraftIngored) throws IOException { - final InputStream is = workflowFilesService.readWorkflowXml(filePath); - StreamingOutput streamer = new StreamingOutput() { - @Override - public void write(OutputStream os) throws IOException, - WebApplicationException { - IOUtils.copy(is, os); - is.close(); - os.close(); + private Response getWorkflowResponse(String filePath, String responseType, boolean olderFormatDraftIngored) { + try { + final InputStream is = workflowFilesService + .readWorkflowXml(filePath); + StreamingOutput streamer = new StreamingOutput() { + @Override + public void write(OutputStream os) throws IOException, + WebApplicationException { + IOUtils.copy(is, os); + is.close(); + os.close(); + } + }; + Response.ResponseBuilder responseBuilder = Response.ok(streamer).header(RESPONSE_TYPE, responseType); + if(olderFormatDraftIngored){ + responseBuilder.header(OLDER_FORMAT_DRAFT_INGORED,Boolean.TRUE.toString()); } - }; - Response.ResponseBuilder responseBuilder = Response.ok(streamer).header(RESPONSE_TYPE, responseType); - if (olderFormatDraftIngored) { - responseBuilder.header(OLDER_FORMAT_DRAFT_INGORED, Boolean.TRUE.toString()); + return responseBuilder.build(); + } catch (IOException e) { + return getRespCodeForException(e); } - return responseBuilder.build(); - } @GET @@ -434,13 +496,12 @@ public class OozieProxyImpersonator { public Response readWorkflowXml( @QueryParam("workflowXmlPath") String workflowPath,@QueryParam("jobType") String jobTypeStr) { if (StringUtils.isEmpty(workflowPath)) { - throw new WfmWebException(ErrorCode.INVALID_EMPTY_INPUT); + throw new RuntimeException("workflowXmlPath can't be empty."); } + try { - if (!hdfsFileUtils.fileExists(workflowPath)) { - throw new WfmWebException(ErrorCode.WORKFLOW_XML_DOES_NOT_EXIST); - } - final InputStream is = workflowFilesService.readWorkflowXml(workflowPath); + final InputStream is = workflowFilesService + .readWorkflowXml(workflowPath); StreamingOutput streamer = new StreamingOutput() { @Override public void write(OutputStream os) throws IOException, @@ -451,13 +512,24 @@ public class OozieProxyImpersonator { } }; return Response.ok(streamer).status(200).build(); - } catch (WfmWebException ex) { - throw ex; - } catch (Exception ex) { - throw new WfmWebException(ex); + } catch (IOException e) { + return getRespCodeForException(e); } } + private HashMap<String, String> getErrorDetails(String status, + String message, Exception ex) { + HashMap<String, String> resp = new HashMap<String, String>(); + resp.put("status", status); + if (message != null) { + resp.put("message", message); + } + if (ex != null) { + resp.put("stackTrace", ExceptionUtils.getFullStackTrace(ex)); + } + return resp; + } + @GET @Path("/{path: .*}") public Response handleGet(@Context HttpHeaders headers, @Context UriInfo ui) { @@ -466,7 +538,8 @@ public class OozieProxyImpersonator { .getPath(), ui.getQueryParameters(), HttpMethod.GET, null); } catch (Exception ex) { LOGGER.error("Error in GET proxy", ex); - throw new WfmWebException(ex); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(getErrorDetailsForException("Oozie", ex)).build(); } } @@ -475,11 +548,13 @@ public class OozieProxyImpersonator { public Response handlePost(String xml, @Context HttpHeaders headers, @Context UriInfo ui) { try { + return oozieDelegate.consumeService(headers, ui.getAbsolutePath() .getPath(), ui.getQueryParameters(), HttpMethod.POST, xml); } catch (Exception ex) { LOGGER.error("Error in POST proxy", ex); - throw new WfmWebException(ex); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(getErrorDetailsForException("Oozie", ex)).build(); } } @@ -492,7 +567,8 @@ public class OozieProxyImpersonator { .getPath(), ui.getQueryParameters(), HttpMethod.POST, null); } catch (Exception ex) { LOGGER.error("Error in DELETE proxy", ex); - throw new WfmWebException(ex); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(getErrorDetailsForException("Oozie", ex)).build(); } } @@ -505,7 +581,22 @@ public class OozieProxyImpersonator { .getPath(), ui.getQueryParameters(), HttpMethod.PUT, body); } catch (Exception ex) { LOGGER.error("Error in PUT proxy", ex); - throw new WfmWebException(ex); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(getErrorDetailsForException("Oozie", ex)).build(); + } + } + + private Map<String, String> getErrorDetailsForException(String component, + Exception ex) { + String errorCode = component + "exception"; + String errorMessage = component + " Exception"; + if (ex instanceof RuntimeException) { + Throwable cause = ex.getCause(); + if (cause instanceof IOException) { + errorCode = component + "io.exception"; + errorMessage = component + "IO Exception"; + } } + return getErrorDetails(errorCode, errorMessage, ex); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/assets/AssetResource.java ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/assets/AssetResource.java b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/assets/AssetResource.java index 3355c85..ef3b508 100644 --- a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/assets/AssetResource.java +++ b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/assets/AssetResource.java @@ -25,15 +25,13 @@ import org.apache.oozie.ambari.view.*; import org.apache.oozie.ambari.view.assets.model.ActionAsset; import org.apache.oozie.ambari.view.assets.model.ActionAssetDefinition; import org.apache.oozie.ambari.view.assets.model.AssetDefintion; -import org.apache.oozie.ambari.view.exception.ErrorCode; -import org.apache.oozie.ambari.view.exception.WfmException; -import org.apache.oozie.ambari.view.exception.WfmWebException; import org.apache.oozie.ambari.view.model.APIResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.ws.rs.*; import javax.ws.rs.core.*; +import javax.ws.rs.core.Response.Status; import java.io.IOException; import java.util.*; @@ -67,7 +65,7 @@ public class AssetResource { result.setData(assets); return Response.ok(result).build(); } catch (Exception e) { - throw new WfmWebException(e); + throw new ServiceFormattedException(e); } } @@ -82,7 +80,7 @@ public class AssetResource { result.setData(assets); return Response.ok(result).build(); } catch (Exception e) { - throw new WfmWebException(e); + throw new ServiceFormattedException(e); } } @POST @@ -90,20 +88,19 @@ public class AssetResource { @QueryParam("id") String id, @Context UriInfo ui, String body) { try { Gson gson = new Gson(); - AssetDefintion assetDefinition = gson.fromJson(body, AssetDefintion.class); + AssetDefintion assetDefinition = gson.fromJson(body, + AssetDefintion.class); Map<String, String> validateAsset = validateAsset(headers, assetDefinition.getDefinition(), ui.getQueryParameters()); if (!STATUS_OK.equals(validateAsset.get(STATUS_KEY))) { - throw new WfmWebException(ErrorCode.ASSET_INVALID_FROM_OOZIE); + return Response.status(Status.BAD_REQUEST).build(); } assetService.saveAsset(id, viewContext.getUsername(), assetDefinition); APIResult result = new APIResult(); result.setStatus(APIResult.Status.SUCCESS); return Response.ok(result).build(); - } catch (WfmWebException ex) { - throw ex; - } catch (Exception ex) { - throw new WfmWebException(ex); + } catch (Exception e) { + throw new ServiceFormattedException(e); } } @@ -116,50 +113,43 @@ public class AssetResource { public Map<String, String> validateAsset(HttpHeaders headers, String postBody, MultivaluedMap<String, String> queryParams) { String workflowXml = oozieUtils.generateWorkflowXml(postBody); - Map<String, String> result = new HashMap<>(); - String tempWfPath = "/tmp" + "/tmpooziewfs/tempwf_" + Math.round(Math.random() * 100000) + ".xml"; try { + Map<String, String> result = new HashMap<>(); + String tempWfPath = "/tmp" + "/tmpooziewfs/tempwf_" + Math.round(Math.random()*100000) + ".xml"; hdfsFileUtils.writeToFile(tempWfPath, workflowXml, true); - } catch (IOException e) { - throw new WfmWebException(e, ErrorCode.FILE_ACCESS_UNKNOWN_ERROR); - } - queryParams.put("oozieparam.action", getAsList("dryrun")); - queryParams.put("oozieconfig.rerunOnFailure", getAsList("false")); - queryParams.put("oozieconfig.useSystemLibPath", getAsList("true")); - queryParams.put("resourceManager", getAsList("useDefault")); - String dryRunResp = oozieDelegate.submitWorkflowJobToOozie(headers, - tempWfPath, queryParams, JobType.WORKFLOW); - LOGGER.info(String.format("resp from validating asset=[%s]", dryRunResp)); - try { + queryParams.put("oozieparam.action", getAsList("dryrun")); + queryParams.put("oozieconfig.rerunOnFailure", getAsList("false")); + queryParams.put("oozieconfig.useSystemLibPath", getAsList("true")); + queryParams.put("resourceManager", getAsList("useDefault")); + String dryRunResp = oozieDelegate.submitWorkflowJobToOozie(headers, + tempWfPath, queryParams, JobType.WORKFLOW); + LOGGER.info(String.format("resp from validating asset=[%s]", + dryRunResp)); hdfsFileUtils.deleteFile(tempWfPath); - } catch (IOException e) { - throw new WfmWebException(e, ErrorCode.FILE_ACCESS_UNKNOWN_ERROR); - } - if (dryRunResp != null && dryRunResp.trim().startsWith("{")) { - JsonElement jsonElement = new JsonParser().parse(dryRunResp); - JsonElement idElem = jsonElement.getAsJsonObject().get("id"); - if (idElem != null) { - result.put(STATUS_KEY, STATUS_OK); + if (dryRunResp != null && dryRunResp.trim().startsWith("{")) { + JsonElement jsonElement = new JsonParser().parse(dryRunResp); + JsonElement idElem = jsonElement.getAsJsonObject().get("id"); + if (idElem != null) { + result.put(STATUS_KEY, STATUS_OK); + } else { + result.put(STATUS_KEY, STATUS_FAILED); + result.put(MESSAGE_KEY, dryRunResp); + } } else { result.put(STATUS_KEY, STATUS_FAILED); result.put(MESSAGE_KEY, dryRunResp); } - } else { - result.put(STATUS_KEY, STATUS_FAILED); - result.put(MESSAGE_KEY, dryRunResp); + return result; + } catch (IOException e) { + throw new RuntimeException(e); } - return result; } @GET @Path("/assetNameAvailable") public Response assetNameAvailable(@QueryParam("name") String name){ - try { - boolean available = assetService.isAssetNameAvailable(name); - return Response.ok(available).build(); - }catch (Exception e){ - throw new WfmWebException(e); - } + boolean available=assetService.isAssetNameAvailable(name); + return Response.ok(available).build(); } @GET @@ -172,7 +162,7 @@ public class AssetResource { result.setData(assetDefinition); return Response.ok(result).build(); } catch (Exception e) { - throw new WfmWebException(e); + throw new ServiceFormattedException(e); } } @@ -180,13 +170,14 @@ public class AssetResource { @Path("/definition/id}") public Response getAssetDefinition(@PathParam("defnitionId") String id) { try { - ActionAssetDefinition assetDefinition = assetService.getAssetDefinition(id); + ActionAssetDefinition assetDefinition = assetService + .getAssetDefinition(id); APIResult result = new APIResult(); result.setStatus(APIResult.Status.SUCCESS); result.setData(assetDefinition); return Response.ok(result).build(); } catch (Exception e) { - throw new WfmWebException(e); + throw new ServiceFormattedException(e); } } @@ -196,19 +187,19 @@ public class AssetResource { try { ActionAsset asset = assetService.getAsset(id); if (asset == null) { - throw new WfmWebException(ErrorCode.ASSET_NOT_EXIST); + throw new RuntimeException("Asset doesnt exist"); } if (!viewContext.getUsername().equals(asset.getOwner())){ - throw new WfmWebException(ErrorCode.PERMISSION_ERROR); + throw new RuntimeException( + "Dont have permission to delete this asset"); } assetService.deleteAsset(id); APIResult result = new APIResult(); result.setStatus(APIResult.Status.SUCCESS); return Response.ok(result).build(); - } catch (WfmWebException ex) { - throw ex; - } catch (Exception ex) { - throw new WfmWebException(ex); + } catch (Exception e) { + throw new ServiceFormattedException(e); } } + } http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/workflowmanager/WorkflowsManagerResource.java ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/workflowmanager/WorkflowsManagerResource.java b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/workflowmanager/WorkflowsManagerResource.java index e1a5808..a0aa234 100644 --- a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/workflowmanager/WorkflowsManagerResource.java +++ b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/workflowmanager/WorkflowsManagerResource.java @@ -26,10 +26,8 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response; import org.apache.ambari.view.ViewContext; -import org.apache.oozie.ambari.view.exception.WfmWebException; public class WorkflowsManagerResource { private final WorkflowManagerService workflowManagerService; @@ -40,27 +38,19 @@ public class WorkflowsManagerResource { this.workflowManagerService=new WorkflowManagerService(viewContext); } - @GET - public Response getWorkflows() { - try { - HashMap<String, Object> result = new HashMap<>(); - result.put("wfprojects", workflowManagerService.getAllWorkflows(viewContext.getUsername())); - return Response.ok(result).build(); - } catch (Exception ex) { - throw new WfmWebException(ex); - } - } - - - @DELETE + @GET + public Map<String,Object> getWorkflows(){ + HashMap<String,Object> result=new HashMap<>(); + result.put("wfprojects", workflowManagerService.getAllWorkflows(viewContext.getUsername())); + return result; + } + + + @DELETE @Path("/{projectId}") - public Response deleteWorkflow(@PathParam("projectId") String id, - @DefaultValue("false") @QueryParam("deleteDefinition") Boolean deleteDefinition){ - try{ - workflowManagerService.deleteWorkflow(id,deleteDefinition); - return Response.ok().build(); - }catch (Exception ex) { - throw new WfmWebException(ex); - } + public void deleteWorkflow( @PathParam("projectId") String id, + @DefaultValue("false") @QueryParam("deleteDefinition") Boolean deleteDefinition){ + workflowManagerService.deleteWorkflow(id,deleteDefinition); } + } http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js index e94d51a..3ccbc07 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js @@ -156,12 +156,10 @@ export default Ember.Component.extend(Ember.Evented, Validations, { } this.set('bundleFilePath', filePath); this.set("isImporting", false); - }.bind(this)).catch(function(data){ - console.error(data); - this.set("errorMsg", "There is some problem while importing."); + }.bind(this)).catch(function(e){ this.set("isImporting", false); this.set("isImportingSuccess", false); - this.set("data", data); + throw new Error(e); }.bind(this)); }, getBundleFromJSON(draftBundle){ @@ -365,7 +363,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, { }.bind(this)).catch(function(e){ this.$('#loading').hide(); this.get("errors").pushObject({'message' : 'Could not process coordinator from ' + e.path}); - throw new Error(e); + throw new Error(e.trace); }.bind(this)); }, preview(){ http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js index 4a57e37..bbd619d 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js @@ -274,12 +274,10 @@ export default Ember.Component.extend(Validations, Ember.Evented, { } this.set('coordinatorFilePath', filePath); this.set("isImporting", false); - }.bind(this)).catch(function(data){ - console.error(data); - this.set("errorMsg", "There is some problem while importing."); + }.bind(this)).catch(function(e){ this.set("isImporting", false); this.set("isImportingSuccess", false); - this.set("data", data); + throw new Error(e); }.bind(this)); }, getCoordinatorFromJSON(draftCoordinator){ http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-errors.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-errors.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-errors.js index fdb4f5e..7a7c38d 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-errors.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-errors.js @@ -18,53 +18,4 @@ import Ember from 'ember'; export default Ember.Component.extend({ - showingStackTrace: false, - hasErrorMsg : Ember.computed('errorMsg', function() { - return !Ember.isBlank(this.get("errorMsg")); - }), - errorMsgDetails : Ember.computed('data.responseText', function() { - var jsonResponse = this.getparsedResponse(); - if (jsonResponse.message) { - if (jsonResponse.message.indexOf('Permission denied') >= 0) { - return "Permission Denied"; - } - return jsonResponse.message; - } - return ""; - }), - stackTrace : Ember.computed('data.responseText', function() { - var jsonResponse = this.getparsedResponse(); - var stackTraceMsg = jsonResponse.stackTrace; - if(!stackTraceMsg){ - return ""; - } - if (stackTraceMsg instanceof Array) { - return stackTraceMsg.join("").replace(/\tat /g, ' at '); - } else { - return stackTraceMsg.replace(/\tat /g, '<br/> at '); - } - }), - isStackTraceAvailable : Ember.computed('stackTrace', function(){ - return this.get('stackTrace') && this.get('stackTrace').length ? true : false; - }), - getparsedResponse() { - var response = this.get('data.responseText'); - if (response) { - try { - return JSON.parse(response); - } catch(err){ - return ""; - } - } - return ""; - }, - - actions: { - showStackTrace(){ - this.set("showingStackTrace", !this.get("showingStackTrace")); - }, - closeStackTrace(){ - this.set("showingStackTrace", false); - } - } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js index de72c6d..f97add8 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js @@ -94,13 +94,13 @@ export default Ember.Component.extend(FindNodeMixin, Validations, { isWorkflowImporting: false, isAssetPublishing: false, errorMsg: "", - data : { - "responseText": "" - }, shouldPersist : false, useCytoscape: Constants.useCytoscape, cyOverflow: {}, clipboard : Ember.computed.alias('clipboardService.clipboard'), + isStackTraceVisible: false, + isStackTraceAvailable: false, + stackTrace:"", showingStreamImport:false, fileInfo:Ember.Object.create(), isDraft: false, @@ -310,6 +310,24 @@ export default Ember.Component.extend(FindNodeMixin, Validations, { doValidation(){ this.validate(); }, + getStackTrace(data){ + if(data){ + try{ + var stackTraceMsg = JSON.parse(data).stackTrace; + if(!stackTraceMsg){ + return ""; + } + if(stackTraceMsg instanceof Array){ + return stackTraceMsg.join("").replace(/\tat /g, ' at '); + } else { + return stackTraceMsg.replace(/\tat /g, '<br/> at '); + } + } catch(err){ + return ""; + } + } + return ""; + }, importWorkflow(filePath){ var self = this; this.set("isWorkflowImporting", true); @@ -325,8 +343,8 @@ export default Ember.Component.extend(FindNodeMixin, Validations, { this.set("workflowFilePath", filePath); }.bind(this)).catch(function(data){ console.error(data); - self.set("errorMsg", "There is some problem while importing."); - self.set("data", data); + self.set("errorMsg", "There is some problem while importing.Please try again."); + self.showingErrorMsgInDesigner(data); self.set("isWorkflowImporting", false); }); }, @@ -473,8 +491,8 @@ export default Ember.Component.extend(FindNodeMixin, Validations, { exportActionNodeXmlDefered.promise.then(function(data){ self.set("isAssetPublishing", false); }.bind(this)).catch(function(data){ - self.set("errorMsg", "There is some problem while publishing asset."); - self.set("data", data); + self.set("errorMsg", "There is some problem while publishing asset. Please try again."); + self.showingErrorMsgInDesigner(data); self.set("isAssetPublishing", false); }); @@ -721,6 +739,15 @@ export default Ember.Component.extend(FindNodeMixin, Validations, { this.set("showingWorkflowConfigProps",true); } }, + showingErrorMsgInDesigner(data){ + var self = this, stackTraceMsg = self.getStackTrace(data.responseText); + if(stackTraceMsg.length){ + self.set("stackTrace", stackTraceMsg); + self.set("isStackTraceAvailable", true); + } else { + self.set("isStackTraceAvailable", false); + } + }, isDraftExists(path){ var deferred = Ember.RSVP.defer(), url, self = this; if(!path){ @@ -806,6 +833,12 @@ export default Ember.Component.extend(FindNodeMixin, Validations, { }); reader.readAsText(file); }, + showStackTrace(){ + this.set("isStackTraceVisible", true); + }, + hideStackTrace(){ + this.set("isStackTraceVisible", false); + }, showWorkflowSla (value) { this.set('showWorkflowSla', value); }, @@ -996,8 +1029,9 @@ export default Ember.Component.extend(FindNodeMixin, Validations, { actionSettingsXmlDefered.promise.then(function(data){ this.importActionSettingsFromString(data); }.bind(this)).catch(function(data){ - self.set("errorMsg", "There is some problem while importing asset."); - self.set("data", data); + console.error(data); + self.set("errorMsg", "There is some problem while importing asset.Please try again."); + self.showingErrorMsgInDesigner(data); }); } }, @@ -1013,8 +1047,9 @@ export default Ember.Component.extend(FindNodeMixin, Validations, { actionSettingsXmlDefered.promise.then(function(data){ this.importActionNodeFromString(data); }.bind(this)).catch(function(data){ - self.set("errorMsg", "There is some problem while importing asset."); - self.set("data", data); + console.error(data); + self.set("errorMsg", "There is some problem while importing asset. Please try again."); + self.showingErrorMsgInDesigner(data); }); } }, @@ -1149,9 +1184,9 @@ export default Ember.Component.extend(FindNodeMixin, Validations, { saveAssetConfigDefered.promise.then(function(data){ self.set("isAssetPublishing", false); }.bind(this)).catch(function(data){ - self.set("errorMsg", "There is some problem while saving asset."); - self.set("data", data); self.set("isAssetPublishing", false); + self.set("errorMsg", "There is some problem while saving asset. Please try again."); + self.showingErrorMsgInDesigner(data); }); }, showAssetList(value) { @@ -1169,9 +1204,9 @@ export default Ember.Component.extend(FindNodeMixin, Validations, { self.importActionSettingsFromString(importedAsset.definition); self.set("isAssetImporting", false); }.bind(this)).catch(function(data){ - self.set("errorMsg", "There is some problem while importing asset."); - self.set("data", data); self.set("isAssetImporting", false); + self.set("errorMsg", "There is some problem while importing asset. Please try again."); + self.showingErrorMsgInDesigner(data); }); }, showAssetNodeList(value) { @@ -1189,9 +1224,9 @@ export default Ember.Component.extend(FindNodeMixin, Validations, { self.importActionNodeFromString(importedAsset.definition); self.set("isAssetImporting", false); }.bind(this)).catch(function(data){ - self.set("errorMsg", "There is some problem while importing asset."); - self.set("data", data); self.set("isAssetImporting", false); + self.set("errorMsg", "There is some problem while importing asset. Please try again."); + self.showingErrorMsgInDesigner(data); }); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less index a424049..e98d182 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less +++ b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less @@ -605,10 +605,9 @@ input:invalid { #configureJob .modal-dialog, #asset-delete-confirm-dialog .modal-dialog, #projectsList .modal-dialog, -#previewModal .modal-dialog, -#stack_trace_dialog .modal-dialog { +#previewModal .modal-dialog { width: @modalDialogWidth; - height: 100vh; +height: 100vh; } #collapseOne{ @@ -1548,11 +1547,15 @@ input:invalid { padding-left: 0px; padding-right: 0px; } - +#stackTrace{ + white-space: pre-wrap; + max-width: 100%; + max-height: 400px; + overflow: scroll; +} .jobIdClass { width: 50px; } - .width50 { white-space: nowrap; width: 150px; http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs index 2d374a5..ca58431 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs @@ -72,7 +72,7 @@ <div id='loading'> {{spin-spinner lines=13 length=20 width=10}} </div> - {{designer-errors errors=errors validationErrors=validationErrors errorMsg=errorMsg data=data}} + {{designer-errors errors=errors}} <form class="form-horizontal"> <div class="col-sm-12 paddingtop10"> <div class="col-sm-8 centralize-panel"> @@ -100,7 +100,7 @@ <li class="list-group-item">No Coordinators Configured.</li> {{/each}} </ul> - {{#field-error model=this field='bundle.coordinators' showErrorMessage=showErrorMessage}}{{/field-error}} + {{#field-error model=this field='bundle.coordinators' showErrorMessage=true}}{{/field-error}} {{#if coordinatorCreateMode}} {{#bundle-coord-config coordinator=currentCoordinator openTab="openTab" openFileBrowser="openFileBrowser" add="addCoordinator" cancel="cancelCoordinatorOperation" createMode=coordinatorCreateMode}}{{/bundle-coord-config}} http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs index 7db5ce2..7b607ca 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs @@ -93,7 +93,7 @@ {{spin-spinner lines=13 length=20 width=10}} </div> <div class="container-fluid"> - {{designer-errors errors=errors validationErrors=validationErrors errorMsg=errorMsg data=data}} + {{designer-errors errors=errors}} <form class="form-horizontal"> <div class="col-sm-12 paddingtop10"> <div class="col-sm-8 centralize-panel"> http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-errors.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-errors.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-errors.hbs index 00cb8a6..8438255 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-errors.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-errors.hbs @@ -34,21 +34,4 @@ {{/if}} </div> {{/if}} - - {{#if hasErrorMsg}} - <div id="loader"> - <div id="alert"class="alert alert-danger alert-dismissible workflow-error" role="alert"> - {{errorMsg}} - <div id="errorMsgDetails"> - {{errorMsgDetails}} - {{#if isStackTraceAvailable}} - <a href="#" class="action-link" {{action "showStackTrace"}}>Details</a> - {{/if}} - </div> - </div> - </div> - {{/if}} </div> -{{#if showingStackTrace}} - {{#stack-trace-dialog title="Stack Trace" stackTrace=stackTrace closeStackTrace="closeStackTrace"}}{{/stack-trace-dialog}} -{{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/523247aa/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs index 4ff9d87..1a73421 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs @@ -138,7 +138,7 @@ {{/if}} <div id="content" class="panel panel-default designer-main-panel col-xs-20"> <div class="designer-panel designer-canvas"> - {{designer-errors errors=errors validationErrors=validationErrors errorMsg=errorMsg data=data}} + {{designer-errors errors=errors validationErrors=validationErrors}} {{#if undoAvailable}} <div id="alert"class="alert alert-warning workflow-error" role="alert"> {{#if (eq undoType 'nodeDeleted')}} @@ -157,6 +157,22 @@ </div> </div> {{/if}} + {{#if (not (eq errorMsg ""))}} + <div id="loader"> + <div id="alert"class="alert alert-danger alert-dismissible workflow-error" role="alert"> + {{errorMsg}} + {{#if isStackTraceAvailable}} + {{#if isStackTraceVisible}} + <a href="#" class="action-link" {{action "hideStackTrace"}}>Hide Log</a> + <div id="stackTrace">{{{stackTrace}}}</div> + {{/if}} + {{#unless isStackTraceVisible}} + <a href="#" class="action-link" {{action "showStackTrace"}}>Show Log</a> + {{/unless}} + {{/if}} + </div> + </div> + {{/if}} {{#if isAssetPublishing}} <div id="loader"> <div id="alert"class="alert alert-info alert-dismissible workflow-error" role="alert">