third_party/pipeline/pipeline/ui/common.js
function setButter(message, error, traceback, asHtml) {
  var butter = $('#butter');
  // Prevent flicker on butter update by hiding it first.
  butter.css('display', 'none');
  if (error) {
    butter.removeClass('info').addClass('error');
  } else {
    butter.removeClass('error').addClass('info');
  }
  butter.children().remove();
  if (asHtml) {
    butter.append($('<div>').html(message));
  } else {
    butter.append($('<div>').text(message));
  }

  function centerButter() {
    butter.css('left', ($(window).width() - $(butter).outerWidth()) / 2);
  }

  if (traceback) {
    var showDetail = $('<a href="">').text('Detail');
    showDetail.click(function(event) {
      $('#butter-detail').toggle();
      centerButter();
      event.preventDefault();
    });
    var butterDetail = $('<pre id="butter-detail">').text(traceback);
    butterDetail.css('display', 'none');

    butter.append(showDetail);
    butter.append(butterDetail);
  }
  centerButter();
  butter.css('display', null);
}
function setButter(message, error, traceback, asHtml) {
  var butter = $('#butter');
  // Prevent flicker on butter update by hiding it first.
  butter.css('display', 'none');
  if (error) {
    butter.removeClass('info').addClass('error');
  } else {
    butter.removeClass('error').addClass('info');
  }
  butter.children().remove();
  if (asHtml) {
    butter.append($('<div>').html(message));
  } else {
    butter.append($('<div>').text(message));
  }

  function centerButter() {
    butter.css('left', ($(window).width() - $(butter).outerWidth()) / 2);
  }

  if (traceback) {
    var showDetail = $('<a href="">').text('Detail');
    showDetail.click(function(event) {
      $('#butter-detail').toggle();
      centerButter();
      event.preventDefault();
    });
    var butterDetail = $('<pre id="butter-detail">').text(traceback);
    butterDetail.css('display', 'none');

    butter.append(showDetail);
    butter.append(butterDetail);
  }
  centerButter();
  butter.css('display', null);
}
function setButter ( message , error , traceback , asHtml ) { var butter = $ ( '#butter' ) ; // Prevent flicker on butter update by hiding it first. butter . css ( 'display' , 'none' ) ; if ( error ) { butter . removeClass ( 'info' ) . addClass ( 'error' ) ; } else { butter . removeClass ( 'error' ) . addClass ( 'info' ) ; } butter . children ( ) . remove ( ) ; if ( asHtml ) { butter . append ( $ ( '<div>' ) . html ( message ) ) ; } else { butter . append ( $ ( '<div>' ) . text ( message ) ) ; } function centerButter ( ) { butter . css ( 'left' , ( $ ( window ) . width ( ) - $ ( butter ) . outerWidth ( ) ) / 2 ) ; } if ( traceback ) { var showDetail = $ ( '<a href="">' ) . text ( 'Detail' ) ; showDetail . click ( function ( event ) { $ ( '#butter-detail' ) . toggle ( ) ; centerButter ( ) ; event . preventDefault ( ) ; } ) ; var butterDetail = $ ( '<pre id="butter-detail">' ) . text ( traceback ) ; butterDetail . css ( 'display' , 'none' ) ; butter . append ( showDetail ) ; butter . append ( butterDetail ) ; } centerButter ( ) ; butter . css ( 'display' , null ) ; }
Sets the status butter, optionally indicating if it's an error message.
Sets the status butter optionally indicating if it s an error message .