-
Notifications
You must be signed in to change notification settings - Fork 42
MMT-2230 Adding tool cloning #608
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
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| module ToolsHelper | ||
| def render_change_provider_tool_action_link(tool_action, concept_id, revision_id = nil) | ||
| case tool_action | ||
| when 'edit' | ||
| link_to('Edit Service', edit_tool_path(concept_id, revision_id: revision_id), class: 'is-invisible', id: 'change-provider-tool-edit') | ||
| when 'clone' | ||
| link_to('Clone Service', clone_tool_path(concept_id, revision_id: revision_id), class: 'is-invisible', id: 'change-provider-tool-clone') | ||
| when 'delete' | ||
| link_to('Delete Service', tool_path(concept_id), method: :delete, class: 'is-invisible', id: 'change-provider-tool-delete') | ||
| end | ||
| end | ||
| end |
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
62 changes: 62 additions & 0 deletions
62
spec/features/tool_drafts/create_tool_draft_from_cloning_spec.rb
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,62 @@ | ||
| describe 'Creating a tool draft from cloning a tool', reset_provider: true, js: true do | ||
| before :all do | ||
| @ingest_response, _concept_response, @native_id = publish_tool_draft | ||
| end | ||
|
|
||
| after :all do | ||
| delete_response = cmr_client.delete_tool('MMT_2', @native_id, 'token') | ||
|
|
||
| raise unless delete_response.success? | ||
| end | ||
|
|
||
| context 'when cloning a published tool' do | ||
| before do | ||
| login | ||
|
|
||
| visit tool_path(@ingest_response['concept-id']) | ||
|
|
||
| click_on 'Clone Tool Record' | ||
| end | ||
|
|
||
| it 'displays the draft preview page' do | ||
| within '.eui-breadcrumbs' do | ||
| expect(page).to have_content('Tool Drafts') | ||
| end | ||
|
|
||
| expect(page).to have_content('Publish Tool Draft') | ||
| expect(page).to have_content('Delete Tool Draft') | ||
| expect(page).to have_content('Metadata Fields') | ||
| expect(page).to have_content('Tool Information') | ||
| end | ||
|
|
||
| it 'removes the Name and Long Name from the metadata' do | ||
| within '#tool_draft_draft_name_preview' do | ||
| expect(page).to have_css('p', text: 'No value for Name provided.') | ||
| end | ||
|
|
||
| within '#tool_draft_draft_long_name_preview' do | ||
| expect(page).to have_css('p', text: 'No value for Long Name provided.') | ||
| end | ||
| end | ||
|
|
||
| it 'creates a new native id for the draft' do | ||
| draft = ToolDraft.last | ||
| expect(draft.native_id).to eq("mmt_tool_#{draft.id}") | ||
| end | ||
|
|
||
| it 'displays a message that the draft needs a unique Name' do | ||
| expect(page).to have_content('Records must have a unique Name and Long Name within a provider. Click here to enter a new Name and Long Name.') | ||
| end | ||
|
|
||
| context 'when clicking the banner message to enter a new Name' do | ||
| before do | ||
| click_on 'Click here to enter a new Name and Long Name.' | ||
| end | ||
|
|
||
| it 'displays the empty Name and Long Name fields' do | ||
| expect(page).to have_field('Name', with: '') | ||
| expect(page).to have_field('Long Name', with: '') | ||
| end | ||
| end | ||
| end | ||
| end |
Oops, something went wrong.
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.
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.
If not all the links are being enabled, should we keep the comments and possibly move them down to be near links that are still disabled?
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.
Moving it around was going to cause more merge conflicts, so I decided to remove it. Especially since I expect to have all of these links working by the end of the week.