mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
renaming DataSource type to DataSourceSettings and moved to grafana ui
This commit is contained in:
parent
febb9e7168
commit
ecab597e5e
@ -55,3 +55,31 @@ export interface DataSourceApi {
|
||||
*/
|
||||
testDatasource(): Promise<any>;
|
||||
}
|
||||
|
||||
export interface DataSourceSettings {
|
||||
id: number;
|
||||
orgId: number;
|
||||
name: string;
|
||||
typeLogoUrl: string;
|
||||
type: string;
|
||||
access: string;
|
||||
url: string;
|
||||
password: string;
|
||||
user: string;
|
||||
database: string;
|
||||
basicAuth: boolean;
|
||||
basicAuthPassword: string;
|
||||
basicAuthUser: string;
|
||||
isDefault: boolean;
|
||||
jsonData: { authType: string; defaultRegion: string };
|
||||
readOnly: boolean;
|
||||
withCredentials: boolean;
|
||||
}
|
||||
|
||||
export interface DataSourceSelectItem {
|
||||
name: string;
|
||||
value: string | null;
|
||||
meta: PluginMeta;
|
||||
sort: string;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import _ from 'lodash';
|
||||
import { Select } from '@grafana/ui';
|
||||
|
||||
// Types
|
||||
import { DataSourceSelectItem } from 'app/types';
|
||||
import { DataSourceSelectItem } from '@grafana/ui/src/types';
|
||||
|
||||
export interface Props {
|
||||
onChange: (ds: DataSourceSelectItem) => void;
|
||||
|
@ -18,8 +18,7 @@ import config from 'app/core/config';
|
||||
// Types
|
||||
import { PanelModel } from '../panel_model';
|
||||
import { DashboardModel } from '../dashboard_model';
|
||||
import { DataQuery } from '@grafana/ui';
|
||||
import { DataSourceSelectItem } from 'app/types';
|
||||
import { DataQuery, DataSourceSelectItem } from '@grafana/ui/src/types';
|
||||
import { PluginHelp } from 'app/core/components/PluginHelp/PluginHelp';
|
||||
|
||||
interface Props {
|
||||
|
@ -14,7 +14,8 @@ import { FormLabel } from '@grafana/ui';
|
||||
|
||||
// Types
|
||||
import { PanelModel } from '../panel_model';
|
||||
import { ValidationEvents, DataSourceSelectItem } from 'app/types';
|
||||
import { DataSourceSelectItem } from '@grafana/ui/src/types';
|
||||
import { ValidationEvents } from 'app/types';
|
||||
|
||||
const timeRangeValidationEvents: ValidationEvents = {
|
||||
[EventsWithValidation.onBlur]: [
|
||||
|
@ -1,13 +1,14 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { DataSourceDashboards, Props } from './DataSourceDashboards';
|
||||
import { DataSource, NavModel, PluginDashboard } from 'app/types';
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
import { NavModel, PluginDashboard } from 'app/types';
|
||||
|
||||
const setup = (propOverrides?: object) => {
|
||||
const props: Props = {
|
||||
navModel: {} as NavModel,
|
||||
dashboards: [] as PluginDashboard[],
|
||||
dataSource: {} as DataSource,
|
||||
dataSource: {} as DataSourceSettings,
|
||||
pageId: 1,
|
||||
importDashboard: jest.fn(),
|
||||
loadDataSource: jest.fn(),
|
||||
|
@ -1,9 +1,13 @@
|
||||
// Libraries
|
||||
import React, { PureComponent } from 'react';
|
||||
import { hot } from 'react-hot-loader';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
// Components
|
||||
import PageHeader from 'app/core/components/PageHeader/PageHeader';
|
||||
import DashboardTable from './DashboardsTable';
|
||||
import { DataSource, NavModel, PluginDashboard } from 'app/types';
|
||||
|
||||
// Actions & Selectors
|
||||
import { getNavModel } from 'app/core/selectors/navModel';
|
||||
import { getRouteParamsId } from 'app/core/selectors/location';
|
||||
import { loadDataSource } from './state/actions';
|
||||
@ -11,10 +15,14 @@ import { loadPluginDashboards } from '../plugins/state/actions';
|
||||
import { importDashboard, removeDashboard } from '../dashboard/state/actions';
|
||||
import { getDataSource } from './state/selectors';
|
||||
|
||||
// Types
|
||||
import { NavModel, PluginDashboard } from 'app/types';
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
|
||||
export interface Props {
|
||||
navModel: NavModel;
|
||||
dashboards: PluginDashboard[];
|
||||
dataSource: DataSource;
|
||||
dataSource: DataSourceSettings;
|
||||
pageId: number;
|
||||
importDashboard: typeof importDashboard;
|
||||
loadDataSource: typeof loadDataSource;
|
||||
|
@ -1,11 +1,16 @@
|
||||
// Libraries
|
||||
import React, { PureComponent } from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
// Components
|
||||
import DataSourcesListItem from './DataSourcesListItem';
|
||||
import { DataSource } from 'app/types';
|
||||
|
||||
// Types
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
import { LayoutMode, LayoutModes } from '../../core/components/LayoutSelector/LayoutSelector';
|
||||
|
||||
export interface Props {
|
||||
dataSources: DataSource[];
|
||||
dataSources: DataSourceSettings[];
|
||||
layoutMode: LayoutMode;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { DataSource } from 'app/types';
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
|
||||
export interface Props {
|
||||
dataSource: DataSource;
|
||||
dataSource: DataSourceSettings;
|
||||
}
|
||||
|
||||
export class DataSourcesListItem extends PureComponent<Props> {
|
||||
|
@ -1,13 +1,14 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { DataSourcesListPage, Props } from './DataSourcesListPage';
|
||||
import { DataSource, NavModel } from 'app/types';
|
||||
import { NavModel } from 'app/types';
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
import { LayoutModes } from '../../core/components/LayoutSelector/LayoutSelector';
|
||||
import { getMockDataSources } from './__mocks__/dataSourcesMocks';
|
||||
|
||||
const setup = (propOverrides?: object) => {
|
||||
const props: Props = {
|
||||
dataSources: [] as DataSource[],
|
||||
dataSources: [] as DataSourceSettings[],
|
||||
layoutMode: LayoutModes.Grid,
|
||||
loadDataSources: jest.fn(),
|
||||
navModel: {
|
||||
|
@ -1,12 +1,20 @@
|
||||
// Libraries
|
||||
import React, { PureComponent } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { hot } from 'react-hot-loader';
|
||||
|
||||
// Components
|
||||
import Page from 'app/core/components/Page/Page';
|
||||
import OrgActionBar from 'app/core/components/OrgActionBar/OrgActionBar';
|
||||
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
||||
import DataSourcesList from './DataSourcesList';
|
||||
import { DataSource, NavModel, StoreState } from 'app/types';
|
||||
|
||||
// Types
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
import { NavModel, StoreState } from 'app/types';
|
||||
import { LayoutMode } from 'app/core/components/LayoutSelector/LayoutSelector';
|
||||
|
||||
// Actions
|
||||
import { loadDataSources, setDataSourcesLayoutMode, setDataSourcesSearchQuery } from './state/actions';
|
||||
import { getNavModel } from 'app/core/selectors/navModel';
|
||||
|
||||
@ -19,7 +27,7 @@ import {
|
||||
|
||||
export interface Props {
|
||||
navModel: NavModel;
|
||||
dataSources: DataSource[];
|
||||
dataSources: DataSourceSettings[];
|
||||
dataSourcesCount: number;
|
||||
layoutMode: LayoutMode;
|
||||
searchQuery: string;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { DataSource } from 'app/types';
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
|
||||
export const getMockDataSources = (amount: number): DataSource[] => {
|
||||
export const getMockDataSources = (amount: number): DataSourceSettings[] => {
|
||||
const dataSources = [];
|
||||
|
||||
for (let i = 0; i <= amount; i++) {
|
||||
@ -25,7 +25,7 @@ export const getMockDataSources = (amount: number): DataSource[] => {
|
||||
return dataSources;
|
||||
};
|
||||
|
||||
export const getMockDataSource = (): DataSource => {
|
||||
export const getMockDataSource = (): DataSourceSettings => {
|
||||
return {
|
||||
access: '',
|
||||
basicAuth: false,
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { DataSourceSettings, Props } from './DataSourceSettings';
|
||||
import { DataSource, NavModel } from '../../../types';
|
||||
import { DataSourceSettingsPage, Props } from './DataSourceSettingsPage';
|
||||
import { NavModel } from 'app/types';
|
||||
import { DataSourceSettings } from '@grafana/ui';
|
||||
import { getMockDataSource } from '../__mocks__/dataSourcesMocks';
|
||||
import { getMockPlugin } from '../../plugins/__mocks__/pluginMocks';
|
||||
|
||||
@ -20,7 +21,7 @@ const setup = (propOverrides?: object) => {
|
||||
|
||||
Object.assign(props, propOverrides);
|
||||
|
||||
return shallow(<DataSourceSettings {...props} />);
|
||||
return shallow(<DataSourceSettingsPage {...props} />);
|
||||
};
|
||||
|
||||
describe('Render', () => {
|
||||
@ -32,7 +33,7 @@ describe('Render', () => {
|
||||
|
||||
it('should render loader', () => {
|
||||
const wrapper = setup({
|
||||
dataSource: {} as DataSource,
|
||||
dataSource: {} as DataSourceSettings,
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
@ -1,28 +1,34 @@
|
||||
// Libraries
|
||||
import React, { PureComponent } from 'react';
|
||||
import { hot } from 'react-hot-loader';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
// Components
|
||||
import PageHeader from 'app/core/components/PageHeader/PageHeader';
|
||||
import PageLoader from 'app/core/components/PageLoader/PageLoader';
|
||||
import PluginSettings from './PluginSettings';
|
||||
import BasicSettings from './BasicSettings';
|
||||
import ButtonRow from './ButtonRow';
|
||||
|
||||
// Services & Utils
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
|
||||
// Actions & selectors
|
||||
import { getDataSource, getDataSourceMeta } from '../state/selectors';
|
||||
import { deleteDataSource, loadDataSource, setDataSourceName, setIsDefault, updateDataSource } from '../state/actions';
|
||||
import { getNavModel } from 'app/core/selectors/navModel';
|
||||
import { getRouteParamsId } from 'app/core/selectors/location';
|
||||
|
||||
import { DataSource, NavModel, Plugin } from 'app/types/';
|
||||
// Types
|
||||
import { NavModel, Plugin } from 'app/types/';
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types/';
|
||||
import { getDataSourceLoadingNav } from '../state/navModel';
|
||||
|
||||
export interface Props {
|
||||
navModel: NavModel;
|
||||
dataSource: DataSource;
|
||||
dataSource: DataSourceSettings;
|
||||
dataSourceMeta: Plugin;
|
||||
pageId: number;
|
||||
deleteDataSource: typeof deleteDataSource;
|
||||
@ -33,7 +39,7 @@ export interface Props {
|
||||
}
|
||||
|
||||
interface State {
|
||||
dataSource: DataSource;
|
||||
dataSource: DataSourceSettings;
|
||||
isTesting?: boolean;
|
||||
testingMessage?: string;
|
||||
testingStatus?: string;
|
||||
@ -44,12 +50,12 @@ enum DataSourceStates {
|
||||
Beta = 'beta',
|
||||
}
|
||||
|
||||
export class DataSourceSettings extends PureComponent<Props, State> {
|
||||
export class DataSourceSettingsPage extends PureComponent<Props, State> {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
dataSource: {} as DataSource,
|
||||
dataSource: {} as DataSourceSettings,
|
||||
};
|
||||
}
|
||||
|
||||
@ -246,4 +252,4 @@ const mapDispatchToProps = {
|
||||
setIsDefault,
|
||||
};
|
||||
|
||||
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DataSourceSettings));
|
||||
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DataSourceSettingsPage));
|
@ -1,20 +1,21 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import _ from 'lodash';
|
||||
import { DataSource, Plugin } from 'app/types/';
|
||||
import { Plugin } from 'app/types';
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader';
|
||||
|
||||
export interface Props {
|
||||
dataSource: DataSource;
|
||||
dataSource: DataSourceSettings;
|
||||
dataSourceMeta: Plugin;
|
||||
onModelChange: (dataSource: DataSource) => void;
|
||||
onModelChange: (dataSource: DataSourceSettings) => void;
|
||||
}
|
||||
|
||||
export class PluginSettings extends PureComponent<Props> {
|
||||
element: any;
|
||||
component: AngularComponent;
|
||||
scopeProps: {
|
||||
ctrl: { datasourceMeta: Plugin; current: DataSource };
|
||||
onModelChanged: (dataSource: DataSource) => void;
|
||||
ctrl: { datasourceMeta: Plugin; current: DataSourceSettings };
|
||||
onModelChanged: (dataSource: DataSourceSettings) => void;
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
@ -51,7 +52,7 @@ export class PluginSettings extends PureComponent<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
onModelChanged = (dataSource: DataSource) => {
|
||||
onModelChanged = (dataSource: DataSourceSettings) => {
|
||||
this.props.onModelChange(dataSource);
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,8 @@ import { LayoutMode } from 'app/core/components/LayoutSelector/LayoutSelector';
|
||||
import { updateLocation, updateNavIndex, UpdateNavIndexAction } from 'app/core/actions';
|
||||
import { UpdateLocationAction } from 'app/core/actions/location';
|
||||
import { buildNavModel } from './navModel';
|
||||
import { DataSource, Plugin, StoreState } from 'app/types';
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
import { Plugin, StoreState } from 'app/types';
|
||||
|
||||
export enum ActionTypes {
|
||||
LoadDataSources = 'LOAD_DATA_SOURCES',
|
||||
@ -22,7 +23,7 @@ export enum ActionTypes {
|
||||
|
||||
interface LoadDataSourcesAction {
|
||||
type: ActionTypes.LoadDataSources;
|
||||
payload: DataSource[];
|
||||
payload: DataSourceSettings[];
|
||||
}
|
||||
|
||||
interface SetDataSourcesSearchQueryAction {
|
||||
@ -47,7 +48,7 @@ interface SetDataSourceTypeSearchQueryAction {
|
||||
|
||||
interface LoadDataSourceAction {
|
||||
type: ActionTypes.LoadDataSource;
|
||||
payload: DataSource;
|
||||
payload: DataSourceSettings;
|
||||
}
|
||||
|
||||
interface LoadDataSourceMetaAction {
|
||||
@ -65,12 +66,12 @@ interface SetIsDefaultAction {
|
||||
payload: boolean;
|
||||
}
|
||||
|
||||
const dataSourcesLoaded = (dataSources: DataSource[]): LoadDataSourcesAction => ({
|
||||
const dataSourcesLoaded = (dataSources: DataSourceSettings[]): LoadDataSourcesAction => ({
|
||||
type: ActionTypes.LoadDataSources,
|
||||
payload: dataSources,
|
||||
});
|
||||
|
||||
const dataSourceLoaded = (dataSource: DataSource): LoadDataSourceAction => ({
|
||||
const dataSourceLoaded = (dataSource: DataSourceSettings): LoadDataSourceAction => ({
|
||||
type: ActionTypes.LoadDataSource,
|
||||
payload: dataSource,
|
||||
});
|
||||
@ -171,7 +172,7 @@ export function loadDataSourceTypes(): ThunkResult<void> {
|
||||
};
|
||||
}
|
||||
|
||||
export function updateDataSource(dataSource: DataSource): ThunkResult<void> {
|
||||
export function updateDataSource(dataSource: DataSourceSettings): ThunkResult<void> {
|
||||
return async dispatch => {
|
||||
await getBackendSrv().put(`/api/datasources/${dataSource.id}`, dataSource);
|
||||
await updateFrontendSettings();
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { DataSource, NavModel, NavModelItem } from 'app/types';
|
||||
import { PluginMeta } from '@grafana/ui/src/types';
|
||||
import { NavModel, NavModelItem } from 'app/types';
|
||||
import { PluginMeta, DataSourceSettings } from '@grafana/ui/src/types';
|
||||
import config from 'app/core/config';
|
||||
|
||||
export function buildNavModel(dataSource: DataSource, pluginMeta: PluginMeta): NavModelItem {
|
||||
export function buildNavModel(dataSource: DataSourceSettings, pluginMeta: PluginMeta): NavModelItem {
|
||||
const navModel = {
|
||||
img: pluginMeta.info.logos.large,
|
||||
id: 'datasource-' + dataSource.id,
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { DataSource, DataSourcesState, Plugin } from 'app/types';
|
||||
import { DataSourcesState, Plugin } from 'app/types';
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
import { Action, ActionTypes } from './actions';
|
||||
import { LayoutModes } from '../../../core/components/LayoutSelector/LayoutSelector';
|
||||
import { LayoutModes } from 'app/core/components/LayoutSelector/LayoutSelector';
|
||||
|
||||
const initialState: DataSourcesState = {
|
||||
dataSources: [] as DataSource[],
|
||||
dataSource: {} as DataSource,
|
||||
dataSources: [] as DataSourceSettings[],
|
||||
dataSource: {} as DataSourceSettings,
|
||||
layoutMode: LayoutModes.List,
|
||||
searchQuery: '',
|
||||
dataSourcesCount: 0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { DataSource } from '../../../types';
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
|
||||
export const getDataSources = state => {
|
||||
const regex = new RegExp(state.searchQuery, 'i');
|
||||
@ -16,11 +16,11 @@ export const getDataSourceTypes = state => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getDataSource = (state, dataSourceId): DataSource | null => {
|
||||
export const getDataSource = (state, dataSourceId): DataSourceSettings | null => {
|
||||
if (state.dataSource.id === parseInt(dataSourceId, 10)) {
|
||||
return state.dataSource;
|
||||
}
|
||||
return {} as DataSource;
|
||||
return {} as DataSourceSettings;
|
||||
};
|
||||
|
||||
export const getDataSourceMeta = (state, type): Plugin => {
|
||||
|
@ -9,7 +9,7 @@ import { AutoSizer } from 'react-virtualized';
|
||||
import store from 'app/core/store';
|
||||
|
||||
// Components
|
||||
import { DataSourceSelectItem } from 'app/types/datasources';
|
||||
import { DataSourceSelectItem } from '@grafana/ui/src/types';
|
||||
import { DataSourcePicker } from 'app/core/components/Select/DataSourcePicker';
|
||||
import { Alert } from './Error';
|
||||
import ErrorBoundary from './ErrorBoundary';
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Types
|
||||
import { Emitter } from 'app/core/core';
|
||||
import { RawTimeRange, TimeRange, DataQuery } from '@grafana/ui';
|
||||
import { RawTimeRange, TimeRange, DataQuery, DataSourceSelectItem } from '@grafana/ui/src/types';
|
||||
import {
|
||||
ExploreId,
|
||||
ExploreItemState,
|
||||
@ -9,7 +9,6 @@ import {
|
||||
ResultType,
|
||||
QueryTransaction,
|
||||
} from 'app/types/explore';
|
||||
import { DataSourceSelectItem } from 'app/types/datasources';
|
||||
|
||||
export enum ActionTypes {
|
||||
AddQueryRow = 'explore/ADD_QUERY_ROW',
|
||||
|
@ -16,9 +16,8 @@ import {
|
||||
|
||||
import { updateLocation } from 'app/core/actions';
|
||||
import store from 'app/core/store';
|
||||
import { DataSourceSelectItem } from 'app/types/datasources';
|
||||
import { StoreState } from 'app/types';
|
||||
import { DataQuery } from '@grafana/ui/src/types';
|
||||
import { DataQuery, DataSourceSelectItem } from '@grafana/ui/src/types';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
import {
|
||||
ExploreId,
|
||||
|
@ -1,14 +1,16 @@
|
||||
// Libraries
|
||||
import _ from 'lodash';
|
||||
import coreModule from 'app/core/core_module';
|
||||
|
||||
// Services & Utils
|
||||
import config from 'app/core/config';
|
||||
import { importPluginModule } from './plugin_loader';
|
||||
|
||||
import { DataSourceApi } from '@grafana/ui/src/types';
|
||||
import { DataSource, DataSourceSelectItem } from 'app/types';
|
||||
// Types
|
||||
import { DataSourceApi, DataSourceSelectItem } from '@grafana/ui/src/types';
|
||||
|
||||
export class DatasourceSrv {
|
||||
datasources: { [name: string]: DataSource };
|
||||
datasources: { [name: string]: DataSourceApi };
|
||||
|
||||
/** @ngInject */
|
||||
constructor(private $q, private $injector, private $rootScope, private templateSrv) {
|
||||
@ -59,7 +61,7 @@ export class DatasourceSrv {
|
||||
throw new Error('Plugin module is missing Datasource constructor');
|
||||
}
|
||||
|
||||
const instance: DataSource = this.$injector.instantiate(plugin.Datasource, { instanceSettings: dsConfig });
|
||||
const instance: DataSourceApi = this.$injector.instantiate(plugin.Datasource, { instanceSettings: dsConfig });
|
||||
instance.meta = pluginDef;
|
||||
instance.name = name;
|
||||
instance.pluginExports = plugin;
|
||||
|
@ -1,9 +1,14 @@
|
||||
// Libraries
|
||||
import _ from 'lodash';
|
||||
import { DataSource, NavModel } from 'app/types';
|
||||
import { PluginMeta } from '@grafana/ui/src/types';
|
||||
|
||||
// Utils & Services
|
||||
import config from 'app/core/config';
|
||||
|
||||
export function buildNavModel(ds: DataSource, plugin: PluginMeta, currentPage: string): NavModel {
|
||||
// Types
|
||||
import { NavModel } from 'app/types';
|
||||
import { PluginMeta, DataSourceSettings } from '@grafana/ui/src/types';
|
||||
|
||||
export function buildNavModel(ds: DataSourceSettings, plugin: PluginMeta, currentPage: string): NavModel {
|
||||
let title = 'New';
|
||||
const subTitle = `Type: ${plugin.name}`;
|
||||
|
||||
|
@ -14,7 +14,7 @@ import DataSourcesListPage from 'app/features/datasources/DataSourcesListPage';
|
||||
import NewDataSourcePage from '../features/datasources/NewDataSourcePage';
|
||||
import UsersListPage from 'app/features/users/UsersListPage';
|
||||
import DataSourceDashboards from 'app/features/datasources/DataSourceDashboards';
|
||||
import DataSourceSettings from '../features/datasources/settings/DataSourceSettings';
|
||||
import DataSourceSettingsPage from '../features/datasources/settings/DataSourceSettingsPage';
|
||||
import OrgDetailsPage from '../features/org/OrgDetailsPage';
|
||||
|
||||
/** @ngInject */
|
||||
@ -78,7 +78,7 @@ export function setupAngularRoutes($routeProvider, $locationProvider) {
|
||||
.when('/datasources/edit/:id/', {
|
||||
template: '<react-container />',
|
||||
resolve: {
|
||||
component: () => DataSourceSettings,
|
||||
component: () => DataSourceSettingsPage,
|
||||
},
|
||||
})
|
||||
.when('/datasources/edit/:id/dashboards', {
|
||||
|
@ -1,44 +1,15 @@
|
||||
import { LayoutMode } from '../core/components/LayoutSelector/LayoutSelector';
|
||||
import { Plugin } from './plugins';
|
||||
import { PluginExports, PluginMeta } from '@grafana/ui/src/types';
|
||||
|
||||
export interface DataSource {
|
||||
id: number;
|
||||
orgId: number;
|
||||
name: string;
|
||||
typeLogoUrl: string;
|
||||
type: string;
|
||||
access: string;
|
||||
url: string;
|
||||
password: string;
|
||||
user: string;
|
||||
database: string;
|
||||
basicAuth: boolean;
|
||||
basicAuthPassword: string;
|
||||
basicAuthUser: string;
|
||||
isDefault: boolean;
|
||||
jsonData: { authType: string; defaultRegion: string };
|
||||
readOnly: boolean;
|
||||
withCredentials: boolean;
|
||||
meta?: PluginMeta;
|
||||
pluginExports?: PluginExports;
|
||||
}
|
||||
|
||||
export interface DataSourceSelectItem {
|
||||
name: string;
|
||||
value: string | null;
|
||||
meta: PluginMeta;
|
||||
sort: string;
|
||||
}
|
||||
import { DataSourceSettings } from '@grafana/ui/src/types';
|
||||
|
||||
export interface DataSourcesState {
|
||||
dataSources: DataSource[];
|
||||
dataSources: DataSourceSettings[];
|
||||
searchQuery: string;
|
||||
dataSourceTypeSearchQuery: string;
|
||||
layoutMode: LayoutMode;
|
||||
dataSourcesCount: number;
|
||||
dataSourceTypes: Plugin[];
|
||||
dataSource: DataSource;
|
||||
dataSource: DataSourceSettings;
|
||||
dataSourceMeta: Plugin;
|
||||
hasFetched: boolean;
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { Value } from 'slate';
|
||||
import { RawTimeRange, TimeRange, DataQuery } from '@grafana/ui';
|
||||
import { RawTimeRange, TimeRange, DataQuery, DataSourceSelectItem } from '@grafana/ui';
|
||||
|
||||
import { Emitter } from 'app/core/core';
|
||||
import { LogsModel } from 'app/core/logs_model';
|
||||
import TableModel from 'app/core/table_model';
|
||||
import { DataSourceSelectItem } from 'app/types/datasources';
|
||||
|
||||
export interface CompletionItem {
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user