diff --git a/CHANGELOG.md b/CHANGELOG.md index aed25afb02e..41b07e4ad7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 5.3.0 (unreleased) +* **Dashboard**: TV & Kiosk mode changes, new cycle view mode button in dashboard toolbar [#13025](https://github.com/grafana/grafana/pull/13025) * **OAuth**: Gitlab OAuth with support for filter by groups [#5623](https://github.com/grafana/grafana/issues/5623), thx [@BenoitKnecht](https://github.com/BenoitKnecht) * **Dataproxy**: Pass configured/auth headers to a Datasource [#10971](https://github.com/grafana/grafana/issues/10971), thx [@mrsiano](https://github.com/mrsiano) * **Cleanup**: Make temp file time to live configurable [#11607](https://github.com/grafana/grafana/issues/11607), thx [@xapon](https://github.com/xapon) @@ -62,6 +63,8 @@ om/grafana/grafana/issues/12668) ### Breaking changes * Postgres datasource no longer automatically adds time column alias when using the $__timeGroup alias. However, there's code in place which should make this change backward compatible and shouldn't create any issues. +* Kiosk mode now also hides submenu (variables) +* ?inactive url parameter no longer supported, replaced with kiosk=tv url parameter ### New experimental features diff --git a/Gopkg.lock b/Gopkg.lock index 6f08e208ecd..bd247d691dd 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -427,12 +427,6 @@ revision = "1744e2970ca51c86172c8190fadad617561ed6e7" version = "v1.0.0" -[[projects]] - branch = "master" - name = "github.com/shurcooL/sanitized_anchor_name" - packages = ["."] - revision = "86672fcb3f950f35f2e675df2240550f2a50762f" - [[projects]] name = "github.com/smartystreets/assertions" packages = [ @@ -679,6 +673,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "cb8e7fd81f23ec987fc4d5dd9d31ae0f1164bc2f30cbea2fe86e0d97dd945beb" + inputs-digest = "81a37e747b875cf870c1b9486fa3147e704dea7db8ba86f7cb942d3ddc01d3e3" solver-name = "gps-cdcl" solver-version = 1 diff --git a/package.json b/package.json index 9cc47ff71b8..87ba147fb4d 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "build": "grunt build", "test": "grunt test", "test:coverage": "grunt test --coverage=true", - "lint": "tslint -c tslint.json --project tsconfig.json --type-check", + "lint": "tslint -c tslint.json --project tsconfig.json", "jest": "jest --notify --watch", "api-tests": "jest --notify --watch --config=tests/api/jest.js", "precommit": "lint-staged && grunt precommit" diff --git a/pkg/cmd/grafana-cli/utils/grafana_path.go b/pkg/cmd/grafana-cli/utils/grafana_path.go index afb622bbb93..5f5c944f52b 100644 --- a/pkg/cmd/grafana-cli/utils/grafana_path.go +++ b/pkg/cmd/grafana-cli/utils/grafana_path.go @@ -42,6 +42,8 @@ func returnOsDefault(currentOs string) string { return "/usr/local/var/lib/grafana/plugins" case "freebsd": return "/var/db/grafana/plugins" + case "openbsd": + return "/var/grafana/plugins" default: //"linux" return "/var/lib/grafana/plugins" } diff --git a/public/app/containers/Explore/Explore.tsx b/public/app/containers/Explore/Explore.tsx index 92712709858..16175747a06 100644 --- a/public/app/containers/Explore/Explore.tsx +++ b/public/app/containers/Explore/Explore.tsx @@ -173,6 +173,12 @@ export class Explore extends React.Component { datasource.init(); } + // Keep queries but reset edit state + const nextQueries = this.state.queries.map(q => ({ + ...q, + edited: false, + })); + this.setState( { datasource, @@ -182,6 +188,7 @@ export class Explore extends React.Component { supportsLogs, supportsTable, datasourceLoading: false, + queries: nextQueries, }, () => datasourceError === null && this.onSubmit() ); diff --git a/public/app/containers/Explore/utils/debounce.ts b/public/app/containers/Explore/utils/debounce.ts index 9f2bd35e116..5fda5a05f5f 100644 --- a/public/app/containers/Explore/utils/debounce.ts +++ b/public/app/containers/Explore/utils/debounce.ts @@ -1,7 +1,7 @@ // Based on underscore.js debounce() export default function debounce(func, wait) { let timeout; - return function() { + return function(this: any) { const context = this; const args = arguments; const later = function() { diff --git a/public/app/containers/Explore/utils/dom.ts b/public/app/containers/Explore/utils/dom.ts index 6ba21b54c83..6ab3de39923 100644 --- a/public/app/containers/Explore/utils/dom.ts +++ b/public/app/containers/Explore/utils/dom.ts @@ -1,6 +1,6 @@ // Node.closest() polyfill if ('Element' in window && !Element.prototype.closest) { - Element.prototype.closest = function(s) { + Element.prototype.closest = function(this: any, s) { const matches = (this.document || this.ownerDocument).querySelectorAll(s); let el = this; let i; diff --git a/public/app/core/angular_wrappers.ts b/public/app/core/angular_wrappers.ts index a4439509f8e..e7295646172 100644 --- a/public/app/core/angular_wrappers.ts +++ b/public/app/core/angular_wrappers.ts @@ -2,7 +2,6 @@ import { react2AngularDirective } from 'app/core/utils/react2angular'; import { PasswordStrength } from './components/PasswordStrength'; import PageHeader from './components/PageHeader/PageHeader'; import EmptyListCTA from './components/EmptyListCTA/EmptyListCTA'; -import LoginBackground from './components/Login/LoginBackground'; import { SearchResult } from './components/search/SearchResult'; import { TagFilter } from './components/TagFilter/TagFilter'; import DashboardPermissions from './components/Permissions/DashboardPermissions'; @@ -11,7 +10,6 @@ export function registerAngularDirectives() { react2AngularDirective('passwordStrength', PasswordStrength, ['password']); react2AngularDirective('pageHeader', PageHeader, ['model', 'noTabs']); react2AngularDirective('emptyListCta', EmptyListCTA, ['model']); - react2AngularDirective('loginBackground', LoginBackground, []); react2AngularDirective('searchResult', SearchResult, []); react2AngularDirective('tagFilter', TagFilter, [ 'tags', diff --git a/public/app/core/components/Login/LoginBackground.tsx b/public/app/core/components/Login/LoginBackground.tsx deleted file mode 100644 index 83e228ab6e0..00000000000 --- a/public/app/core/components/Login/LoginBackground.tsx +++ /dev/null @@ -1,1240 +0,0 @@ -import React, { Component } from 'react'; - -const xCount = 50; -const yCount = 50; - -function Cell({ x, y, flipIndex }) { - const index = (y * xCount) + x; - const bgColor1 = getColor(x, y); - return ( -
- ); -} - -function getRandomInt(min, max) { - min = Math.ceil(min); - max = Math.floor(max); - return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive -} - -export default class LoginBackground extends Component { - cancelInterval: any; - - constructor(props) { - super(props); - - this.state = { - flipIndex: null, - }; - - this.flipElements = this.flipElements.bind(this); - } - - flipElements() { - const elementIndexToFlip = getRandomInt(0, (xCount * yCount) - 1); - this.setState(prevState => { - return { - ...prevState, - flipIndex: elementIndexToFlip, - }; - }); - } - - componentWillMount() { - this.cancelInterval = setInterval(this.flipElements, 3000); - } - - componentWillUnmount() { - clearInterval(this.cancelInterval); - } - - render() { - console.log('re-render!', this.state.flipIndex); - - return ( -
- {Array.from(Array(yCount)).map((el, y) => { - return ( -
- {Array.from(Array(xCount)).map((el2, x) => { - return ( - - ); - })} -
- ); - })} -
- ); - } -} - -function getColor(x, y) { - const colors = [ - '#14161A', - '#111920', - '#121E27', - '#13212B', - '#122029', - '#101C24', - '#0F1B23', - '#0F1B22', - '#111C24', - '#101A22', - '#101A21', - '#111D25', - '#101E27', - '#101D26', - '#101B23', - '#11191E', - '#131519', - '#131518', - '#101B21', - '#121F29', - '#10232D', - '#11212B', - '#0E1C25', - '#0E1C24', - '#111F29', - '#11222B', - '#101E28', - '#102028', - '#111F2A', - '#11202A', - '#11191F', - '#121417', - '#12191D', - '#101D25', - '#11212C', - '#10242F', - '#0F212B', - '#0F1E27', - '#0F1D26', - '#0F1F29', - '#0F2029', - '#11232E', - '#10212B', - '#10222C', - '#0F202A', - '#112530', - '#10252F', - '#0F242E', - '#10222D', - '#10202A', - '#0F1C24', - '#0F1E28', - '#0F212A', - '#0F222B', - '#14171A', - '#0F1A20', - '#0F1C25', - '#10232E', - '#0E202A', - '#0E1E27', - '#0E1D26', - '#0F202B', - '#11232F', - '#102632', - '#102530', - '#122430', - '#0F1B21', - '#0F212C', - '#0E1F29', - '#112531', - '#0F2734', - '#0F2835', - '#0D1B23', - '#0F1A21', - '#0F1A23', - '#0F1D27', - '#0F222D', - '#102430', - '#102531', - '#10222E', - '#0F232D', - '#0E2633', - '#0E2734', - '#0F2834', - '#0E2835', - '#0F2633', - '#0F2532', - '#0E1A22', - '#0D1C24', - '#0F2735', - '#0F2937', - '#102A38', - '#112938', - '#102A39', - '#0F2A38', - '#102836', - '#0E1B23', - '#0F2938', - '#102A3A', - '#102D3D', - '#0F3040', - '#102D3E', - '#0F2E3E', - '#112C3B', - '#102B3B', - '#102B3A', - '#102D3C', - '#0F2A39', - '#0F2634', - '#0E2029', - '#0E1A21', - '#0F2B39', - '#0F2D3D', - '#0F2F40', - '#0E3142', - '#113445', - '#122431', - '#102E3E', - '#0F3345', - '#0E2F40', - '#0F3143', - '#102C3C', - '#0F2B3A', - '#0F1F28', - '#0F3344', - '#113548', - '#113C51', - '#144258', - '#103A4E', - '#103A4F', - '#103547', - '#10364A', - '#103649', - '#0F3448', - '#102C3A', - '#0F2836', - '#103447', - '#0F384C', - '#123F55', - '#15445A', - '#133F55', - '#103B50', - '#113E54', - '#103446', - '#0F3A4F', - '#0F3548', - '#0D3142', - '#102C3B', - '#0E2937', - '#103D52', - '#0E3544', - '#184C65', - '#154760', - '#14435B', - '#15465F', - '#124159', - '#0F3D53', - '#103C51', - '#0F3447', - '#0E3243', - '#113143', - '#113D53', - '#184B64', - '#184D67', - '#184C66', - '#174A63', - '#15455C', - '#13425A', - '#14445A', - '#10384C', - '#0E3446', - '#10181E', - '#103243', - '#0F384D', - '#14455C', - '#164761', - '#164C66', - '#1D627D', - '#12425A', - '#164A63', - '#14465D', - '#13435A', - '#0A2B38', - '#0F3446', - '#0D2F40', - '#0D2F3F', - '#0F2531', - '#102937', - '#10384B', - '#0F3649', - '#184E68', - '#1A5472', - '#184D68', - '#154A63', - '#19506B', - '#19536F', - '#1A4F69', - '#144760', - '#114058', - '#0E3A4F', - '#0E3547', - '#0C3042', - '#0E1B24', - '#11222C', - '#154C65', - '#1A5776', - '#1B5675', - '#113847', - '#1A5371', - '#194E68', - '#0E2D3D', - '#112D3B', - '#113D52', - '#18516D', - '#1A5979', - '#1B5878', - '#19526E', - '#1A526E', - '#13435B', - '#0F3E55', - '#0B374C', - '#0E3448', - '#0D2E3F', - '#0F2B3B', - '#112E3E', - '#113B50', - '#15465D', - '#1A526F', - '#1E5E81', - '#1D5B7B', - '#1A5777', - '#154456', - '#113949', - '#0D394E', - '#0F3549', - '#0F2C3B', - '#0E2733', - '#112E3D', - '#123D52', - '#10394C', - '#1B5674', - '#1A5370', - '#144861', - '#104058', - '#104159', - '#0E384C', - '#0D2D3D', - '#0E2533', - '#112C3A', - '#1B5979', - '#1B5C7D', - '#1A5675', - '#104057', - '#0F3C51', - '#11425A', - '#0E394D', - '#0C3243', - '#0E2735', - '#112F3E', - '#134158', - '#1D5E7F', - '#1D6083', - '#1C5877', - '#1A5573', - '#184D66', - '#164962', - '#0F3D54', - '#0E3D53', - '#0E3447', - '#0F2A3A', - '#0F2936', - '#101F28', - '#103040', - '#124056', - '#164E69', - '#144B64', - '#164D66', - '#0F3E54', - '#0E3B51', - '#0D3346', - '#0E1F27', - '#124158', - '#164961', - '#0E3C52', - '#19506C', - '#0F2C3C', - '#0E3244', - '#0E2A39', - '#0E2938', - '#113040', - '#134057', - '#1A5471', - '#154B63', - '#1C597A', - '#164760', - '#10374B', - '#0E374C', - '#0E384D', - '#11242F', - '#10394D', - '#18526E', - '#154B65', - '#103F55', - '#0D3345', - '#102532', - '#102029', - '#113142', - '#1B5973', - '#1A516B', - '#1C5979', - '#1C5A7A', - '#184A65', - '#164C65', - '#0D3041', - '#123142', - '#123E54', - '#1B5877', - '#1A5574', - '#1C5878', - '#13435C', - '#0F374B', - '#0C3143', - '#112F40', - '#123C51', - '#174E68', - '#1D5C7D', - '#14465F', - '#0F3F56', - '#0B3041', - '#123243', - '#15435B', - '#19516D', - '#1D5D7E', - '#1C5C7D', - '#184F69', - '#11374B', - '#103E54', - '#0E3143', - '#0F2D3C', - '#11242E', - '#133445', - '#1A5674', - '#1D6184', - '#1F658B', - '#0D3A50', - '#0C374B', - '#154862', - '#164B64', - '#154961', - '#0D384D', - '#102631', - '#113242', - '#134259', - '#185270', - '#1D6386', - '#1E678C', - '#1C5978', - '#0D3549', - '#0F2632', - '#184961', - '#1D5E80', - '#1E6488', - '#1F678D', - '#1E5B7C', - '#164862', - '#19526D', - '#113C52', - '#15455E', - '#0F2F3F', - '#144259', - '#194D67', - '#1D6991', - '#195777', - '#19516C', - '#103F56', - '#144660', - '#0D2E3E', - '#10212A', - '#113141', - '#16455C', - '#1D5B7C', - '#1F6589', - '#1E668C', - '#1E5F81', - '#0F3B50', - '#0D3244', - '#164A64', - '#184E69', - '#0E364A', - '#0E2E3E', - '#10222B', - '#19475E', - '#1B5A7B', - '#1E5D7F', - '#1E678D', - '#1E6184', - '#19506A', - '#1B5370', - '#1B5573', - '#0E3041', - '#122E3E', - '#16455B', - '#195370', - '#1D6489', - '#1D6B93', - '#164A65', - '#154A64', - '#1A5572', - '#1D6082', - '#1F6286', - '#1D6C94', - '#1E709A', - '#174A65', - '#1B526F', - '#1E6589', - '#1D6384', - '#0D3143', - '#0E2F3F', - '#174760', - '#1F6487', - '#1D668C', - '#0D2F41', - '#103B4F', - '#1C5C7E', - '#1F688F', - '#1C5B7C', - '#164D68', - '#1D6285', - '#0D364A', - '#1D5A7A', - '#1E6990', - '#1D6488', - '#18516B', - '#1A506B', - '#0E3B50', - '#0E3548', - '#124259', - '#13455C', - '#14485F', - '#1E5C7D', - '#122D3C', - '#1E6E98', - '#1E6A91', - '#1E6286', - '#1E6C95', - '#1D6990', - '#101F29', - '#174A62', - '#10394E', - '#1D6D96', - '#1E688E', - '#1D6E97', - '#1E6C94', - '#0E394E', - '#112B39', - '#195270', - '#1E668B', - '#1E6386', - '#1D6385', - '#0C3142', - '#1E6083', - '#1E729C', - '#1F709A', - '#1E6F98', - '#1D5F81', - '#1F688D', - '#1C6488', - '#1D6588', - '#1C6A93', - '#1E658B', - '#1F6C95', - '#0D3C52', - '#1C6385', - '#1E5F82', - '#0E3D54', - '#0F3244', - '#18485F', - '#1E6991', - '#1C5B7B', - '#1F6082', - '#0F3346', - '#18536F', - '#114056', - '#1D6B92', - '#1B5776', - '#0F3C52', - '#1E6890', - '#1F688E', - '#0C394E', - '#0F1D25', - '#1F6386', - '#1E688D', - '#1F6488', - '#20668C', - '#1D5978', - '#0F3D52', - '#0F1E26', - '#13465F', - '#0D374C', - '#1B5C7C', - '#0E1A23', - '#0F374A', - '#1B5574', - '#0F394C', - '#0E2A38', - '#102A37', - '#18506B', - '#1E5A7A', - '#0F3245', - '#0E2E3F', - '#1E678E', - '#1C5D7E', - '#1A5A7A', - '#0E2837', - '#102733', - '#0F3B51', - '#15475E', - '#1E6B93', - '#1E648A', - '#194961', - '#0F3A4E', - '#0E1D25', - '#194F69', - '#103345', - '#0F394D', - '#102B39', - '#103E55', - '#1B5572', - '#164861', - '#174861', - '#113B4F', - '#102936', - '#0F3041', - '#174961', - '#113E53', - '#134056', - '#124057', - '#194B63', - '#0E364B', - '#15445B', - '#16475E', - '#102F3F', - '#16485F', - '#0F2E3D', - '#101920', - '#12222C', - '#122C3B', - '#144157', - '#123B50', - '#16465D', - '#184960', - '#112B3A', - '#12232F', - '#132430', - '#113344', - '#11394C', - '#113649', - '#11364A', - '#133F56', - '#121D25', - '#112733', - '#112A38', - '#0F1F2A', - '#113447', - '#113A4E', - '#0F222C', - '#13222B', - '#112836', - '#102F3E', - '#113243', - '#123445', - '#12374B', - '#121E26', - '#122531', - '#11303F', - '#0D1D25', - '#102835', - '#112834', - '#101C23', - '#111C23', - '#12212B', - '#11222D', - '#0E1B22', - '#0E1D27', - '#121C22', - '#12202A', - '#101A20', - '#13191E', - '#111E28', - '#11212D', - '#0F1B24', - '#0F1C23', - '#13181D', - '#15171A', - '#121D23', - '#121F27', - '#111E27', - '#101B22', - '#121F28', - '#111E26', - '#101D24', - '#111C22', - '#12161E', - '#101925', - '#121E2D', - '#112033', - '#111E2F', - '#0F1B29', - '#0F1A28', - '#101B2A', - '#0E1A27', - '#101C2B', - '#111D2D', - '#111D2B', - '#0F1B28', - '#101923', - '#13161D', - '#13161C', - '#0F1A26', - '#101E2F', - '#112235', - '#102031', - '#0F1B2A', - '#112031', - '#102032', - '#101D2E', - '#121F2F', - '#112133', - '#101E30', - '#101F30', - '#102336', - '#101B2C', - '#0F1C2B', - '#111E2E', - '#0F2134', - '#102236', - '#0F2133', - '#101F31', - '#0F2438', - '#102337', - '#102235', - '#102133', - '#11171E', - '#101F2F', - '#102030', - '#102234', - '#102132', - '#12181F', - '#0F1A25', - '#0F2135', - '#0F1F30', - '#0F1C2D', - '#101D2C', - '#0F2033', - '#0E2338', - '#0F2237', - '#0F2236', - '#0B243B', - '#0D2338', - '#0E1A26', - '#0F1D2E', - '#0F2032', - '#0D2339', - '#0B253F', - '#0A253F', - '#0A253E', - '#0C2439', - '#0E1925', - '#0E2135', - '#0F2235', - '#0A243A', - '#08253E', - '#09253E', - '#0A263F', - '#0A243C', - '#0B233B', - '#0E1A28', - '#0D1A26', - '#09253F', - '#0A2743', - '#0B2844', - '#0B2641', - '#0A2744', - '#0A2844', - '#0B2743', - '#092745', - '#0F2337', - '#101D2D', - '#092743', - '#092846', - '#0E2B4C', - '#102E4F', - '#0E2C4D', - '#0B2A49', - '#082947', - '#0D2B4B', - '#0C2A4A', - '#092946', - '#082845', - '#0C2B4B', - '#0F2D4E', - '#103051', - '#133257', - '#0E2D4E', - '#143156', - '#112F51', - '#0B243A', - '#082744', - '#092844', - '#123054', - '#143359', - '#173A64', - '#183F6E', - '#173F6D', - '#153961', - '#163962', - '#133358', - '#15345B', - '#14345A', - '#102F50', - '#0A2948', - '#082844', - '#092641', - '#16375F', - '#193C69', - '#174170', - '#173E6B', - '#163A63', - '#173D69', - '#183D6A', - '#15365E', - '#112E50', - '#0A2A49', - '#082743', - '#0E1927', - '#173C68', - '#13487E', - '#164476', - '#174375', - '#193F6F', - '#173B66', - '#163B65', - '#082A48', - '#0A2641', - '#09243C', - '#174171', - '#14477C', - '#124980', - '#14487F', - '#174374', - '#15467B', - '#184172', - '#17406F', - '#184070', - '#163C67', - '#16355D', - '#123256', - '#0E1B29', - '#0F1923', - '#113052', - '#184274', - '#164579', - '#13477C', - '#193E6D', - '#0A243E', - '#0B233A', - '#0D1A29', - '#0B2742', - '#17365E', - '#163860', - '#124A84', - '#095191', - '#114A83', - '#0D4D8A', - '#0C4D8C', - '#104B85', - '#15477E', - '#174477', - '#183862', - '#0A233A', - '#092947', - '#09243D', - '#173963', - '#194173', - '#085396', - '#085394', - '#114B87', - '#144983', - '#094F8E', - '#075090', - '#0F4C89', - '#215287', - '#0E1A29', - '#184376', - '#0C4D8B', - '#07549A', - '#0A4E8D', - '#0F4C88', - '#0A4E8C', - '#174273', - '#193C6A', - '#0B2948', - '#0B2C4B', - '#0C4E8D', - '#1259A4', - '#0C579E', - '#0D4D8B', - '#095397', - '#085397', - '#085295', - '#144880', - '#173861', - '#15335A', - '#0F2C4D', - '#0C2949', - '#0B4E8D', - '#08559C', - '#07508F', - '#154578', - '#17365F', - '#122F53', - '#111D2C', - '#092A48', - '#08559D', - '#08559E', - '#0C56A1', - '#164271', - '#163E6A', - '#194071', - '#082642', - '#0F1E30', - '#0D2D4D', - '#114C87', - '#0E59A3', - '#135BA6', - '#085498', - '#085497', - '#095192', - '#0E4D8B', - '#0C4E8A', - '#134982', - '#17457B', - '#121F2E', - '#183E6C', - '#153E69', - '#07508E', - '#173F6C', - '#193D6B', - '#112D4F', - '#0A243B', - '#072946', - '#111E2D', - '#0B2740', - '#10497F', - '#17406E', - '#084F8D', - '#104A80', - '#0E2E4F', - '#143358', - '#16365D', - '#0A2742', - '#13477B', - '#154474', - '#104C86', - '#095291', - '#0B4F8E', - '#114A80', - '#095090', - '#075296', - '#163760', - '#2D6DB5', - '#0C2843', - '#0C233A', - '#153A62', - '#14467A', - '#075498', - '#085293', - '#09263F', - '#122030', - '#09559D', - '#0F4B83', - '#08549A', - '#14375D', - '#085499', - '#075499', - '#0A243D', - '#143E68', - '#10497E', - '#074F8E', - '#085496', - '#0C58A3', - '#065499', - '#085190', - '#0A2B4A', - '#104C88', - '#0D4F8E', - '#0F58A2', - '#0B569B', - '#0D58A1', - '#134A81', - '#09559C', - '#0A5293', - '#114B86', - '#0D2C4C', - '#103255', - '#16457A', - '#074F8C', - '#07559C', - '#185DA9', - '#1D61AD', - '#175CA8', - '#16406D', - '#153C65', - '#0E243A', - '#144679', - '#085192', - '#1A5EAC', - '#1D61AE', - '#11497F', - '#12487E', - '#0C243C', - '#123155', - '#0F59A3', - '#1B5FAB', - '#1E61AD', - '#145CA4', - '#0E599F', - '#11497E', - '#094F8D', - '#15345A', - '#134A85', - '#165CA8', - '#2263AF', - '#124466', - '#0A518F', - '#08569D', - '#16416F', - '#0B2B4A', - '#124A83', - '#0C57A2', - '#1E60AD', - '#1E62AE', - '#165DA8', - '#1059A4', - '#15406C', - '#0A4F8E', - '#12365A', - '#0A5191', - '#16355C', - '#1C5EAB', - '#155CA7', - '#085292', - '#174478', - '#153258', - '#111F2F', - '#174272', - '#1159A5', - '#1C5EAC', - '#2F74BB', - '#0C58A2', - '#0D59A3', - '#14477D', - '#132F53', - '#155BA6', - '#195FAA', - '#2366B1', - '#2967B2', - '#14477E', - '#1B5EAB', - '#175DA8', - '#0F4C86', - '#065090', - '#1C5FAC', - '#185CA8', - '#0D58A3', - '#0C4E8C', - '#134981', - '#14416D', - '#0F5AA5', - '#1F63AF', - '#114B88', - '#09508E', - '#0A569D', - '#195DAA', - '#0F1D2F', - '#1059A2', - '#0E599E', - '#2063AF', - '#1F63AE', - '#1A5EAA', - '#0C57A0', - '#195EAA', - '#1A5EA9', - '#0E4E8A', - '#12487D', - '#185DAA', - '#175EAA', - '#0A508E', - '#1559A6', - '#0E58A3', - '#095399', - '#0B4E8B', - '#0B569F', - '#0C57A1', - '#2967B1', - '#2365B0', - '#2163AE', - '#1A5DAA', - '#195EAB', - '#1E5FAC', - '#2564AF', - '#2767B1', - '#2766B1', - '#0D5A9F', - '#2062AE', - '#1F61AD', - '#195FAB', - '#0D4E8D', - '#173760', - '#111D2E', - '#09518F', - '#1A5FAC', - '#135BA7', - '#085291', - '#183761', - '#0B2845', - '#113457', - '#075393', - '#185EA9', - '#2B69B3', - '#2A67B2', - '#2867B1', - '#155DA8', - '#135CA6', - '#135AA5', - '#114980', - '#2566B1', - '#2064AF', - '#2364AF', - '#13365B', - '#154475', - '#08549B', - '#164373', - '#085392', - '#144576', - '#12497E', - '#0E5392', - '#135BA3', - '#0C5395', - '#0C5291', - '#0E579C', - '#0E5290', - '#134C83', - '#2163AC', - '#195CA6', - '#0D4E8C', - '#082945', - '#133256', - '#0E2F50', - '#105AA6', - '#134677', - '#144475', - '#145BA7', - '#154270', - '#1D60AD', - '#09569B', - '#09243E', - '#134A86', - '#0E59A4', - '#0A4E8B', - '#0E4B83', - '#1D5EAC', - '#101C2A', - '#134A84', - '#0E518F', - '#145CA7', - '#0E5699', - '#145BA5', - '#095292', - '#15416E', - '#153D67', - '#153F6B', - '#125AA5', - '#16406E', - '#0E1B27', - '#0D4F8C', - '#0F58A3', - '#114A82', - '#09569C', - '#0C2339', - '#0E1B28', - '#0D59A4', - '#07559D', - '#08569E', - '#095190', - '#0B253E', - '#0C2B49', - '#2264AF', - '#09549A', - '#09569F', - '#163D68', - '#0C263F', - '#143960', - '#183A65', - '#075496', - '#0C579F', - '#085191', - '#102438', - '#075295', - '#082946', - '#102437', - '#0C2642', - '#101C29', - '#0C253E', - '#15355C', - '#0B2E4D', - '#0F3253', - '#154577', - '#16335B', - '#0F1925', - '#0C2742', - '#0B2946', - '#0E2C4B', - '#0E2B48', - '#0E2237', - '#102237', - '#0B253D', - '#0A2946', - '#0C2841', - '#0D2A47', - '#0C2C4A', - '#08253F', - '#08243D', - '#111C2B', - '#0C2844', - '#0C2945', - '#0D243A', - '#122134', - '#0B2642', - '#113154', - '#113255', - '#0A2642', - '#0A2945', - '#0B263F', - '#0D2E4E', - '#0F1E2E', - '#0A2845', - '#0D2439', - '#0F1A29', - '#101C2E', - '#111923', - '#13181F', - '#111D2F', - '#111F30', - '#121E30', - '#121E2E', - '#101B27', - '#101A27', - '#13171F', - ]; - - // let randX = getRandomInt(0, x); - // let randY = getRandomInt(0, y); - // let randIndex = randY * xCount + randX; - - return colors[(y*xCount + x) % colors.length]; -} diff --git a/public/app/core/components/form_dropdown/form_dropdown.ts b/public/app/core/components/form_dropdown/form_dropdown.ts index 4604e1d7838..6e863e1cb5d 100644 --- a/public/app/core/components/form_dropdown/form_dropdown.ts +++ b/public/app/core/components/form_dropdown/form_dropdown.ts @@ -1,8 +1,8 @@ import _ from 'lodash'; import coreModule from '../../core_module'; -function typeaheadMatcher(item) { - var str = this.query; +function typeaheadMatcher(this: any, item) { + let str = this.query; if (str === '') { return true; } @@ -36,7 +36,7 @@ export class FormDropdownCtrl { startOpen: any; debounce: number; - /** @ngInject **/ + /** @ngInject */ constructor(private $scope, $element, private $sce, private templateSrv, private $q) { this.inputElement = $element.find('input').first(); this.linkElement = $element.find('a').first(); diff --git a/public/app/core/components/grafana_app.ts b/public/app/core/components/grafana_app.ts index b715a20e28f..286c3f743c7 100644 --- a/public/app/core/components/grafana_app.ts +++ b/public/app/core/components/grafana_app.ts @@ -50,7 +50,7 @@ export class GrafanaCtrl { $rootScope.onAppEvent = function(name, callback, localScope) { const unbind = $rootScope.$on(name, callback); - var callerScope = this; + let callerScope = this; if (callerScope.$id === 1 && !localScope) { console.log('warning rootScope onAppEvent called without localscope'); } @@ -69,18 +69,44 @@ export class GrafanaCtrl { } } +function setViewModeBodyClass(body, mode, sidemenuOpen: boolean) { + body.removeClass('view-mode--tv'); + body.removeClass('view-mode--kiosk'); + body.removeClass('view-mode--inactive'); + + switch (mode) { + case 'tv': { + body.removeClass('sidemenu-open'); + body.addClass('view-mode--tv'); + break; + } + // 1 & true for legacy states + case 1: + case true: { + body.removeClass('sidemenu-open'); + body.addClass('view-mode--kiosk'); + break; + } + default: { + body.toggleClass('sidemenu-open', sidemenuOpen); + } + } +} + /** @ngInject */ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScope, $location) { return { restrict: 'E', controller: GrafanaCtrl, link: (scope, elem) => { - var sidemenuOpen; + let sidemenuOpen; const body = $('body'); // see https://github.com/zenorocha/clipboard.js/issues/155 $.fn.modal.Constructor.prototype.enforceFocus = function() {}; + $('.preloader').remove(); + sidemenuOpen = scope.contextSrv.sidemenu; body.toggleClass('sidemenu-open', sidemenuOpen); @@ -98,7 +124,7 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop }); scope.$watch(() => playlistSrv.isPlaying, function(newValue) { - elem.toggleClass('playlist-active', newValue === true); + elem.toggleClass('view-mode--playlist', newValue === true); }); // check if we are in server side render @@ -108,7 +134,7 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop // tooltip removal fix // manage page classes - var pageClass; + let pageClass; scope.$on('$routeChangeSuccess', function(evt, data) { if (pageClass) { body.removeClass(pageClass); @@ -127,17 +153,7 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop $('#tooltip, .tooltip').remove(); // check for kiosk url param - if (data.params.kiosk) { - appEvents.emit('toggle-kiosk-mode'); - } - - // check for 'inactive' url param for clean looks like kiosk, but with title - if (data.params.inactive) { - body.addClass('user-activity-low'); - - // for some reason, with this class it looks cleanest - body.addClass('sidemenu-open'); - } + setViewModeBodyClass(body, data.params.kiosk, sidemenuOpen); // close all drops for (const drop of Drop.drops) { @@ -146,15 +162,37 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop }); // handle kiosk mode - appEvents.on('toggle-kiosk-mode', () => { - body.toggleClass('page-kiosk-mode'); + appEvents.on('toggle-kiosk-mode', options => { + const search = $location.search(); + + if (options && options.exit) { + search.kiosk = 1; + } + + switch (search.kiosk) { + case 'tv': { + search.kiosk = 1; + appEvents.emit('alert-success', ['Press ESC to exit Kiosk mode']); + break; + } + case 1: + case true: { + delete search.kiosk; + break; + } + default: { + search.kiosk = 'tv'; + } + } + + $location.search(search); + setViewModeBodyClass(body, search.kiosk, sidemenuOpen); }); // handle in active view state class - var lastActivity = new Date().getTime(); - var activeUser = true; - const inActiveTimeLimit = 60 * 1000; - var sidemenuHidden = false; + let lastActivity = new Date().getTime(); + let activeUser = true; + const inActiveTimeLimit = 60 * 5000; function checkForInActiveUser() { if (!activeUser) { @@ -167,15 +205,8 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop if (new Date().getTime() - lastActivity > inActiveTimeLimit) { activeUser = false; - body.addClass('user-activity-low'); - // hide sidemenu - if (sidemenuOpen) { - sidemenuHidden = true; - body.removeClass('sidemenu-open'); - $timeout(function() { - $rootScope.$broadcast('render'); - }, 100); - } + body.addClass('view-mode--inactive'); + body.removeClass('sidemenu-open'); } } @@ -183,17 +214,8 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop lastActivity = new Date().getTime(); if (!activeUser) { activeUser = true; - body.removeClass('user-activity-low'); - - // restore sidemenu - if (sidemenuHidden) { - sidemenuHidden = false; - body.addClass('sidemenu-open'); - appEvents.emit('toggle-inactive-mode'); - $timeout(function() { - $rootScope.$broadcast('render'); - }, 100); - } + body.removeClass('view-mode--inactive'); + body.toggleClass('sidemenu-open', sidemenuOpen); } } diff --git a/public/app/core/components/json_explorer/helpers.ts b/public/app/core/components/json_explorer/helpers.ts index bc7468b3b21..c039d818281 100644 --- a/public/app/core/components/json_explorer/helpers.ts +++ b/public/app/core/components/json_explorer/helpers.ts @@ -21,7 +21,7 @@ export function isObject(value: any): boolean { * From http://stackoverflow.com/a/332429 * */ -export function getObjectName(object: Object): string { +export function getObjectName(object: object): string { if (object === undefined) { return ''; } @@ -44,7 +44,7 @@ export function getObjectName(object: Object): string { /* * Gets type of an object. Returns "null" for null objects */ -export function getType(object: Object): string { +export function getType(object: object): string { if (object === null) { return 'null'; } @@ -54,7 +54,7 @@ export function getType(object: Object): string { /* * Generates inline preview for a JavaScript object based on a value */ -export function getValuePreview(object: Object, value: string): string { +export function getValuePreview(object: object, value: string): string { const type = getType(object); if (type === 'null' || type === 'undefined') { @@ -79,15 +79,15 @@ export function getValuePreview(object: Object, value: string): string { /* * Generates inline preview for a JavaScript object */ -export function getPreview(object: string): string { - let value = ''; - if (isObject(object)) { - value = getObjectName(object); - if (Array.isArray(object)) { - value += '[' + object.length + ']'; +let value = ''; +export function getPreview(obj: object): string { + if (isObject(obj)) { + value = getObjectName(obj); + if (Array.isArray(obj)) { + value += '[' + obj.length + ']'; } } else { - value = getValuePreview(object, object); + value = getValuePreview(obj, obj.toString()); } return value; } diff --git a/public/app/core/components/layout_selector/layout_selector.ts b/public/app/core/components/layout_selector/layout_selector.ts index a28abe19251..6fcc768c846 100644 --- a/public/app/core/components/layout_selector/layout_selector.ts +++ b/public/app/core/components/layout_selector/layout_selector.ts @@ -15,7 +15,7 @@ const template = ` export class LayoutSelectorCtrl { mode: string; - /** @ngInject **/ + /** @ngInject */ constructor(private $rootScope) { this.mode = store.get('grafana.list.layout.mode') || 'grid'; } @@ -33,7 +33,7 @@ export class LayoutSelectorCtrl { } } -/** @ngInject **/ +/** @ngInject */ export function layoutSelector() { return { restrict: 'E', @@ -45,14 +45,14 @@ export function layoutSelector() { }; } -/** @ngInject **/ +/** @ngInject */ export function layoutMode($rootScope) { return { restrict: 'A', scope: {}, link: function(scope, elem) { const layout = store.get('grafana.list.layout.mode') || 'grid'; - var className = 'card-list-layout-' + layout; + let className = 'card-list-layout-' + layout; elem.addClass(className); $rootScope.onAppEvent( diff --git a/public/app/core/components/manage_dashboards/manage_dashboards.ts b/public/app/core/components/manage_dashboards/manage_dashboards.ts index 0016305e617..da3fa2f8ab8 100644 --- a/public/app/core/components/manage_dashboards/manage_dashboards.ts +++ b/public/app/core/components/manage_dashboards/manage_dashboards.ts @@ -14,7 +14,7 @@ class Query { } export class ManageDashboardsCtrl { - public sections: any[]; + sections: any[]; query: Query; navModel: any; diff --git a/public/app/core/components/query_part/query_part.ts b/public/app/core/components/query_part/query_part.ts index ea874094402..10ac878f4b5 100644 --- a/public/app/core/components/query_part/query_part.ts +++ b/public/app/core/components/query_part/query_part.ts @@ -74,7 +74,7 @@ export class QueryPart { return; } - var text = this.def.type + '('; + let text = this.def.type + '('; text += this.params.join(', '); text += ')'; this.text = text; diff --git a/public/app/core/components/query_part/query_part_editor.ts b/public/app/core/components/query_part/query_part_editor.ts index cab7907a9a2..d45c6532364 100644 --- a/public/app/core/components/query_part/query_part_editor.ts +++ b/public/app/core/components/query_part/query_part_editor.ts @@ -33,7 +33,7 @@ export function queryPartEditorDirective($compile, templateSrv) { $scope.partActions = []; - function clickFuncParam(paramIndex) { + function clickFuncParam(this: any, paramIndex) { /*jshint validthis:true */ const $link = $(this); const $input = $link.next(); @@ -53,7 +53,7 @@ export function queryPartEditorDirective($compile, templateSrv) { } } - function inputBlur(paramIndex) { + function inputBlur(this: any, paramIndex) { /*jshint validthis:true */ const $input = $(this); const $link = $input.prev(); @@ -72,14 +72,14 @@ export function queryPartEditorDirective($compile, templateSrv) { $link.show(); } - function inputKeyPress(paramIndex, e) { + function inputKeyPress(this: any, paramIndex, e) { /*jshint validthis:true */ if (e.which === 13) { inputBlur.call(this, paramIndex); } } - function inputKeyDown() { + function inputKeyDown(this: any) { /*jshint validthis:true */ this.style.width = (3 + this.value.length) * 8 + 'px'; } @@ -91,7 +91,7 @@ export function queryPartEditorDirective($compile, templateSrv) { const typeaheadSource = function(query, callback) { if (param.options) { - var options = param.options; + let options = param.options; if (param.type === 'int') { options = _.map(options, function(val) { return val.toString(); diff --git a/public/app/core/components/scroll/scroll.ts b/public/app/core/components/scroll/scroll.ts index 5cdbdb62ee3..2d60825e739 100644 --- a/public/app/core/components/scroll/scroll.ts +++ b/public/app/core/components/scroll/scroll.ts @@ -1,7 +1,6 @@ import $ from 'jquery'; import baron from 'baron'; import coreModule from 'app/core/core_module'; -import appEvents from 'app/core/app_events'; const scrollBarHTML = `
@@ -39,43 +38,6 @@ export function geminiScrollbar() { const scrollbar = baron(scrollParams); - let lastPos = 0; - - appEvents.on( - 'dash-scroll', - evt => { - if (evt.restore) { - elem[0].scrollTop = lastPos; - return; - } - - lastPos = elem[0].scrollTop; - - if (evt.animate) { - elem.animate({ scrollTop: evt.pos }, 500); - } else { - elem[0].scrollTop = evt.pos; - } - }, - scope - ); - - // force updating dashboard width - appEvents.on('toggle-sidemenu', forceUpdate, scope); - appEvents.on('toggle-sidemenu-hidden', forceUpdate, scope); - appEvents.on('toggle-view-mode', forceUpdate, scope); - appEvents.on('toggle-kiosk-mode', forceUpdate, scope); - appEvents.on('toggle-inactive-mode', forceUpdate, scope); - - function forceUpdate() { - scrollbar.scroll(); - } - - scope.$on('$routeChangeSuccess', () => { - lastPos = 0; - elem[0].scrollTop = 0; - }); - scope.$on('$destroy', () => { scrollbar.dispose(); }); diff --git a/public/app/core/components/sql_part/sql_part_editor.ts b/public/app/core/components/sql_part/sql_part_editor.ts index f272a6d7254..5d0f63a6953 100644 --- a/public/app/core/components/sql_part/sql_part_editor.ts +++ b/public/app/core/components/sql_part/sql_part_editor.ts @@ -2,7 +2,7 @@ import _ from 'lodash'; import $ from 'jquery'; import coreModule from 'app/core/core_module'; -let template = ` +const template = `