1 function run_pipeline_button_state() {
2 var a = $('a.editable.required.editable-empty,input.form-control.required[value=]');
4 $(".run-pipeline-button").addClass("disabled");
7 $(".run-pipeline-button").removeClass("disabled");
11 $(document).on('editable:success', function(event, tag, response, newValue) {
13 if ($('.run-pipeline-button').length == 0)
15 if ($tag.hasClass("required")) {
16 if (newValue && newValue.trim() != "") {
17 $tag.removeClass("editable-empty");
18 $tag.parent().css("background-color", "");
19 $tag.parent().prev().css("background-color", "");
22 $tag.addClass("editable-empty");
23 $tag.parent().css("background-color", "#ffdddd");
24 $tag.parent().prev().css("background-color", "#ffdddd");
27 if ($tag.attr('data-name')) {
28 // Update other inputs representing the same piece of data
29 $('.editable[data-name="' + $tag.attr('data-name') + '"]').
30 editable('setValue', newValue);
32 run_pipeline_button_state();
35 $(document).on('ready ajax:complete', function() {
36 $('a.editable.required').each(function() {
38 if ($tag.hasClass("editable-empty")) {
39 $tag.parent().css("background-color", "#ffdddd");
40 $tag.parent().prev().css("background-color", "#ffdddd");
43 $tag.parent().css("background-color", "");
44 $tag.parent().prev().css("background-color", "");
47 run_pipeline_button_state();
50 $(document).on('arv-log-event', '.arv-log-event-handler-append-logs', function(event, eventData){
51 var wasatbottom = ($(this).scrollTop() + $(this).height() >=
53 var parsedData = JSON.parse(eventData);
54 var propertyText = undefined;
55 var properties = parsedData.properties;
57 if (properties !== null) {
58 propertyText = properties.text;
60 if (propertyText !== undefined) {
61 propertyText = propertyText.
63 replace(/\n/g, '<br/>');
64 $(this).append(propertyText + "<br/>");
65 } else if (parsedData.summary !== undefined) {
66 if (parsedData.summary.match(/^update of [-a-z0-9]{27}$/))
69 $(this).append(parsedData.summary + "<br/>");
72 this.scrollTop = this.scrollHeight;
73 }).on('arv:pane:loaded', '#Logs,#Log', function(){
74 $('.arv-log-event-handler-append-logs', this).each(function() {
75 this.scrollTop = this.scrollHeight;
76 $(this).closest('.tab-pane').on('arv:pane:reload', function(e) {
77 // Do not let this tab auto-refresh.
81 }).on('ready ajax:complete', function(){
82 $(".arv-log-event-listener[data-object-uuids-live]").each(function() {
83 // Look at data-object-uuid attribute of elements matching
84 // given selector, so the event listener can listen for events
85 // that appeared on the page via ajax.
86 var $listener = $(this);
87 var have_uuids = '' + $listener.attr('data-object-uuids');
88 $($listener.attr('data-object-uuids-live')).each(function() {
89 var this_uuid = $(this).attr('data-object-uuid');
90 if (have_uuids.indexOf(this_uuid) == -1) {
91 have_uuids = have_uuids + ' ' + this_uuid;
94 $listener.attr('data-object-uuids', have_uuids);
98 var showhide_compare = function() {
99 var form = $('form#compare')[0];
100 $('input[type=hidden][name="uuids[]"]', form).remove();
101 $('input[type=submit]', form).prop('disabled',true).show();
102 var checked_inputs = $('[data-object-uuid*=-d1hrv-] input[name="uuids[]"]:checked');
103 if (checked_inputs.length >= 2 && checked_inputs.length <= 3) {
104 checked_inputs.each(function(){
106 $('input[type=submit]', form).prop('disabled',false).show();
107 $(form).append($('<input type="hidden" name="uuids[]"/>').val(this.value));
112 $('[data-object-uuid*=-d1hrv-] input[name="uuids[]"]').on('click', showhide_compare);
115 setInterval(function(){
116 if ($('[data-pipeline-state=RunningOnServer],[data-pipeline-state=RunningOnClient]').length > 0) {
117 $('#Components-tab,#Graph-tab,#pipeline-instance-tab-buttons').trigger('arv:pane:reload');