Просмотр исходного кода

Plugins: return a promise for loadPluginCss (#18273)

Ryan McKinley 6 лет назад
Родитель
Сommit
7949329636
1 измененных файлов с 3 добавлено и 6 удалено
  1. 3 6
      packages/grafana-runtime/src/utils/plugin.ts

+ 3 - 6
packages/grafana-runtime/src/utils/plugin.ts

@@ -10,10 +10,7 @@ export interface PluginCssOptions {
 
 export const SystemJS = System;
 
-export function loadPluginCss(options: PluginCssOptions) {
-  if (config.bootData.user.lightTheme) {
-    SystemJS.import(`${options.light}!css`);
-  } else {
-    SystemJS.import(`${options.dark}!css`);
-  }
+export function loadPluginCss(options: PluginCssOptions): Promise<any> {
+  const theme = config.bootData.user.lightTheme ? options.light : options.dark;
+  return SystemJS.import(`${theme}!css`);
 }