Skip to content

Commit

Permalink
[Rename] saved-objects-management plugin (#136)
Browse files Browse the repository at this point in the history
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
  • Loading branch information
kavilla committed Mar 12, 2021
1 parent 2e5df35 commit 5c08eab
Show file tree
Hide file tree
Showing 44 changed files with 112 additions and 112 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"id": "savedObjectsManagement",
"version": "kibana",
"version": "opensearchDashboards",
"server": true,
"ui": true,
"requiredPlugins": ["management", "data"],
"optionalPlugins": ["dashboard", "visualizations", "discover", "home"],
"extraPublicDirs": ["public/lib"],
"requiredBundles": ["kibanaReact", "home"]
"requiredBundles": ["opensearchDashboardsReact", "home"]
}
2 changes: 1 addition & 1 deletion src/plugins/saved_objects_management/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { PluginInitializerContext } from 'kibana/public';
import { PluginInitializerContext } from 'opensearch-dashboards/public';
import { SavedObjectsManagementPlugin } from './plugin';

export { SavedObjectsManagementPluginSetup, SavedObjectsManagementPluginStart } from './plugin';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { forOwn, keyBy, isNumber, isBoolean, isPlainObject, isString } from 'lodash';
import { SimpleSavedObject } from '../../../../core/public';
import { castEsToKbnFieldTypeName } from '../../../data/public';
import { castOpenSearchToOsdFieldTypeName } from '../../../data/public';
import { ObjectField } from '../management_section/types';
import { SavedObjectLoader } from '../../../saved_objects/public';

Expand Down Expand Up @@ -95,13 +95,13 @@ const addFieldsFromClass = function (
) {
const fieldMap = keyBy(fields, 'name');

forOwn(Class.mapping, (esType, name) => {
forOwn(Class.mapping, (opensearchType, name) => {
if (!name || fieldMap[name]) {
return;
}

const getFieldTypeFromEsType = () => {
switch (castEsToKbnFieldTypeName(esType)) {
switch (castOpenSearchToOsdFieldTypeName(opensearchType)) {
case 'string':
return 'text';
case 'number':
Expand All @@ -120,9 +120,9 @@ const addFieldsFromClass = function (
});
});

if (Class.searchSource && !fieldMap['kibanaSavedObjectMeta.searchSourceJSON']) {
if (Class.searchSource && !fieldMap['opensearchDashboardsSavedObjectMeta.searchSourceJSON']) {
fields.push({
name: 'kibanaSavedObjectMeta.searchSourceJSON',
name: 'opensearchDashboardsSavedObjectMeta.searchSourceJSON',
type: 'json',
value: '{}',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function findObjects(
findOptions: SavedObjectsFindOptions
): Promise<SavedObjectsFindResponse> {
const response = await http.get<Record<string, any>>(
'/api/kibana/management/saved_objects/_find',
'/api/opensearch-dashboards/management/saved_objects/_find',
{
query: findOptions as Record<string, any>,
}
Expand All @@ -48,6 +48,6 @@ export async function findObject(
id: string
): Promise<SavedObjectWithMetadata> {
return await http.get<SavedObjectWithMetadata>(
`/api/kibana/management/saved_objects/${encodeURIComponent(type)}/${encodeURIComponent(id)}`
`/api/opensearch-dashboards/management/saved_objects/${encodeURIComponent(type)}/${encodeURIComponent(id)}`
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface GetAllowedTypesResponse {

export async function getAllowedTypes(http: HttpStart) {
const response = await http.get<GetAllowedTypesResponse>(
'/api/kibana/management/saved_objects/_allowed_types'
'/api/opensearch-dashboards/management/saved_objects/_allowed_types'
);
return response.types;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function getRelationships(
id: string,
savedObjectTypes: string[]
): Promise<SavedObjectRelation[]> {
const url = `/api/kibana/management/saved_objects/relationships/${encodeURIComponent(
const url = `/api/opensearch-dashboards/management/saved_objects/relationships/${encodeURIComponent(
type
)}/${encodeURIComponent(id)}`;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function getSavedObjectCounts(
searchString?: string
): Promise<Record<string, number>> {
return await http.post<Record<string, number>>(
`/api/kibana/management/saved_objects/scroll/counts`,
`/api/opensearch-dashboards/management/saved_objects/scroll/counts`,
{ body: JSON.stringify({ typesToInclude, searchString }) }
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('canViewInApp', () => {
it('should handle index patterns', () => {
let uiCapabilities = createCapabilities({
management: {
kibana: {
opensearchDashboards: {
indexPatterns: true,
},
},
Expand All @@ -80,7 +80,7 @@ describe('canViewInApp', () => {

uiCapabilities = createCapabilities({
management: {
kibana: {
opensearchDashboards: {
indexPatterns: false,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function canViewInApp(uiCapabilities: Capabilities, type: string): boolea
case 'index-pattern':
case 'index-patterns':
case 'indexPatterns':
return uiCapabilities.management.kibana.indexPatterns as boolean;
return uiCapabilities.management.opensearchDashboards.indexPatterns as boolean;
case 'dashboard':
case 'dashboards':
return uiCapabilities.dashboard.show as boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
SavedObjectsImportResponse,
SavedObjectsImportAmbiguousConflictError,
} from 'src/core/public';
import { Required } from '@kbn/utility-types';
import { Required } from '@osd/utility-types';
import { FailedImport, ProcessedImportResponse } from './process_import_response';

// the HTTP route requires type and ID; all other field are optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ describe('resolveSavedObjects', () => {
},
doc: {
_source: {
kibanaSavedObjectMeta: {
opensearchDashboardsSavedObjectMeta: {
searchSourceJSON: JSON.stringify({
index: '1',
}),
Expand All @@ -271,7 +271,7 @@ describe('resolveSavedObjects', () => {
},
doc: {
_source: {
kibanaSavedObjectMeta: {
opensearchDashboardsSavedObjectMeta: {
searchSourceJSON: JSON.stringify({
index: '3',
}),
Expand Down Expand Up @@ -319,7 +319,7 @@ describe('resolveSavedObjects', () => {
},
doc: {
_source: {
kibanaSavedObjectMeta: {
opensearchDashboardsSavedObjectMeta: {
searchSourceJSON: JSON.stringify({
index: '1',
filter: [{ meta: { index: 'filterIndex' } }],
Expand All @@ -334,7 +334,7 @@ describe('resolveSavedObjects', () => {
},
doc: {
_source: {
kibanaSavedObjectMeta: {
opensearchDashboardsSavedObjectMeta: {
searchSourceJSON: JSON.stringify({
index: '3',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import { cloneDeep } from 'lodash';
import { OverlayStart, SavedObjectReference } from 'src/core/public';
import { SavedObject, SavedObjectLoader } from '../../../saved_objects/public';
Expand Down Expand Up @@ -176,7 +176,7 @@ export async function resolveIndexPatternConflicts(

for (const { obj, doc } of conflictedIndexPatterns) {
const serializedSearchSource = JSON.parse(
doc._source.kibanaSavedObjectMeta?.searchSourceJSON || '{}'
doc._source.opensearchDashboardsSavedObjectMeta?.searchSourceJSON || '{}'
);
const oldIndexId = serializedSearchSource.index;
let allResolved = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import React, { lazy, Suspense } from 'react';
import ReactDOM from 'react-dom';
import { Router, Switch, Route } from 'react-router-dom';
import { I18nProvider } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { I18nProvider } from '@osd/i18n/react';
import { i18n } from '@osd/i18n';
import { EuiLoadingSpinner } from '@elastic/eui';
import { CoreSetup } from 'src/core/public';
import { ManagementAppMountParams } from '../../../management/public';
Expand Down Expand Up @@ -59,7 +59,7 @@ export const mountManagementSection = async ({
const capabilities = coreStart.application.capabilities;

const RedirectToHomeIfUnauthorized: React.FunctionComponent = ({ children }) => {
const allowed = capabilities?.management?.kibana?.objects ?? false;
const allowed = capabilities?.management?.opensearchDashboards?.objects ?? false;

if (!allowed) {
coreStart.application.navigateToApp('home');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React from 'react';
import { mount } from 'enzyme';
import { I18nProvider } from '@kbn/i18n/react';
import { I18nProvider } from '@osd/i18n/react';
import { Field } from './field';
import { FieldState, FieldType } from '../../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React, { PureComponent } from 'react';
import { EuiFieldNumber, EuiFieldText, EuiFormRow, EuiSwitch, EuiCodeEditor } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { FormattedMessage } from '@osd/i18n/react';
import { FieldState, FieldType } from '../../types';

interface FieldProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import {
} from '@elastic/eui';
import { set } from '@elastic/safer-lodash-set';
import { cloneDeep } from 'lodash';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import { SimpleSavedObject, SavedObjectsClientContract } from '../../../../../../core/public';
import { SavedObjectLoader } from '../../../../../saved_objects/public';
import { Field } from './field';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React from 'react';
import { mount } from 'enzyme';
import { I18nProvider } from '@kbn/i18n/react';
import { I18nProvider } from '@osd/i18n/react';
import { Header } from './header';

describe('Intro component', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
EuiPageContentHeader,
EuiPageContentHeaderSection,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { FormattedMessage } from '@osd/i18n/react';

interface HeaderProps {
canEdit: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React from 'react';
import { mount } from 'enzyme';
import { I18nProvider } from '@kbn/i18n/react';
import { I18nProvider } from '@osd/i18n/react';
import { Intro } from './intro';

describe('Intro component', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React from 'react';
import { EuiCallOut } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { FormattedMessage } from '@osd/i18n/react';

export const Intro = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React from 'react';
import { mount } from 'enzyme';
import { I18nProvider } from '@kbn/i18n/react';
import { I18nProvider } from '@osd/i18n/react';
import { NotFoundErrors } from './not_found_errors';

describe('NotFoundErrors component', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React from 'react';
import { EuiCallOut } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { FormattedMessage } from '@osd/i18n/react';

interface NotFoundErrors {
type: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import React, { Component } from 'react';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import { EuiSpacer, EuiPageContent } from '@elastic/eui';
import {
Capabilities,
Expand Down Expand Up @@ -138,7 +138,7 @@ export class SavedObjectEdition extends Component<

const confirmed = await overlays.openConfirm(
i18n.translate('savedObjectsManagement.deleteConfirm.modalDescription', {
defaultMessage: 'This action permanently removes the object from Kibana.',
defaultMessage: 'This action permanently removes the object from OpenSearch Dashboards.',
}),
{
confirmButtonText: i18n.translate(
Expand All @@ -150,7 +150,7 @@ export class SavedObjectEdition extends Component<
title: i18n.translate('savedObjectsManagement.deleteConfirm.modalTitle', {
defaultMessage: `Delete '{title}'?`,
values: {
title: object?.attributes?.title || 'saved Kibana object',
title: object?.attributes?.title || 'saved OpenSearch Dashboards object',
},
}),
buttonColor: 'danger',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import {
EuiSpacer,
EuiLink,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import { OverlayStart, HttpStart } from 'src/core/public';
import {
IndexPatternsContract,
Expand Down Expand Up @@ -289,7 +289,7 @@ export class Flyout extends Component<FlyoutProps, FlyoutState> {
.map((doc) => ({
...doc,
// The server assumes that documents with no migrationVersion are up to date.
// That assumption enables Kibana and other API consumers to not have to build
// That assumption enables OpenSearch Dashboards and other API consumers to not have to build
// up migrationVersion prior to creating new objects. But it means that imports
// need to set migrationVersion to something other than undefined, so that imported
// docs are not seen as automatically up-to-date.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
EuiTextColor,
EuiButtonEmpty,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { FormattedMessage } from '@osd/i18n/react';

export const Header = ({
onExportAll,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
EuiFlexItem,
EuiIconTip,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';

export interface ImportModeControlProps {
initialValues: ImportMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import {
EuiTitle,
EuiSpacer,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { SavedObjectsImportSuccess } from 'kibana/public';
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import { SavedObjectsImportSuccess } from 'opensearch-dashboards/public';
import { FailedImport } from '../../..';
import { getDefaultTitle, getSavedObjectLabel } from '../../../lib';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
EuiText,
EuiSuperSelect,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import moment from 'moment';
import { FailedImportConflict } from '../../../lib/resolve_import_errors';
import { getDefaultTitle } from '../../../lib';
Expand Down
Loading

0 comments on commit 5c08eab

Please sign in to comment.