-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: create a mockup for all upload status exception published #2093
base: develop
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
<?php } ?> | ||
|
||
<?php if ($flashError = Yii::app()->user->getFlash('updateError')) { ?> | ||
<div class="alert alert-danger" role="alert"> | ||
<div id="flashError" class="alert alert-danger" role="alert"> | ||
<?= $flashError ?> | ||
</div> | ||
<?php } ?> | ||
|
@@ -554,7 +554,7 @@ | |
|
||
if ($showCreateResetUrlBtn) { | ||
?> | ||
<a class="btn background-btn-o" href="<?php echo Yii::app()->createUrl('/adminDataset/private/identifier/' . $model->identifier) ?>" title="This will save any changes made on this page AND create a new mockup page URL/token link" data-toggle="tooltip">Create/Reset Private URL</a> | ||
<a id="mockup" class="btn background-btn-o" href="<?php echo Yii::app()->createUrl('/adminDataset/private/identifier/' . $model->identifier) ?>" title="This will save any changes made on this page AND create a new mockup page URL/token link" data-toggle="tooltip">Create/Reset Private URL</a> | ||
<?php | ||
} | ||
if ($showMockupBtn) { | ||
|
@@ -643,6 +643,32 @@ class="form-control" | |
</div><!-- /.modal-dialog --> | ||
</div><!-- /.modal --> | ||
<script> | ||
$(document).ready(function () { | ||
$('#mockup').on('click', function (event) { | ||
event.preventDefault(); | ||
|
||
mockupUrl = $(this).attr("href"); | ||
form = $('#dataset-form'); | ||
|
||
$.ajax({ | ||
url: form.attr('action'), | ||
method: 'POST', | ||
data: form.serialize(), | ||
success: function (response, textStatus, xhr) { | ||
if (200 === xhr.status) { | ||
window.location.href = mockupUrl; | ||
} else { | ||
$('#flashError').html('An error occurred while trying to save the dataset') | ||
} | ||
|
||
}, | ||
error: function (error) { | ||
$('#flashError').html('An error occurred while trying to save the dataset') | ||
} | ||
}) | ||
}); | ||
}); | ||
|
||
Comment on lines
+646
to
+671
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. praise: This JS function/AJAX call makes sure to save any changes made in the form when clicking the |
||
$(function() { | ||
|
||
var publication_date = $('.js-date-pub'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,10 +131,16 @@ Feature: form to update dataset details | |
Scenario: Can create/reset private url | ||
When I am on "/adminDataset/update/id/5" | ||
And I press the button "Create/Reset Private URL" | ||
And I wait "1" seconds | ||
And I wait "3" seconds | ||
Then I should see current url contains "/dataset/100039/token/" | ||
And I should see "Genomic data of the Puerto Rican Parrot (Amazona vittata) from a locally funded project." | ||
|
||
@ok @dataset-status | ||
Scenario: Can't see create/reset private url for a published dataset | ||
When I am on "/adminDataset/update/id/8" | ||
Then I should not see "Create/Reset Private URL" | ||
And I should not see "Open Private URL" | ||
|
||
@ok @issue-1023 | ||
Scenario: Open private url is working | ||
When I am on "/adminDataset/update/id/5" | ||
|
@@ -189,6 +195,7 @@ Feature: form to update dataset details | |
And I fill in the field of "name" "Dataset[title]" with "test dataset" | ||
And I fill in the field of "name" "Dataset[identifier]" with "123789" | ||
And I fill in the field of "name" "Dataset[ftp_site]" with "ftp://test" | ||
When I check the field "Dataset_Epigenomic" | ||
And I press the button "Create" | ||
And I wait "1" seconds | ||
And I am on "/adminDataset/update/id/2741" | ||
|
@@ -465,14 +472,20 @@ Feature: form to update dataset details | |
| "DataAvailableForReview" | | ||
| "DataPending" | | ||
|
||
@ok @dataset-status | ||
Scenario: Links to create mockup or to open mockup are not present for a published dataset | ||
@ok @test | ||
Scenario: Links to create mockup is present for a submitted dataset | ||
Given I am on "/adminDataset/update/id/5" | ||
And I select "Published" from the field "Dataset_upload_status" | ||
And I select "DataAvailableForReview" from the field "Dataset_upload_status" | ||
And I press the button "Save" | ||
When I am on "/adminDataset/update/id/5" | ||
Then I should not see "Create/Reset Private URL" | ||
And I should not see "Open Private URL" | ||
And I select "Submitted" from the field "Dataset_upload_status" | ||
And I press the button "Save" | ||
When I am on "/adminDataset/update/id/5" | ||
Then I should see "Create/Reset Private URL" | ||
And I press the button "Create/Reset Private URL" | ||
And I wait "3" seconds | ||
Then I should see current url contains "/dataset/100039/token/" | ||
And I should see "Genomic data of the Puerto Rican Parrot (Amazona vittata) from a locally funded project." | ||
Comment on lines
+475
to
+488
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. question: Is this test still
But in fact, the current existing scenario 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. The tag will be removed, just used locally. 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 that is the case, may be the test can be:
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. why do you want to add "Cannot change status to Submitted from non DataAvailableForReview". it's another PR 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. Can you remind me which PR? If there is already a PR for it, you can ignore 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. not opened yet |
||
|
||
|
||
@ok @issue-1812 @mockup | ||
|
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.
praise: Using Yii's built-in request handling, which is generally safer and more consistent