mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: upgrade to Typescript 3.9.3 (#25154)
* upgrade to typescript 3.9.3 * Fix errors that surfaced with update * Null check fixs * FIx null checks Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
This commit is contained in:
@@ -188,7 +188,7 @@
|
||||
"ts-jest": "26.1.0",
|
||||
"ts-node": "8.8.1",
|
||||
"tslib": "1.10.0",
|
||||
"typescript": "3.7.5",
|
||||
"typescript": "3.9.3",
|
||||
"webpack": "4.41.5",
|
||||
"webpack-bundle-analyzer": "3.6.0",
|
||||
"webpack-cleanup-plugin": "0.5.1",
|
||||
|
@@ -51,6 +51,6 @@
|
||||
"rollup-plugin-typescript2": "0.26.0",
|
||||
"rollup-plugin-visualizer": "3.3.1",
|
||||
"sinon": "8.1.1",
|
||||
"typescript": "3.7.5"
|
||||
"typescript": "3.9.3"
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@
|
||||
"@grafana/tsconfig": "^1.0.0-rc1",
|
||||
"commander": "5.0.0",
|
||||
"execa": "4.0.0",
|
||||
"typescript": "3.7.5",
|
||||
"typescript": "3.9.3",
|
||||
"yaml": "^1.8.3"
|
||||
}
|
||||
}
|
||||
|
@@ -54,7 +54,7 @@
|
||||
"execa": "4.0.0",
|
||||
"resolve-as-bin": "2.1.0",
|
||||
"ts-loader": "6.2.1",
|
||||
"typescript": "3.7.5",
|
||||
"typescript": "3.9.3",
|
||||
"yaml": "^1.8.3"
|
||||
}
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@
|
||||
"rollup-plugin-terser": "5.3.0",
|
||||
"rollup-plugin-typescript2": "0.26.0",
|
||||
"rollup-plugin-visualizer": "3.3.1",
|
||||
"typescript": "3.7.5"
|
||||
"typescript": "3.9.3"
|
||||
},
|
||||
"types": "src/index.ts"
|
||||
}
|
||||
|
@@ -106,7 +106,7 @@
|
||||
"ts-loader": "6.2.1",
|
||||
"ts-node": "8.8.1",
|
||||
"tslib": "1.10.0",
|
||||
"typescript": "3.7.5",
|
||||
"typescript": "3.9.3",
|
||||
"url-loader": "^2.0.1",
|
||||
"webpack": "4.41.5"
|
||||
},
|
||||
|
@@ -105,7 +105,7 @@
|
||||
"rollup-plugin-visualizer": "3.3.1",
|
||||
"storybook-dark-mode": "0.6.1",
|
||||
"ts-loader": "6.2.1",
|
||||
"typescript": "3.7.5"
|
||||
"typescript": "3.9.3"
|
||||
},
|
||||
"types": "src/index.ts"
|
||||
}
|
||||
|
@@ -55,7 +55,6 @@ export const withAllowCustomValue = () => {
|
||||
{(value, updateValue) => {
|
||||
return (
|
||||
<Select
|
||||
// value={value}
|
||||
placeholder="Choose..."
|
||||
options={options}
|
||||
width={20}
|
||||
@@ -73,7 +72,7 @@ export const withAllowCustomValue = () => {
|
||||
|
||||
export const asyncSelect = () => {
|
||||
const [isLoading, setIsLoading] = useState<boolean>(true);
|
||||
const [value, setValue] = useState();
|
||||
const [value, setValue] = useState<SelectableValue<any>>();
|
||||
const loadAsyncOptions = useCallback(
|
||||
inputValue => {
|
||||
return new Promise<Array<SelectableValue<string>>>(resolve => {
|
||||
|
@@ -1,10 +1,18 @@
|
||||
import React, { useState, useRef, ReactElement } from 'react';
|
||||
|
||||
export const useExpandableLabel = (initialExpanded: boolean) => {
|
||||
interface LabelProps {
|
||||
Component: ReactElement;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
export const useExpandableLabel = (
|
||||
initialExpanded: boolean
|
||||
): [React.ComponentType<LabelProps>, number, boolean, (expanded: boolean) => void] => {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const [expanded, setExpanded] = useState(initialExpanded);
|
||||
const [width, setWidth] = useState();
|
||||
const Label = ({ Component, onClick }: { Component: ReactElement; onClick: () => void }) => (
|
||||
const [expanded, setExpanded] = useState<boolean>(initialExpanded);
|
||||
const [width, setWidth] = useState(0);
|
||||
|
||||
const Label: React.FC<LabelProps> = ({ Component, onClick }) => (
|
||||
<div
|
||||
className="gf-form"
|
||||
ref={ref}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
"devDependencies": {
|
||||
"enzyme": "^3.8.0",
|
||||
"enzyme-adapter-react-16": "^1.2.0",
|
||||
"typescript": "3.7.5"
|
||||
"typescript": "3.9.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grafana/data": "7.1.0-pre.0",
|
||||
|
@@ -6,7 +6,7 @@ import PageLoader from '../PageLoader/PageLoader';
|
||||
|
||||
interface Props {
|
||||
isLoading?: boolean;
|
||||
children: JSX.Element[] | JSX.Element;
|
||||
children: JSX.Element[] | JSX.Element | null;
|
||||
}
|
||||
|
||||
class PageContents extends Component<Props> {
|
||||
|
@@ -34,11 +34,11 @@ export class HelpModal extends React.PureComponent {
|
||||
'Time Range': [
|
||||
{ keys: ['t', 'z'], description: 'Zoom out time range' },
|
||||
{
|
||||
keys: ['t', <Icon name="arrow-left" />],
|
||||
keys: ['t', '←'],
|
||||
description: 'Move time range back',
|
||||
},
|
||||
{
|
||||
keys: ['t', <Icon name="arrow-right" />],
|
||||
keys: ['t', '→'],
|
||||
description: 'Move time range forward',
|
||||
},
|
||||
],
|
||||
|
@@ -8,7 +8,7 @@ import appEvents from 'app/core/app_events';
|
||||
import config from 'app/core/config';
|
||||
import { DataSourceResponse } from 'app/types/events';
|
||||
import { DashboardSearchHit } from 'app/features/search/types';
|
||||
import { CoreEvents, DashboardDTO, FolderInfo, DashboardDataDTO } from 'app/types';
|
||||
import { CoreEvents, DashboardDTO, FolderInfo, DashboardDataDTO, FolderDTO } from 'app/types';
|
||||
import { coreModule } from 'app/core/core_module';
|
||||
import { ContextSrv, contextSrv } from './context_srv';
|
||||
import { Emitter } from '../utils/emitter';
|
||||
@@ -84,7 +84,7 @@ export class BackendSrv implements BackendService {
|
||||
}
|
||||
}
|
||||
|
||||
async get(url: string, params?: any, requestId?: string) {
|
||||
async get<T = any>(url: string, params?: any, requestId?: string): Promise<T> {
|
||||
return await this.request({ method: 'GET', url, params, requestId });
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ export class BackendSrv implements BackendService {
|
||||
}
|
||||
|
||||
getFolderByUid(uid: string) {
|
||||
return this.get(`/api/folders/${uid}`);
|
||||
return this.get<FolderDTO>(`/api/folders/${uid}`);
|
||||
}
|
||||
|
||||
saveDashboard(
|
||||
|
@@ -17,7 +17,9 @@ export class Emitter {
|
||||
* Emits an `event` with `payload`.
|
||||
*/
|
||||
emit<T extends undefined>(event: AppEvent<T>): void;
|
||||
emit<T extends Partial<T> extends T ? Partial<T> : never>(event: AppEvent<T>): void;
|
||||
emit<T extends (U extends any ? Partial<T> : unknown) extends T ? Partial<T> : never, U = any>(
|
||||
event: AppEvent<T>
|
||||
): void;
|
||||
emit<T>(event: AppEvent<T>, payload: T): void;
|
||||
emit<T>(event: AppEvent<T> | string, payload?: T | any): void {
|
||||
if (typeof event === 'string') {
|
||||
@@ -37,7 +39,11 @@ export class Emitter {
|
||||
* Handles `event` with `handler()` when emitted.
|
||||
*/
|
||||
on<T extends undefined>(event: AppEvent<T>, handler: () => void, scope?: any): void;
|
||||
on<T extends Partial<T> extends T ? Partial<T> : never>(event: AppEvent<T>, handler: () => void, scope?: any): void;
|
||||
on<T extends (U extends any ? Partial<T> : unknown) extends T ? Partial<T> : never, U = any>(
|
||||
event: AppEvent<T>,
|
||||
handler: () => void,
|
||||
scope?: any
|
||||
): void;
|
||||
on<T>(event: AppEvent<T>, handler: (payload: T) => void, scope?: any): void;
|
||||
on<T>(event: AppEvent<T> | string, handler: (payload?: T | any) => void, scope?: any) {
|
||||
if (typeof event === 'string') {
|
||||
@@ -69,7 +75,11 @@ export class Emitter {
|
||||
off(name: string, handler: (payload?: any) => void): void;
|
||||
|
||||
off<T extends undefined>(event: AppEvent<T>, handler: () => void): void;
|
||||
off<T extends Partial<T> extends T ? Partial<T> : never>(event: AppEvent<T>, handler: () => void, scope?: any): void;
|
||||
off<T extends (U extends any ? Partial<T> : unknown) extends T ? Partial<T> : never, U = any>(
|
||||
event: AppEvent<T>,
|
||||
handler: () => void,
|
||||
scope?: any
|
||||
): void;
|
||||
off<T>(event: AppEvent<T>, handler: (payload: T) => void): void;
|
||||
off<T>(event: AppEvent<T> | string, handler: (payload?: T | any) => void) {
|
||||
if (typeof event === 'string') {
|
||||
|
@@ -50,7 +50,8 @@ export const OptionsPaneContent: React.FC<Props> = ({
|
||||
config={fieldConfig}
|
||||
plugin={plugin}
|
||||
onChange={onFieldConfigsChange}
|
||||
data={currentData.series}
|
||||
/* hasSeries makes sure current data is there */
|
||||
data={currentData!.series}
|
||||
/>
|
||||
);
|
||||
},
|
||||
@@ -70,7 +71,8 @@ export const OptionsPaneContent: React.FC<Props> = ({
|
||||
config={fieldConfig}
|
||||
plugin={plugin}
|
||||
onChange={onFieldConfigsChange}
|
||||
data={currentData.series}
|
||||
/* hasSeries makes sure current data is there */
|
||||
data={currentData!.series}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
@@ -7,7 +7,7 @@ import validationSrv from 'app/features/manage-dashboards/services/ValidationSrv
|
||||
|
||||
interface SaveDashboardAsFormDTO {
|
||||
title: string;
|
||||
$folder: { id: number; title: string };
|
||||
$folder: { id?: number; title?: string };
|
||||
copyTags: boolean;
|
||||
}
|
||||
|
||||
|
@@ -187,12 +187,16 @@ export class DashboardPage extends PureComponent<Props, State> {
|
||||
|
||||
setScrollTop = (e: MouseEvent<HTMLElement>): void => {
|
||||
const target = e.target as HTMLElement;
|
||||
this.setState({ scrollTop: target.scrollTop, updateScrollTop: null });
|
||||
this.setState({ scrollTop: target.scrollTop, updateScrollTop: undefined });
|
||||
};
|
||||
|
||||
onAddPanel = () => {
|
||||
const { dashboard } = this.props;
|
||||
|
||||
if (!dashboard) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Return if the "Add panel" exists already
|
||||
if (dashboard.panels.length > 0 && dashboard.panels[0].type === 'add-panel') {
|
||||
return;
|
||||
@@ -234,6 +238,10 @@ export class DashboardPage extends PureComponent<Props, State> {
|
||||
renderInitFailedState() {
|
||||
const { initError } = this.props;
|
||||
|
||||
if (!initError) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="dashboard-loading">
|
||||
<Alert
|
||||
|
@@ -237,7 +237,7 @@ export class DataSourceSettingsPage extends PureComponent<Props> {
|
||||
return (
|
||||
<Page navModel={navModel}>
|
||||
<Page.Contents isLoading={!this.hasDataSource}>
|
||||
{this.hasDataSource && <div>{page ? this.renderConfigPageBody(page) : this.renderSettings()}</div>}
|
||||
{this.hasDataSource ? <div>{page ? this.renderConfigPageBody(page) : this.renderSettings()}</div> : null}
|
||||
</Page.Contents>
|
||||
</Page>
|
||||
);
|
||||
|
@@ -42,6 +42,8 @@ export function getLoadingNav(tabIndex: number): NavModel {
|
||||
title: 'Loading',
|
||||
url: 'url',
|
||||
canSave: false,
|
||||
canEdit: false,
|
||||
canAdmin: false,
|
||||
version: 0,
|
||||
});
|
||||
|
||||
|
@@ -9,6 +9,8 @@ function getTestFolder(): FolderDTO {
|
||||
uid: 'asd',
|
||||
url: 'url',
|
||||
canSave: true,
|
||||
canEdit: true,
|
||||
canAdmin: true,
|
||||
version: 0,
|
||||
};
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ import { useAsync } from 'react-use';
|
||||
import { connect, MapStateToProps } from 'react-redux';
|
||||
import { NavModel, locationUtil } from '@grafana/data';
|
||||
import { getLocationSrv } from '@grafana/runtime';
|
||||
import { StoreState } from 'app/types';
|
||||
import { FolderDTO, StoreState } from 'app/types';
|
||||
import { getNavModel } from 'app/core/selectors/navModel';
|
||||
import { getRouteParams, getUrl } from 'app/core/selectors/location';
|
||||
import Page from 'app/core/components/Page/Page';
|
||||
@@ -17,7 +17,7 @@ interface Props {
|
||||
}
|
||||
|
||||
export const DashboardListPage: FC<Props> = memo(({ navModel, uid, url }) => {
|
||||
const { loading, value } = useAsync(() => {
|
||||
const { loading, value } = useAsync<{ folder?: FolderDTO; pageNavModel: NavModel }>(() => {
|
||||
if (!uid || !url.startsWith('/dashboards')) {
|
||||
return Promise.resolve({ pageNavModel: navModel });
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
import { backendSrv } from 'app/core/services/backend_srv';
|
||||
import { NavModel } from '@grafana/data';
|
||||
|
||||
export const loadFolderPage = (uid: string, activeChildId: string) => {
|
||||
const navModel = {
|
||||
const navModel: Pick<NavModel, 'main'> = {
|
||||
main: {
|
||||
icon: 'folder-open',
|
||||
id: 'manage-folder',
|
||||
@@ -35,7 +36,7 @@ export const loadFolderPage = (uid: string, activeChildId: string) => {
|
||||
},
|
||||
};
|
||||
|
||||
return backendSrv.getFolderByUid(uid).then((folder: any) => {
|
||||
return backendSrv.getFolderByUid(uid).then(folder => {
|
||||
const folderTitle = folder.title;
|
||||
const folderUrl = folder.url;
|
||||
navModel.main.text = folderTitle;
|
||||
|
@@ -133,7 +133,11 @@ export class TeamList extends PureComponent<Props, any> {
|
||||
}
|
||||
|
||||
renderList() {
|
||||
const { teamsCount } = this.props;
|
||||
const { teamsCount, hasFetched } = this.props;
|
||||
|
||||
if (!hasFetched) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (teamsCount > 0) {
|
||||
return this.renderTeamList();
|
||||
@@ -147,7 +151,7 @@ export class TeamList extends PureComponent<Props, any> {
|
||||
|
||||
return (
|
||||
<Page navModel={navModel}>
|
||||
<Page.Contents isLoading={!hasFetched}>{hasFetched && this.renderList()}</Page.Contents>
|
||||
<Page.Contents isLoading={!hasFetched}>{this.renderList()}</Page.Contents>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ const SingupInvitedPageUnconnected: FC<DispatchProps & ConnectedProps> = ({ code
|
||||
<Form defaultValues={initFormModel} onSubmit={onSubmit}>
|
||||
{({ register, errors }) => (
|
||||
<>
|
||||
<Field invalid={!!errors.email} error={!!errors.email && errors.email.message} label="Email">
|
||||
<Field invalid={!!errors.email} error={errors.email && errors.email.message} label="Email">
|
||||
<Input
|
||||
placeholder="email@example.com"
|
||||
name="email"
|
||||
@@ -86,13 +86,13 @@ const SingupInvitedPageUnconnected: FC<DispatchProps & ConnectedProps> = ({ code
|
||||
})}
|
||||
/>
|
||||
</Field>
|
||||
<Field invalid={!!errors.name} error={!!errors.name && errors.name.message} label="Name">
|
||||
<Field invalid={!!errors.name} error={errors.name && errors.name.message} label="Name">
|
||||
<Input placeholder="Name (optional)" name="name" ref={register} />
|
||||
</Field>
|
||||
<Field invalid={!!errors.username} error={!!errors.username && errors.username.message} label="Username">
|
||||
<Field invalid={!!errors.username} error={errors.username && errors.username.message} label="Username">
|
||||
<Input placeholder="Username" name="username" ref={register({ required: 'Username is required' })} />
|
||||
</Field>
|
||||
<Field invalid={!!errors.password} error={!!errors.password && errors.password.message} label="Password">
|
||||
<Field invalid={!!errors.password} error={errors.password && errors.password.message} label="Password">
|
||||
<Input
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
|
@@ -45,17 +45,17 @@ export class BarGaugePanel extends PureComponent<PanelProps<BarGaugeOptions>> {
|
||||
const { value } = valueProps;
|
||||
const { hasLinks, getLinks } = value;
|
||||
|
||||
if (!hasLinks || !getLinks) {
|
||||
return this.renderComponent(valueProps, {});
|
||||
if (hasLinks && getLinks) {
|
||||
return (
|
||||
<DataLinksContextMenu links={getLinks}>
|
||||
{api => {
|
||||
return this.renderComponent(valueProps, api);
|
||||
}}
|
||||
</DataLinksContextMenu>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<DataLinksContextMenu links={getLinks}>
|
||||
{api => {
|
||||
return this.renderComponent(valueProps, api);
|
||||
}}
|
||||
</DataLinksContextMenu>
|
||||
);
|
||||
return this.renderComponent(valueProps, {});
|
||||
};
|
||||
|
||||
getValues = (): FieldDisplay[] => {
|
||||
|
@@ -35,17 +35,17 @@ export class GaugePanel extends PureComponent<PanelProps<GaugeOptions>> {
|
||||
const { value } = valueProps;
|
||||
const { getLinks, hasLinks } = value;
|
||||
|
||||
if (!hasLinks || !getLinks) {
|
||||
return this.renderComponent(valueProps, {});
|
||||
if (hasLinks && getLinks) {
|
||||
return (
|
||||
<DataLinksContextMenu links={getLinks}>
|
||||
{api => {
|
||||
return this.renderComponent(valueProps, api);
|
||||
}}
|
||||
</DataLinksContextMenu>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<DataLinksContextMenu links={getLinks}>
|
||||
{api => {
|
||||
return this.renderComponent(valueProps, api);
|
||||
}}
|
||||
</DataLinksContextMenu>
|
||||
);
|
||||
return this.renderComponent(valueProps, {});
|
||||
};
|
||||
|
||||
getValues = (): FieldDisplay[] => {
|
||||
|
@@ -19,7 +19,7 @@ interface LegendEventHandlers {
|
||||
|
||||
interface LegendComponentEventHandlers {
|
||||
onToggleSeries?: (series: TimeSeries, event: any) => void;
|
||||
onToggleSort?: (sortBy: Sort, sortDesc: any) => void;
|
||||
onToggleSort?: (sortBy: Sort | undefined, sortDesc: any) => void;
|
||||
onToggleAxis?: (series: TimeSeries) => void;
|
||||
onColorChange?: (series: TimeSeries, color: string) => void;
|
||||
}
|
||||
@@ -90,9 +90,10 @@ export class GraphLegend extends PureComponent<GraphLegendProps, LegendState> {
|
||||
|
||||
sortLegend() {
|
||||
let seriesList: TimeSeries[] = [...this.props.seriesList] || [];
|
||||
if (this.props.sort && this.props[this.props.sort] && this.props.alignAsTable) {
|
||||
const sortBy = this.props.sort;
|
||||
if (sortBy && this.props[sortBy] && this.props.alignAsTable) {
|
||||
seriesList = _.sortBy(seriesList, series => {
|
||||
let sort = series.stats[this.props.sort];
|
||||
let sort = series.stats[sortBy];
|
||||
if (sort === null) {
|
||||
sort = -Infinity;
|
||||
}
|
||||
@@ -106,6 +107,10 @@ export class GraphLegend extends PureComponent<GraphLegendProps, LegendState> {
|
||||
}
|
||||
|
||||
onToggleSeries = (series: TimeSeries, event: any) => {
|
||||
if (!this.props.onToggleSeries) {
|
||||
return;
|
||||
}
|
||||
|
||||
let hiddenSeries = { ...this.state.hiddenSeries };
|
||||
if (event.ctrlKey || event.metaKey || event.shiftKey) {
|
||||
if (hiddenSeries[series.alias]) {
|
||||
@@ -228,16 +233,20 @@ class LegendSeriesList extends PureComponent<LegendComponentProps> {
|
||||
|
||||
class LegendTable extends PureComponent<Partial<LegendComponentProps>> {
|
||||
onToggleSort = (stat: Sort) => {
|
||||
if (!this.props.onToggleSort) {
|
||||
return;
|
||||
}
|
||||
|
||||
let sortDesc = this.props.sortDesc;
|
||||
let sortBy = this.props.sort;
|
||||
if (stat !== sortBy) {
|
||||
sortDesc = null;
|
||||
sortDesc = undefined;
|
||||
}
|
||||
|
||||
// if already sort ascending, disable sorting
|
||||
if (sortDesc === false) {
|
||||
sortBy = null;
|
||||
sortDesc = null;
|
||||
sortBy = undefined;
|
||||
sortDesc = undefined;
|
||||
} else {
|
||||
sortDesc = !sortDesc;
|
||||
sortBy = stat;
|
||||
@@ -249,6 +258,11 @@ class LegendTable extends PureComponent<Partial<LegendComponentProps>> {
|
||||
const seriesList = this.props.seriesList;
|
||||
const { values, min, max, avg, current, total, sort, sortDesc, hiddenSeries } = this.props;
|
||||
const seriesValuesProps: any = { values, min, max, avg, current, total };
|
||||
|
||||
if (!seriesList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<table>
|
||||
<colgroup>
|
||||
@@ -296,7 +310,11 @@ interface LegendTableHeaderProps {
|
||||
}
|
||||
|
||||
class LegendTableHeaderItem extends PureComponent<LegendTableHeaderProps & LegendSortProps> {
|
||||
onClick = () => this.props.onClick(this.props.statName);
|
||||
onClick = () => {
|
||||
if (this.props.onClick) {
|
||||
this.props.onClick(this.props.statName);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { statName, sort, sortDesc } = this.props;
|
||||
|
@@ -124,7 +124,7 @@ interface LegendSeriesLabelProps {
|
||||
label: string;
|
||||
color: string;
|
||||
yaxis?: number;
|
||||
onLabelClick?: (event: any) => void;
|
||||
onLabelClick: (event: any) => void;
|
||||
}
|
||||
|
||||
class LegendSeriesLabel extends PureComponent<LegendSeriesLabelProps & LegendSeriesIconProps> {
|
||||
@@ -179,12 +179,18 @@ class LegendSeriesIcon extends PureComponent<LegendSeriesIconProps, LegendSeries
|
||||
onToggleAxis: () => {},
|
||||
};
|
||||
|
||||
onColorChange = (color: string) => {
|
||||
const { onColorChange } = this.props;
|
||||
if (onColorChange) {
|
||||
onColorChange(color);
|
||||
}
|
||||
};
|
||||
render() {
|
||||
return (
|
||||
<SeriesColorPicker
|
||||
yaxis={this.props.yaxis}
|
||||
color={this.props.color}
|
||||
onChange={this.props.onColorChange}
|
||||
onChange={this.onColorChange}
|
||||
onToggleAxis={this.props.onToggleAxis}
|
||||
enableNamedColors
|
||||
>
|
||||
|
@@ -65,17 +65,17 @@ export class StatPanel extends PureComponent<PanelProps<StatPanelOptions>> {
|
||||
const { value } = valueProps;
|
||||
const { getLinks, hasLinks } = value;
|
||||
|
||||
if (!hasLinks || !getLinks) {
|
||||
return this.renderComponent(valueProps, {});
|
||||
if (hasLinks && getLinks) {
|
||||
return (
|
||||
<DataLinksContextMenu links={getLinks}>
|
||||
{api => {
|
||||
return this.renderComponent(valueProps, api);
|
||||
}}
|
||||
</DataLinksContextMenu>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<DataLinksContextMenu links={getLinks}>
|
||||
{api => {
|
||||
return this.renderComponent(valueProps, api);
|
||||
}}
|
||||
</DataLinksContextMenu>
|
||||
);
|
||||
return this.renderComponent(valueProps, {});
|
||||
};
|
||||
|
||||
getValues = (): FieldDisplay[] => {
|
||||
|
@@ -36,6 +36,7 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati
|
||||
})
|
||||
.when('/d/:uid/:slug', {
|
||||
template: '<react-container />',
|
||||
//@ts-ignore
|
||||
pageClass: 'page-dashboard',
|
||||
routeInfo: DashboardRouteInfo.Normal,
|
||||
reloadOnSearch: false,
|
||||
@@ -45,6 +46,7 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati
|
||||
})
|
||||
.when('/d/:uid', {
|
||||
template: '<react-container />',
|
||||
//@ts-ignore
|
||||
pageClass: 'page-dashboard',
|
||||
reloadOnSearch: false,
|
||||
routeInfo: DashboardRouteInfo.Normal,
|
||||
@@ -54,6 +56,7 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati
|
||||
})
|
||||
.when('/dashboard/:type/:slug', {
|
||||
template: '<react-container />',
|
||||
//@ts-ignore
|
||||
pageClass: 'page-dashboard',
|
||||
routeInfo: DashboardRouteInfo.Normal,
|
||||
reloadOnSearch: false,
|
||||
@@ -63,6 +66,7 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati
|
||||
})
|
||||
.when('/dashboard/new', {
|
||||
template: '<react-container />',
|
||||
//@ts-ignore
|
||||
pageClass: 'page-dashboard',
|
||||
routeInfo: DashboardRouteInfo.New,
|
||||
reloadOnSearch: false,
|
||||
@@ -72,6 +76,7 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati
|
||||
})
|
||||
.when('/d-solo/:uid/:slug', {
|
||||
template: '<react-container />',
|
||||
//@ts-ignore
|
||||
pageClass: 'dashboard-solo',
|
||||
routeInfo: DashboardRouteInfo.Normal,
|
||||
reloadOnSearch: false,
|
||||
@@ -84,6 +89,7 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati
|
||||
})
|
||||
.when('/d-solo/:uid', {
|
||||
template: '<react-container />',
|
||||
//@ts-ignore
|
||||
pageClass: 'dashboard-solo',
|
||||
routeInfo: DashboardRouteInfo.Normal,
|
||||
reloadOnSearch: false,
|
||||
@@ -96,6 +102,7 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati
|
||||
})
|
||||
.when('/dashboard-solo/:type/:slug', {
|
||||
template: '<react-container />',
|
||||
//@ts-ignore
|
||||
pageClass: 'dashboard-solo',
|
||||
routeInfo: DashboardRouteInfo.Normal,
|
||||
reloadOnSearch: false,
|
||||
@@ -221,6 +228,7 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati
|
||||
.when('/explore', {
|
||||
template: '<react-container />',
|
||||
reloadOnSearch: false,
|
||||
//@ts-ignore
|
||||
pageClass: 'page-explore',
|
||||
resolve: {
|
||||
roles: () => (config.viewersCanEdit ? [] : ['Editor', 'Admin']),
|
||||
@@ -406,13 +414,15 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati
|
||||
// LOGIN / SIGNUP
|
||||
.when('/login', {
|
||||
template: '<react-container/>',
|
||||
//@ts-ignore
|
||||
pageClass: 'login-page sidemenu-hidden',
|
||||
resolve: {
|
||||
component: () => LoginPage,
|
||||
},
|
||||
pageClass: 'login-page sidemenu-hidden',
|
||||
})
|
||||
.when('/invite/:code', {
|
||||
template: '<react-container/>',
|
||||
//@ts-ignore
|
||||
pageClass: 'sidemenu-hidden',
|
||||
resolve: {
|
||||
component: () =>
|
||||
@@ -421,19 +431,22 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati
|
||||
})
|
||||
.when('/signup', {
|
||||
template: '<react-container/>',
|
||||
//@ts-ignore
|
||||
pageClass: 'sidemenu-hidden',
|
||||
resolve: {
|
||||
component: () => SignupPage,
|
||||
},
|
||||
pageClass: 'sidemenu-hidden',
|
||||
})
|
||||
.when('/user/password/send-reset-email', {
|
||||
templateUrl: 'public/app/partials/reset_password.html',
|
||||
controller: 'ResetPasswordCtrl',
|
||||
//@ts-ignore
|
||||
pageClass: 'sidemenu-hidden',
|
||||
})
|
||||
.when('/user/password/reset', {
|
||||
templateUrl: 'public/app/partials/reset_password.html',
|
||||
controller: 'ResetPasswordCtrl',
|
||||
//@ts-ignore
|
||||
pageClass: 'sidemenu-hidden',
|
||||
})
|
||||
.when('/dashboard/snapshots', {
|
||||
|
@@ -9,7 +9,9 @@ export interface AppEventEmitter {
|
||||
|
||||
appEvent<T extends undefined>(event: AppEvent<T>): void;
|
||||
// This overload allows for omitting the appEvent payload if the payload's type only contains optional properties
|
||||
appEvent<T extends Partial<T> extends T ? Partial<T> : never>(event: AppEvent<T>): void;
|
||||
appEvent<T extends (U extends any ? Partial<T> : unknown) extends T ? Partial<T> : never, U = any>(
|
||||
event: AppEvent<T>
|
||||
): void;
|
||||
appEvent<T>(event: AppEvent<T>, payload: T): void;
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,8 @@ export interface FolderDTO {
|
||||
url: string;
|
||||
version: number;
|
||||
canSave: boolean;
|
||||
canEdit: boolean;
|
||||
canAdmin: boolean;
|
||||
}
|
||||
|
||||
export interface FolderState {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
echo -e "Collecting code stats (typescript errors & more)"
|
||||
|
||||
ERROR_COUNT_LIMIT=702
|
||||
ERROR_COUNT_LIMIT=700
|
||||
DIRECTIVES_LIMIT=172
|
||||
CONTROLLERS_LIMIT=139
|
||||
|
||||
|
@@ -25870,6 +25870,11 @@ typescript@3.7.5, typescript@~3.7.2:
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae"
|
||||
integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==
|
||||
|
||||
typescript@3.9.3:
|
||||
version "3.9.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.3.tgz#d3ac8883a97c26139e42df5e93eeece33d610b8a"
|
||||
integrity sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==
|
||||
|
||||
typical@^2.6.1:
|
||||
version "2.6.1"
|
||||
resolved "https://registry.yarnpkg.com/typical/-/typical-2.6.1.tgz#5c080e5d661cbbe38259d2e70a3c7253e873881d"
|
||||
|
Reference in New Issue
Block a user