mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
parent
d9c232b331
commit
0ffdcbbe52
@ -2747,17 +2747,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||||
],
|
],
|
||||||
"public/app/features/org/state/reducers.ts:5381": [
|
"public/app/features/org/state/reducers.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
|
||||||
],
|
|
||||||
"public/app/features/panel/components/PanelPluginError.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/features/panel/components/PanelRenderer.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/panel/components/VizTypePicker/PanelTypeCard.tsx:5381": [
|
"public/app/features/panel/components/VizTypePicker/PanelTypeCard.tsx:5381": [
|
||||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||||
@ -2766,8 +2756,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/features/panel/panellinks/linkSuppliers.ts:5381": [
|
"public/app/features/panel/panellinks/linkSuppliers.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/panel/panellinks/link_srv.ts:5381": [
|
"public/app/features/panel/panellinks/link_srv.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
@ -2775,9 +2764,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/panel/state/actions.ts:5381": [
|
"public/app/features/panel/state/actions.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
@ -2797,17 +2784,9 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||||
],
|
],
|
||||||
"public/app/features/plugins/admin/components/AppConfigWrapper.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
|
||||||
],
|
|
||||||
"public/app/features/plugins/admin/components/GetStartedWithPlugin/GetStartedWithDataSource.tsx:5381": [
|
"public/app/features/plugins/admin/components/GetStartedWithPlugin/GetStartedWithDataSource.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/features/plugins/admin/components/PluginDashboards.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
|
||||||
],
|
|
||||||
"public/app/features/plugins/admin/components/PluginDetailsBody.tsx:5381": [
|
"public/app/features/plugins/admin/components/PluginDetailsBody.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
@ -2823,25 +2802,14 @@ exports[`better eslint`] = {
|
|||||||
"public/app/features/plugins/admin/components/SearchField.tsx:5381": [
|
"public/app/features/plugins/admin/components/SearchField.tsx:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/features/plugins/admin/helpers.ts:5381": [
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/features/plugins/admin/hooks/useHistory.tsx:5381": [
|
"public/app/features/plugins/admin/hooks/useHistory.tsx:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/features/plugins/admin/pages/Browse.tsx:5381": [
|
"public/app/features/plugins/admin/pages/Browse.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/plugins/admin/state/actions.ts:5381": [
|
"public/app/features/plugins/admin/state/actions.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
|
||||||
],
|
|
||||||
"public/app/features/plugins/admin/state/selectors.ts:5381": [
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/features/plugins/admin/types.ts:5381": [
|
"public/app/features/plugins/admin/types.ts:5381": [
|
||||||
@ -2929,18 +2897,13 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "4"]
|
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "4"]
|
||||||
],
|
],
|
||||||
"public/app/features/query/components/QueryEditorRowHeader.tsx:5381": [
|
"public/app/features/query/components/QueryEditorRowHeader.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
|
||||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "2"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/query/components/QueryGroup.tsx:5381": [
|
"public/app/features/query/components/QueryGroup.tsx:5381": [
|
||||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"],
|
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"],
|
||||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"],
|
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"],
|
||||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "2"]
|
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "2"]
|
||||||
],
|
],
|
||||||
"public/app/features/query/components/QueryGroupOptions.tsx:5381": [
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/features/query/state/DashboardQueryRunner/AlertStatesWorker.test.ts:5381": [
|
"public/app/features/query/state/DashboardQueryRunner/AlertStatesWorker.test.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||||
|
@ -4,7 +4,7 @@ import { Organization, OrganizationState, UserOrg } from 'app/types';
|
|||||||
|
|
||||||
export const initialState: OrganizationState = {
|
export const initialState: OrganizationState = {
|
||||||
organization: {} as Organization,
|
organization: {} as Organization,
|
||||||
userOrgs: [] as UserOrg[],
|
userOrgs: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const organizationSlice = createSlice({
|
const organizationSlice = createSlice({
|
||||||
|
@ -32,7 +32,7 @@ class PanelPluginError extends PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPanelPluginLoadError(meta: PanelPluginMeta, err: any): PanelPlugin {
|
export function getPanelPluginLoadError(meta: PanelPluginMeta, err: unknown): PanelPlugin {
|
||||||
const LoadError = class LoadError extends PureComponent<PanelProps> {
|
const LoadError = class LoadError extends PureComponent<PanelProps> {
|
||||||
render() {
|
render() {
|
||||||
const text = (
|
const text = (
|
||||||
|
@ -17,7 +17,7 @@ import { importPanelPlugin, syncGetPanelPlugin } from '../../plugins/importPanel
|
|||||||
|
|
||||||
const defaultFieldConfig = { defaults: {}, overrides: [] };
|
const defaultFieldConfig = { defaults: {}, overrides: [] };
|
||||||
|
|
||||||
export function PanelRenderer<P extends object = any, F extends object = any>(props: PanelRendererProps<P, F>) {
|
export function PanelRenderer<P extends object = {}, F extends object = {}>(props: PanelRendererProps<P, F>) {
|
||||||
const {
|
const {
|
||||||
pluginId,
|
pluginId,
|
||||||
data,
|
data,
|
||||||
@ -107,7 +107,7 @@ export function PanelRenderer<P extends object = any, F extends object = any>(pr
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function useOptionDefaults<P extends object = any, F extends object = any>(
|
function useOptionDefaults<P extends object = {}, F extends object = {}>(
|
||||||
plugin: PanelPlugin | undefined,
|
plugin: PanelPlugin | undefined,
|
||||||
options: P,
|
options: P,
|
||||||
fieldConfig: FieldConfigSource<F>
|
fieldConfig: FieldConfigSource<F>
|
||||||
|
@ -126,7 +126,7 @@ export const getFieldLinksSupplier = (value: FieldDisplay): LinkModelSupplier<Fi
|
|||||||
|
|
||||||
const replace: InterpolateFunction = (value: string, vars: ScopedVars | undefined, fmt?: string | Function) => {
|
const replace: InterpolateFunction = (value: string, vars: ScopedVars | undefined, fmt?: string | Function) => {
|
||||||
const finalVars: ScopedVars = {
|
const finalVars: ScopedVars = {
|
||||||
...(scopedVars as ScopedVars),
|
...scopedVars,
|
||||||
...vars,
|
...vars,
|
||||||
};
|
};
|
||||||
return replaceVariables(value, finalVars, fmt);
|
return replaceVariables(value, finalVars, fmt);
|
||||||
|
@ -245,7 +245,11 @@ export const getCalculationValueDataLinksVariableSuggestions = (dataFrames: Data
|
|||||||
|
|
||||||
export interface LinkService {
|
export interface LinkService {
|
||||||
getDataLinkUIModel: <T>(link: DataLink, replaceVariables: InterpolateFunction | undefined, origin: T) => LinkModel<T>;
|
getDataLinkUIModel: <T>(link: DataLink, replaceVariables: InterpolateFunction | undefined, origin: T) => LinkModel<T>;
|
||||||
getAnchorInfo: (link: any) => any;
|
getAnchorInfo: (link: any) => {
|
||||||
|
href: string;
|
||||||
|
title: string;
|
||||||
|
tooltip: string;
|
||||||
|
};
|
||||||
getLinkUrl: (link: any) => string;
|
getLinkUrl: (link: any) => string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,11 +277,11 @@ export class LinkSrv implements LinkService {
|
|||||||
|
|
||||||
getAnchorInfo(link: any) {
|
getAnchorInfo(link: any) {
|
||||||
const templateSrv = getTemplateSrv();
|
const templateSrv = getTemplateSrv();
|
||||||
const info: any = {};
|
return {
|
||||||
info.href = this.getLinkUrl(link);
|
href: this.getLinkUrl(link),
|
||||||
info.title = templateSrv.replace(link.title || '');
|
title: templateSrv.replace(link.title || ''),
|
||||||
info.tooltip = templateSrv.replace(link.tooltip || '');
|
tooltip: templateSrv.replace(link.tooltip || ''),
|
||||||
return info;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,11 +119,11 @@ export class AppConfigCtrlWrapper extends PureComponent<Props, State> {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
setPreUpdateHook = (callback: () => any) => {
|
setPreUpdateHook = (callback: () => Promise<void>) => {
|
||||||
this.preUpdateHook = callback;
|
this.preUpdateHook = callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
setPostUpdateHook = (callback: () => any) => {
|
setPostUpdateHook = (callback: () => Promise<void>) => {
|
||||||
this.postUpdateHook = callback;
|
this.postUpdateHook = callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ export class PluginDashboards extends PureComponent<Props, State> {
|
|||||||
const pluginId = this.props.plugin.id;
|
const pluginId = this.props.plugin.id;
|
||||||
getBackendSrv()
|
getBackendSrv()
|
||||||
.get(`/api/plugins/${pluginId}/dashboards`)
|
.get(`/api/plugins/${pluginId}/dashboards`)
|
||||||
.then((dashboards: any) => {
|
.then((dashboards) => {
|
||||||
this.setState({ dashboards, loading: false });
|
this.setState({ dashboards, loading: false });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -59,21 +59,21 @@ export class PluginDashboards extends PureComponent<Props, State> {
|
|||||||
import = (dash: PluginDashboard, overwrite: boolean) => {
|
import = (dash: PluginDashboard, overwrite: boolean) => {
|
||||||
const { plugin, datasource } = this.props;
|
const { plugin, datasource } = this.props;
|
||||||
|
|
||||||
const installCmd: any = {
|
const installCmd = {
|
||||||
pluginId: plugin.id,
|
pluginId: plugin.id,
|
||||||
path: dash.path,
|
path: dash.path,
|
||||||
overwrite: overwrite,
|
overwrite: overwrite,
|
||||||
inputs: [],
|
inputs: datasource
|
||||||
};
|
? [
|
||||||
|
{
|
||||||
if (datasource) {
|
|
||||||
installCmd.inputs.push({
|
|
||||||
name: '*',
|
name: '*',
|
||||||
type: 'datasource',
|
type: 'datasource',
|
||||||
pluginId: datasource.meta.id,
|
pluginId: datasource.meta.id,
|
||||||
value: datasource.name,
|
value: datasource.name,
|
||||||
});
|
},
|
||||||
}
|
]
|
||||||
|
: [],
|
||||||
|
};
|
||||||
|
|
||||||
return getBackendSrv()
|
return getBackendSrv()
|
||||||
.post(`/api/dashboards/import`, installCmd)
|
.post(`/api/dashboards/import`, installCmd)
|
||||||
|
@ -223,13 +223,10 @@ export const sortPlugins = (plugins: CatalogPlugin[], sortBy: Sorters) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function groupErrorsByPluginId(errors: PluginError[] = []): Record<string, PluginError | undefined> {
|
function groupErrorsByPluginId(errors: PluginError[] = []): Record<string, PluginError | undefined> {
|
||||||
return errors.reduce(
|
return errors.reduce<Record<string, PluginError | undefined>>((byId, error) => {
|
||||||
(byId, error) => {
|
|
||||||
byId[error.pluginId] = error;
|
byId[error.pluginId] = error;
|
||||||
return byId;
|
return byId;
|
||||||
},
|
}, {});
|
||||||
{} as Record<string, PluginError | undefined>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPluginSignature(options: {
|
function getPluginSignature(options: {
|
||||||
|
@ -27,8 +27,8 @@ export default function Browse({ route }: GrafanaRouteComponentProps): ReactElem
|
|||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const remotePluginsAvailable = useIsRemotePluginsAvailable();
|
const remotePluginsAvailable = useIsRemotePluginsAvailable();
|
||||||
const keyword = (locationSearch.q as string) || '';
|
const keyword = locationSearch.q?.toString() || '';
|
||||||
const filterBy = (locationSearch.filterBy as string) || 'installed';
|
const filterBy = locationSearch.filterBy?.toString() || 'installed';
|
||||||
const filterByType = (locationSearch.filterByType as PluginType | 'all') || 'all';
|
const filterByType = (locationSearch.filterByType as PluginType | 'all') || 'all';
|
||||||
const sortBy = (locationSearch.sortBy as Sorters) || Sorters.nameAsc;
|
const sortBy = (locationSearch.sortBy as Sorters) || Sorters.nameAsc;
|
||||||
const { isLoading, error, plugins } = useGetAll(
|
const { isLoading, error, plugins } = useGetAll(
|
||||||
|
@ -56,23 +56,31 @@ export const fetchRemotePlugins = createAsyncThunk<RemotePlugin[], void, { rejec
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const fetchDetails = createAsyncThunk(`${STATE_PREFIX}/fetchDetails`, async (id: string, thunkApi) => {
|
export const fetchDetails = createAsyncThunk<Update<CatalogPlugin>, string>(
|
||||||
|
`${STATE_PREFIX}/fetchDetails`,
|
||||||
|
async (id: string, thunkApi) => {
|
||||||
try {
|
try {
|
||||||
const details = await getPluginDetails(id);
|
const details = await getPluginDetails(id);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
changes: { details },
|
changes: { details },
|
||||||
} as Update<CatalogPlugin>;
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return thunkApi.rejectWithValue('Unknown error.');
|
return thunkApi.rejectWithValue('Unknown error.');
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// We are also using the install API endpoint to update the plugin
|
// We are also using the install API endpoint to update the plugin
|
||||||
export const install = createAsyncThunk(
|
export const install = createAsyncThunk<
|
||||||
`${STATE_PREFIX}/install`,
|
Update<CatalogPlugin>,
|
||||||
async ({ id, version, isUpdating = false }: { id: string; version?: string; isUpdating?: boolean }, thunkApi) => {
|
{
|
||||||
|
id: string;
|
||||||
|
version?: string;
|
||||||
|
isUpdating?: boolean;
|
||||||
|
}
|
||||||
|
>(`${STATE_PREFIX}/install`, async ({ id, version, isUpdating = false }, thunkApi) => {
|
||||||
const changes = isUpdating
|
const changes = isUpdating
|
||||||
? { isInstalled: true, installedVersion: version, hasUpdate: false }
|
? { isInstalled: true, installedVersion: version, hasUpdate: false }
|
||||||
: { isInstalled: true, installedVersion: version };
|
: { isInstalled: true, installedVersion: version };
|
||||||
@ -84,7 +92,7 @@ export const install = createAsyncThunk(
|
|||||||
invalidatePluginInCache(id);
|
invalidatePluginInCache(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { id, changes } as Update<CatalogPlugin>;
|
return { id, changes };
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
if (isFetchError(e)) {
|
if (isFetchError(e)) {
|
||||||
@ -93,12 +101,13 @@ export const install = createAsyncThunk(
|
|||||||
|
|
||||||
return thunkApi.rejectWithValue('Unknown error.');
|
return thunkApi.rejectWithValue('Unknown error.');
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
export const unsetInstall = createAsyncThunk(`${STATE_PREFIX}/install`, async () => ({}));
|
export const unsetInstall = createAsyncThunk(`${STATE_PREFIX}/install`, async () => ({}));
|
||||||
|
|
||||||
export const uninstall = createAsyncThunk(`${STATE_PREFIX}/uninstall`, async (id: string, thunkApi) => {
|
export const uninstall = createAsyncThunk<Update<CatalogPlugin>, string>(
|
||||||
|
`${STATE_PREFIX}/uninstall`,
|
||||||
|
async (id, thunkApi) => {
|
||||||
try {
|
try {
|
||||||
await uninstallPlugin(id);
|
await uninstallPlugin(id);
|
||||||
await updatePanels();
|
await updatePanels();
|
||||||
@ -108,13 +117,14 @@ export const uninstall = createAsyncThunk(`${STATE_PREFIX}/uninstall`, async (id
|
|||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
changes: { isInstalled: false, installedVersion: undefined },
|
changes: { isInstalled: false, installedVersion: undefined },
|
||||||
} as Update<CatalogPlugin>;
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
||||||
return thunkApi.rejectWithValue('Unknown error.');
|
return thunkApi.rejectWithValue('Unknown error.');
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// We need this to be backwards-compatible with other parts of Grafana.
|
// We need this to be backwards-compatible with other parts of Grafana.
|
||||||
// (Originally in "public/app/features/plugins/state/actions.ts")
|
// (Originally in "public/app/features/plugins/state/actions.ts")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createSelector } from '@reduxjs/toolkit';
|
import { createSelector } from '@reduxjs/toolkit';
|
||||||
|
|
||||||
import { PluginError, PluginErrorCode, PluginType, unEscapeStringFromRegex } from '@grafana/data';
|
import { PluginError, PluginType, unEscapeStringFromRegex } from '@grafana/data';
|
||||||
|
|
||||||
import { RequestStatus, PluginCatalogStoreState } from '../types';
|
import { RequestStatus, PluginCatalogStoreState } from '../types';
|
||||||
|
|
||||||
@ -63,18 +63,19 @@ export const selectPlugins = (filters: PluginFilters) =>
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export const selectPluginErrors = createSelector(selectAll, (plugins) =>
|
export const selectPluginErrors = createSelector(selectAll, (plugins) => {
|
||||||
plugins
|
const pluginErrors: PluginError[] = [];
|
||||||
? plugins
|
for (const plugin of plugins) {
|
||||||
.filter((p) => Boolean(p.error))
|
if (plugin.error) {
|
||||||
.map(
|
pluginErrors.push({
|
||||||
(p): PluginError => ({
|
pluginId: plugin.id,
|
||||||
pluginId: p.id,
|
errorCode: plugin.error,
|
||||||
errorCode: p!.error as PluginErrorCode,
|
});
|
||||||
})
|
}
|
||||||
)
|
}
|
||||||
: []
|
|
||||||
);
|
return pluginErrors;
|
||||||
|
});
|
||||||
|
|
||||||
// The following selectors are used to get information about the outstanding or completed plugins-related network requests.
|
// The following selectors are used to get information about the outstanding or completed plugins-related network requests.
|
||||||
export const selectRequest = (actionType: string) =>
|
export const selectRequest = (actionType: string) =>
|
||||||
|
@ -71,9 +71,9 @@ export const QueryEditorRowHeader = <TQuery extends DataQuery>(props: Props<TQue
|
|||||||
onEndEditName(event.currentTarget.value.trim());
|
onEndEditName(event.currentTarget.value.trim());
|
||||||
};
|
};
|
||||||
|
|
||||||
const onKeyDown = (event: React.KeyboardEvent) => {
|
const onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
if (event.key === 'Enter') {
|
if (event.key === 'Enter') {
|
||||||
onEndEditName((event.target as any).value);
|
onEndEditName(event.currentTarget.value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ export class QueryGroupOptionsEditor extends PureComponent<Props, State> {
|
|||||||
onMaxDataPointsBlur = (event: ChangeEvent<HTMLInputElement>) => {
|
onMaxDataPointsBlur = (event: ChangeEvent<HTMLInputElement>) => {
|
||||||
const { options, onChange } = this.props;
|
const { options, onChange } = this.props;
|
||||||
|
|
||||||
let maxDataPoints: number | null = parseInt(event.target.value as string, 10);
|
let maxDataPoints: number | null = parseInt(event.currentTarget.value, 10);
|
||||||
|
|
||||||
if (isNaN(maxDataPoints) || maxDataPoints === 0) {
|
if (isNaN(maxDataPoints) || maxDataPoints === 0) {
|
||||||
maxDataPoints = null;
|
maxDataPoints = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user