-
Notifications
You must be signed in to change notification settings - Fork 35
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
Fulfil assignment #1848
Fulfil assignment #1848
Changes from 24 commits
998cff9
209db09
def1a61
629c2e8
46387f7
a9fe557
63b3795
3b4db41
d309048
6ee85a5
400ef62
9a8ec9e
25ff5e5
8c7e9ad
7cc6b74
e768699
1bdb1bd
cd6150c
1804301
2bb3a63
ecc568e
e7e5715
adaa48b
dfc8cfb
93da8b6
950608f
ce435ba
7e4b490
59b038e
3193af5
1dca13f
652b26a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import {IPlanningExtensionConfigurationOptions} from './extension_configuration_ | |
import {AutopostIngestRuleEditor} from './ingest_rule_autopost/AutopostIngestRuleEditor'; | ||
import {AutopostIngestRulePreview} from './ingest_rule_autopost/AutopostIngestRulePreview'; | ||
import {extensionBridge} from './extension_bridge'; | ||
const {isContentLinkToCoverageAllowed} = extensionBridge.assignments.utils; | ||
|
||
function onSpike(superdesk: ISuperdesk, item: IArticle) { | ||
const {gettext} = superdesk.localization; | ||
|
@@ -108,6 +109,7 @@ const extension: IExtension = { | |
const displayTopbarWidget = superdesk.privileges.hasPrivilege('planning_assignments_view') | ||
&& extensionConfig?.assignmentsTopBarWidget === true; | ||
const {gettext} = superdesk.localization; | ||
const planningActionsGroupId = 'planning-actions'; | ||
|
||
const result: IExtensionActivationResult = { | ||
contributions: { | ||
|
@@ -116,12 +118,12 @@ const extension: IExtension = { | |
getActions: (item) => [ | ||
{ | ||
label: gettext('Unlink as Coverage'), | ||
groupId: 'planning-actions', | ||
groupId: planningActionsGroupId, | ||
icon: 'cut', | ||
onTrigger: () => { | ||
const superdeskArticle = superdesk.entities.article; | ||
|
||
// keep in sync with client/planning-extension/src/extension.ts:123 | ||
// keep in sync with index.ts:108 | ||
if ( | ||
superdesk.privileges.hasPrivilege('archive') && | ||
item.assignment_id != null && | ||
|
@@ -135,6 +137,28 @@ const extension: IExtension = { | |
) { | ||
const event = new CustomEvent('planning:unlinkfromcoverage', {detail: {item}}); | ||
|
||
window.dispatchEvent(event); | ||
} | ||
}, | ||
}, | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering whether this would appear in authoring-angular as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you're asking wether there would be a conflict thus two of the same actions rendering because of being registered in two places yes. I plan to address this in another PR, together with the I think doing a simple collision detection mechanism would suffice for now. If we have an action with the same id coming from extensions as well, we don't push it to the e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extensions API have access to Alternativelly, what about if we dropped the old action and kept only the new one? I did that with planning details widget - dropped the angular version of a widget - and the react one works in both - angular and react based authoring. |
||
label: superdesk.localization.gettext('Fulfil assignment'), | ||
groupId: planningActionsGroupId, | ||
icon: 'calendar-list', | ||
onTrigger: () => { | ||
const itemStates = ['killed', 'recalled', 'unpublished', 'spiked', 'correction']; | ||
|
||
// keep in sync with index.ts:79 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. link relative path |
||
if ( | ||
!item.assignment_id && | ||
isContentLinkToCoverageAllowed(item) && | ||
!superdesk.entities.article.isPersonal(item) && | ||
superdesk.privileges.hasPrivilege('archive') && | ||
!superdesk.entities.article.isLockedInOtherSession(item) && | ||
!itemStates.includes(item.state) | ||
) { | ||
const event = new CustomEvent('planning:fulfilassignment', {detail: item}); | ||
|
||
window.dispatchEvent(event); | ||
} | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better keep relative path. There are lots of index files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you mean the absolute it would be something like superdesk-planning/index.ts
If relative, then this is it, and coincidentally index.ts really is the path & file name, relative to the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant relative to the project. You get it by right clicking open file tab and choosing "copy relative path"