141 lost license in workflow edit#144
Open
amadulhaxxani wants to merge 3 commits into
Open
Conversation
Delete the generated binary test-output.log from the repository to avoid committing test artifacts and reduce repository noise. The file has been removed from the index and will no longer be tracked.
reverting accidental changes
There was a problem hiding this comment.
Pull request overview
This PR updates the CLARIN license submission section to work on both workspace item edit and workflow item edit pages by relying on the route-aware SubmissionService and PATCHing the submission object via its own self link.
Changes:
- Replace workspaceitem-only lookup logic with
SubmissionService.retrieveSubmission(submissionId)to support both workspace and workflow edit routes. - Send the license PATCH request directly to
submission._links.self.hrefinstead of constructing a workspaceitems endpoint URL. - Adjust item/license initialization to resolve the item via
submission._links.item.href.
Comments suppressed due to low confidence (2)
src/app/submission/sections/clarin-license-resource/section-license.component.ts:301
buildFromRequestUUID(requestId)emits a completedRemoteDataeven on failures, wherepayloadcan be undefined. This code immediately dereferences/destructuresresponse.payload(const workspaceitem = response.payload; const {sections} = workspaceitem; ...), which will throw if the PATCH fails (e.g. 4xx/5xx). Add a guard likeif (!response?.hasSucceeded || !response.payload) { ... return; }before readingsections/errors, and handle the failure path (e.g. show an error notification).
.subscribe((response: RemoteData<SubmissionObject>) => {
// show validation errors in every section
const workspaceitem = response.payload;
const {sections} = workspaceitem;
const {errors} = workspaceitem;
src/app/submission/sections/clarin-license-resource/section-license.component.ts:300
- The local variable name
workspaceitemis misleading here because the response is now typed asRemoteData<SubmissionObject>and may represent either a workspace or workflow submission. Renaming it to something likesubmissionObject(and updatingsections/errorsdestructuring) will make the code clearer and reduce confusion during maintenance.
// show validation errors in every section
const workspaceitem = response.payload;
const {sections} = workspaceitem;
const {errors} = workspaceitem;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem description
Fix the CLARIN license section so it uses the route-aware submission service instead of workspace-only lookups. This makes the component work against both workspace item edit pages and workflow item edit pages by loading the correct submission endpoint and sending the PATCH request to the submission’s own self link.
Copilot review