http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/processor/ProcessorResource.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/processor/ProcessorResource.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/processor/ProcessorResource.java new file mode 100644 index 0000000..962c6fe --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/processor/ProcessorResource.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.web.standard.api.processor; + +import java.util.Map; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.apache.nifi.web.ComponentDetails; +import org.apache.nifi.web.NiFiWebConfigurationContext; + +import org.apache.nifi.web.NiFiWebConfigurationRequestContext; +import org.apache.nifi.web.standard.api.AbstractStandardResource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Path("/standard/processor") +public class ProcessorResource extends AbstractStandardResource { + + private static final Logger logger = LoggerFactory.getLogger(ProcessorResource.class); + + @GET + @Produces({MediaType.APPLICATION_JSON}) + @Path("/details") + public Response getDetails(@QueryParam("processorId") final String processorId) { + final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); + final ComponentDetails componentDetails = ProcessorWebUtils.getComponentDetails(nifiWebContext, processorId, request); + final Response.ResponseBuilder response = ProcessorWebUtils.applyCacheControl(Response.ok(componentDetails)); + return response.build(); + } + + @PUT + @Produces({MediaType.APPLICATION_JSON}) + @Consumes({MediaType.APPLICATION_JSON}) + @Path("/properties") + public Response setProperties(@QueryParam("processorId") final String processorId, @QueryParam("revisionId") final Long revisionId, + @QueryParam("clientId") final String clientId, Map<String,String> properties){ + final NiFiWebConfigurationContext nifiWebContext = getWebConfigurationContext(); + final NiFiWebConfigurationRequestContext niFiRequestContext = ProcessorWebUtils.getRequestContext(processorId,revisionId,clientId,request); + final ComponentDetails componentDetails = nifiWebContext.updateComponent(niFiRequestContext,null,properties); + final Response.ResponseBuilder response = ProcessorWebUtils.applyCacheControl(Response.ok(componentDetails)); + return response.build(); + } + +}
http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/processor/ProcessorWebUtils.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/processor/ProcessorWebUtils.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/processor/ProcessorWebUtils.java new file mode 100644 index 0000000..bf81df3 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/processor/ProcessorWebUtils.java @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.web.standard.api.processor; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.CacheControl; +import javax.ws.rs.core.Response; + +import org.apache.nifi.web.ComponentDetails; +import org.apache.nifi.web.HttpServletConfigurationRequestContext; +import org.apache.nifi.web.HttpServletRequestContext; +import org.apache.nifi.web.NiFiWebConfigurationContext; +import org.apache.nifi.web.NiFiWebConfigurationRequestContext; +import org.apache.nifi.web.NiFiWebRequestContext; +import org.apache.nifi.web.Revision; +import org.apache.nifi.web.UiExtensionType; + + +class ProcessorWebUtils { + + static ComponentDetails getComponentDetails(final NiFiWebConfigurationContext configurationContext,final String processorId, + final Long revision, final String clientId, HttpServletRequest request){ + + final NiFiWebRequestContext requestContext; + + if(processorId != null && revision != null && clientId != null){ + requestContext = getRequestContext(processorId, revision, clientId, request) ; + } else{ + requestContext = getRequestContext(processorId,request); + } + + return configurationContext.getComponentDetails(requestContext); + + } + + static ComponentDetails getComponentDetails(final NiFiWebConfigurationContext configurationContext,final String processorId, HttpServletRequest request){ + return getComponentDetails(configurationContext,processorId,null,null,request); + } + + static Response.ResponseBuilder applyCacheControl(Response.ResponseBuilder response) { + CacheControl cacheControl = new CacheControl(); + cacheControl.setPrivate(true); + cacheControl.setNoCache(true); + cacheControl.setNoStore(true); + return response.cacheControl(cacheControl); + } + + static NiFiWebConfigurationRequestContext getRequestContext(final String processorId, final Long revision, final String clientId, HttpServletRequest request) { + return new HttpServletConfigurationRequestContext(UiExtensionType.ProcessorConfiguration, request) { + @Override + public String getId() { + return processorId; + } + + @Override + public Revision getRevision() { + return new Revision(revision, clientId, processorId); + } + }; + } + + + private static NiFiWebRequestContext getRequestContext(final String processorId, HttpServletRequest request) { + return new HttpServletRequestContext(UiExtensionType.ProcessorConfiguration, request) { + @Override + public String getId() { + return processorId; + } + }; + } + + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/TransformJSONResource.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/TransformJSONResource.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/TransformJSONResource.java new file mode 100644 index 0000000..861c120 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/TransformJSONResource.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.web.standard.api.transformjson; + +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.apache.commons.lang3.StringUtils; +import org.apache.nifi.processors.standard.util.TransformFactory; +import org.apache.nifi.web.standard.api.AbstractStandardResource; +import org.apache.nifi.web.standard.api.transformjson.dto.JoltSpecificationDTO; +import org.apache.nifi.web.standard.api.transformjson.dto.ValidationDTO; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.bazaarvoice.jolt.JsonUtils; +import com.bazaarvoice.jolt.Transform; + +@Path("/standard/transformjson") +public class TransformJSONResource extends AbstractStandardResource { + + private static final Logger logger = LoggerFactory.getLogger(TransformJSONResource.class); + + protected Object getSpecificationJsonObject(String specification){ + + if (!StringUtils.isEmpty(specification)){ + return JsonUtils.jsonToObject(specification, "UTF-8"); + }else{ + return null; + } + } + + @POST + @Produces({MediaType.APPLICATION_JSON}) + @Path("/validate") + public Response validateSpec(JoltSpecificationDTO specificationDTO) { + + Object specJson = getSpecificationJsonObject(specificationDTO.getSpecification()); + + try { + TransformFactory.getTransform(specificationDTO.getTransform(), specJson); + }catch(final Exception e){ + logger.error("Validation Failed - " + e.toString()); + return Response.ok(new ValidationDTO(false,"Validation Failed - Please verify the provided specification.")).build(); + } + + return Response.ok(new ValidationDTO(true,null)).build(); + } + + @POST + @Produces({MediaType.APPLICATION_JSON}) + @Path("/execute") + public Response executeSpec(JoltSpecificationDTO specificationDTO) { + + Object specJson = getSpecificationJsonObject(specificationDTO.getSpecification()); + + try { + Transform transform = TransformFactory.getTransform(specificationDTO.getTransform(), specJson); + Object inputJson = JsonUtils.jsonToObject(specificationDTO.getInput()); + return Response.ok(JsonUtils.toJsonString(transform.transform(inputJson))).build(); + + }catch(final Exception e){ + logger.error("Execute Specification Failed - " + e.toString()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } + + } + + + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/dto/JoltSpecificationDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/dto/JoltSpecificationDTO.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/dto/JoltSpecificationDTO.java new file mode 100644 index 0000000..d189198 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/dto/JoltSpecificationDTO.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.web.standard.api.transformjson.dto; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class JoltSpecificationDTO implements Serializable{ + + + private String transform; + private String specification; + private String input; + + public JoltSpecificationDTO() { + } + + public JoltSpecificationDTO(String transform, String specification) { + this.transform = transform; + this.specification = specification; + } + + public String getTransform() { + return transform; + } + + public void setTransform(String transform) { + this.transform = transform; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getInput() { + return input; + } + + public void setInput(String input) { + this.input = input; + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/dto/ValidationDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/dto/ValidationDTO.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/dto/ValidationDTO.java new file mode 100644 index 0000000..fe1cef9 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/dto/ValidationDTO.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.web.standard.api.transformjson.dto; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + + +@XmlRootElement +public class ValidationDTO implements Serializable { + + private Boolean valid; + private String message; + + public ValidationDTO() { + } + + public ValidationDTO(Boolean valid, String message) { + this.valid = valid; + this.message = message; + } + + public Boolean isValid() { + return valid; + } + + public void setValid(Boolean valid) { + this.valid = valid; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/resources/META-INF/LICENSE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/resources/META-INF/LICENSE b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/resources/META-INF/LICENSE new file mode 100644 index 0000000..1a72391 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/resources/META-INF/LICENSE @@ -0,0 +1,320 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +APACHE NIFI SUBCOMPONENTS: + +The Apache NiFi project contains subcomponents with separate copyright +notices and license terms. Your use of the source code for the these +subcomponents is subject to the terms and conditions of the following +licenses. + + The binary distribution of this product bundles 'Antlr 3' which is available + under a "3-clause BSD" license. For details see http://www.antlr3.org/license.html + + Copyright (c) 2010 Terence Parr + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + Neither the name of the author nor the names of its contributors may be used + to endorse or promote products derived from this software without specific + prior written permission. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + THE POSSIBILITY OF SUCH DAMAGE. + +This product bundles 'Jolt' which is available under an Apache License. For details see https://github.com/bazaarvoice/jolt/blob/jolt-0.0.20/LICENSE + + Copyright 2013-2014 Bazaarvoice, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +This product bundles 'AngularUI Codemirror' which is available under an MIT license. + + Copyright (c) 2012 the AngularUI Team, http://angular-ui.github.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +This product bundles 'AngularUI Router' which is available under an MIT license. + + Copyright (c) 2013-2015 The AngularUI Team, Karsten Sperling + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +This product bundles 'js-beautify' which is available under an MIT license. + + Copyright (c) 2007-2013 Einar Lielmanis and contributors. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000..c2786db --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/resources/META-INF/NOTICE @@ -0,0 +1,53 @@ +nifi-transform-json-ui +Copyright 2014-2016 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +****************** +Apache Software License v2 +****************** + +The following binary components are provided under the Apache Software License v2 + + (ASLv2) Apache Commons Lang + The following NOTICE information applies: + Apache Commons Lang + Copyright 2001-2014 The Apache Software Foundation + + This product includes software from the Spring Framework, + under the Apache License 2.0 (see: StringUtils.containsWhitespace()) + + (ASLv2) Jettison + The following NOTICE information applies: + Copyright 2006 Envoi Solutions LLC + + (ASLv2) Jolt + The following NOTICE information applies: + Copyright 2013-2014 Bazaarvoice, Inc + +************************ +Common Development and Distribution License 1.1 +************************ + +The following binary components are provided under the Common Development and Distribution License 1.1. See project link for details. + + (CDDL 1.1) (GPL2 w/ CPE) jersey-core (com.sun.jersey:jersey-core:jar:1.18.3 - https://jersey.java.net/jersey-core/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-server (com.sun.jersey:jersey-server:jar:1.18.3 - https://jersey.java.net/jersey-server/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-json (com.sun.jersey:jersey-json:jar:1.18.3 - https://jersey.java.net/index.html) + (CDDL 1.1) (GPL2 w/ CPE) jersey-servlet (com.sun.jersey:jersey-servlet:jar:1.18.3 - https://jersey.java.net/index.html) + (CDDL 1.1) (GPL2 w/ CPE) Old JAXB Runtime (com.sun.xml.bind:jaxb-impl:jar:2.2.3-1 - http://jaxb.java.net/) + (CDDL 1.1) (GPL2 w/ CPE) Java Architecture For XML Binding (javax.xml.bind:jaxb-api:jar:2.2.2 - https://jaxb.dev.java.net/) + +************************ +Common Development and Distribution License 1.0 +************************ + +The following binary components are provided under the Common Development and Distribution License 1.0. See project link for details. + + (CDDL 1.0) (GPL3) Streaming API For XML (javax.xml.stream:stax-api:jar:1.0-2 - no url provided) + (CDDL 1.0) JavaBeans Activation Framework (JAF) (javax.activation:activation:jar:1.1 - http://java.sun.com/products/javabeans/jaf/index.jsp) + + + + http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/META-INF/nifi-processor-configuration ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/META-INF/nifi-processor-configuration b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/META-INF/nifi-processor-configuration new file mode 100644 index 0000000..14977f0 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/META-INF/nifi-processor-configuration @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +org.apache.nifi.processors.standard.JoltTransformJSON http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/jsp/index.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/jsp/index.jsp b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/jsp/index.jsp new file mode 100644 index 0000000..750bd8b --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/jsp/index.jsp @@ -0,0 +1,67 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> +<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %> +<!DOCTYPE html> +<html lang="en"> +<head> + <link rel="stylesheet" type="text/css" href="../nifi/js/codemirror/lib/codemirror.css"/> + <link rel="stylesheet" type="text/css" href="../nifi/js/codemirror/addon/lint/lint.css"> + <link rel="stylesheet" type="text/css" href="../nifi/assets/angular-material/angular-material.css"> + <link rel="stylesheet" type="text/css" href="css/main.css"> +</head> + +<body ng-app="standardUI" ng-cloak> + +<!--Parent Libraries--> +<script type="text/javascript" src="../nifi/js/codemirror/lib/codemirror-compressed.js"></script> +<script type="text/javascript" src="../nifi/js/codemirror/addon/lint/lint.js"></script> +<script type="text/javascript" src="../nifi/js/codemirror/addon/lint/json-lint.js"></script> +<script type="text/javascript" src="../nifi/js/jsonlint/jsonlint.min.js"></script> +<script type="text/javascript" src="../nifi/assets/angular/angular.min.js"></script> +<script type="text/javascript" src="../nifi/assets/angular-animate/angular-animate.min.js"></script> +<script type="text/javascript" src="../nifi/assets/angular-aria/angular-aria.min.js"></script> +<script type="text/javascript" src="../nifi/assets/angular-messages/angular-messages.min.js"></script> +<script type="text/javascript" src="../nifi/assets/angular-material/angular-material.min.js"></script> + +<!--Bower Libraries--> +<script type="text/javascript" src="assets/angular-ui-codemirror/ui-codemirror.min.js"></script> +<script type="text/javascript" src="assets/angular-ui-router/release/angular-ui-router.min.js"></script> + +<!--Local Libraries--> +<script type="text/javascript" src="js/js-beautify/beautify.js"></script> + +<!--Custom UI App--> +<script type="text/javascript" src="app/app.js"></script> + +<!--Custom Global Components--> +<script type="text/javascript" src="app/components/error/error.state.js"></script> +<script type="text/javascript" src="app/components/processor/processor.service.js"></script> + +<!--Custom View Components--> +<script type="text/javascript" src="app/main/main.state.js"></script> +<script type="text/javascript" src="app/main/main.controller.js"></script> +<script type="text/javascript" src="app/transformjson/transformjson.state.js"></script> +<script type="text/javascript" src="app/transformjson/transformjson.controller.js"></script> +<script type="text/javascript" src="app/transformjson/transformjson.service.js"></script> + + +<div ui-view> + +</div> + +</body> +</html> http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/web.xml b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..13d0d41 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> + <servlet> + <servlet-name>api</servlet-name> + <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> + <init-param> + <param-name>com.sun.jersey.config.property.packages</param-name> + <param-value>org.apache.nifi.web.standard.api.processor,org.apache.nifi.web.standard.api.transformjson</param-value> + </init-param> + <init-param> + <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name> + <param-value>true</param-value> + </init-param> + </servlet> + <servlet-mapping> + <servlet-name>api</servlet-name> + <url-pattern>/api/*</url-pattern> + </servlet-mapping> + + <servlet> + <servlet-name>index</servlet-name> + <jsp-file>/WEB-INF/jsp/index.jsp</jsp-file> + </servlet> + + <servlet-mapping> + <servlet-name>index</servlet-name> + <url-pattern>/configure</url-pattern> + </servlet-mapping> + + <welcome-file-list> + <welcome-file>configure</welcome-file> + </welcome-file-list> + +</web-app> + http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/app.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/app.js b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/app.js new file mode 100644 index 0000000..67c440c --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/app.js @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +var AppRun = function($rootScope,$state){ + + $rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error){ + event.preventDefault(); + $state.go('error'); + }); + +}; + +var AppConfig = function ($urlRouterProvider) { + + $urlRouterProvider.otherwise(function($injector,$location){ + var urlComponents = $location.absUrl().split("?"); + return '/main?' + urlComponents[1]; + }); + +}; + +AppRun.$inject = ['$rootScope','$state']; + +AppConfig.$inject = ['$urlRouterProvider']; + +angular.module('standardUI', ['ui.codemirror','ui.router']) + .run(AppRun) + .config(AppConfig); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/error/error.state.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/error/error.state.js b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/error/error.state.js new file mode 100644 index 0000000..ff4cf30 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/error/error.state.js @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +var ErrorState = function($stateProvider) { + + $stateProvider + .state('error', { + url: "/error", + templateUrl: "app/components/error/error.view.html" + }) +}; + +ErrorState.$inject = ['$stateProvider']; +angular.module('standardUI').config(ErrorState); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/error/error.view.html ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/error/error.view.html b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/error/error.view.html new file mode 100644 index 0000000..8908e67 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/error/error.view.html @@ -0,0 +1,15 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<h2> An error has occurred loading the editor.</h2> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/processor/processor.service.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/processor/processor.service.js b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/processor/processor.service.js new file mode 100644 index 0000000..ef1b6f2 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/components/processor/processor.service.js @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +var ProcessorService = function ProcessorService($http) { + + return { + 'setProperties': setProperties, + 'getType': getType, + 'getDetails' : getDetails + }; + + function setProperties(processorId,revisionId,clientId,properties){ + var urlParams = 'processorId='+processorId+'&revisionId='+revisionId+'&clientId='+clientId; + return $http({url: 'api/standard/processor/properties?'+urlParams,method:'PUT',data:properties}); + } + + function getType(id) { + return $http({ + url: 'api/standard/processor/details?processorId=' + id, + method: 'GET', + transformResponse: [function (data) { + var obj = JSON.parse(data) + var type = obj['type']; + return type; + }] + }); + } + + function getDetails(id) { + return $http({ url: 'api/standard/processor/details?processorId=' + id, method: 'GET'}); + } + +}; + +ProcessorService.$inject = ['$http']; + +angular.module('standardUI').factory('ProcessorService', ProcessorService); http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/main/main.controller.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/main/main.controller.js b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/main/main.controller.js new file mode 100644 index 0000000..6f092f7 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/main/main.controller.js @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +var MainController = function ($scope, $state, ProcessorService) { + + ProcessorService.getType($state.params.id).then(function(response){ + var type = response.data + var stateName = type.substring(type.lastIndexOf(".") + 1, type.length).toLowerCase(); + var result = $state.go(stateName,$state.params); + + }).catch(function(response) { + $state.go('error'); + }); + +}; + +MainController.$inject = ['$scope','$state','ProcessorService']; + +angular.module('standardUI').controller('MainController', MainController); http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/main/main.state.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/main/main.state.js b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/main/main.state.js new file mode 100644 index 0000000..e664ee8 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/main/main.state.js @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +var MainState = function($stateProvider) { + + $stateProvider + .state('main', { + url: "/main?id&revision&clientId&editable", + controller: 'MainController' + }) +}; + +MainState.$inject = ['$stateProvider']; + +angular.module('standardUI').config(MainState); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.controller.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.controller.js b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.controller.js new file mode 100644 index 0000000..4c8b637 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.controller.js @@ -0,0 +1,374 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +var TransformJsonController = function ($scope, $state, $q, TransformJsonService, ProcessorService, details) { + + $scope.processorId = ''; + $scope.clientId = ''; + $scope.revisionId = ''; + $scope.editable = false; + $scope.specEditor = {}; + $scope.inputEditor = {}; + $scope.jsonInput = ''; + $scope.jsonOutput = ''; + $scope.sortOutput = false; + $scope.validObj = {}; + $scope.error = ''; + $scope.disableCSS = ''; + $scope.saveStatus = ''; + $scope.specUpdated = false; + + $scope.convertToArray= function (map){ + var labelValueArray = []; + angular.forEach(map, function(value, key){ + labelValueArray.push({'label' : value, 'value' : key}); + }); + return labelValueArray; + }; + + $scope.getJsonSpec = function(details){ + if(details['properties']['jolt-spec'] != null && details['properties']['jolt-spec'] != "") { + return details['properties']['jolt-spec']; + } + else return ''; + }; + + $scope.getTransform = function(details){ + return details['properties']['jolt-transform'] ? details['properties']['jolt-transform'] : + details['descriptors']['jolt-transform']['defaultValue'] ; + }; + + $scope.getTransformOptions = function(details){ + return $scope.convertToArray(details['descriptors']['jolt-transform']['allowableValues']); + }; + + $scope.populateScopeWithDetails = function(details){ + $scope.jsonSpec = $scope.getJsonSpec(details); + $scope.transform = $scope.getTransform(details); + $scope.transformOptions = $scope.getTransformOptions(details); + }; + + $scope.populateScopeWithDetails(details.data); + + $scope.clearValidation = function(){ + $scope.validObj = {}; + }; + + $scope.clearError = function(){ + $scope.error = ''; + }; + + $scope.clearSave = function(){ + if($scope.saveStatus != ''){ + $scope.saveStatus = ''; + } + }; + + $scope.clearMessages = function(){ + $scope.clearSave(); + $scope.clearError(); + $scope.clearValidation(); + }; + + $scope.showError = function(message,detail){ + $scope.error = message; + console.log('Error received:', detail); + }; + + $scope.initEditors = function(_editor) { + + _editor.setOption('extraKeys',{ + + 'Shift-F': function(cm){ + var jsonValue = js_beautify(cm.getDoc().getValue(), { + 'indent_size': 1, + 'indent_char': '\t' + }); + cm.getDoc().setValue(jsonValue) + } + + }); + + }; + + $scope.initSpecEditor = function(_editor){ + $scope.initEditors(_editor); + $scope.specEditor = _editor; + _editor.on('update',function(cm){ + if($scope.transform == 'jolt-transform-sort'){ + $scope.toggleEditorErrors(_editor,'hide'); + } + }); + + _editor.on('change',function(cm,changeObj){ + + if(!($scope.transform == 'jolt-transform-sort' && changeObj.text.toString() == "")){ + $scope.clearMessages(); + if(changeObj.text.toString() != changeObj.removed.toString()){ + $scope.specUpdated = true; + } + } + }); + + }; + + $scope.initInputEditor = function(_editor){ + $scope.initEditors(_editor); + $scope.inputEditor = _editor; + + _editor.on('change',function(cm,changeObj){ + $scope.clearMessages(); + }); + + _editor.clearGutter('CodeMirror-lint-markers'); + }; + + $scope.editorProperties = { + lineNumbers: true, + gutters: ['CodeMirror-lint-markers'], + mode: 'application/json', + lint: true, + value: $scope.jsonSpec, + onLoad: $scope.initSpecEditor + }; + + $scope.inputProperties = { + lineNumbers: true, + gutters: ['CodeMirror-lint-markers'], + mode: 'application/json', + lint: true, + value: "", + onLoad: $scope.initInputEditor + }; + + $scope.outputProperties = { + lineNumbers: true, + gutters: ['CodeMirror-lint-markers'], + mode: 'application/json', + lint: false, + readOnly: true + }; + + $scope.formatEditor = function(editor){ + + var jsonValue = js_beautify(editor.getDoc().getValue(), { + 'indent_size': 1, + 'indent_char': '\t' + }); + editor.getDoc().setValue(jsonValue); + + }; + + $scope.hasJsonErrors = function(input, transform){ + try{ + jsonlint.parse(input); + }catch(e){ + return true; + } + return false; + }; + + $scope.toggleEditorErrors = function(editor,toggle){ + var display = editor.display.wrapper; + var errors = display.getElementsByClassName("CodeMirror-lint-marker-error"); + + if(toggle == 'hide'){ + + angular.forEach(errors,function(error){ + var element = angular.element(error); + element.addClass('hide'); + }); + + var markErrors = display.getElementsByClassName("CodeMirror-lint-mark-error"); + angular.forEach(markErrors,function(error){ + var element = angular.element(error); + element.addClass('CodeMirror-lint-mark-error-hide'); + element.removeClass('CodeMirror-lint-mark-error'); + }); + + }else{ + + angular.forEach(errors,function(error){ + var element = angular.element(error); + element.removeClass('hide'); + }); + + var markErrors = display.getElementsByClassName("CodeMirror-lint-mark-error-hide"); + angular.forEach(markErrors,function(error){ + var element = angular.element(error); + element.addClass('CodeMirror-lint-mark-error'); + element.removeClass('CodeMirror-lint-mark-error-hide'); + }); + + } + + }; + + $scope.toggleEditor = function(editor,transform,specUpdated){ + + if(transform == 'jolt-transform-sort'){ + editor.setOption("readOnly","nocursor"); + $scope.disableCSS = "trans"; + $scope.toggleEditorErrors(editor,'hide'); + } + else{ + editor.setOption("readOnly",false); + $scope.disableCSS = ""; + $scope.toggleEditorErrors(editor,'show'); + } + + $scope.specUpdated = specUpdated; + + $scope.clearMessages(); + + } + + $scope.getJoltSpec = function(transform,jsonSpec,jsonInput){ + + return { + "transform": transform, + "specification" : jsonSpec, + "input" : jsonInput + }; + }; + + $scope.getProperties = function(transform,jsonSpec){ + + return { + "jolt-transform" : transform != "" ? transform : null, + "jolt-spec": jsonSpec != "" ? jsonSpec : null + }; + + }; + + $scope.getSpec = function(transform,jsonSpec){ + if(transform != 'jolt-transform-sort'){ + return jsonSpec; + }else{ + return null; + } + }; + + $scope.validateJson = function(jsonInput,jsonSpec,transform){ + + var deferred = $q.defer(); + + $scope.clearError(); + + if( transform == 'jolt-transform-sort' ||!$scope.hasJsonErrors(jsonSpec,transform) ){ + var joltSpec = $scope.getJoltSpec(transform,jsonSpec,jsonInput); + + TransformJsonService.validate(joltSpec).then(function(response){ + $scope.validObj = response.data; + deferred.resolve($scope.validObj); + }).catch(function(response) { + $scope.showError("Error occurred during validation",response.statusText) + deferred.reject($scope.error); + }); + + }else{ + $scope.validObj = {"valid":false,"message":"JSON Spec provided is not valid JSON format"}; + deferred.resolve($scope.validObj); + } + + return deferred.promise; + + }; + + $scope.transformJson = function(jsonInput,jsonSpec,transform){ + + + if( !$scope.hasJsonErrors(jsonInput,transform) ){ + + $scope.validateJson(jsonInput,jsonSpec,transform).then(function(response){ + + var validObj = response; + + if(validObj.valid == true){ + + var joltSpec = $scope.getJoltSpec(transform,jsonSpec,jsonInput); + + TransformJsonService.execute(joltSpec).then(function(response){ + + $scope.jsonOutput = js_beautify(response.data, { + 'indent_size': 1, + 'indent_char': '\t' + }); + + }) + .catch(function(response) { + $scope.showError("Error occurred during transformation",response.statusText) + }); + + } + + }); + + }else{ + $scope.validObj = {"valid":false,"message":"JSON Input provided is not valid JSON format"}; + } + }; + + $scope.saveSpec = function(jsonInput,jsonSpec,transform,processorId,clientId,revisionId){ + + $scope.clearError(); + + var properties = $scope.getProperties(transform,jsonSpec); + + ProcessorService.setProperties(processorId,revisionId,clientId,properties) + .then(function(response) { + var details = response.data; + $scope.populateScopeWithDetails(details); + $scope.saveStatus = "Changes saved successfully"; + $scope.specUpdated = false; + }) + .catch(function(response) { + $scope.showError("Error occurred during save properties",response.statusText); + }); + + }; + + $scope.initController = function(params){ + + $scope.processorId = params.id; + $scope.clientId = params.clientId; + $scope.revisionId = params.revision; + $scope.editable = eval(params.editable); + + var jsonSpec = $scope.getSpec($scope.transform,$scope.jsonSpec); + if(jsonSpec != null && jsonSpec != ""){ + setTimeout(function(){ + $scope.$apply(function(){ + $scope.validateJson($scope.jsonInput,jsonSpec,$scope.transform); + }); + }); + } + + }; + + $scope.$watch("specEditor", function (newValue, oldValue ) { + $scope.toggleEditor(newValue,$scope.transform,false); + }); + + $scope.initController($state.params); + + +}; + +TransformJsonController.$inject = ['$scope', '$state', '$q', 'TransformJsonService', 'ProcessorService','details']; +angular.module('standardUI').controller('TransformJsonController', TransformJsonController); http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.service.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.service.js b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.service.js new file mode 100644 index 0000000..1e8bdcb --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.service.js @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +var TransformJsonService = function TransformJsonService($http) { + + return { + 'validate': validate, + 'execute' : execute + }; + + + function validate(spec){ + return $http({ url:'api/standard/transformjson/validate',method:'POST', data:spec }); + } + + function execute(spec){ + return $http({ url:'api/standard/transformjson/execute',method:'POST', data:spec, + transformResponse: [function (data) { + return data; + }]}); + } + +}; + +TransformJsonService.$inject = ['$http']; +angular.module('standardUI').factory('TransformJsonService', TransformJsonService); http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.state.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.state.js b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.state.js new file mode 100644 index 0000000..7e580a6 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.state.js @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +var TransformJsonState = function($stateProvider) { + + $stateProvider + .state('jolttransformjson', { + url: "/transformjson?id&revision&clientId&editable", + templateUrl: "app/transformjson/transformjson.view.html", + controller: 'TransformJsonController', + resolve: { + details: ['ProcessorService','$stateParams', + function (ProcessorService,$stateParams) { + return ProcessorService.getDetails($stateParams.id); + } + ] + } + }) + +}; + +TransformJsonState.$inject = ['$stateProvider']; + +angular.module('standardUI').config(TransformJsonState); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.view.html ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.view.html b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.view.html new file mode 100644 index 0000000..5e12c1c --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/app/transformjson/transformjson.view.html @@ -0,0 +1,117 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<div layout="column"> + + <div layout="column" layout> + <md-toolbar> + <div class="md-toolbar-tools large-label"> + <span> + Jolt Transformation DSL + </span> + <span flex></span> + <span ng-show="(jsonSpec || transform == 'jolt-transform-sort') && !validObj.valid && !error">{{validObj.message}}</span> + <span ng-show="jsonSpec && validObj.valid && !error">Specification is Valid</span> + <span ng-show="error">{{error}}</span> + <span> + + <button ng-click="validateJson(jsonInput,getSpec(transform,jsonSpec),transform)" ng-disabled="!(jsonSpec)"> + Validate + </button> + </span> + </div> + <div class="md-toolbar-tools large-label"> + <select ng-model="transform" ng-options="option.value as option.label for option in transformOptions | orderBy: 'label'" ng-change="toggleEditor(specEditor,transform,true)"></select> + </div> + <div class="md-toolbar-tools large-label"> + <span> + Jolt Specification + </span> + <span flex></span> + <span class="info"> + + <button ng-click="formatEditor(specEditor)" ng-disabled="!jsonSpec || transform == 'jolt-transform-sort'"> + Format + </button> + </span> + </div> + </md-toolbar> + <div id="specEditor" ui-refresh="true" ng-model="jsonSpec" ui-codemirror="editorProperties" class="code-mirror-editor {{disableCSS}}" > + </div> + </div> + +</div> + +<div layout="column"> + <div layout="row"> + <div flex></div> + <div class="large-label"> + <br/> + <span ng-show="error">{{error}}</span> + <span ng-show="saveStatus && !error">{{saveStatus}}</span> + <span> + <button ng-click="saveSpec(jsonInput,getSpec(transform,jsonSpec),transform,processorId,clientId,revisionId)" ng-disabled="(!jsonSpec && transform != 'jolt-transform-sort') || !editable || !specUpdated"> + Save + </button> + </span> + </div> + </div> +</div> + +<div layout="column"> + + <div layout="row"> + <div flex="45"> + <md-toolbar> + <div class="md-toolbar-tools large-label"> + <span> + JSON Input + </span> + <span flex></span> + <span class="info"> + + <button ng-click="formatEditor(inputEditor)" ng-disabled="!(jsonInput) || (!jsonSpec && transform != 'jolt-transform-sort')"> + Format + </button> + + </span> + </div> + + </md-toolbar> + <div id="inputJson" ng-model="jsonInput" ui-refresh="true" ui-codemirror="inputProperties" class="code-mirror-editor"></div> + </div> + + <div flex="10" layout="column" layout-align="center center"> + + <div class="large-label"> + <button ng-click="transformJson(jsonInput,getSpec(transform,jsonSpec),transform)" ng-disabled="!(jsonInput) || (!jsonSpec && transform != 'jolt-transform-sort')"> + Transform + </button> + </div> + + </div> + + <div flex="45"> + <md-toolbar> + <div class="md-toolbar-tools large-label"> + JSON Output + </div> + </md-toolbar> + <div id="outputJson" ng-model="jsonOutput" ui-refresh="true" ui-codemirror="outputProperties" class="code-mirror-editor"></div> + </div> + + </div> + +</div> + http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/css/main.css ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/css/main.css b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/css/main.css new file mode 100644 index 0000000..59a7663 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/css/main.css @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +body { + font-family: Verdana, Arial, Helvetica, sans-serif; +} + +div.code-mirror-editor { + border: 1px solid rgba(79, 70, 70, 0.13); +} + +div.code-mirror-editor.trans { + opacity: 0.4; + filter: alpha(opacity=40); /* For IE8 and earlier */ +} + +.large-label { + color: #527991; + font-size: 13px; + font-weight: bold; + line-height: 19px; +} + +div.md-toolbar-tools{ + height: 30px; +} + +md-toolbar { + min-height: 30px; +} + +.CodeMirror { + border: 1px solid #eee; + height: 40vh; +} + +.info { + font-style: italic; + color: rgb(170, 170, 170); + font-size: 75%; +} http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/js/js-beautify/LICENSE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/js/js-beautify/LICENSE b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/js/js-beautify/LICENSE new file mode 100644 index 0000000..51da268 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/webapp/js/js-beautify/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2007-2013 Einar Lielmanis and contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.
