mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[data views] Make data view saved objects share capable (#114408)
This commit is contained in:
parent
d91bc28846
commit
1e718a5572
7 changed files with 67 additions and 52 deletions
|
@ -13,7 +13,8 @@ import { DATA_VIEW_SAVED_OBJECT_TYPE } from '../../common';
|
|||
export const dataViewSavedObjectType: SavedObjectsType = {
|
||||
name: DATA_VIEW_SAVED_OBJECT_TYPE,
|
||||
hidden: false,
|
||||
namespaceType: 'single',
|
||||
namespaceType: 'multiple-isolated',
|
||||
convertToMultiNamespaceTypeVersion: '8.0.0',
|
||||
management: {
|
||||
displayName: 'Data view',
|
||||
icon: 'indexPatternApp',
|
||||
|
|
|
@ -249,7 +249,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
path: '/app/management/kibana/dataViews/dataView/8963ca30-3224-11e8-a572-ffca06da1357',
|
||||
uiCapabilitiesPath: 'management.kibana.indexPatterns',
|
||||
},
|
||||
namespaceType: 'single',
|
||||
namespaceType: 'multiple-isolated',
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
|
|
@ -91,7 +91,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
path: '/app/management/kibana/dataViews/dataView/8963ca30-3224-11e8-a572-ffca06da1357',
|
||||
uiCapabilitiesPath: 'management.kibana.indexPatterns',
|
||||
},
|
||||
namespaceType: 'single',
|
||||
namespaceType: 'multiple-isolated',
|
||||
hiddenType: false,
|
||||
},
|
||||
},
|
||||
|
@ -132,7 +132,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
path: '/app/management/kibana/dataViews/dataView/8963ca30-3224-11e8-a572-ffca06da1357',
|
||||
uiCapabilitiesPath: 'management.kibana.indexPatterns',
|
||||
},
|
||||
namespaceType: 'single',
|
||||
namespaceType: 'multiple-isolated',
|
||||
hiddenType: false,
|
||||
},
|
||||
relationship: 'child',
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
"references": [
|
||||
{
|
||||
"type": "index-pattern",
|
||||
"id": "cts_ip_1",
|
||||
"id": "cts_ip_1_default",
|
||||
"name": "CTS IP 1"
|
||||
}
|
||||
],
|
||||
|
@ -182,7 +182,7 @@
|
|||
"references": [
|
||||
{
|
||||
"type": "index-pattern",
|
||||
"id": "cts_ip_1",
|
||||
"id": "cts_ip_1_default",
|
||||
"name": "CTS IP 1"
|
||||
}
|
||||
],
|
||||
|
@ -212,7 +212,7 @@
|
|||
"references": [
|
||||
{
|
||||
"type": "index-pattern",
|
||||
"id": "cts_ip_1",
|
||||
"id": "cts_ip_1_default",
|
||||
"name": "CTS IP 1"
|
||||
}
|
||||
],
|
||||
|
@ -276,7 +276,7 @@
|
|||
"references": [
|
||||
{
|
||||
"type": "index-pattern",
|
||||
"id": "cts_ip_1",
|
||||
"id": "cts_ip_1_space_1",
|
||||
"name": "CTS IP 1"
|
||||
}
|
||||
],
|
||||
|
@ -305,7 +305,7 @@
|
|||
"references": [
|
||||
{
|
||||
"type": "index-pattern",
|
||||
"id": "cts_ip_1",
|
||||
"id": "cts_ip_1_space_1",
|
||||
"name": "CTS IP 1"
|
||||
}
|
||||
],
|
||||
|
@ -335,7 +335,7 @@
|
|||
"references": [
|
||||
{
|
||||
"type": "index-pattern",
|
||||
"id": "cts_ip_1",
|
||||
"id": "cts_ip_1_space_1",
|
||||
"name": "CTS IP 1"
|
||||
}
|
||||
],
|
||||
|
@ -350,15 +350,17 @@
|
|||
{
|
||||
"type": "_doc",
|
||||
"value": {
|
||||
"id": "index-pattern:cts_ip_1",
|
||||
"id": "index-pattern:cts_ip_1_default",
|
||||
"index": ".kibana",
|
||||
"source": {
|
||||
"originId": "cts_ip_1",
|
||||
"index-pattern": {
|
||||
"title": "Copy to Space index pattern 1 from default space"
|
||||
},
|
||||
"references": [],
|
||||
"type": "index-pattern",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z"
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"namespaces": ["default"]
|
||||
},
|
||||
"type": "_doc"
|
||||
}
|
||||
|
@ -367,16 +369,17 @@
|
|||
{
|
||||
"type": "_doc",
|
||||
"value": {
|
||||
"id": "space_1:index-pattern:cts_ip_1",
|
||||
"id": "index-pattern:cts_ip_1_space_1",
|
||||
"index": ".kibana",
|
||||
"source": {
|
||||
"originId": "cts_ip_1",
|
||||
"index-pattern": {
|
||||
"title": "Copy to Space index pattern 1 from space_1 space"
|
||||
},
|
||||
"references": [],
|
||||
"type": "index-pattern",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"namespace": "space_1"
|
||||
"namespaces": ["space_1"]
|
||||
},
|
||||
"type": "_doc"
|
||||
}
|
||||
|
|
|
@ -183,6 +183,8 @@ export function copyToSpaceTestSuiteFactory(
|
|||
const destination = getDestinationWithoutConflicts();
|
||||
const result = resp.body as CopyResponse;
|
||||
|
||||
const indexPatternDestinationId = result[destination].successResults![0].destinationId;
|
||||
expect(indexPatternDestinationId).to.match(UUID_PATTERN); // this was copied to space 2 and hit an unresolvable conflict, so the object ID was regenerated silently / the destinationId is a UUID
|
||||
const vis1DestinationId = result[destination].successResults![1].destinationId;
|
||||
expect(vis1DestinationId).to.match(UUID_PATTERN); // this was copied to space 2 and hit an unresolvable conflict, so the object ID was regenerated silently / the destinationId is a UUID
|
||||
const vis2DestinationId = result[destination].successResults![2].destinationId;
|
||||
|
@ -196,12 +198,13 @@ export function copyToSpaceTestSuiteFactory(
|
|||
successCount: 5,
|
||||
successResults: [
|
||||
{
|
||||
id: 'cts_ip_1',
|
||||
id: `cts_ip_1_${spaceId}`,
|
||||
type: 'index-pattern',
|
||||
meta: {
|
||||
icon: 'indexPatternApp',
|
||||
title: `Copy to Space index pattern 1 from ${spaceId} space`,
|
||||
},
|
||||
destinationId: indexPatternDestinationId,
|
||||
},
|
||||
{
|
||||
id: `cts_vis_1_${spaceId}`,
|
||||
|
@ -321,13 +324,14 @@ export function copyToSpaceTestSuiteFactory(
|
|||
successCount: 5,
|
||||
successResults: [
|
||||
{
|
||||
id: 'cts_ip_1',
|
||||
id: `cts_ip_1_${spaceId}`,
|
||||
type: 'index-pattern',
|
||||
meta: {
|
||||
icon: 'indexPatternApp',
|
||||
title: `Copy to Space index pattern 1 from ${spaceId} space`,
|
||||
},
|
||||
overwrite: true,
|
||||
destinationId: `cts_ip_1_${destination}`, // this conflicted with another index pattern in the destination space because of a shared originId
|
||||
},
|
||||
{
|
||||
id: `cts_vis_1_${spaceId}`,
|
||||
|
@ -409,8 +413,11 @@ export function copyToSpaceTestSuiteFactory(
|
|||
},
|
||||
},
|
||||
{
|
||||
error: { type: 'conflict' },
|
||||
id: 'cts_ip_1',
|
||||
error: {
|
||||
type: 'conflict',
|
||||
destinationId: `cts_ip_1_${destination}`, // this conflicted with another index pattern in the destination space because of a shared originId
|
||||
},
|
||||
id: `cts_ip_1_${spaceId}`,
|
||||
title: `Copy to Space index pattern 1 from ${spaceId} space`,
|
||||
type: 'index-pattern',
|
||||
meta: {
|
||||
|
|
|
@ -82,8 +82,18 @@ export function resolveCopyToSpaceConflictsSuite(
|
|||
expect(result).to.eql({
|
||||
[destination]: {
|
||||
success: true,
|
||||
successCount: 1,
|
||||
successCount: 2,
|
||||
successResults: [
|
||||
{
|
||||
id: `cts_ip_1_${sourceSpaceId}`,
|
||||
type: 'index-pattern',
|
||||
meta: {
|
||||
title: `Copy to Space index pattern 1 from ${sourceSpaceId} space`,
|
||||
icon: 'indexPatternApp',
|
||||
},
|
||||
destinationId: `cts_ip_1_${destination}`, // this conflicted with another index pattern in the destination space because of a shared originId
|
||||
overwrite: true,
|
||||
},
|
||||
{
|
||||
id: `cts_vis_3_${sourceSpaceId}`,
|
||||
type: 'visualization',
|
||||
|
@ -146,6 +156,19 @@ export function resolveCopyToSpaceConflictsSuite(
|
|||
success: false,
|
||||
successCount: 0,
|
||||
errors: [
|
||||
{
|
||||
error: {
|
||||
type: 'conflict',
|
||||
destinationId: `cts_ip_1_${destination}`, // this conflicted with another index pattern in the destination space because of a shared originId
|
||||
},
|
||||
id: `cts_ip_1_${sourceSpaceId}`,
|
||||
title: `Copy to Space index pattern 1 from ${sourceSpaceId} space`,
|
||||
meta: {
|
||||
title: `Copy to Space index pattern 1 from ${sourceSpaceId} space`,
|
||||
icon: 'indexPatternApp',
|
||||
},
|
||||
type: 'index-pattern',
|
||||
},
|
||||
{
|
||||
error: {
|
||||
type: 'conflict',
|
||||
|
@ -231,35 +254,7 @@ export function resolveCopyToSpaceConflictsSuite(
|
|||
{
|
||||
statusCode: 403,
|
||||
error: 'Forbidden',
|
||||
message: 'Unable to bulk_get index-pattern',
|
||||
},
|
||||
],
|
||||
},
|
||||
} as CopyResponse);
|
||||
|
||||
// Query ES to ensure that nothing was copied
|
||||
const [dashboard, visualization] = await getObjectsAtSpace(destination);
|
||||
expect(dashboard.attributes.title).to.eql(
|
||||
`This is the ${destination} test space CTS dashboard`
|
||||
);
|
||||
expect(visualization.attributes.title).to.eql(`CTS vis 3 from ${destination} space`);
|
||||
};
|
||||
|
||||
const createExpectReadonlyAtSpaceWithReferencesResult =
|
||||
(spaceId: string = DEFAULT_SPACE_ID) =>
|
||||
async (resp: TestResponse) => {
|
||||
const destination = getDestinationSpace(spaceId);
|
||||
|
||||
const result = resp.body as CopyResponse;
|
||||
expect(result).to.eql({
|
||||
[destination]: {
|
||||
success: false,
|
||||
successCount: 0,
|
||||
errors: [
|
||||
{
|
||||
statusCode: 403,
|
||||
error: 'Forbidden',
|
||||
message: 'Unable to bulk_create visualization',
|
||||
message: 'Unable to bulk_create index-pattern,visualization',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -449,6 +444,7 @@ export function resolveCopyToSpaceConflictsSuite(
|
|||
|
||||
const dashboardObject = { type: 'dashboard', id: 'cts_dashboard' };
|
||||
const visualizationObject = { type: 'visualization', id: `cts_vis_3_${spaceId}` };
|
||||
const indexPatternObject = { type: 'index-pattern', id: `cts_ip_1_${spaceId}` };
|
||||
|
||||
it(`should return ${tests.withReferencesNotOverwriting.statusCode} when not overwriting, with references`, async () => {
|
||||
const destination = getDestinationSpace(spaceId);
|
||||
|
@ -462,6 +458,11 @@ export function resolveCopyToSpaceConflictsSuite(
|
|||
createNewCopies: false,
|
||||
retries: {
|
||||
[destination]: [
|
||||
{
|
||||
...indexPatternObject,
|
||||
destinationId: `cts_ip_1_${destination}`,
|
||||
overwrite: false,
|
||||
},
|
||||
{
|
||||
...visualizationObject,
|
||||
destinationId: `cts_vis_3_${destination}`,
|
||||
|
@ -486,6 +487,11 @@ export function resolveCopyToSpaceConflictsSuite(
|
|||
createNewCopies: false,
|
||||
retries: {
|
||||
[destination]: [
|
||||
{
|
||||
...indexPatternObject,
|
||||
destinationId: `cts_ip_1_${destination}`,
|
||||
overwrite: true,
|
||||
},
|
||||
{
|
||||
...visualizationObject,
|
||||
destinationId: `cts_vis_3_${destination}`,
|
||||
|
@ -589,7 +595,6 @@ export function resolveCopyToSpaceConflictsSuite(
|
|||
createExpectNonOverriddenResponseWithReferences,
|
||||
createExpectNonOverriddenResponseWithoutReferences,
|
||||
createExpectUnauthorizedAtSpaceWithReferencesResult,
|
||||
createExpectReadonlyAtSpaceWithReferencesResult,
|
||||
createExpectUnauthorizedAtSpaceWithoutReferencesResult,
|
||||
createMultiNamespaceTestCases,
|
||||
originSpaces: ['default', 'space_1'],
|
||||
|
|
|
@ -24,7 +24,6 @@ export default function resolveCopyToSpaceConflictsTestSuite({ getService }: Ftr
|
|||
createExpectOverriddenResponseWithoutReferences,
|
||||
expectRouteForbiddenResponse,
|
||||
createExpectUnauthorizedAtSpaceWithReferencesResult,
|
||||
createExpectReadonlyAtSpaceWithReferencesResult,
|
||||
createExpectUnauthorizedAtSpaceWithoutReferencesResult,
|
||||
createMultiNamespaceTestCases,
|
||||
NON_EXISTENT_SPACE_ID,
|
||||
|
@ -122,11 +121,11 @@ export default function resolveCopyToSpaceConflictsTestSuite({ getService }: Ftr
|
|||
tests: {
|
||||
withReferencesNotOverwriting: {
|
||||
statusCode: 200,
|
||||
response: createExpectReadonlyAtSpaceWithReferencesResult(spaceId),
|
||||
response: createExpectUnauthorizedAtSpaceWithReferencesResult(spaceId),
|
||||
},
|
||||
withReferencesOverwriting: {
|
||||
statusCode: 200,
|
||||
response: createExpectReadonlyAtSpaceWithReferencesResult(spaceId),
|
||||
response: createExpectUnauthorizedAtSpaceWithReferencesResult(spaceId),
|
||||
},
|
||||
withoutReferencesOverwriting: {
|
||||
statusCode: 200,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue