Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sharing saved objects to all spaces #76132

Merged
merged 29 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8cdf171
Change `delete` to always delete the object
jportner Aug 27, 2020
d978bce
Change `SavedObjectsRepository` to support `'*'` namespace string
jportner Sep 10, 2020
966f826
Small refactor for SecureSavedObjectsClientWrapper unit tests
jportner Sep 11, 2020
69f6491
Change `create` and `bulkCreate` to allow initial namespaces
jportner Sep 18, 2020
2e1dabb
Change "share to space" initial warning callout
jportner Sep 21, 2020
6012e05
Clean up "Shared spaces" column code, add unit tests
jportner Sep 22, 2020
87ed4e8
Change "Shared spaces" column to display "All spaces" badge
jportner Sep 22, 2020
8385cdb
Clean up "Share to space" routes, add unit tests
jportner Sep 23, 2020
b79aff1
Remove dead code
jportner Sep 23, 2020
1deac86
Clean up saved object authorization unit tests / errors
jportner Sep 23, 2020
a15abff
Change "Share to space" flyout to support sharing to all spaces
jportner Sep 30, 2020
e68ecc4
Change saved objects table to use force-delete
jportner Sep 30, 2020
f855fcd
Fix "Copy to space" functional test
jportner Sep 30, 2020
1761d87
Fix unit tests that broke due to e68ecc4
jportner Sep 30, 2020
42b6541
Merge branch 'master' into issue-69808-share-to-all-spaces
jportner Oct 1, 2020
ebf7da0
PR review feedback
jportner Oct 1, 2020
48f0698
Tweak "no spaces available" text
jportner Oct 1, 2020
ebea8e4
Changes for additional PR review feedback
jportner Oct 1, 2020
bc9a57b
Address nits with SSOTAS authz
legrego Oct 1, 2020
c55dca3
Change `addToNamespaces` and `deleteFromNamespaces` authZ check
jportner Oct 1, 2020
64a5b84
Don't pass start services to all share-to-space components
jportner Oct 1, 2020
c95bd93
Fix type check
jportner Oct 2, 2020
cb006b1
Merge branch 'master' into issue-69808-share-to-all-spaces
jportner Oct 2, 2020
08eaf51
Fix API integration tests
jportner Oct 2, 2020
bdcf5fe
Merge branch 'master' into issue-69808-share-to-all-spaces
jportner Oct 2, 2020
e0ad362
More changes for PR review feedback
jportner Oct 2, 2020
790a437
Rename `initialNamespaces` to `namespaces`
jportner Oct 2, 2020
57ad704
Merge branch 'master' into issue-69808-share-to-all-spaces
jportner Oct 3, 2020
3c0aa6b
Fix API integration tests
jportner Oct 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { CoreStart } from 'src/core/public';
import { NoSpacesAvailable } from './no_spaces_available';
import { useKibana } from '../../../../../../src/plugins/kibana_react/public';
import { ALL_SPACES_ID, UNKNOWN_SPACE } from '../../../common/constants';
import { DocumentationLinksService } from '../../lib';
import { SpaceAvatar } from '../../space_avatar';
import { SpaceTarget } from '../types';

interface Props {
coreStart: CoreStart;
spaces: SpaceTarget[];
selectedSpaceIds: string[];
onChange: (selectedSpaceIds: string[]) => void;
Expand All @@ -43,8 +42,9 @@ const activeSpaceProps = {
};

export const SelectableSpacesControl = (props: Props) => {
const { coreStart, spaces, selectedSpaceIds, onChange } = props;
const { application, docLinks } = coreStart;
const { spaces, selectedSpaceIds, onChange } = props;
const { services } = useKibana();
const { application, docLinks } = services;

const isGlobalControlChecked = selectedSpaceIds.includes(ALL_SPACES_ID);
const options = spaces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ import {
EuiTitle,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { CoreStart } from 'src/core/public';
import { SelectableSpacesControl } from './selectable_spaces_control';
import { ALL_SPACES_ID } from '../../../common/constants';
import { SpaceTarget } from '../types';

interface Props {
coreStart: CoreStart;
spaces: SpaceTarget[];
canShareToAllSpaces: boolean;
selectedSpaceIds: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { ToastsStart, StartServicesAccessor, CoreStart } from 'src/core/public';
import { SavedObjectsManagementRecord } from '../../../../../../src/plugins/saved_objects_management/public';
import { createKibanaReactContext } from '../../../../../../src/plugins/kibana_react/public';
import { ALL_SPACES_ID, UNKNOWN_SPACE } from '../../../common/constants';
import { Space } from '../../../common/model/space';
import { SpacesManager } from '../../spaces_manager';
Expand Down Expand Up @@ -207,17 +208,23 @@ export const ShareSavedObjectsToSpaceFlyout = (props: Props) => {
const activeSpace = spaces.find((x) => x.isActiveSpace)!;
const showShareWarning =
spaces.length > 1 && arraysAreEqual(currentNamespaces, [activeSpace.id]);
const { application, docLinks } = coreStart!;
const { Provider: KibanaReactContextProvider } = createKibanaReactContext({
application,
docLinks,
});
jportner marked this conversation as resolved.
Show resolved Hide resolved
// Step 2: Share has not been initiated yet; User must fill out form to continue.
return (
<ShareToSpaceForm
coreStart={coreStart!}
spaces={spaces}
shareOptions={shareOptions}
onUpdate={setShareOptions}
showShareWarning={showShareWarning}
canShareToAllSpaces={canShareToAllSpaces}
makeCopy={() => setShowMakeCopy(true)}
/>
<KibanaReactContextProvider>
<ShareToSpaceForm
spaces={spaces}
shareOptions={shareOptions}
onUpdate={setShareOptions}
showShareWarning={showShareWarning}
canShareToAllSpaces={canShareToAllSpaces}
makeCopy={() => setShowMakeCopy(true)}
/>
</KibanaReactContextProvider>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import './share_to_space_form.scss';
import React, { Fragment } from 'react';
import { EuiHorizontalRule, EuiCallOut, EuiLink } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { CoreStart } from 'src/core/public';
import { ShareOptions, SpaceTarget } from '../types';
import { ShareModeControl } from './share_mode_control';

interface Props {
coreStart: CoreStart;
spaces: SpaceTarget[];
onUpdate: (shareOptions: ShareOptions) => void;
shareOptions: ShareOptions;
Expand All @@ -23,15 +21,7 @@ interface Props {
}

export const ShareToSpaceForm = (props: Props) => {
const {
coreStart,
spaces,
onUpdate,
shareOptions,
showShareWarning,
canShareToAllSpaces,
makeCopy,
} = props;
const { spaces, onUpdate, shareOptions, showShareWarning, canShareToAllSpaces, makeCopy } = props;

const setSelectedSpaceIds = (selectedSpaceIds: string[]) =>
onUpdate({ ...shareOptions, selectedSpaceIds });
Expand Down Expand Up @@ -79,7 +69,6 @@ export const ShareToSpaceForm = (props: Props) => {
{getShareWarning()}

<ShareModeControl
coreStart={coreStart}
spaces={spaces}
canShareToAllSpaces={canShareToAllSpaces}
selectedSpaceIds={shareOptions.selectedSpaceIds}
Expand Down