mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Removed the initial data source as I could not see it being used anywhere
This commit is contained in:
parent
91d926f180
commit
a1a905cbb1
@ -45,7 +45,6 @@ interface ExploreProps {
|
|||||||
datasourceLoading: boolean | null;
|
datasourceLoading: boolean | null;
|
||||||
datasourceMissing: boolean;
|
datasourceMissing: boolean;
|
||||||
exploreId: ExploreId;
|
exploreId: ExploreId;
|
||||||
initialDatasource?: string;
|
|
||||||
initialQueries: DataQuery[];
|
initialQueries: DataQuery[];
|
||||||
initializeExplore: typeof initializeExplore;
|
initializeExplore: typeof initializeExplore;
|
||||||
initialized: boolean;
|
initialized: boolean;
|
||||||
@ -251,7 +250,6 @@ function mapStateToProps(state: StoreState, { exploreId }) {
|
|||||||
datasourceInstance,
|
datasourceInstance,
|
||||||
datasourceLoading,
|
datasourceLoading,
|
||||||
datasourceMissing,
|
datasourceMissing,
|
||||||
initialDatasource,
|
|
||||||
initialQueries,
|
initialQueries,
|
||||||
initialized,
|
initialized,
|
||||||
range,
|
range,
|
||||||
@ -266,7 +264,6 @@ function mapStateToProps(state: StoreState, { exploreId }) {
|
|||||||
datasourceInstance,
|
datasourceInstance,
|
||||||
datasourceLoading,
|
datasourceLoading,
|
||||||
datasourceMissing,
|
datasourceMissing,
|
||||||
initialDatasource,
|
|
||||||
initialQueries,
|
initialQueries,
|
||||||
initialized,
|
initialized,
|
||||||
range,
|
range,
|
||||||
|
@ -101,7 +101,6 @@ export interface InitializeExploreAction {
|
|||||||
payload: {
|
payload: {
|
||||||
exploreId: ExploreId;
|
exploreId: ExploreId;
|
||||||
containerWidth: number;
|
containerWidth: number;
|
||||||
datasource: string;
|
|
||||||
eventBridge: Emitter;
|
eventBridge: Emitter;
|
||||||
exploreDatasources: DataSourceSelectItem[];
|
exploreDatasources: DataSourceSelectItem[];
|
||||||
queries: DataQuery[];
|
queries: DataQuery[];
|
||||||
@ -125,7 +124,7 @@ export interface LoadDatasourcePendingAction {
|
|||||||
type: ActionTypes.LoadDatasourcePending;
|
type: ActionTypes.LoadDatasourcePending;
|
||||||
payload: {
|
payload: {
|
||||||
exploreId: ExploreId;
|
exploreId: ExploreId;
|
||||||
datasourceName: string;
|
requestedDatasourceName: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +142,6 @@ export interface LoadDatasourceSuccessAction {
|
|||||||
StartPage?: any;
|
StartPage?: any;
|
||||||
datasourceInstance: any;
|
datasourceInstance: any;
|
||||||
history: HistoryItem[];
|
history: HistoryItem[];
|
||||||
initialDatasource: string;
|
|
||||||
initialQueries: DataQuery[];
|
initialQueries: DataQuery[];
|
||||||
logsHighlighterExpressions?: any[];
|
logsHighlighterExpressions?: any[];
|
||||||
showingStartPage: boolean;
|
showingStartPage: boolean;
|
||||||
|
@ -144,7 +144,7 @@ export function highlightLogsExpression(exploreId: ExploreId, expressions: strin
|
|||||||
*/
|
*/
|
||||||
export function initializeExplore(
|
export function initializeExplore(
|
||||||
exploreId: ExploreId,
|
exploreId: ExploreId,
|
||||||
datasource: string,
|
datasourceName: string,
|
||||||
queries: DataQuery[],
|
queries: DataQuery[],
|
||||||
range: RawTimeRange,
|
range: RawTimeRange,
|
||||||
containerWidth: number,
|
containerWidth: number,
|
||||||
@ -164,7 +164,7 @@ export function initializeExplore(
|
|||||||
payload: {
|
payload: {
|
||||||
exploreId,
|
exploreId,
|
||||||
containerWidth,
|
containerWidth,
|
||||||
datasource,
|
datasourceName,
|
||||||
eventBridge,
|
eventBridge,
|
||||||
exploreDatasources,
|
exploreDatasources,
|
||||||
queries,
|
queries,
|
||||||
@ -174,9 +174,9 @@ export function initializeExplore(
|
|||||||
|
|
||||||
if (exploreDatasources.length >= 1) {
|
if (exploreDatasources.length >= 1) {
|
||||||
let instance;
|
let instance;
|
||||||
if (datasource) {
|
if (datasourceName) {
|
||||||
try {
|
try {
|
||||||
instance = await getDatasourceSrv().get(datasource);
|
instance = await getDatasourceSrv().get(datasourceName);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
@ -185,6 +185,7 @@ export function initializeExplore(
|
|||||||
if (!instance) {
|
if (!instance) {
|
||||||
instance = await getDatasourceSrv().get();
|
instance = await getDatasourceSrv().get();
|
||||||
}
|
}
|
||||||
|
dispatch(updateDatasourceInstance(exploreId, instance));
|
||||||
dispatch(loadDatasource(exploreId, instance));
|
dispatch(loadDatasource(exploreId, instance));
|
||||||
} else {
|
} else {
|
||||||
dispatch(loadDatasourceMissing(exploreId));
|
dispatch(loadDatasourceMissing(exploreId));
|
||||||
@ -223,11 +224,11 @@ export const loadDatasourceMissing = (exploreId: ExploreId): LoadDatasourceMissi
|
|||||||
/**
|
/**
|
||||||
* Start the async process of loading a datasource to display a loading indicator
|
* Start the async process of loading a datasource to display a loading indicator
|
||||||
*/
|
*/
|
||||||
export const loadDatasourcePending = (exploreId: ExploreId, datasourceName: string): LoadDatasourcePendingAction => ({
|
export const loadDatasourcePending = (exploreId: ExploreId, requestedDatasourceName: string): LoadDatasourcePendingAction => ({
|
||||||
type: ActionTypes.LoadDatasourcePending,
|
type: ActionTypes.LoadDatasourcePending,
|
||||||
payload: {
|
payload: {
|
||||||
exploreId,
|
exploreId,
|
||||||
datasourceName,
|
requestedDatasourceName,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -260,7 +261,6 @@ export const loadDatasourceSuccess = (
|
|||||||
StartPage,
|
StartPage,
|
||||||
datasourceInstance: instance,
|
datasourceInstance: instance,
|
||||||
history,
|
history,
|
||||||
initialDatasource: instance.name,
|
|
||||||
initialQueries: queries,
|
initialQueries: queries,
|
||||||
showingStartPage: Boolean(StartPage),
|
showingStartPage: Boolean(StartPage),
|
||||||
supportsGraph,
|
supportsGraph,
|
||||||
|
@ -24,6 +24,7 @@ export const makeExploreItemState = (): ExploreItemState => ({
|
|||||||
StartPage: undefined,
|
StartPage: undefined,
|
||||||
containerWidth: 0,
|
containerWidth: 0,
|
||||||
datasourceInstance: null,
|
datasourceInstance: null,
|
||||||
|
requestedDatasourceName: null,
|
||||||
datasourceError: null,
|
datasourceError: null,
|
||||||
datasourceLoading: null,
|
datasourceLoading: null,
|
||||||
datasourceMissing: false,
|
datasourceMissing: false,
|
||||||
@ -162,14 +163,13 @@ export const itemReducer = (state, action: Action): ExploreItemState => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case ActionTypes.InitializeExplore: {
|
case ActionTypes.InitializeExplore: {
|
||||||
const { containerWidth, datasource, eventBridge, exploreDatasources, queries, range } = action.payload;
|
const { containerWidth, eventBridge, exploreDatasources, queries, range } = action.payload;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
containerWidth,
|
containerWidth,
|
||||||
eventBridge,
|
eventBridge,
|
||||||
exploreDatasources,
|
exploreDatasources,
|
||||||
range,
|
range,
|
||||||
initialDatasource: datasource,
|
|
||||||
initialQueries: queries,
|
initialQueries: queries,
|
||||||
initialized: true,
|
initialized: true,
|
||||||
modifiedQueries: queries.slice(),
|
modifiedQueries: queries.slice(),
|
||||||
@ -181,6 +181,7 @@ export const itemReducer = (state, action: Action): ExploreItemState => {
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
datasourceInstance,
|
datasourceInstance,
|
||||||
|
datasourceName: datasourceInstance.name,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +194,7 @@ export const itemReducer = (state, action: Action): ExploreItemState => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case ActionTypes.LoadDatasourcePending: {
|
case ActionTypes.LoadDatasourcePending: {
|
||||||
return { ...state, datasourceLoading: true, requestedDatasourceName: action.payload.datasourceName };
|
return { ...state, datasourceLoading: true, requestedDatasourceName: action.payload.requestedDatasourceName };
|
||||||
}
|
}
|
||||||
|
|
||||||
case ActionTypes.LoadDatasourceSuccess: {
|
case ActionTypes.LoadDatasourceSuccess: {
|
||||||
@ -202,7 +203,6 @@ export const itemReducer = (state, action: Action): ExploreItemState => {
|
|||||||
StartPage,
|
StartPage,
|
||||||
datasourceInstance,
|
datasourceInstance,
|
||||||
history,
|
history,
|
||||||
initialDatasource,
|
|
||||||
initialQueries,
|
initialQueries,
|
||||||
showingStartPage,
|
showingStartPage,
|
||||||
supportsGraph,
|
supportsGraph,
|
||||||
@ -217,7 +217,6 @@ export const itemReducer = (state, action: Action): ExploreItemState => {
|
|||||||
StartPage,
|
StartPage,
|
||||||
datasourceInstance,
|
datasourceInstance,
|
||||||
history,
|
history,
|
||||||
initialDatasource,
|
|
||||||
initialQueries,
|
initialQueries,
|
||||||
showingStartPage,
|
showingStartPage,
|
||||||
supportsGraph,
|
supportsGraph,
|
||||||
|
@ -110,7 +110,11 @@ export interface ExploreItemState {
|
|||||||
/**
|
/**
|
||||||
* Datasource instance that has been selected. Datasource-specific logic can be run on this object.
|
* Datasource instance that has been selected. Datasource-specific logic can be run on this object.
|
||||||
*/
|
*/
|
||||||
datasourceInstance: DataSourceApi;
|
datasourceInstance: DataSourceApi | null;
|
||||||
|
/**
|
||||||
|
* Current data source name or null if default
|
||||||
|
*/
|
||||||
|
requestedDatasourceName: string | null;
|
||||||
/**
|
/**
|
||||||
* Error to be shown when datasource loading or testing failed.
|
* Error to be shown when datasource loading or testing failed.
|
||||||
*/
|
*/
|
||||||
@ -139,10 +143,6 @@ export interface ExploreItemState {
|
|||||||
* History of recent queries. Datasource-specific and initialized via localStorage.
|
* History of recent queries. Datasource-specific and initialized via localStorage.
|
||||||
*/
|
*/
|
||||||
history: HistoryItem[];
|
history: HistoryItem[];
|
||||||
/**
|
|
||||||
* Initial datasource for this Explore, e.g., set via URL.
|
|
||||||
*/
|
|
||||||
initialDatasource?: string;
|
|
||||||
/**
|
/**
|
||||||
* Initial queries for this Explore, e.g., set via URL. Each query will be
|
* Initial queries for this Explore, e.g., set via URL. Each query will be
|
||||||
* converted to a query row. Query edits should be tracked in `modifiedQueries` though.
|
* converted to a query row. Query edits should be tracked in `modifiedQueries` though.
|
||||||
@ -181,12 +181,6 @@ export interface ExploreItemState {
|
|||||||
* when query rows are removed.
|
* when query rows are removed.
|
||||||
*/
|
*/
|
||||||
queryTransactions: QueryTransaction[];
|
queryTransactions: QueryTransaction[];
|
||||||
/**
|
|
||||||
* Tracks datasource when selected in the datasource selector.
|
|
||||||
* Allows the selection to be discarded if something went wrong during the asynchronous
|
|
||||||
* loading of the datasource.
|
|
||||||
*/
|
|
||||||
requestedDatasourceName?: string;
|
|
||||||
/**
|
/**
|
||||||
* Time range for this Explore. Managed by the time picker and used by all query runs.
|
* Time range for this Explore. Managed by the time picker and used by all query runs.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user