2016-11-03 05:21:11 +08:00
|
|
|
///<reference path="../../../headers/common.d.ts" />
|
|
|
|
|
|
|
|
|
|
import {PanelCtrl} from 'app/plugins/sdk';
|
|
|
|
|
|
2016-11-09 17:41:39 +08:00
|
|
|
import {contextSrv} from 'app/core/core';
|
|
|
|
|
|
|
|
|
|
class GettingStartedPanelCtrl extends PanelCtrl {
|
2016-11-03 05:21:11 +08:00
|
|
|
static templateUrl = 'public/app/plugins/panel/gettingstarted/module.html';
|
2016-11-09 17:41:39 +08:00
|
|
|
hasDatasources: boolean;
|
|
|
|
|
checksDone: boolean;
|
2016-11-03 05:21:11 +08:00
|
|
|
|
2016-11-09 17:41:39 +08:00
|
|
|
/** @ngInject **/
|
|
|
|
|
constructor($scope, $injector, private backendSrv, private datasourceSrv) {
|
2016-11-03 05:21:11 +08:00
|
|
|
super($scope, $injector);
|
2016-11-09 17:41:39 +08:00
|
|
|
|
|
|
|
|
/* tslint:disable */
|
|
|
|
|
if (contextSrv.user.helpFlags1 & 1) {
|
|
|
|
|
this.row.removePanel(this.panel, false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* tslint:enable */
|
|
|
|
|
|
|
|
|
|
var datasources = datasourceSrv.getMetricSources().filter(item => {
|
|
|
|
|
return item.meta.builtIn === false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.hasDatasources = datasources.length > 0;
|
|
|
|
|
this.checksDone = true;
|
2016-11-03 05:21:11 +08:00
|
|
|
}
|
|
|
|
|
|
2016-11-09 17:41:39 +08:00
|
|
|
dismiss() {
|
|
|
|
|
this.row.removePanel(this.panel, false);
|
|
|
|
|
|
|
|
|
|
this.backendSrv.request({
|
|
|
|
|
method: 'PUT',
|
|
|
|
|
url: '/api/user/helpflags/1',
|
|
|
|
|
showSuccessAlert: false,
|
|
|
|
|
}).then(res => {
|
|
|
|
|
contextSrv.user.helpFlags1 = res.helpFlags1;
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-11-03 05:21:11 +08:00
|
|
|
}
|
|
|
|
|
|
2016-11-09 17:41:39 +08:00
|
|
|
export {GettingStartedPanelCtrl, GettingStartedPanelCtrl as PanelCtrl}
|