Commit 2fec5c75 by Torkel Ödegaard

Grafana ui lib is starting to work

parent 6e66b2b9
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
"name": "@grafana/ui", "name": "@grafana/ui",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "dist/index.js", "main": "src/index.ts",
"types": "dist/types",
"scripts": { "scripts": {
"test": "tsc --noEmit" "test": "tsc --noEmit"
}, },
......
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
export interface DeleteButtonProps { interface Props {
onConfirmDelete(); onConfirm();
} }
export interface DeleteButtonStates { interface State {
showConfirm: boolean; showConfirm: boolean;
} }
export default class DeleteButton extends PureComponent<DeleteButtonProps, DeleteButtonStates> { export class DeleteButton extends PureComponent<Props, State> {
state: DeleteButtonStates = { state: State = {
showConfirm: false, showConfirm: false,
}; };
...@@ -33,7 +33,7 @@ export default class DeleteButton extends PureComponent<DeleteButtonProps, Delet ...@@ -33,7 +33,7 @@ export default class DeleteButton extends PureComponent<DeleteButtonProps, Delet
}; };
render() { render() {
const onClickConfirm = this.props.onConfirmDelete; const { onConfirm } = this.props;
let showConfirm; let showConfirm;
let showDeleteButton; let showDeleteButton;
...@@ -55,7 +55,7 @@ export default class DeleteButton extends PureComponent<DeleteButtonProps, Delet ...@@ -55,7 +55,7 @@ export default class DeleteButton extends PureComponent<DeleteButtonProps, Delet
<a className="btn btn-small" onClick={this.onClickCancel}> <a className="btn btn-small" onClick={this.onClickCancel}>
Cancel Cancel
</a> </a>
<a className="btn btn-danger btn-small" onClick={onClickConfirm}> <a className="btn btn-danger btn-small" onClick={onConfirm}>
Confirm Delete Confirm Delete
</a> </a>
</span> </span>
......
export { DeleteButton } from './DeleteButton/DeleteButton';
export { Other } from './other'; export * from './components';
import { TimeSeries } from '../types';
export class Google {
data: TimeSeries;
hello() {
return 'hello';
}
}
class Singleton {
constructor(private state: string) {}
hello() {
return this.state;
}
change() {
this.state = 'mod2';
}
}
const singletonSrv = new Singleton('hello');
export { singletonSrv };
export class Other {
static hello() {
return "hello from other";
}
}
export interface TimeSeries {
name: string;
}
...@@ -13,7 +13,7 @@ import ApiKeysAddedModal from './ApiKeysAddedModal'; ...@@ -13,7 +13,7 @@ import ApiKeysAddedModal from './ApiKeysAddedModal';
import config from 'app/core/config'; import config from 'app/core/config';
import appEvents from 'app/core/app_events'; import appEvents from 'app/core/app_events';
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA'; import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
import DeleteButton from 'app/core/components/DeleteButton/DeleteButton'; import { DeleteButton } from '@grafana/ui';
export interface Props { export interface Props {
navModel: NavModel; navModel: NavModel;
...@@ -224,7 +224,7 @@ export class ApiKeysPage extends PureComponent<Props, any> { ...@@ -224,7 +224,7 @@ export class ApiKeysPage extends PureComponent<Props, any> {
<td>{key.name}</td> <td>{key.name}</td>
<td>{key.role}</td> <td>{key.role}</td>
<td> <td>
<DeleteButton onConfirmDelete={() => this.onDeleteApiKey(key)} /> <DeleteButton onConfirm={() => this.onDeleteApiKey(key)} />
</td> </td>
</tr> </tr>
); );
......
...@@ -7,9 +7,6 @@ import { DashboardModel } from '../dashboard_model'; ...@@ -7,9 +7,6 @@ import { DashboardModel } from '../dashboard_model';
import { PanelModel } from '../panel_model'; import { PanelModel } from '../panel_model';
import classNames from 'classnames'; import classNames from 'classnames';
import sizeMe from 'react-sizeme'; import sizeMe from 'react-sizeme';
import { Google } from 'grafana-ui';
console.log(Google);
let lastGridWidth = 1200; let lastGridWidth = 1200;
let ignoreNextWidthChange = false; let ignoreNextWidthChange = false;
......
...@@ -15,7 +15,6 @@ import { PanelOptionSection } from './PanelOptionSection'; ...@@ -15,7 +15,6 @@ import { PanelOptionSection } from './PanelOptionSection';
import { PanelModel } from '../panel_model'; import { PanelModel } from '../panel_model';
import { DashboardModel } from '../dashboard_model'; import { DashboardModel } from '../dashboard_model';
import { PanelPlugin } from 'app/types/plugins'; import { PanelPlugin } from 'app/types/plugins';
import { TimeSeries } from '@grafana/ui/types';
interface Props { interface Props {
panel: PanelModel; panel: PanelModel;
......
...@@ -72,7 +72,7 @@ function exposeToPlugin(name: string, component: any) { ...@@ -72,7 +72,7 @@ function exposeToPlugin(name: string, component: any) {
}); });
} }
exposeToPlugin('grafana-ui', grafanaUI); exposeToPlugin('@grafana/ui', grafanaUI);
exposeToPlugin('lodash', _); exposeToPlugin('lodash', _);
exposeToPlugin('moment', moment); exposeToPlugin('moment', moment);
exposeToPlugin('jquery', jquery); exposeToPlugin('jquery', jquery);
......
...@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react'; ...@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { hot } from 'react-hot-loader'; import { hot } from 'react-hot-loader';
import PageHeader from 'app/core/components/PageHeader/PageHeader'; import PageHeader from 'app/core/components/PageHeader/PageHeader';
import DeleteButton from 'app/core/components/DeleteButton/DeleteButton'; import { DeleteButton } from '@grafana/ui';
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA'; import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
import PageLoader from 'app/core/components/PageLoader/PageLoader'; import PageLoader from 'app/core/components/PageLoader/PageLoader';
import { NavModel, Team } from '../../types'; import { NavModel, Team } from '../../types';
...@@ -58,7 +58,7 @@ export class TeamList extends PureComponent<Props, any> { ...@@ -58,7 +58,7 @@ export class TeamList extends PureComponent<Props, any> {
<a href={teamUrl}>{team.memberCount}</a> <a href={teamUrl}>{team.memberCount}</a>
</td> </td>
<td className="text-right"> <td className="text-right">
<DeleteButton onConfirmDelete={() => this.deleteTeam(team)} /> <DeleteButton onConfirm={() => this.deleteTeam(team)} />
</td> </td>
</tr> </tr>
); );
......
...@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react'; ...@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import SlideDown from 'app/core/components/Animations/SlideDown'; import SlideDown from 'app/core/components/Animations/SlideDown';
import { UserPicker } from 'app/core/components/Select/UserPicker'; import { UserPicker } from 'app/core/components/Select/UserPicker';
import DeleteButton from 'app/core/components/DeleteButton/DeleteButton'; import { DeleteButton } from '@grafana/ui';
import { TagBadge } from 'app/core/components/TagFilter/TagBadge'; import { TagBadge } from 'app/core/components/TagFilter/TagBadge';
import { TeamMember, User } from 'app/types'; import { TeamMember, User } from 'app/types';
import { loadTeamMembers, addTeamMember, removeTeamMember, setSearchMemberQuery } from './state/actions'; import { loadTeamMembers, addTeamMember, removeTeamMember, setSearchMemberQuery } from './state/actions';
...@@ -76,7 +76,7 @@ export class TeamMembers extends PureComponent<Props, State> { ...@@ -76,7 +76,7 @@ export class TeamMembers extends PureComponent<Props, State> {
<td>{member.email}</td> <td>{member.email}</td>
{syncEnabled && this.renderLabels(member.labels)} {syncEnabled && this.renderLabels(member.labels)}
<td className="text-right"> <td className="text-right">
<DeleteButton onConfirmDelete={() => this.onRemoveMember(member)} /> <DeleteButton onConfirm={() => this.onRemoveMember(member)} />
</td> </td>
</tr> </tr>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment