2017-12-20 05:33:33 -06:00
|
|
|
import config from 'app/core/config';
|
2019-05-13 02:38:19 -05:00
|
|
|
import { BackendSrv } from 'app/core/services/backend_srv';
|
|
|
|
import { NavModelSrv } from 'app/core/core';
|
2016-02-18 09:05:15 -06:00
|
|
|
|
2018-09-10 06:38:45 -05:00
|
|
|
export default class StyleGuideCtrl {
|
2016-02-18 10:25:11 -06:00
|
|
|
theme: string;
|
2017-12-21 01:39:31 -06:00
|
|
|
buttonNames = ['primary', 'secondary', 'inverse', 'success', 'warning', 'danger'];
|
2017-12-20 05:33:33 -06:00
|
|
|
buttonSizes = ['btn-small', '', 'btn-large'];
|
|
|
|
buttonVariants = ['-'];
|
2017-06-02 07:00:42 -05:00
|
|
|
navModel: any;
|
2016-02-18 10:25:11 -06:00
|
|
|
|
2018-08-31 09:40:43 -05:00
|
|
|
/** @ngInject */
|
2019-05-13 02:38:19 -05:00
|
|
|
constructor(private $routeParams: any, private backendSrv: BackendSrv, navModelSrv: NavModelSrv) {
|
2019-06-05 08:18:31 -05:00
|
|
|
this.navModel = navModelSrv.getNav('admin', 'styleguide', 0);
|
2017-12-20 05:33:33 -06:00
|
|
|
this.theme = config.bootData.user.lightTheme ? 'light' : 'dark';
|
2017-05-02 07:50:10 -05:00
|
|
|
}
|
|
|
|
|
2016-02-18 09:05:15 -06:00
|
|
|
switchTheme() {
|
2017-12-20 05:33:33 -06:00
|
|
|
this.$routeParams.theme = this.theme === 'dark' ? 'light' : 'dark';
|
2017-05-02 08:45:34 -05:00
|
|
|
|
2018-08-26 13:19:23 -05:00
|
|
|
const cmd = {
|
2017-12-20 05:33:33 -06:00
|
|
|
theme: this.$routeParams.theme,
|
2017-05-02 08:45:34 -05:00
|
|
|
};
|
|
|
|
|
2017-12-20 05:33:33 -06:00
|
|
|
this.backendSrv.put('/api/user/preferences', cmd).then(() => {
|
2016-09-21 02:10:25 -05:00
|
|
|
window.location.href = window.location.href;
|
|
|
|
});
|
2016-02-18 09:05:15 -06:00
|
|
|
}
|
|
|
|
}
|