Skip to content

Commit

Permalink
Fixed the bug that can not duplicate all saved objects
Browse files Browse the repository at this point in the history
Signed-off-by: yubonluo <[email protected]>
  • Loading branch information
yubonluo committed Apr 12, 2024
1 parent 98bfa54 commit e62431f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('copy saved objects', () => {
[MockFunction] {
"calls": Array [
Array [
"/api/saved_objects/_copy",
"/api/workspaces/_duplicate_saved_objects",
Object {
"body": "{\\"objects\\":[{\\"type\\":\\"dashboard\\",\\"id\\":\\"1\\"},{\\"type\\":\\"visualization\\",\\"id\\":\\"2\\"}],\\"includeReferencesDeep\\":true,\\"targetWorkspace\\":\\"1\\"}",
},
Expand All @@ -40,13 +40,13 @@ describe('copy saved objects', () => {
[MockFunction] {
"calls": Array [
Array [
"/api/saved_objects/_copy",
"/api/workspaces/_duplicate_saved_objects",
Object {
"body": "{\\"objects\\":[{\\"type\\":\\"dashboard\\",\\"id\\":\\"1\\"},{\\"type\\":\\"visualization\\",\\"id\\":\\"2\\"}],\\"includeReferencesDeep\\":true,\\"targetWorkspace\\":\\"1\\"}",
},
],
Array [
"/api/saved_objects/_copy",
"/api/workspaces/_duplicate_saved_objects",
Object {
"body": "{\\"objects\\":[{\\"type\\":\\"dashboard\\",\\"id\\":\\"1\\"},{\\"type\\":\\"visualization\\",\\"id\\":\\"2\\"}],\\"includeReferencesDeep\\":true,\\"targetWorkspace\\":\\"1\\"}",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function duplicateSavedObjects(
includeReferencesDeep: boolean = true,
targetWorkspace: string
) {
return await http.post('/api/saved_objects/_copy', {
return await http.post('/api/workspaces/_duplicate_saved_objects', {
body: JSON.stringify({
objects,
includeReferencesDeep,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,8 @@ describe('SavedObjectsTable', () => {
const header = component.find('Header') as any;
expect(header.prop('showDuplicateAll')).toEqual(true);
header.prop('onDuplicate')();

await new Promise((resolve) => process.nextTick(resolve));
component.update();

expect(component.state('isShowingDuplicateModal')).toEqual(true);
Expand Down

0 comments on commit e62431f

Please sign in to comment.