bosun.org@v0.0.0-20210513094433-e25bc3e69a1f/cmd/bosun/web/static/partials/config.html (about)

     1  <style type="text/css">
     2  	.resize {
     3  		margin-bottom: 15px;
     4  		border: 1px solid lightgrey;
     5  		height: 500px;
     6  		width: 100%
     7  	}
     8  
     9  	.ace_editor {
    10  		width: 100%;
    11  		height: 100%;
    12  	}
    13  
    14  	.selectorDropdown {
    15  		float: left;
    16  		margin-right: 5px;
    17  		margin-bottom: 15px;
    18  	}
    19  
    20  	.actionButtons {
    21  		float: right;
    22  		margin-left: 5px;
    23  	}
    24  
    25  	.section-button {
    26  		max-height: 500px;
    27  		overflow-y: auto;
    28  	}
    29  	/* http://stackoverflow.com/questions/17206631/why-are-bootstrap-tabs-displaying-tab-pane-divs-with-incorrect-widths-when-using fixes timeline drawing at default width while tab is hidden */
    30  
    31  	.tab-content>.tab-pane {
    32  		display: block;
    33  		height: 0;
    34  		overflow-y: hidden;
    35  		overflow-x: hidden;
    36  	}
    37  
    38  	.tab-content>.active {
    39  		height: auto;
    40  	}
    41  
    42  	#configSaveModal .modal-dialog {
    43  		width: 50%;
    44  	}
    45  
    46  	.popover {
    47  		max-width: 600px;
    48  		outline: none !important;
    49  	}
    50  </style>
    51  <label class="selectorDropdown" style="margin-right:15px;">Jump to:</label>
    52  <div class="row">
    53  	<div class="dropdown selectorDropdown" ng-repeat="(type,list) in items">
    54  		<button class="btn btn-primary btn-xs dropdown-toggle" type="button" id="itemSelector" data-toggle="dropdown">
    55  			{{ type }} <i class="fa fa-caret-down"></i>
    56  		</button>
    57  		<ul class="dropdown-menu section-button" role="menu">
    58  			<li role="presentation"><a tabindex="-1" role="menuitem" target="_blank" ng-href="{{sectionToDocs[type]}}">
    59  				{{ type }} Documentation <i class="fa fa-external-link"></i></a>
    60  			</li>
    61  			<li class="divider"></li>
    62  			<li role="presentation" ng-repeat="item in list | orderBy:'toString()'"><a role="menuitem" tabindex="-1" ng-click="scrollTo(type,item);">{{item}}</a></li>
    63  		</ul>
    64  	</div>
    65  	<div class="btn btn-default btn-xs" ng-show="quickJumpTarget" ng-bind="quickJumpTarget" ng-click="quickJump()"></div>
    66  	<div class="btn btn-default btn-xs actionButtons" data-toggle="modal" data-target="#configSaveModal" ng-click="diffConfig()"
    67  	 ng-if="saveEnabled">Save</div>
    68  	<div class="btn btn-default btn-xs actionButtons" ng-click="validate()">Validate</div>
    69  	<div class="btn btn-default btn-xs actionButtons" ng-click="downloadConfig()">Download</div>
    70  </div>
    71  <div class="row" ng-show="validationResult">
    72  	<div class="col-lg-12">
    73  		<div class="alert alert-dismissible" ng-class="validationResult == 'Valid' ? 'alert-success' : 'alert-danger'" ng-bind="validationResult">
    74  			<button type="button" class="close" ng-click="validationResult=''"><span>&times;</span></button>
    75  		</div>
    76  	</div>
    77  </div>
    78  <div class="row" ng-show="saveResult">
    79  	<div class="col-lg-12">
    80  		<div class="alert" ng-class="saveClass()">{{saveResult}}
    81  			<button ng-show="saveClass() != 'alert-warning'" type="button" class="close" ng-click="saveResult=''"><span>&times;</span></button>
    82  		</div>
    83  	</div>
    84  </div>
    85  <div class="row" ng-show="runningChanged" ng-if="saveEnabled">
    86  	<div class="col-lg-12">
    87  		<div class="alert alert-danger">The running configuration has been changed since you started editing.
    88  			<div style="outline: none;" class="pull-right" data-placement="bottom" data-title="Help" data-content="{{runningChangedHelp}}"
    89  			 bs-popover><span class="fa fa-question"></span></div>
    90  		</div>
    91  	</div>
    92  </div>
    93  <div class="row" ng-show="runningHashResult" ng-if="saveEnabled">
    94  	<div class="col-lg-12">
    95  		<div class="alert alert-warning">{{runningHashResult}}
    96  			<button type="button" class="close" ng-click="runningHashResult=''; getRunningHash()"><span>&times;</span></button>
    97  		</div>
    98  	</div>
    99  </div>
   100  <div class="row">
   101  	<div tsresizable on-resize="editor.resize()" class='resize'>
   102  		<div ui-ace="{ onLoad : aceLoaded, mode: aceMode, theme: aceTheme, advanced: { fontSize: '14px', fontFamily: 'Menlo, Monaco, Consolas, monospace' }}"
   103  		 ng-model="config_text"></div>
   104  	</div>
   105  </div>
   106  <div class="row">
   107  	<div class="col-lg-12">
   108  		<form class="form-inline">
   109  			<div class="form-group">
   110  				<label class="control-label">From</label>
   111  				<input type="text" class="form-control" style="width:9em" ng-model="fromDate" ng-change="setInterval()" placeholder="yyyy-mm-dd"
   112  				 bs-datepicker data-date-format="yyyy-MM-dd" data-date-type="string">
   113  				<input type="text" class="form-control" style="width:9em" ng-model="fromTime" ng-change="setInterval()" placeholder="HH:MM">
   114  			</div>
   115  			<div class="form-group">
   116  				<label class="control-label">To</label>
   117  				<input type="text" class="form-control" style="width:9em" ng-model="toDate" ng-change="setInterval()" placeholder="yyyy-mm-dd"
   118  				 bs-datepicker data-date-format="yyyy-MM-dd" data-date-type="string">
   119  			</div>
   120  			<div class="form-group">
   121  				<input type="text" class="form-control" style="width:9em" ng-model="toTime" ng-change="setInterval()" placeholder="HH:MM">
   122  			</div>
   123  			<div class="form-group">
   124  				<label class="control-label">Intervals</label>
   125  				<input type="number" min="2" step="1" style="width:7em" class="form-control" ng-model="intervals" ng-change="setInterval()"
   126  				 ng-disabled="!fromDate || !toDate" tooltip title="Number of evaluations between timespan.">
   127  			</div>
   128  			<div class="form-group">
   129  				<label class="control-label">Step Duration (m)</label>
   130  				<input type="number" min="1" step="1" style="width:7em" class="form-control" ng-model="duration" ng-change="setDuration()"
   131  				 ng-disabled="!fromDate || !toDate" tooltip title="Step duration in minutes between intervals.">
   132  			</div>
   133  
   134  		</form>
   135  	</div>
   136  </div>
   137  <div class="row" style="margin-bottom:15px;">
   138  	<div class="col-lg-12">
   139  		</p>
   140  		<form class="form-inline">
   141  			<div class="form-group">
   142  				<label class="control-label">Email</label>
   143  				<input type="email" class="form-control" style="width:20em" ng-model="email">
   144  			</div>
   145  			<div class="form-group">
   146  				<label class="control-label">Template Group</label>
   147  				<input type="text" class="form-control" style="width:20em" ng-model="template_group" tooltip title="Set which result to use for the template by setting an opentsdb group (aka tagset) in the format of k=v,m=o. The first result for which the specified group is a subset of a result is used. If no results are a subset of the specified group, then the first result is chosen.">
   148  			</div>
   149  			<div class="form-group">
   150  				<label class="control-label">Incident Id</label>
   151  				<input type="number" class="form-control" style="width:10em" ng-model="incidentId" tooltip title="Incident Id to use for preview notifications">
   152  			</div>
   153  			<div class="form-group">
   154  				<button class="btn btn-primary" ng-click="test()">Test {{selected_alert}}</button>
   155      			<i class="fa fa-question-circle-o fa-lg" tooltip title="Notice: some alerts might not be shown in case their status is 'unknown'"></i>
   156  			</div>
   157  		</form>
   158  	</div>
   159  </div>
   160  <div class="row" ng-show="running">
   161  	<div class="col-lg-12">
   162  		<div class="alert alert-info">
   163  			Running...
   164  		</div>
   165  	</div>
   166  </div>
   167  <div class="row" ng-repeat="error in errors">
   168  	<div class="col-lg-12">
   169  		<pre class="alert alert-danger" ng-bind="error" style="white-space: pre-wrap;"></pre>
   170  	</div>
   171  </div>
   172  <div class="row" ng-show="warning.length > 0">
   173  	<div class="col-lg-12" ng-repeat="w in warning track by $index">
   174  		<div class="alert alert-warning" ng-bind="w"></div>
   175  	</div>
   176  </div>
   177  
   178  <ul class="nav nav-tabs">
   179  	<li ng-class="{active: tab == 'results'}"><a href ng-click="tab = 'results'">Results</a></li>
   180  	<li ng-class="{active: tab == 'template'}"><a href ng-click="tab = 'template'">Template</a></li>
   181  	<li ng-class="{active: tab == 'timeline'}"><a href ng-click="tab = 'timeline'">Timeline</a></li>
   182  	<li ng-class="{active: tab == 'notifications'}"><a href ng-click="tab = 'notifications'">Notifications</a></li>
   183  	<li ng-class="{active: tab == 'anotifications'}"><a href ng-click="tab = 'anotifications'">Action Notifications</a></li>
   184  </ul>
   185  
   186  <div class="tab-content">
   187  	<div class="tab-pane" ng-class="{active: tab == 'timeline'}">
   188  		<div ng-if="tab == 'timeline' && fromDate && toDate">
   189  			<div class="row">
   190  				<div class="col-lg-12 timeline" ts-time-line></div>
   191  			</div>
   192  			<div class="row">
   193  				<div class="panel-group" ng-repeat="entry in entries" ng-init="name = entry.key; a = entry.value">
   194  					<div class="panel panel-default">
   195  						<div class="panel-heading panel-title" ng-click="collapse('group' + $index)">
   196  							<span ng-bind="name"></span>
   197  							<span class="pull-right" ng-bind="a.History.length + ' events'"></span>
   198  						</div>
   199  						<div class="panel-body" ng-if="shown['group' + $index]">
   200  							<div class="panel-group">
   201  								<div class="panel" ng-class="panelClass(v.Status)" ng-repeat="v in a.History">
   202  									<div class="panel-heading" ng-click="collapse('panel' + $parent.$index + '-' + $index,entry,v)" id="{{'panel' + $parent.$index + '-' + $index}}">
   203  										<h4 class="panel-title">
   204  											<a href>
   205  												<span ng-bind="name + ': ' + v.Status"></span>
   206  												<span class="pull-right" ng-show="v.Time" ts-time="v.Time" ts-end-time="v.EndTime" no-link="true"></span>
   207  											</a>
   208  										</h4>
   209  									</div>
   210  									<div class="panel-body" ng-if="shown['panel' + $parent.$index + '-' + $index]">
   211  										<div ng-show="!v.doneLoading">Loading...</div>
   212  										<div class="row" ng-show="v.error">
   213  											<div class="col-lg-12">
   214  												<pre class="alert alert-danger" ng-bind="v.error" style="white-space: pre-wrap;"></pre>
   215  											</div>
   216  										</div>
   217  										<div class="panel panel-default">
   218  											<div class="panel-heading">
   219  												<h3 class="panel-title">Subject</h3>
   220  											</div>
   221  											<div class="panel-body template" ng-bind="v.subject"></div>
   222  										</div>
   223  										<div class="panel panel-default">
   224  											<div class="panel-heading">
   225  												<h3 class="panel-title">Body</h3>
   226  											</div>
   227  											<div class="panel-body template" ng-bind-html="v.body"></div>
   228  										</div>
   229  									</div>
   230  								</div>
   231  							</div>
   232  						</div>
   233  					</div>
   234  				</div>
   235  			</div>
   236  		</div>
   237  	</div>
   238  	<div class="tab-pane" ng-class="{active: tab == 'template'}">
   239  		<div class="panel panel-default">
   240  			<div class="panel-heading">
   241  				<h3 class="panel-title">Subject</h3>
   242  			</div>
   243  			<div class="panel-body template" ng-bind="subject"></div>
   244  		</div>
   245  		<div class="panel panel-default">
   246  			<div class="panel-heading">
   247  				<h3 class="panel-title">Body</h3>
   248  			</div>
   249  			<div class="panel-body template" ng-bind-html="body"></div>
   250  		</div>
   251  		<div class="panel panel-default" ng-if="emailSubject">
   252  			<div class="panel-heading">
   253  				<h3 class="panel-title">Email Subject</h3>
   254  			</div>
   255  			<div class="panel-body template" ng-bind="emailSubject"></div>
   256  		</div>
   257  		<div class="panel panel-default" ng-if="emailBody">
   258  			<div class="panel-heading">
   259  				<h3 class="panel-title">Email Body</h3>
   260  			</div>
   261  			<div class="panel-body template" ng-bind-html="emailBody"></div>
   262  		</div>
   263  		<div class="panel panel-default" ng-repeat="(name, bod) in customTemplates">
   264  			<div class="panel-heading">
   265  				<h3 class="panel-title">{{name}}</h3>
   266  			</div>
   267  			<div class="panel-body template" ng-bind-html="bod"></div>
   268  		</div>
   269  		<h4>Available Variables</h4>
   270  		<pre ng-bind="data"></pre>
   271  	</div>
   272  	<div class="tab-pane" ng-class="{active: tab == 'results'}">
   273  		<div class="row">
   274  			<div class="col-sm-6">
   275  				<table class="table">
   276  					<thead>
   277  						<tr>
   278  							<th>Time</th>
   279  							<th>Criticals</th>
   280  							<th>Warnings</th>
   281  							<th>Normals</th>
   282  						</tr>
   283  					</thead>
   284  					<tbody>
   285  						<tr ng-repeat="set in sets">
   286  							<td>
   287  								<a href="#" ng-bind="set.Time" ng-click="scrollToInterval($index)"></a>
   288  							</td>
   289  							<td ng-bind="set.Critical || ''" ng-class="set.Critical ? 'danger' : ''"></td>
   290  							<td ng-bind="set.Warning || ''" ng-class="set.Warning ? 'warning' : ''"></td>
   291  							<td ng-bind="set.Normal || ''" ng-class="set.Normal ? 'success' : ''"></td>
   292  						</tr>
   293  					</tbody>
   294  				</table>
   295  			</div>
   296  		</div>
   297  		<div class="row" ng-repeat="set in sets">
   298  			<div class="col-sm-12">
   299  				<h4 id="time-{{$index}}">
   300  					Time: {{set.Time}}
   301  					<small>criticals: {{set.Critical}}, warnings: {{set.Warning}}, normals: {{set.Normal}}</small>
   302  					<button class="btn btn-default btn-sm" ng-hide="set.Results" ng-click="show(set)" ng-bind="set.Show || 'show'" ng-disabled="set.Show"></button>
   303  				</h4>
   304  				<table class="table" ng-show="set.Results">
   305  					<thead>
   306  						<tr>
   307  							<th>Group</th>
   308  							<th>Status</th>
   309  							<th>Expression</th>
   310  							<th>Result</th>
   311  							<th>Computations</th>
   312  						</tr>
   313  					</thead>
   314  					<tbody ng-repeat="r in set.Results" ng-init="result = r.Result; group = r.Group">
   315  						<tr>
   316  							<td rowspan="2" ng-bind="zws(group)" ng-click="setTemplateGroup(group)"></td>
   317  							<td rowspan="2" ng-bind="result.Status" ng-class="panelClass(result.Status, '')"></td>
   318  							<td ng-if="result.Crit">critical</td>
   319  							<td ng-if="result.Crit">
   320  								<pre ng-bind="json(result.Crit.Value)" ng-show="result.Crit"></pre>
   321  							</td>
   322  							<td ng-if="result.Crit" ts-computations="result.Crit.Computations"></td>
   323  						</tr>
   324  						<tr ng-if="result.Warn">
   325  							<td>warning</td>
   326  							<td>
   327  								<pre ng-bind="json(result.Warn.Value)" ng-show="result.Warn"></pre>
   328  							</td>
   329  							<td ts-computations="result.Warn.Computations"></td>
   330  						</tr>
   331  					</tbody>
   332  				</table>
   333  			</div>
   334  		</div>
   335  	</div>
   336  	<div class="tab-pane" ng-class="{active: tab == 'notifications'}">
   337  		<div style='margin-top:10px;'>
   338  			<div class="panel panel-default" ng-repeat="(name, dat) in notifications">
   339  				<div class="panel-heading">
   340  					<h3 class="panel-title">{{name}}</h3>
   341  				</div>
   342  				<div class="panel-body">
   343  					<notification dat="dat"></notification>
   344  				</div>
   345  				<div ng-hide="notifications" class='col-md-12'>
   346  					<h4>No Notifications</h4>
   347  				</div>
   348  			</div>
   349  		</div>
   350  	</div>
   351  
   352  	<div class="tab-pane" ng-class="{active: tab == 'anotifications'}">
   353  		<div style='margin-top:10px;'>
   354  			
   355  			<div class="dropdown selectorDropdown" style="float:none;margin-bottom:10px;" ng-if="actionNotifications">
   356  				<button class="btn btn-primary btn-xs dropdown-toggle" type="button" data-toggle="dropdown">
   357  						{{notificationToShow}} <i class="fa fa-caret-down"></i>
   358  					</button>
   359  					<ul class="dropdown-menu section-button" role="menu">
   360  						<li role="presentation" ng-repeat="(n, ats) in actionNotifications"><a role="menuitem" tabindex="-1" ng-click="setNotificationToShow(n)">{{n}}</a></li>
   361  					</ul>
   362  			</div>
   363  			<div ng-repeat="(n, ats) in actionNotifications">
   364  				<div class="panel panel-default" ng-if="n==notificationToShow" ng-repeat="(at, dat) in ats">
   365  					<div class="panel-heading">
   366  						<h3 class="panel-title">{{n}} {{at}}</h3>
   367  					</div>
   368  					<div class="panel-body">
   369  						<notification dat="dat"></notification>
   370  					</div>
   371  					<div ng-hide="notifications" class='col-md-12'>
   372  						<h4>No Notifications</h4>
   373  					</div>
   374  				</div>
   375  			</div>
   376  		</div>
   377  	</div>
   378  
   379  	<div class="modal fade" id="configSaveModal" tabindex="-1" role="dialog">
   380  		<div class="modal-dialog modal-admin" role="document">
   381  			<div class="modal-content">
   382  				<div class="modal-header">
   383  					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
   384  					<h4 class="modal-title" id="myModalLabel">Save Configuration</h4>
   385  				</div>
   386  				<div class="modal-body">
   387  					<div class="form-horizontal">
   388  						<div class="form-group">
   389  							<label class="col-sm-2 control-label">Username</label>
   390  							<div class="col-sm-6">
   391  								<username-input></username-input>
   392  							</div>
   393  						</div>
   394  						<div class="form-group">
   395  							<label class="col-sm-2 control-label">Message</label>
   396  							<div class="col-sm-6">
   397  								<textarea rows="10" class="form-control" ng-model="message"></textarea>
   398  							</div>
   399  						</div>
   400  					</div>
   401  				</div>
   402  				<div>
   403  					<pre ng-bind="diff"></pre>
   404  				</div>
   405  				<div class="modal-footer">
   406  					<button type="button" class="btn btn-primary" ng-click="diffConfig()">Refresh Diff</button>
   407  					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
   408  					<button type="button" class="btn btn-primary" ng-class="runningChanged == true ? 'alert-warning' : ''" data-dismiss="modal"
   409  					 ng-click="saveConfig()" title="This will save and reload the config if the config is valid. If the config is not valid (or if the Diff has changed since viewing it) the config will not be saved and a reload will not happen. If this button is yellow (warning) then the running config has changed since you started editing on the rule page - be careful not to overwrite other's changes.">Save and Reload</button>
   410  				</div>
   411  			</div>
   412  		</div>
   413  	</div>