Skip to content
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

feat(Spasht):Added new API request to send data back to clearlyDefined #2261

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Pendyala-thanvi
Copy link
Contributor

@Pendyala-thanvi Pendyala-thanvi commented Jul 13, 2022

Description

This PR introduces a new API request to send data back to clearlyDefined.

Changes

src/spasht/ui/ui-spasht.php
src/spasht/ui/template/agent_spasht_contribute.html.twig
src/spasht/ui/template/agent_spasht.js.twig
src/spasht/ui/template/agent_spasht_ui_tabs.html.twig

How to test

  1. Upload any package
  2. Click on the package --> Spasht
  3. Search for any definition and schedule the agent.
  4. Click on contribute tab and fill the form
  5. Click on submit

image

Copy link
Member

@viv9k viv9k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do the required fix

src/spasht/ui/ui-spasht.php Outdated Show resolved Hide resolved
@GMishx GMishx added needs code review needs test GSoC-22 Label to tag issues and pull request for GSOC 2022 activities labels Jul 14, 2022
@@ -141,6 +141,12 @@ public function Output()
$typeName = trim(GetParm("typeName", PARM_STRING));
$providerName = trim(GetParm("providerName", PARM_STRING));

// Reading contribution data
$coordinatesInfo = trim(GetParm("jsonStringCoordinates", PARM_STRING));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coordinates should be read from the database for the upload. A client can manipulate the request data and put invalid coordinates.

Comment on lines +397 to +416
$contributionPacket["contributionInfo"] = $contributionInfo;
$patches =array();

$patch = array();
$patch["coordinates"] = $coordinatesInfo;
$revision = array();
$contributionFiles = array();
$file = array();
$file["path"] = "";
$file["license"] = "";
$file["attributions"] = "";

array_push($contributionFiles, $file);

$revision[$contributionRevision]["files"] = $contributionFiles;
$patch["revisions"] = $revision;

array_push($patches, $patch);
$contributionPacket["patches"] = $patches;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the indentation.

$file["license"] = "";
$file["attributions"] = "";

array_push($contributionFiles, $file);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified.

Suggested change
array_push($contributionFiles, $file);
$contributionFiles[] = $file;

$revision[$contributionRevision]["files"] = $contributionFiles;
$patch["revisions"] = $revision;

array_push($patches, $patch);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Suggested change
array_push($patches, $patch);
$patches[] = $patch;

Comment on lines +401 to +407
$patch["coordinates"] = $coordinatesInfo;
$revision = array();
$contributionFiles = array();
$file = array();
$file["path"] = "";
$file["license"] = "";
$file["attributions"] = "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a PHP class for the data structure in src/lib/php/Data/Spasht.

<tr>
<td>
<p style="text-align:left">Title</p>
<input type="text" id="ContributionTitle" style="width:100%"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use required attribute to allow user to understand it is a required field.

$("#contributionDataValid").val("true");
$("#contributtionSubmitButton").submit();
} else {
$("#contributionDataValid").val("false");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a feedback if the data is invalid. Otherwise, user might click on the button and wait for the page to load/do something.

@GMishx GMishx added the WIP label Jul 25, 2022
@viv9k
Copy link
Member

viv9k commented Jan 24, 2023

Can we take this as medium project in gsoc 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC-22 Label to tag issues and pull request for GSOC 2022 activities needs code review needs test WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants