From 17adb58d803008562faaaa6ff51546816154e773 Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 5 Nov 2018 17:32:28 +0100 Subject: [PATCH 1/5] export: provide more help regarding export format this will provide the user with more info about the export format and default to not use the format for sharing on grafana.com etc. ref #13781 --- .../dashboard/export/export_modal.html | 12 +++++- .../features/dashboard/export/export_modal.ts | 40 ++++++++++++++----- 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/public/app/features/dashboard/export/export_modal.html b/public/app/features/dashboard/export/export_modal.html index 0598c612fd6..3505e50b821 100644 --- a/public/app/features/dashboard/export/export_modal.html +++ b/public/app/features/dashboard/export/export_modal.html @@ -15,11 +15,19 @@ You can share dashboards on Grafana.com

+ + +
- - Cancel diff --git a/public/app/features/dashboard/export/export_modal.ts b/public/app/features/dashboard/export/export_modal.ts index f99946915d6..08a79702ed5 100644 --- a/public/app/features/dashboard/export/export_modal.ts +++ b/public/app/features/dashboard/export/export_modal.ts @@ -8,27 +8,47 @@ export class DashExportCtrl { dash: any; exporter: DashboardExporter; dismiss: () => void; + shareExternally: boolean; /** @ngInject */ constructor(private dashboardSrv, datasourceSrv, private $scope, private $rootScope) { this.exporter = new DashboardExporter(datasourceSrv); - this.exporter.makeExportable(this.dashboardSrv.getCurrent()).then(dash => { - this.$scope.$apply(() => { - this.dash = dash; - }); - }); + this.dash = this.dashboardSrv.getCurrent(); } - save() { - const blob = new Blob([angular.toJson(this.dash, true)], { + saveDashboardAsFile() { + if (this.shareExternally) { + this.exporter.makeExportable(this.dash).then((dashboardJson: any) => { + this.$scope.$apply(() => { + this._saveFile(dashboardJson); + }); + }); + } else { + this._saveFile(this.dash.getSaveModelClone()); + } + } + + viewJson() { + if (this.shareExternally) { + this.exporter.makeExportable(this.dash).then((dashboardJson: any) => { + this.$scope.$apply(() => { + this._viewJson(dashboardJson); + }); + }); + } else { + this._viewJson(this.dash.getSaveModelClone()); + } + } + + _saveFile(dash: any) { + const blob = new Blob([angular.toJson(dash, true)], { type: 'application/json;charset=utf-8', }); - saveAs(blob, this.dash.title + '-' + new Date().getTime() + '.json'); + saveAs(blob, dash.title + '-' + new Date().getTime() + '.json'); } - saveJson() { - const clone = this.dash; + _viewJson(clone: any) { const editScope = this.$rootScope.$new(); editScope.object = clone; editScope.enableCopy = true; From 7bde98aff9789c071bb3221d50ffe17798e371bb Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 6 Nov 2018 09:00:17 +0100 Subject: [PATCH 2/5] rename and mark functions as private --- public/app/features/dashboard/export/export_modal.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/app/features/dashboard/export/export_modal.ts b/public/app/features/dashboard/export/export_modal.ts index 08a79702ed5..0e48041ca87 100644 --- a/public/app/features/dashboard/export/export_modal.ts +++ b/public/app/features/dashboard/export/export_modal.ts @@ -21,11 +21,11 @@ export class DashExportCtrl { if (this.shareExternally) { this.exporter.makeExportable(this.dash).then((dashboardJson: any) => { this.$scope.$apply(() => { - this._saveFile(dashboardJson); + this.openSaveAsDialog(dashboardJson); }); }); } else { - this._saveFile(this.dash.getSaveModelClone()); + this.openSaveAsDialog(this.dash.getSaveModelClone()); } } @@ -33,22 +33,22 @@ export class DashExportCtrl { if (this.shareExternally) { this.exporter.makeExportable(this.dash).then((dashboardJson: any) => { this.$scope.$apply(() => { - this._viewJson(dashboardJson); + this.openJsonModal(dashboardJson); }); }); } else { - this._viewJson(this.dash.getSaveModelClone()); + this.openJsonModal(this.dash.getSaveModelClone()); } } - _saveFile(dash: any) { + private openSaveAsDialog(dash: any) { const blob = new Blob([angular.toJson(dash, true)], { type: 'application/json;charset=utf-8', }); saveAs(blob, dash.title + '-' + new Date().getTime() + '.json'); } - _viewJson(clone: any) { + private openJsonModal(clone: any) { const editScope = this.$rootScope.$new(); editScope.object = clone; editScope.enableCopy = true; From 1d3b8e25ce52cd73de185f2c6bb206332f8ed7c8 Mon Sep 17 00:00:00 2001 From: Alexandre de Verteuil Date: Tue, 6 Nov 2018 15:41:37 -0500 Subject: [PATCH 3/5] Fix typo in docs/sources/reference/scripting.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change: > In the folder grafana install folder under `public/dashboards/` there is a file named `scripted.js`. …to: > In the grafana install folder under `public/dashboards/` there is a file named `scripted.js`. --- docs/sources/reference/scripting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/reference/scripting.md b/docs/sources/reference/scripting.md index 7f218765d39..12ab91f3c3c 100644 --- a/docs/sources/reference/scripting.md +++ b/docs/sources/reference/scripting.md @@ -12,7 +12,7 @@ weight = 9 If you have lots of metric names that change (new servers etc) in a defined pattern it is irritating to constantly have to create new dashboards. -With scripted dashboards you can dynamically create your dashboards using javascript. In the folder grafana install folder +With scripted dashboards you can dynamically create your dashboards using javascript. In the grafana install folder under `public/dashboards/` there is a file named `scripted.js`. This file contains an example of a scripted dashboard. You can access it by using the url: `http://grafana_url/dashboard/script/scripted.js?rows=3&name=myName` From d88693fd6db8c69f1011ebdc548ee0d5ab20f23d Mon Sep 17 00:00:00 2001 From: Leonard Gram Date: Wed, 7 Nov 2018 17:03:24 +0100 Subject: [PATCH 4/5] build: removes unused. --- scripts/build/Dockerfile | 43 -------------------------------- scripts/build/build_container.sh | 17 ------------- 2 files changed, 60 deletions(-) delete mode 100644 scripts/build/Dockerfile delete mode 100755 scripts/build/build_container.sh diff --git a/scripts/build/Dockerfile b/scripts/build/Dockerfile deleted file mode 100644 index c7f4fecc649..00000000000 --- a/scripts/build/Dockerfile +++ /dev/null @@ -1,43 +0,0 @@ -FROM centos:6.6 - -RUN yum install -y yum-plugin-ovl initscripts curl tar gcc libc6-dev git gcc-c++ openssl-devel && \ - yum install -y g++ make automake autoconf curl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel && \ - yum install -y wget yum-utils bzip2 bzip2-devel && \ - yum install -y fontconfig freetype freetype-devel fontconfig-devel libstdc++ && \ - yum install -y rpm-build patch readline readline-devel libtool bison lzma && \ - yum install -y which tar - -# Install RUBY 1.9.3 -# install necessary utilities -# RUN yum install -y which tar -RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 && \ - curl -sSl https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer | bash -s stable && \ - source /etc/profile.d/rvm.sh && \ - /bin/bash -l -c "rvm requirements" && \ - /bin/bash -l -c "rvm install 2.1.9" && \ - /bin/bash -l -c "rvm use 2.1.9 --default" - -# install nodejs -RUN curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - && \ - yum install -y nodejs --nogpgcheck - -ENV GOLANG_VERSION 1.11 - -RUN wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo && \ - yum install -y yarn --nogpgcheck && \ - wget https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz && \ - tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz - - -ENV PATH /usr/local/go/bin:$PATH - -RUN mkdir -p /go/src /go/bin && chmod -R 777 /go - -ENV GOPATH /go -ENV PATH /go/bin:$PATH - -ADD ./build.sh /tmp/ - -WORKDIR /tmp/ - -CMD ["./build.sh"] diff --git a/scripts/build/build_container.sh b/scripts/build/build_container.sh deleted file mode 100755 index 16406993e75..00000000000 --- a/scripts/build/build_container.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -docker info && docker version -mkdir -p ~/docker - -echo "Circle branch: ${CIRCLE_BRANCH}" -echo "Circle tag: ${CIRCLE_TAG}" - -# try to load docker container from cache -if [[ -e ~/docker/centos.tar ]]; then - docker load -i ~/docker/centos.tar; -else - docker build --rm=false --tag "grafana/buildcontainer" ./scripts/build/ - - # save docker container so we don't have to recreate it next run - docker save grafana/buildcontainer > ~/docker/centos.tar; -fi From c52e91ee6c17effe9c18f0324cacf68f2b118c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 7 Nov 2018 10:46:09 -0800 Subject: [PATCH 5/5] minor text change in export modal --- .../app/features/dashboard/export/export_modal.html | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/public/app/features/dashboard/export/export_modal.html b/public/app/features/dashboard/export/export_modal.html index 3505e50b821..3c14c4b184d 100644 --- a/public/app/features/dashboard/export/export_modal.html +++ b/public/app/features/dashboard/export/export_modal.html @@ -1,20 +1,8 @@ - - - - - -