From dev-return-3013-archive-asf-public=cust-asf.ponee.io@griffin.incubator.apache.org Thu Oct 25 07:21:51 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id C42A8180670 for ; Thu, 25 Oct 2018 07:21:50 +0200 (CEST) Received: (qmail 69284 invoked by uid 500); 25 Oct 2018 05:21:49 -0000 Mailing-List: contact dev-help@griffin.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@griffin.incubator.apache.org Delivered-To: mailing list dev@griffin.incubator.apache.org Received: (qmail 69273 invoked by uid 99); 25 Oct 2018 05:21:49 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Oct 2018 05:21:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id BDC60182F9C for ; Thu, 25 Oct 2018 05:21:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4 X-Spam-Level: X-Spam-Status: No, score=-4 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id rdpOcEtp5CKc for ; Thu, 25 Oct 2018 05:21:47 +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 C54AC5F502 for ; Thu, 25 Oct 2018 05:21:46 +0000 (UTC) Received: (qmail 69148 invoked by uid 99); 25 Oct 2018 05:21:45 -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; Thu, 25 Oct 2018 05:21:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AF941E0D59; Thu, 25 Oct 2018 05:21:45 +0000 (UTC) From: gavlyukovskiy To: dev@griffin.incubator.apache.org Reply-To: dev@griffin.incubator.apache.org References: In-Reply-To: Subject: [GitHub] incubator-griffin pull request #446: [GRIFFIN-203] "Plaintext mode" for meas... Content-Type: text/plain Message-Id: <20181025052145.AF941E0D59@git1-us-west.apache.org> Date: Thu, 25 Oct 2018 05:21:45 +0000 (UTC) Github user gavlyukovskiy commented on a diff in the pull request: https://github.com/apache/incubator-griffin/pull/446#discussion_r228037408 --- Diff: ui/angular/src/app/measure/create-measure/raw/raw.component.ts --- @@ -0,0 +1,180 @@ +/* +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. +*/ +import {Component, OnInit} from "@angular/core"; +import {ServiceService} from "../../../service/service.service"; +import {TREE_ACTIONS, ITreeOptions} from "angular-tree-component"; +import {ToasterService} from "angular2-toaster"; +import * as $ from "jquery"; +import {HttpClient} from "@angular/common/http"; +import {ActivatedRoute, Router} from "@angular/router"; +import {AfterViewChecked, ElementRef} from "@angular/core"; +import {MeasureFormatService, Format} from "../../../service/measure-format.service"; + +@Component({ + selector: "app-raw", + templateUrl: "./raw.component.html", + providers: [ServiceService, MeasureFormatService], + styleUrls: ["./raw.component.css"] +}) +export class RawComponent implements AfterViewChecked, OnInit { + + constructor( + private elementRef: ElementRef, + private toasterService: ToasterService, + private measureFormatService: MeasureFormatService, + private http: HttpClient, + private router: Router, + public serviceService: ServiceService + ) { + } + + data = ""; + valid = false; + Format: typeof Format = Format; + format: Format; + createResult: any; + public visible = false; + public visibleAnimate = false; + + public hide(): void { + this.visibleAnimate = false; + setTimeout(() => (this.visible = false), 300); + $("#save").removeAttr("disabled"); + } + + public onContainerClicked(event: MouseEvent): void { + if ((event.target).classList.contains("modal")) { + this.hide(); + } + } + + onResize(event) { + this.resizeWindow(); + } + + resizeWindow() { + var stepSelection = ".formStep"; + $(stepSelection).css({ + height: window.innerHeight - $(stepSelection).offset().top + }); + $("fieldset").height( + $(stepSelection).height() - + $(stepSelection + ">.stepDesc").height() - + $(".btn-container").height() - + 130 + ); + $(".y-scrollable").css({ + height: $("fieldset").height() + }); + } + + submit(form) { + if (!form.valid) { + this.toasterService.pop( + "error", + "Error!", + "please complete the form in this step before proceeding" + ); + return false; + } + this.visible = true; + setTimeout(() => (this.visibleAnimate = true), 100); + } + + save() { + let measure2Save = this.measureFormatService.parse(this.data, this.format); + console.log(measure2Save); + let addModels = this.serviceService.config.uri.addModels; + $("#save").attr("disabled", "true"); + this.http.post(addModels, measure2Save).subscribe( + data => { + this.createResult = data; + this.hide(); + this.router.navigate(["/measures"]); + }, + err => { + let response = JSON.parse(err.error); + if (response.code === '40901') { + this.toasterService.pop("error", "Error!", "Measure name already exists!"); + } else { + this.toasterService.pop("error", "Error!", "Measure is not valid"); --- End diff -- fixed ---