-
Notifications
You must be signed in to change notification settings - Fork 42
MMT-2346: Notify user of potential data loss when attempting to edit a non-UMM collection #625
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
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
986e271
MMT-2313: Added loss reporting route, added a display action to the c…
57b82a3
MMT-2313: added nokogiri/diff to gemfile, added hidden url endpoint f…
49c7dd9
MMT-2313: added loss reporting for arrays
67676fc
MMT-2313: Added comment to collections_controller
d767d9f
MMT-2313: made changes as per MMT-2311-1 PR change requests
83f5057
MMT-2313: Updated comparison logic to use nokogiri for array paths
affd9ab
MMT-2313: removed some comments and test code
7cae6d6
MMT-2313: Added custom function for hash mapping, finds the path for …
e23bb6a
MMT-2313: adjusted whitespace
50c0c0f
MMT-2313: added some comments
748631e
MMT-2313: increased readability of loss_report_output
d6d5077
MMT-2313: improved readability
db730a0
MMT-2313: attempting to fix asterisk problem
d1854c8
MMT-2313 attempting to fix asterisk problem
1bc3d15
MMT-2313: fix nokogiri problems
be69b30
MMT-2313: cleaned up inefficiencies, fixed bugs
34bb5fe
MMT-2313: fixed bugs, improved accuracy
a267e4c
MMT-2313: added some test code to be removed later
937342d
MMT-2313: Added some exception handling
fa56d22
MMT-2313: created specs and stored some sample reports
20fd9e2
MMT-2313: moved loss_report_samples_helper.rb and added it to the rai…
34891ec
MMT-2313: made changes per PR change requests
758e8fa
MMT-2313: removed unneeded comment
aa3e768
MMT-2313: removed an unecessary cmr call
3a7591c
MMT-2346: added loss-report modal
c5be602
MMT-2346: loss reporting - link and modal options
91103d3
MMT-2346: MVP modal access to loss report
a242f66
MMT-2346: completed modal specs
28c5f34
MMT-2346: adjusted modal styling
2d4c2aa
MMT-2346: fixed merge conflicts
afe1331
MMT-2346: fixed another conflict
d4c872e
MMT-2346: adjusted some styling
76fb366
MMT-2346: adjusted specs and styling
3e0c54e
MMT-2346: Fixed affected specs
bbd315a
MMT-2346: completed PR change requests
1faafc0
MMT-2346: remove LARC from available context
365a903
MMT-2346: made specs more readable, improved styling of loss-report-m…
ce63e8c
MMT-2346: adjusted modal Edit button and coffee script
c626849
MMT-2346: updated spec to match change requests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <div id="loss-report-modal" class="eui-modal-content" > | ||
ChristianTrummer99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <a href="javascript:void(0);" class="modal-close float-r" id="close-loss-report-modal"><i class="fa fa-times"></i><span class="is-invisible">Close</span></a> | ||
| <div> | ||
| <h4>Conversion to UMM Format Required</h4> | ||
| <p>The native format of this collection is <%= options[:native_format].split('/').last.gsub('+xml','').upcase %>. Editing this record using the MMT will convert it to UMM-JSON, which may result in data loss. Select 'View Loss Report' to see how the conversion will affect this record.</p> | ||
| <p> | ||
| <%= link_to 'View Loss Report', loss_report_collections_path(options[:concept_id], format: 'json'), class: 'eui-btn eui-btn--steel-blue', target: :_blank %> | ||
|
|
||
| <% if current_provider?(options[:provider_id]) %> | ||
ChristianTrummer99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <%= link_to 'Edit Collection', edit_collection_path(revision_id: options[:revision_id]), class: 'eui-btn--blue modal-close button-spacing' %> | ||
| <% elsif available_provider?(options[:provider_id]) %> | ||
| <%= link_to 'Edit Collection', '#not-current-provider-modal', class: 'eui-btn--blue loss-report button-spacing display-modal not-current-provider', data: { provider: options[:provider_id], record_action: 'edit-collection' } %> | ||
| <% end %> | ||
|
|
||
| <%= link_to 'Cancel', 'javascript:void(0);', class: 'eui-btn modal-close' %> | ||
| </p> | ||
| </div> | ||
| </div> | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
|
|
||
| describe 'loss report modal', js: true do | ||
| # this is an echo collection (SEDAC provider) | ||
| let(:cmr_response) { cmr_client.get_collections({'EntryTitle': 'Anthropogenic Biomes of the World, Version 2: 1700'}) } | ||
| let(:concept_id) { cmr_response.body.dig('items',0,'meta','concept-id') } | ||
|
|
||
| context 'when user clicks Edit Collection Record for a non-UMM collection' do | ||
| context 'when provider context does not need to be changed' do | ||
|
|
||
| before do | ||
| login(provider: 'SEDAC', providers: %w[SEDAC]) | ||
| visit collection_path(concept_id) | ||
| click_on 'Edit Collection Record' | ||
| end | ||
|
|
||
| it 'displays the loss-report-modal with correct links' do | ||
| within '#loss-report-modal' do | ||
| expect(page).to have_content("The native format of this collection is ECHO10. Editing this record using the MMT will convert it to UMM-JSON, which may result in data loss. Select 'View Loss Report' to see how the conversion will affect this record.") | ||
| expect(page).to have_link('View Loss Report', href: loss_report_collections_path(concept_id, format: 'json')) | ||
| expect(page).to have_link('Edit Collection', href: edit_collection_path(id: concept_id)) | ||
| expect(page).to have_link('Cancel', href: 'javascript:void(0);') | ||
| end | ||
| end | ||
|
|
||
| context 'when the "Edit Collection" button is clicked' do | ||
| before do | ||
| within '#loss-report-modal' do | ||
ChristianTrummer99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| click_on 'Edit Collection' | ||
| end | ||
| end | ||
| it 'opens collection draft without displaying the not-current-provider-modal' do | ||
| expect(page).to have_content('Metadata Fields') | ||
| expect(page).to have_content('Collection Information') | ||
| expect(page).to have_content('Acquisition Information') | ||
| expect(page).to have_content('Data Contacts') | ||
| expect(page).to have_content('Metadata Information') | ||
| expect(page).to have_no_css('#not-current-provider-modal') | ||
ChristianTrummer99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
| end | ||
|
|
||
| context 'when the "View Loss Report" button is clicked' do | ||
| before do | ||
| within '#loss-report-modal' do | ||
| click_on 'View Loss Report' | ||
| end | ||
| end | ||
| it 'does not close the loss-report-modal and does not open the not-current-provider-modal' do | ||
| expect(page).to have_no_css('#not-current-provider-modal') | ||
| within '#loss-report-modal' do | ||
| expect(page).to have_content("The native format of this collection is ECHO10. Editing this record using the MMT will convert it to UMM-JSON, which may result in data loss. Select 'View Loss Report' to see how the conversion will affect this record.") | ||
| end | ||
| end | ||
| end | ||
|
|
||
| context 'when the "Cancel" button is clicked' do | ||
| before do | ||
| within '#loss-report-modal' do | ||
| click_on 'Cancel' | ||
| end | ||
| end | ||
| it 'closes loss-report-modal and does not open the not-current-provider-modal' do | ||
| expect(page).to have_no_content('Metadata Preview') | ||
| expect(page).to have_link('Edit Collection Record', href: '#loss-report-modal') | ||
| expect(page).to have_no_css('#not-current-provider-modal') | ||
| expect(page).to have_no_css('#loss-report-modal') | ||
ChristianTrummer99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
| end | ||
| end | ||
|
|
||
| context 'when provider context needs to be changed and the required provider context is available' do | ||
|
|
||
| before do | ||
| login(provider: 'LARC', providers: %w[SEDAC LARC]) | ||
| visit collection_path(concept_id) | ||
| click_on 'Edit Collection Record' | ||
| end | ||
|
|
||
| it 'displays the loss-report-modal with correct links' do | ||
| within '#loss-report-modal' do | ||
| expect(page).to have_content("The native format of this collection is ECHO10. Editing this record using the MMT will convert it to UMM-JSON, which may result in data loss. Select 'View Loss Report' to see how the conversion will affect this record.") | ||
| expect(page).to have_link('View Loss Report', href: loss_report_collections_path(concept_id, format: 'json')) | ||
| expect(page).to have_link('Edit Collection', href: '#not-current-provider-modal') | ||
| expect(page).to have_link('Cancel', href: 'javascript:void(0);') | ||
| end | ||
| end | ||
|
|
||
| context 'when the "Edit Collection" button is clicked' do | ||
| before do | ||
| within '#loss-report-modal' do | ||
| click_on 'Edit Collection' | ||
| end | ||
| end | ||
| it 'closes loss-report-modal and opens the not-current-provider-modal' do | ||
| expect(page).to have_no_css('#loss-report-modal') | ||
| within '#not-current-provider-modal' do | ||
| expect(page).to have_link('Yes', href: '#') | ||
| expect(page).to have_link('No', href: 'javascript:void(0)') | ||
| end | ||
| end | ||
| end | ||
|
|
||
| context 'when the "View Loss Report" button is clicked' do | ||
| before do | ||
| within '#loss-report-modal' do | ||
| click_on 'View Loss Report' | ||
| end | ||
| end | ||
| it 'does not close the loss-report-modal and does not open the not-current-provider-modal' do | ||
| expect(page).to have_content("The native format of this collection is ECHO10. Editing this record using the MMT will convert it to UMM-JSON, which may result in data loss. Select 'View Loss Report' to see how the conversion will affect this record.") | ||
| expect(page).to have_no_css('#not-current-provider-modal') | ||
| end | ||
| end | ||
|
|
||
| context 'when the "Cancel" button is clicked' do | ||
| before do | ||
| within '#loss-report-modal' do | ||
| click_on 'Cancel' | ||
| end | ||
| end | ||
| it 'closes loss-report-modal and does not open the not-current-provider-modal' do | ||
| expect(page).to have_no_css('#not-current-provider-modal') | ||
| expect(page).to have_no_css('#loss-report-modal') | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
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.
Uh oh!
There was an error while loading. Please reload this page.