Skip to content

Commit

Permalink
More changes for PR review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jportner committed Oct 2, 2020
1 parent bdcf5fe commit e0ad362
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
4 changes: 1 addition & 3 deletions x-pack/plugins/spaces/public/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { DocumentationLinksService } from './documentation_links';

export { DocumentationLinksService };
export { DocumentationLinksService } from './documentation_links';
2 changes: 0 additions & 2 deletions x-pack/plugins/spaces/server/lib/utils/namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import { SavedObjectsUtils } from '../../../../../../src/core/server';

export const ALL_SPACES_STRING = '*';

/**
* Converts a Space ID string to its namespace ID representation. Note that a Space ID string is equivalent to a namespace string.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import { schema } from '@kbn/config-schema';
import { wrapError } from '../../../lib/errors';
import { ExternalRouteDeps } from '.';
import { ALL_SPACES_ID } from '../../../../common/constants';
import { SPACE_ID_REGEX } from '../../../lib/space_schema';
import { createLicensedRouteHandler } from '../../lib';
import { ALL_SPACES_STRING } from '../../../lib/utils/namespace';

const uniq = <T>(arr: T[]): T[] => Array.from(new Set<T>(arr));
export function initShareToSpacesApi(deps: ExternalRouteDeps) {
Expand All @@ -19,7 +19,7 @@ export function initShareToSpacesApi(deps: ExternalRouteDeps) {
spaces: schema.arrayOf(
schema.string({
validate: (value) => {
if (value !== ALL_SPACES_STRING && !SPACE_ID_REGEX.test(value)) {
if (value !== ALL_SPACES_ID && !SPACE_ID_REGEX.test(value)) {
return `lower case, a-z, 0-9, "_", and "-" are allowed, OR "*"`;
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import {
SavedObjectsUtils,
ISavedObjectTypeRegistry,
} from '../../../../../src/core/server';
import { ALL_SPACES_ID } from '../../common/constants';
import { SpacesServiceSetup } from '../spaces_service/spaces_service';
import { ALL_SPACES_STRING, spaceIdToNamespace } from '../lib/utils/namespace';
import { spaceIdToNamespace } from '../lib/utils/namespace';
import { SpacesClient } from '../lib/spaces_client';

interface SpacesSavedObjectsClientOptions {
Expand Down Expand Up @@ -169,7 +170,7 @@ export class SpacesSavedObjectsClient implements SavedObjectsClientContract {

try {
const availableSpaces = await spacesClient.getAll('findSavedObjects');
if (namespaces.includes(ALL_SPACES_STRING)) {
if (namespaces.includes(ALL_SPACES_ID)) {
namespaces = availableSpaces.map((space) => space.id);
} else {
namespaces = namespaces.filter((namespace) =>
Expand Down

0 comments on commit e0ad362

Please sign in to comment.