mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* IconButton: New component to share pointer, size & hover style for icon buttons * Progress * IconButton: new component * Think I am done * Updated snapshots * Do not like the black button reverting that, and not the plus-circle changed to plus * fixed test * fixed e2e test * Fixed ts issue
67 lines
1.9 KiB
TypeScript
67 lines
1.9 KiB
TypeScript
// Libaries
|
|
import React, { PureComponent } from 'react';
|
|
|
|
// Utils & Services
|
|
import { AngularComponent, getAngularLoader } from '@grafana/runtime';
|
|
|
|
// Types
|
|
import { DashboardModel } from '../../state/DashboardModel';
|
|
import { BackButton } from 'app/core/components/BackButton/BackButton';
|
|
import { updateLocation } from 'app/core/actions';
|
|
import { CustomScrollbar } from '@grafana/ui';
|
|
|
|
export interface Props {
|
|
dashboard: DashboardModel | null;
|
|
updateLocation: typeof updateLocation;
|
|
}
|
|
|
|
export class DashboardSettings extends PureComponent<Props> {
|
|
element: HTMLElement;
|
|
angularCmp: AngularComponent;
|
|
|
|
componentDidMount() {
|
|
const loader = getAngularLoader();
|
|
|
|
const template = '<dashboard-settings dashboard="dashboard" class="dashboard-settings__body2" />';
|
|
const scopeProps = { dashboard: this.props.dashboard };
|
|
|
|
this.angularCmp = loader.load(this.element, scopeProps, template);
|
|
}
|
|
|
|
componentWillUnmount() {
|
|
if (this.angularCmp) {
|
|
this.angularCmp.destroy();
|
|
}
|
|
}
|
|
|
|
onClose = () => {
|
|
this.props.updateLocation({
|
|
query: { editview: null },
|
|
partial: true,
|
|
});
|
|
};
|
|
|
|
render() {
|
|
const { dashboard } = this.props;
|
|
const folderTitle = dashboard.meta.folderTitle;
|
|
const haveFolder = dashboard.meta.folderId > 0;
|
|
|
|
return (
|
|
<div className="dashboard-settings">
|
|
<div className="navbar navbar--shadow">
|
|
<div className="navbar-edit">
|
|
<BackButton surface="body" onClick={this.onClose} />
|
|
</div>
|
|
<div className="navbar-page-btn">
|
|
{haveFolder && <div className="navbar-page-btn__folder">{folderTitle} / </div>}
|
|
<span>{dashboard.title} / Settings</span>
|
|
</div>
|
|
</div>
|
|
<CustomScrollbar>
|
|
<div className="dashboard-settings__body1" ref={element => (this.element = element)} />
|
|
</CustomScrollbar>
|
|
</div>
|
|
);
|
|
}
|
|
}
|