openedx / frontend-app-authoring

Front-end for the Open edX Studio experience, implemented in React and Paragon.
GNU Affero General Public License v3.0
13 stars 76 forks source link

Publish Component Button #1353

Open jmakowski1123 opened 2 weeks ago

jmakowski1123 commented 2 weeks ago

The Publish component button (in the manage tab of the component sidebar) should be clickable in the following scenarios:

The Publish component button should not be clickable (grayed out, but still visible) in the following scenarios:

Expected behavior:

Syncing:

ormsbee commented 3 days ago

There's no Learning Core API to publish exactly one thing, but publish_drafts accepts a QuerySet of Drafts. So with no changes to openedx-learning, we could do something like:

pe_key = pe_key_from_usage_key(usage_key)  # I'm just making this up, but we have a mapping somewhere
drafts_to_publish = authoring.get_all_drafts(learning_package_id).filter(entity__key=pe_key)
authoring.publish_drafts(learning_package_id, drafts_to_publish, published_by=user.id)
DanielVZ96 commented 3 days ago

@ormsbee I think you mean publish_from_drafts? there's a publish_all_drafts in the public learning core API, but publish_from_drafts isn't public, it's just available for internal learning core apps. I can still do from openedx_learning.apps.authoring.publishing.api import publish_from_drafts, but I guess it'd be better to add it to the exported functions inside __all__ right?

ormsbee commented 3 days ago

@DanielVZ96: Yes, I meant publish_from_drafts, and I had forgotten that it wasn't public. Please feel free to tag me on the openedx-learning PR to make it public. Thank you.