Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2CC14200CB5 for ; Wed, 28 Jun 2017 07:57:34 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 295D6160BF9; Wed, 28 Jun 2017 05:57:34 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D95FA160BE9 for ; Wed, 28 Jun 2017 07:57:31 +0200 (CEST) Received: (qmail 57621 invoked by uid 500); 28 Jun 2017 05:57:31 -0000 Mailing-List: contact commits-help@atlas.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.apache.org Delivered-To: mailing list commits@atlas.apache.org Received: (qmail 57611 invoked by uid 99); 28 Jun 2017 05:57:31 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Jun 2017 05:57:31 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 8E275C061C for ; Wed, 28 Jun 2017 05:57:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.222 X-Spam-Level: X-Spam-Status: No, score=-4.222 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id jHwJxlEUK3CM for ; Wed, 28 Jun 2017 05:57:18 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 7D01E5FCB5 for ; Wed, 28 Jun 2017 05:57:16 +0000 (UTC) Received: (qmail 56893 invoked by uid 99); 28 Jun 2017 05:57:15 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Jun 2017 05:57:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AD08EE10F3; Wed, 28 Jun 2017 05:57:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: madhan@apache.org To: commits@atlas.incubator.apache.org Date: Wed, 28 Jun 2017 05:57:16 -0000 Message-Id: <2b145973c6504d529711a2ab56a5cdcb@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [03/25] incubator-atlas git commit: ATLAS-1898: initial commit of ODF archived-at: Wed, 28 Jun 2017 05:57:34 -0000 http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-web/src/main/webapp/scripts/odf-client.js ---------------------------------------------------------------------- diff --git a/odf/odf-web/src/main/webapp/scripts/odf-client.js b/odf/odf-web/src/main/webapp/scripts/odf-client.js new file mode 100755 index 0000000..de64367 --- /dev/null +++ b/odf/odf-web/src/main/webapp/scripts/odf-client.js @@ -0,0 +1,1087 @@ +/** + * + * 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. + */ +require("bootstrap/dist/css/bootstrap.min.css"); + +var $ = require("jquery"); +var bootstrap = require("bootstrap"); + +var React = require("react"); +var ReactDOM = require("react-dom"); +var LinkedStateMixin = require('react-addons-linked-state-mixin'); +var ReactBootstrap = require("react-bootstrap"); + +var Nav = ReactBootstrap.Nav; +var NavItem = ReactBootstrap.NavItem; +var Navbar = ReactBootstrap.Navbar; +var NavDropdown = ReactBootstrap.NavDropdown; +var Button = ReactBootstrap.Button; +var Grid = ReactBootstrap.Grid; +var Row = ReactBootstrap.Row; +var Col = ReactBootstrap.Col; +var Table = ReactBootstrap.Table; +var Modal = ReactBootstrap.Modal; +var Alert = ReactBootstrap.Alert; +var Panel = ReactBootstrap.Panel; +var Label = ReactBootstrap.Label; +var Input = ReactBootstrap.Input; +var Jumbotron = ReactBootstrap.Jumbotron; +var Image = ReactBootstrap.Image; +var Dropdown = ReactBootstrap.Dropdown; +var DropdownButton = ReactBootstrap.DropdownButton; +var CustomMenu = ReactBootstrap.CustomMenu; +var MenuItem = ReactBootstrap.MenuItem; +var Tooltip = ReactBootstrap.Tooltip; +var OverlayTrigger = ReactBootstrap.OverlayTrigger; +var Glyphicon = ReactBootstrap.Glyphicon; + +var ODFGlobals = require("./odf-globals.js"); +var OdfAnalysisRequest = require("./odf-analysis-request.js"); +var NewAnalysisRequestButton = OdfAnalysisRequest.NewCreateAnnotationsButton; +var ODFBrowser = require("./odf-metadata-browser.js"); +var Utils = require("./odf-utils.js"); +var AtlasHelper = Utils.AtlasHelper; +var AJAXCleanupMixin = require("./odf-mixins.js"); +var UISpec = require("./odf-ui-spec.js"); + + +var knownAnnotations = { + "Default": [{value : "annotationType", style : "primary", label: "Unknown"}], + "ColumnAnalysisColumnAnnotation" : [{value: "jsonProperties.inferredDataClass.className", style: "danger" , label: "Class name"}, {value: "jsonProperties.inferredDataType.type", style: "info", label :"Datatype"}], + "DataQualityColumnAnnotation": [{style: "warning", value: "jsonProperties.qualityScore" , label: "Data quality score"}], + "MatcherAnnotation": [{style: "success", value: "jsonProperties.termAssignments", label: "Matching terms"}] +}; + +//////////////////////////////////////////////////////////////// +// toplevel navigation bar + +const constants_ODFNavBar = { + odfDataLakePage: "navKeyDataLakePage", + odfTermPage: "navKeyTermPage" +} + +var ODFNavBar = React.createClass({ + render: function() { + return ( + + + + Shop for Data Application, powered by Open Discovery Framework + + + + + + + + ); + } +}); + +var ODFAnnotationLegend = React.createClass({ + + render : function(){ + var items = []; + $.each(knownAnnotations, function(key, val){ + $.each(val, function(key2, item){ + items.push(); + }); + }); + + return
{items}
; + } + +}); + +var ODFAnnotationMarker = React.createClass({ + + render : function(){ + var annotationKey = "Default"; + var annotationLabels = []; + if(this.props.annotation && knownAnnotations[this.props.annotation.annotationType]){ + annotationKey = this.props.annotation.annotationType; + var tooltip = {this.props.annotation.annotationType}
{this.props.annotation.summary}
+ $.each(knownAnnotations[annotationKey], function(key, val){ + var style = val.style; + var value = ODFGlobals.getPathValue(this.props.annotation, val.value); + if (annotationKey === "MatcherAnnotation") { + value = value[0].matchingString; // if no abbreviation matches this will be the term; ideally it should be based on the OMBusinessTerm reference + } + else if(value && !isNaN(value)){ + value = Math.round(value*100) + " %"; + } + annotationLabels.push(); + }.bind(this)); + }else{ + var tooltip = {this.props.annotation.annotationType}
{this.props.annotation.summary}
+ annotationLabels.push(); + } + + return
{annotationLabels}
; + } +}); + + +var AnnotationsColumn = React.createClass({ + mixins : [AJAXCleanupMixin], + + getInitialState : function(){ + return {annotations: []}; + }, + + componentDidMount : function() { + if(this.props.annotations){ + this.setState({loadedAnnotations : this.props.annotations}); + return; + } + + if(this.props.annotationReferences){ + this.loadColumnAnnotations(this.props.annotationReferences); + } + }, + + componentWillReceiveProps : function(nextProps){ + if(!this.isMounted()){ + return; + } + + if(nextProps.annotations){ + this.setState({loadedAnnotations : nextProps.annotations}); + return; + } + }, + + render : function(){ + if(this.state){ + var annotations = this.state.loadedAnnotations; + if(!annotations || annotations.length > 0 && annotations[0].repositoryId){ + return