Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #21643 - fix and move nfs_visibilty.js to webpack
- Loading branch information
Showing
11 changed files
with
50 additions
and
54 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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 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 |
---|---|---|
@@ -1,3 +1,11 @@ | ||
module MediumsHelper | ||
include PtablesHelper | ||
|
||
def required_nfs_list | ||
Operatingsystem.families.select {|family| family.constantize.require_nfs_access_to_medium } | ||
end | ||
|
||
def required_nfs? | ||
required_nfs_list.include?(@medium.os_family) | ||
end | ||
end |
This file contains 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 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 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 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 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 |
---|---|---|
|
@@ -17,7 +17,6 @@ | |
host_edit_interfaces | ||
hosts | ||
host_checkbox | ||
nfs_visibility | ||
noVNC/base64 | ||
noVNC/des | ||
noVNC/display | ||
|
This file contains 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 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,5 @@ | ||
import $ from 'jquery'; | ||
|
||
export function nfsVisibility(osFamily, nfsRequired) { | ||
$('#nfs-section').toggle(nfsRequired.includes(osFamily.value)); | ||
} |
This file contains 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,32 @@ | ||
import $ from 'jquery'; | ||
import { nfsVisibility } from './foreman_medium'; | ||
|
||
jest.unmock('./foreman_medium'); | ||
const nfsRequired = ['Solaris']; | ||
|
||
document.body.innerHTML = | ||
`<span id="nfs-section" style=display:none;> | ||
<span class="help-block help-inline">The NFS path to the media.</span> | ||
<span class="help-block help-inline">The NFS path to the jumpstart control files.</span> | ||
<span class="help-block help-inline">The NFS path to the image directory.</span> | ||
</span> | ||
<select id='os_family' id="medium_os_family"> | ||
<option value="">Choose a family</option> | ||
<option value="Redhat">Red Hat</option> | ||
<option value="Solaris">Solaris</option> | ||
</select>`; | ||
|
||
it('When an os family with required nfs is chosen, nfs section should be visable', () => { | ||
$.fn.show = jest.fn(); | ||
expect($('#os_family').is(':visible')).toBe(false); | ||
$('#os_family').val('Solaris'); | ||
nfsVisibility($('#os_family')[0], nfsRequired); | ||
expect($.fn.show).toBeCalled(); | ||
}); | ||
|
||
it('When an os family without required nfs is chosen, nfs section should be hidden', () => { | ||
$.fn.hide = jest.fn(); | ||
$('#os_family').val('Redhat'); | ||
nfsVisibility($('#os_family')[0], nfsRequired); | ||
expect($.fn.hide).toBeCalled(); | ||
}); |