瀏覽代碼

make getAll return array instead of object

Erik Sundell 7 年之前
父節點
當前提交
3d45b5ba73
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. 1 1
      public/app/features/explore/Explore.tsx
  2. 2 1
      public/app/features/plugins/datasource_srv.ts

+ 1 - 1
public/app/features/explore/Explore.tsx

@@ -144,7 +144,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
     if (!datasourceSrv) {
       throw new Error('No datasource service passed as props.');
     }
-    const datasources = Object['values'](datasourceSrv.getAll());
+    const datasources = datasourceSrv.getAll();
     const exploreDatasources = datasources.map(ds => ({
       value: ds.name,
       label: ds.name,

+ 2 - 1
public/app/features/plugins/datasource_srv.ts

@@ -74,7 +74,8 @@ export class DatasourceSrv {
   }
 
   getAll() {
-    return config.datasources;
+    const { datasources } = config;
+    return Object.keys(datasources).map(name => datasources[name]);
   }
 
   getAnnotationSources() {