module.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ///<reference path="../../../headers/common.d.ts" />
  2. import {PanelCtrl} from 'app/plugins/sdk';
  3. import {contextSrv} from 'app/core/core';
  4. class GettingStartedPanelCtrl extends PanelCtrl {
  5. static templateUrl = 'public/app/plugins/panel/gettingstarted/module.html';
  6. hasDatasources: boolean;
  7. checksDone: boolean;
  8. /** @ngInject **/
  9. constructor($scope, $injector, private backendSrv, private datasourceSrv) {
  10. super($scope, $injector);
  11. /* tslint:disable */
  12. if (contextSrv.user.helpFlags1 & 1) {
  13. this.row.removePanel(this.panel, false);
  14. return;
  15. }
  16. /* tslint:enable */
  17. var datasources = datasourceSrv.getMetricSources().filter(item => {
  18. return item.meta.builtIn === false;
  19. });
  20. this.hasDatasources = datasources.length > 0;
  21. this.checksDone = true;
  22. }
  23. dismiss() {
  24. this.row.removePanel(this.panel, false);
  25. this.backendSrv.request({
  26. method: 'PUT',
  27. url: '/api/user/helpflags/1',
  28. showSuccessAlert: false,
  29. }).then(res => {
  30. contextSrv.user.helpFlags1 = res.helpFlags1;
  31. });
  32. }
  33. }
  34. export {GettingStartedPanelCtrl, GettingStartedPanelCtrl as PanelCtrl}