@@ -3,9 +3,11 @@ var compute_resource_id = null;
3
3
4
4
$ ( document ) . on ( 'ContentLoad' , function ( ) {
5
5
var searchParams = new URLSearchParams ( window . location . search ) ;
6
- if ( searchParams . has ( 'hostgroup_id' ) ) {
6
+ if ( searchParams . has ( 'hostgroup_id' ) ) {
7
7
var param = searchParams . get ( 'hostgroup_id' ) ;
8
- $ ( '#host_hostgroup_id' ) . val ( param ) . trigger ( 'change' ) ;
8
+ $ ( '#host_hostgroup_id' )
9
+ . val ( param )
10
+ . trigger ( 'change' ) ;
9
11
}
10
12
onHostEditLoad ( ) ;
11
13
const overrideButtons = document . querySelectorAll ( '[name=is_overridden_btn]' ) ;
@@ -39,17 +41,41 @@ $(document).on('ContentLoad', function() {
39
41
$ ( document )
40
42
. on ( 'select2:select select2:unselecting' , '.hostgroup-select' , function ( evt ) {
41
43
hostgroup_changed ( evt . target ) ;
42
- } ) . on ( 'select2:select select2:unselecting' , '.host-form-compute-resource-handle' , function ( evt ) {
43
- computeResourceSelected ( evt . target ) ;
44
- } ) . on ( 'select2:select select2:unselecting' , '.host-taxonomy-select' , function ( evt ) {
44
+ } )
45
+ . on (
46
+ 'select2:select select2:unselecting' ,
47
+ '.host-form-compute-resource-handle' ,
48
+ function ( evt ) {
49
+ computeResourceSelected ( evt . target ) ;
50
+ }
51
+ )
52
+ . on ( 'select2:select select2:unselecting' , '.host-taxonomy-select' , function (
53
+ evt
54
+ ) {
45
55
update_form ( evt . target ) ;
46
- } ) . on ( 'select2:select select2:unselecting' , '#host_architecture_id' , function ( evt ) {
47
- architecture_selected ( evt . target ) ;
48
- } ) . on ( 'select2:select select2:unselecting' , '#hostgroup_architecture_id' , function ( evt ) {
56
+ } )
57
+ . on ( 'select2:select select2:unselecting' , '#host_architecture_id' , function (
58
+ evt
59
+ ) {
49
60
architecture_selected ( evt . target ) ;
50
- } ) . on ( 'select2:select select2:unselecting' , '.host-architecture-os-select' , function ( evt ) {
51
- os_selected ( evt . target ) ;
52
- } ) . on ( 'select2:select select2:unselecting' , '.host-os-media-select' , function ( evt ) {
61
+ } )
62
+ . on (
63
+ 'select2:select select2:unselecting' ,
64
+ '#hostgroup_architecture_id' ,
65
+ function ( evt ) {
66
+ architecture_selected ( evt . target ) ;
67
+ }
68
+ )
69
+ . on (
70
+ 'select2:select select2:unselecting' ,
71
+ '.host-architecture-os-select' ,
72
+ function ( evt ) {
73
+ os_selected ( evt . target ) ;
74
+ }
75
+ )
76
+ . on ( 'select2:select select2:unselecting' , '.host-os-media-select' , function (
77
+ evt
78
+ ) {
53
79
medium_selected ( evt . target ) ;
54
80
} ) ;
55
81
@@ -207,14 +233,20 @@ function submit_with_all_params() {
207
233
success : function ( response , _responseStatus , jqXHR ) {
208
234
// workaround for redirecting to the new host details page
209
235
if ( ! response . includes ( 'id="main"' ) ) {
210
- return tfm . nav . pushUrl ( tfm . tools . foremanUrl ( jqXHR . getResponseHeader ( 'X-Request-Path' ) ) ) ;
236
+ return tfm . nav . pushUrl (
237
+ tfm . tools . foremanUrl ( jqXHR . getResponseHeader ( 'X-Request-Path' ) )
238
+ ) ;
211
239
}
212
240
213
241
$ ( '#host-progress' ) . hide ( ) ;
214
242
$ ( '#content' ) . replaceWith ( $ ( '#content' , response ) ) ;
215
243
$ ( document . body ) . trigger ( 'ContentLoad' ) ;
216
- if ( $ ( "[data-history-url]" ) . exists ( ) ) {
217
- history . pushState ( { } , 'Host show' , $ ( "[data-history-url]" ) . data ( 'history-url' ) ) ;
244
+ if ( $ ( '[data-history-url]' ) . exists ( ) ) {
245
+ history . pushState (
246
+ { } ,
247
+ 'Host show' ,
248
+ $ ( '[data-history-url]' ) . data ( 'history-url' )
249
+ ) ;
218
250
}
219
251
} ,
220
252
error : function ( response ) {
@@ -275,7 +307,7 @@ function update_progress(data) {
275
307
}
276
308
277
309
function update_default_compute_resource ( hostgroup_id ) {
278
- if ( hostgroup_id ) {
310
+ if ( hostgroup_id ) {
279
311
tfm . tools . showSpinner ( ) ;
280
312
$ . ajax ( {
281
313
type : 'get' ,
@@ -285,10 +317,10 @@ function update_default_compute_resource(hostgroup_id) {
285
317
} ,
286
318
success : function ( response ) {
287
319
compute_resource_id = response [ 'compute_resource_id' ] ;
288
- } } ) ;
289
- }
290
- else {
291
- compute_resource_id = null
320
+ } ,
321
+ } ) ;
322
+ } else {
323
+ compute_resource_id = null ;
292
324
}
293
325
}
294
326
@@ -303,7 +335,6 @@ function hostgroup_changed(element) {
303
335
}
304
336
const hostgroup_id = element . value ;
305
337
update_default_compute_resource ( hostgroup_id ) ;
306
-
307
338
}
308
339
309
340
function handleHostgroupChangeEdit ( element , host_id , host_changed ) {
@@ -482,12 +513,6 @@ function update_provisioning_image() {
482
513
if ( $ ( '#host_provision_method_image' ) [ 0 ] . checked ) {
483
514
if ( $ ( '#provider' ) . val ( ) == 'Libvirt' ) {
484
515
tfm . computeResource . libvirt . imageSelected ( image_options ) ;
485
- } else if ( $ ( '#provider' ) . val ( ) == 'Ovirt' ) {
486
- var template_select = $ ( '#host_compute_attributes_template' ) ;
487
- if ( template_select . length > 0 ) {
488
- template_select . val ( image_options . val ( ) ) ;
489
- tfm . computeResource . ovirt . templateSelected ( image_options ) ;
490
- }
491
516
}
492
517
}
493
518
}
@@ -579,8 +604,8 @@ function onHostEditLoad() {
579
604
$ ( '#params-tab' ) . on ( 'shown' , function ( ) {
580
605
mark_params_override ( ) ;
581
606
} ) ;
582
- $ ( 'a[data-toggle="tab"]' ) . on ( 'shown.bs.tab' , function ( e ) {
583
- $ ( 'a[rel="popover"]' ) . popover ( " destroy" ) ;
607
+ $ ( 'a[data-toggle="tab"]' ) . on ( 'shown.bs.tab' , function ( e ) {
608
+ $ ( 'a[rel="popover"]' ) . popover ( ' destroy' ) ;
584
609
} ) ;
585
610
if ( $ ( '#supports_update' ) && ! $ ( '#supports_update' ) . data ( 'supports-update' ) )
586
611
disable_vm_form_fields ( ) ;
@@ -598,8 +623,6 @@ function build_provision_method_selected() {
598
623
$ ( 'div[id*=_provisioning]' ) . hide ( ) ;
599
624
$ ( '#network_provisioning' ) . show ( ) ;
600
625
$ ( '#image_selection select' ) . attr ( 'disabled' , true ) ;
601
- if ( $ ( '#provider' ) . val ( ) == 'Ovirt' )
602
- $ ( '#host_compute_attributes_template' ) . select2 ( 'readonly' , false ) ;
603
626
}
604
627
$ ( document ) . on (
605
628
'select2:select select2:unselecting' ,
@@ -615,13 +638,6 @@ function image_provision_method_selected() {
615
638
image_options . attr ( 'disabled' , false ) ;
616
639
if ( $ ( '#provider' ) . val ( ) == 'Libvirt' ) {
617
640
tfm . computeResource . libvirt . imageSelected ( image_options ) ;
618
- } else if ( $ ( '#provider' ) . val ( ) == 'Ovirt' ) {
619
- var template_options = $ ( '#host_compute_attributes_template' ) ;
620
- if ( template_options . length > 0 ) {
621
- template_options . select2 ( 'readonly' , true ) ;
622
- template_options . val ( image_options . val ( ) ) ;
623
- tfm . computeResource . ovirt . templateSelected ( image_options ) ;
624
- }
625
641
}
626
642
}
627
643
$ ( document ) . on (
@@ -630,12 +646,16 @@ $(document).on(
630
646
image_provision_method_selected
631
647
) ;
632
648
633
- $ ( document ) . on ( 'select2:select select2:unselecting' , '.interface_domain' , function ( ) {
649
+ $ ( document ) . on (
650
+ 'select2:select select2:unselecting' ,
651
+ '.interface_domain' ,
652
+ function ( ) {
634
653
interface_domain_selected ( this ) ;
635
654
clearIpField ( this , '.interface_ip' ) ;
636
655
clearIpField ( this , '.interface_ip6' ) ;
637
656
reload_host_params ( ) ;
638
- } ) ;
657
+ }
658
+ ) ;
639
659
640
660
function clearIpField ( parent , childclass ) {
641
661
var ip_field = $ ( parent )
@@ -883,7 +903,7 @@ function selectRelatedNetwork(subnetElement) {
883
903
var vlanId = subnet_select . find ( ':selected' ) . attr ( 'data-vlan_id' ) ;
884
904
var network_select = subnet_select
885
905
. closest ( 'fieldset' )
886
- . find ( '.vmware_network,.ovirt_network ' ) ;
906
+ . find ( '.vmware_network' ) ;
887
907
var isVisible = subnet_select . closest ( '#interfaceModal' ) . length > 0 ;
888
908
var isPreSelected = network_select . find ( 'option[selected]' ) . length > 0 ;
889
909
@@ -894,13 +914,10 @@ function selectRelatedNetwork(subnetElement) {
894
914
var selected = null ;
895
915
// prefer a match of the vlanid bounded by non digits
896
916
// this prevent vlanId=1 from matching "vlan100"
897
- var vlanidregex = new RegExp ( " (^|\\D)" + vlanId + " ($|\\D)" )
917
+ var vlanidregex = new RegExp ( ' (^|\\D)' + vlanId + ' ($|\\D)' ) ;
898
918
899
919
network_select . find ( 'option' ) . each ( function ( index , option ) {
900
- if (
901
- selected === null &&
902
- vlanidregex . test ( $ ( option ) . text ( ) )
903
- ) {
920
+ if ( selected === null && vlanidregex . test ( $ ( option ) . text ( ) ) ) {
904
921
selected = option . value ;
905
922
}
906
923
} ) ;
0 commit comments