4a5975a106a24048a07affd82fa97e2870cb4caa
[osm/LW-UI.git] / static / src / projecthandler / descriptorslist.js
1
2 function startFromAgent(start) {
3
4
5 if (start == 'exist'){
6 $('#div_new_agent').hide();
7 $('#div_available_agent').show();
8 }
9 else if (start == 'new'){
10 $('#div_available_agent').hide();
11 $('#div_new_agent').show();
12 }
13
14 $('.required').prop('required', function(){
15 return $(this).is(':visible');
16 });
17
18 }
19 /*
20 function InvalidGitUrl(textbox) {
21 console.log('InvalidGitUrl', textbox,textbox.value == '' ,textbox.validity.typeMismatch)
22 if (textbox.value === '') {
23 textbox.setCustomValidity('Required git URL');
24 }
25 else if (textbox.validity.typeMismatch){
26 textbox.setCustomValidity('please enter a valid git URL');
27
28 }
29 else {
30 textbox.setCustomValidity('please enter a valid git URL');
31 }
32 return true;
33 }
34 */
35 function startFromRepo(start) {
36
37
38 if (start == 'exist'){
39 $('#div_new_repo').hide();
40 $('#div_available_repo').show();
41 }
42 else if (start == 'new'){
43 $('#div_available_repo').hide();
44 $('#div_new_repo').show();
45 }
46
47 $('.required').prop('required', function(){
48 return $(this).is(':visible');
49 });
50
51 }
52
53 $(document).ready(function () {
54 $("#startButtonsSelect :input").change(function () {
55 console.log("select")
56 startFromAgent(this.value);
57 });
58 $("#push_start_buttons_select :input").change(function () {
59 console.log("select")
60 startFromRepo(this.value);
61 });
62
63 // Bind events
64 $("form").submit(function(e) {
65 console.log("on submit form")
66 $("#start_new_deployment").button('loading');
67 });
68
69 });