/**
 * @author Sam Thompson
 *
 * Panel for displaying the status of a service
 */
$( function()
{
	"use strict";
	//noinspection JSUnresolvedVariable
	$.widget( 'jqueryDash.statusPanel', $.jqueryDash.panel, {

		statuses: {
			ok: 'ok',
			warning: 'warning',
			error: 'error',
			unknown: 'unknown'
		},

		options: {
			refreshable: true,
			minHeight: 50,
			minWidth: 50
		},

		refreshContent: function()
		{
			this.setStatus( this.statuses.unknown );
		},

		_destroyViewPanel: function()
		{
			this.setStatus();
			this._super();
		},

		/**
		 * Sets the panel's status
		 *
		 * @param {String} [newStatus] Optionally sets status or removes all statuses if not provided
		 */
		setStatus: function( newStatus )
		{
			var
				status,
				remove = '',
				add = '';
			for( status in this.statuses )
			{
				if( this.statuses.hasOwnProperty( status ) )
				{
					if( status === newStatus )
					{
						add += ' ' + this.statuses[ status ];
					}
					else
					{
						remove += ' ' + this.statuses[ status ];
					}
				}
			}

			if( remove !== '' )
			{
				this.element.removeClass( remove );
			}
			if( add !== '' )
			{
				this.element.addClass( add );
			}
		}

	} );
} );
@@ -369,16 +369,38 @@
 idth: 50
+,%0A%09%09%09status: 'unknown'
 %0A%09%09%7D,%0A%0A%09
@@ -459,24 +459,22 @@
 his.
-statuses.unknown
+options.status
  );%0A

set default status to unknown