Skip to content
This repository was archived by the owner on Dec 28, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -7,6 +7,7 @@ import remoteEvents from '../../../remoteEvents'
import rest from '../../../rest'

const ignoredExceptionMessages = ['Single selection only, aborting...', 'Nothing selected, aborting...']
const entityDocsEntity = ['Folder', 'Resource']

export const loadScript = src =>
new Promise((resolve, reject) => {
Expand Down Expand Up @@ -159,8 +160,9 @@ export function* getSelection(selection) {
}

if (selection.type === 'ID') {
const isEntityDocsEntity = entityDocsEntity.includes(selection.entityName)
legacySelection.selectedEntities = selection.ids
legacySelection.selectionType = 'SELECTION'
legacySelection.selectionType = isEntityDocsEntity ? 'ENTITY_DOCS' : 'SELECTION'
} else if (selection.type === 'QUERY') {
const listState = yield select(listSelector)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,36 @@ describe('app-extensions', () => {
.run()
})

test('should use ENTITY_DOCS selection for Folder', () => {
const selection = {
entityName: 'Folder',
type: 'ID',
ids: ['5', '18', '3']
}
return expectSaga(legacyAction.getSelection, selection)
.returns({
entityName: 'Folder',
selectionType: 'ENTITY_DOCS',
selectedEntities: ['5', '18', '3']
})
.run()
})

test('should use ENTITY_DOCS selection for Resource', () => {
const selection = {
entityName: 'Resource',
type: 'ID',
ids: ['5', '18', '3']
}
return expectSaga(legacyAction.getSelection, selection)
.returns({
entityName: 'Resource',
selectionType: 'ENTITY_DOCS',
selectedEntities: ['5', '18', '3']
})
.run()
})

test('should return search params for QUERY selection', () => {
const selection = {
entityName: 'User',
Expand Down