From e6b82b2fb190fb59c40ee07e9f396f1f0ce3c777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 5 Feb 2018 15:23:46 +0100 Subject: [PATCH 1/5] fix: fixed permission list caching issue, fixes #10750 --- .../ManageDashboards/FolderPermissions.tsx | 3 ++- .../ManageDashboards/FolderSettings.jest.tsx | 17 +++++++++++++---- public/app/stores/FolderStore/FolderStore.ts | 9 +++++++++ .../stores/PermissionsStore/PermissionsStore.ts | 10 +++++++--- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/public/app/containers/ManageDashboards/FolderPermissions.tsx b/public/app/containers/ManageDashboards/FolderPermissions.tsx index 500072c1da0..93cfe9494c2 100644 --- a/public/app/containers/ManageDashboards/FolderPermissions.tsx +++ b/public/app/containers/ManageDashboards/FolderPermissions.tsx @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React, { Component } from 'react'; import { inject, observer } from 'mobx-react'; import { toJS } from 'mobx'; import IContainerProps from 'app/containers/IContainerProps'; @@ -8,6 +8,7 @@ import Tooltip from 'app/core/components/Tooltip/Tooltip'; import PermissionsInfo from 'app/core/components/Permissions/PermissionsInfo'; import AddPermissions from 'app/core/components/Permissions/AddPermissions'; import SlideDown from 'app/core/components/Animations/SlideDown'; + @inject('nav', 'folder', 'view', 'permissions') @observer export class FolderPermissions extends Component { diff --git a/public/app/containers/ManageDashboards/FolderSettings.jest.tsx b/public/app/containers/ManageDashboards/FolderSettings.jest.tsx index bf7b35ed05d..3630bf534ba 100644 --- a/public/app/containers/ManageDashboards/FolderSettings.jest.tsx +++ b/public/app/containers/ManageDashboards/FolderSettings.jest.tsx @@ -14,6 +14,7 @@ describe('FolderSettings', () => { dashboard: { id: 1, title: 'Folder Name', + uid: 'uid-str', }, meta: { url: '/dashboards/f/uid/folder-name', @@ -23,19 +24,27 @@ describe('FolderSettings', () => { ); const store = RootStore.create( - {}, + { + view: { + path: 'asd', + query: {}, + routeParams: { + uid: 'uid-str', + }, + }, + }, { backendSrv: backendSrv, } ); wrapper = shallow(); - return wrapper - .dive() + page = wrapper.dive(); + return page .instance() .loadStore() .then(() => { - page = wrapper.dive(); + page.update(); }); }); diff --git a/public/app/stores/FolderStore/FolderStore.ts b/public/app/stores/FolderStore/FolderStore.ts index 6f14e7221f8..e4533f6a3a9 100644 --- a/public/app/stores/FolderStore/FolderStore.ts +++ b/public/app/stores/FolderStore/FolderStore.ts @@ -5,6 +5,7 @@ export const Folder = types.model('Folder', { title: types.string, url: types.string, canSave: types.boolean, + uid: types.string, hasChanged: types.boolean, }); @@ -14,15 +15,23 @@ export const FolderStore = types }) .actions(self => ({ load: flow(function* load(uid: string) { + // clear folder state + if (self.folder && self.folder.uid !== uid) { + self.folder = null; + } + const backendSrv = getEnv(self).backendSrv; const res = yield backendSrv.getDashboardByUid(uid); + self.folder = Folder.create({ id: res.dashboard.id, title: res.dashboard.title, url: res.meta.url, + uid: res.dashboard.uid, canSave: res.meta.canSave, hasChanged: false, }); + return res; }), diff --git a/public/app/stores/PermissionsStore/PermissionsStore.ts b/public/app/stores/PermissionsStore/PermissionsStore.ts index 9db76c4e124..02413f6b0a1 100644 --- a/public/app/stores/PermissionsStore/PermissionsStore.ts +++ b/public/app/stores/PermissionsStore/PermissionsStore.ts @@ -115,6 +115,7 @@ export const PermissionsStore = types self.fetching = false; self.error = null; }), + addStoreItem: flow(function* addStoreItem() { self.error = null; let item = { @@ -152,11 +153,13 @@ export const PermissionsStore = types resetNewType(); return updateItems(self); }), + removeStoreItem: flow(function* removeStoreItem(idx: number) { self.error = null; self.items.splice(idx, 1); return updateItems(self); }), + updatePermissionOnIndex: flow(function* updatePermissionOnIndex( idx: number, permission: number, @@ -166,18 +169,19 @@ export const PermissionsStore = types self.items[idx].updatePermission(permission, permissionName); return updateItems(self); }), + setNewType(newType: string) { self.newItem = NewPermissionsItem.create({ type: newType }); }, + resetNewType() { resetNewType(); }, + toggleAddPermissions() { self.isAddPermissionsVisible = !self.isAddPermissionsVisible; }, - showAddPermissions() { - self.isAddPermissionsVisible = true; - }, + hideAddPermissions() { self.isAddPermissionsVisible = false; }, From 3e2da1fee53675ec9254995472ae403000b94e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 5 Feb 2018 15:28:57 +0100 Subject: [PATCH 2/5] build: increased version to beta1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index acb992a0936..aad7d2ce92c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Grafana Labs" }, "name": "grafana", - "version": "5.0.0-pre1", + "version": "5.0.0-beta1", "repository": { "type": "git", "url": "http://github.com/grafana/grafana.git" From 8f98e8b8f4d5968f1a74c185ecc6002ebce4819a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 5 Feb 2018 15:36:16 +0100 Subject: [PATCH 3/5] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dacbb716e4..62d9385a526 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ Dashboard panels and rows are positioned using a gridPos object `{x: 0, y: 0, w: * **Singlestat**: suppress error when result contains no datapoints [#9636](https://github.com/grafana/grafana/issues/9636), thx [@utkarshcmu](https://github.com/utkarshcmu) * **Postgres/MySQL**: Control quoting in SQL-queries when using template variables [#9030](https://github.com/grafana/grafana/issues/9030), thanks [@svenklemm](https://github.com/svenklemm) * **Pagerduty**: Pagerduty dont auto resolve incidents by default anymore. [#10222](https://github.com/grafana/grafana/issues/10222) +* **Cloudwatch**: Fix for multi-valued templated queries. [#9903](https://github.com/grafana/grafana/issues/9903) ## Tech * **RabbitMq**: Remove support for publishing events to RabbitMQ [#9645](https://github.com/grafana/grafana/issues/9645) From b2f62ae19c9c6c14440a4f96cd485e7aac67dd7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 5 Feb 2018 16:02:17 +0100 Subject: [PATCH 4/5] docs: update docs with download links --- docs/sources/installation/debian.md | 10 ++++++++++ docs/sources/installation/rpm.md | 7 +++++++ docs/sources/installation/upgrading.md | 5 +++++ docs/sources/installation/windows.md | 1 + 4 files changed, 23 insertions(+) diff --git a/docs/sources/installation/debian.md b/docs/sources/installation/debian.md index b742e96c869..bfc7fdc0a3d 100644 --- a/docs/sources/installation/debian.md +++ b/docs/sources/installation/debian.md @@ -16,6 +16,7 @@ weight = 1 Description | Download ------------ | ------------- Stable for Debian-based Linux | [grafana_4.6.3_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_4.6.3_amd64.deb) +Beta for Debian-based Linux | [grafana_5.0.0-beta1_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.0-beta1_amd64.deb) Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing installation. @@ -27,6 +28,15 @@ installation. wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_4.6.3_amd64.deb sudo apt-get install -y adduser libfontconfig sudo dpkg -i grafana_4.6.3_amd64.deb +``` + +## Install Latest Beta + +```bash +wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.0-beta1_amd64.deb +sudo apt-get install -y adduser libfontconfig +sudo dpkg -i grafana_5.0.0-beta1_amd64.deb + ``` ## APT Repository diff --git a/docs/sources/installation/rpm.md b/docs/sources/installation/rpm.md index d3e796a78c8..f0c498c819f 100644 --- a/docs/sources/installation/rpm.md +++ b/docs/sources/installation/rpm.md @@ -16,6 +16,7 @@ weight = 2 Description | Download ------------ | ------------- Stable for CentOS / Fedora / OpenSuse / Redhat Linux | [4.6.3 (x86-64 rpm)](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.6.3-1.x86_64.rpm) +Latest Beta for CentOS / Fedora / OpenSuse / Redhat Linux | [5.0.0-beta1 (x86-64 rpm)](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-beta1.x86_64.rpm) Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing installation. @@ -28,6 +29,12 @@ You can install Grafana using Yum directly. $ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.6.3-1.x86_64.rpm ``` +## Install Beta + +```bash +$ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-beta1.x86_64.rpm +``` + Or install manually using `rpm`. #### On CentOS / Fedora / Redhat: diff --git a/docs/sources/installation/upgrading.md b/docs/sources/installation/upgrading.md index 6a4b4e8f047..af40c20a40b 100644 --- a/docs/sources/installation/upgrading.md +++ b/docs/sources/installation/upgrading.md @@ -101,3 +101,8 @@ as this will make upgrades easier without risking losing your config changes. ## Upgrading from 2.x We are not aware of any issues upgrading directly from 2.x to 4.x but to be on the safe side go via 3.x => 4.x. + +## Upgrading to v5.0 + +The dashboard grid layout engine has changed. All dashboards will be automatically upgraded to new +positioning system when you load them in v5. Dashboards saved in v5 will not work in older versions of Grafana. diff --git a/docs/sources/installation/windows.md b/docs/sources/installation/windows.md index 7c6a97085df..08d234d63f9 100644 --- a/docs/sources/installation/windows.md +++ b/docs/sources/installation/windows.md @@ -14,6 +14,7 @@ weight = 3 Description | Download ------------ | ------------- Latest stable package for Windows | [grafana.4.6.3.windows-x64.zip](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.6.3.windows-x64.zip) +Latest beta package for Windows | [grafana.5.0.0-beta1.windows-x64.zip](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-beta1.windows-x64.zip) Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing installation. From 97bba1d82612b0aaa2eb29b27f30d6d0b1bb9317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 5 Feb 2018 16:29:10 +0100 Subject: [PATCH 5/5] build: updated publish script --- packaging/publish/publish_testing.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/publish/publish_testing.sh b/packaging/publish/publish_testing.sh index 276193ad63f..ca5e7aea90c 100755 --- a/packaging/publish/publish_testing.sh +++ b/packaging/publish/publish_testing.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -deb_ver=4.6.0-beta1 -rpm_ver=4.6.0-beta1 +deb_ver=5.0.0-beta1 +rpm_ver=5.0.0-beta1 wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_${deb_ver}_amd64.deb