mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'master' into 12759-panel-header-standard-menu-only
This commit is contained in:
@@ -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`
|
||||
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
|
||||
<!-- <p> -->
|
||||
<!-- Exporting will export a cleaned sharable dashboard that can be imported -->
|
||||
<!-- into another Grafana instance. -->
|
||||
<!-- </p> -->
|
||||
|
||||
<div class="share-modal-header">
|
||||
<div class="share-modal-big-icon">
|
||||
<i class="fa fa-cloud-upload"></i>
|
||||
</div>
|
||||
<div>
|
||||
<p class="share-modal-info-text">
|
||||
Export the dashboard to a JSON file. The exporter will templatize the
|
||||
dashboard's data sources to make it easy for others to import and reuse.
|
||||
You can share dashboards on <a class="external-link" href="https://grafana.com">Grafana.com</a>
|
||||
</p>
|
||||
<gf-form-switch
|
||||
class="gf-form"
|
||||
label="Export for sharing externally"
|
||||
label-class="width-16"
|
||||
checked="ctrl.shareExternally"
|
||||
tooltip="Useful for sharing dashboard publicly on grafana.com. Will templatize data source names. Can then only be used with the specific dashboard import API.">
|
||||
</gf-form-switch>
|
||||
|
||||
<div class="gf-form-button-row">
|
||||
<button type="button" class="btn gf-form-btn width-10 btn-success" ng-click="ctrl.save()">
|
||||
<button type="button" class="btn gf-form-btn width-10 btn-success" ng-click="ctrl.saveDashboardAsFile()">
|
||||
<i class="fa fa-save"></i> Save to file
|
||||
</button>
|
||||
<button type="button" class="btn gf-form-btn width-10 btn-secondary" ng-click="ctrl.saveJson()">
|
||||
<button type="button" class="btn gf-form-btn width-10 btn-secondary" ng-click="ctrl.viewJson()">
|
||||
<i class="fa fa-file-text-o"></i> View JSON
|
||||
</button>
|
||||
<a class="btn btn-link" ng-click="ctrl.dismiss()">Cancel</a>
|
||||
|
||||
@@ -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.openSaveAsDialog(dashboardJson);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.openSaveAsDialog(this.dash.getSaveModelClone());
|
||||
}
|
||||
}
|
||||
|
||||
viewJson() {
|
||||
if (this.shareExternally) {
|
||||
this.exporter.makeExportable(this.dash).then((dashboardJson: any) => {
|
||||
this.$scope.$apply(() => {
|
||||
this.openJsonModal(dashboardJson);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.openJsonModal(this.dash.getSaveModelClone());
|
||||
}
|
||||
}
|
||||
|
||||
private openSaveAsDialog(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;
|
||||
private openJsonModal(clone: object) {
|
||||
const model = {
|
||||
object: clone,
|
||||
enableCopy: true,
|
||||
|
||||
@@ -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"]
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user