mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Grafana ui library poc
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"private": true,
|
||||
"author": {
|
||||
"name": "Torkel Ödegaard",
|
||||
"company": "Grafana Labs"
|
||||
@@ -178,5 +179,6 @@
|
||||
"resolutions": {
|
||||
"caniuse-db": "1.0.30000772",
|
||||
"**/@types/react": "16.7.6"
|
||||
}
|
||||
},
|
||||
"workspaces": ["packages/grafana-ui"]
|
||||
}
|
||||
|
||||
21
packages/grafana-ui/index.ts
Normal file
21
packages/grafana-ui/index.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
export class Google {
|
||||
hello() {
|
||||
return 'hello';
|
||||
}
|
||||
}
|
||||
|
||||
class Singleton {
|
||||
constructor(private state) {}
|
||||
|
||||
hello() {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
change() {
|
||||
this.state = 'mod2';
|
||||
}
|
||||
}
|
||||
|
||||
const singletonSrv = new Singleton('hello');
|
||||
|
||||
export { singletonSrv };
|
||||
11
packages/grafana-ui/package.json
Normal file
11
packages/grafana-ui/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "grafana-ui",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
||||
@@ -7,6 +7,9 @@ import { DashboardModel } from '../dashboard_model';
|
||||
import { PanelModel } from '../panel_model';
|
||||
import classNames from 'classnames';
|
||||
import sizeMe from 'react-sizeme';
|
||||
import { Google } from 'grafana-ui';
|
||||
|
||||
console.log(Google);
|
||||
|
||||
let lastGridWidth = 1200;
|
||||
let ignoreNextWidthChange = false;
|
||||
|
||||
@@ -26,6 +26,7 @@ import * as ticks from 'app/core/utils/ticks';
|
||||
import impressionSrv from 'app/core/services/impression_srv';
|
||||
import builtInPlugins from './built_in_plugins';
|
||||
import * as d3 from 'd3';
|
||||
import * as grafanaUI from 'grafana-ui';
|
||||
|
||||
// rxjs
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
@@ -71,6 +72,7 @@ function exposeToPlugin(name: string, component: any) {
|
||||
});
|
||||
}
|
||||
|
||||
exposeToPlugin('grafana-ui', grafanaUI);
|
||||
exposeToPlugin('lodash', _);
|
||||
exposeToPlugin('moment', moment);
|
||||
exposeToPlugin('jquery', jquery);
|
||||
|
||||
Reference in New Issue
Block a user