Pārlūkot izejas kodu

AMBARI-15096 Edit WEB Alert should show Critical for Connection Timeout (Joe Wang via rzang)

Richard Zang 9 gadi atpakaļ
vecāks
revīzija
7091250a93

+ 14 - 2
ambari-web/app/controllers/main/alerts/definition_configs_controller.js

@@ -16,6 +16,8 @@
  * limitations under the License.
  */
 
+var numericUtils = require('utils/number_utils');
+
 App.MainAlertDefinitionConfigsController = Em.Controller.extend({
 
   name: 'mainAlertDefinitionConfigsController',
@@ -289,8 +291,18 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
         text: isWizard ? '' : this.getThresholdsProperty('critical', 'text'),
         value: isWizard ? '' : this.getThresholdsProperty('critical', 'value')
       }),
-      App.AlertConfigProperties.ConnectionTimeout.create({
-        value: alertDefinition.get('uri.connectionTimeout')
+      App.AlertConfigProperties.Parameter.create({
+        value: alertDefinition.get('uri.connectionTimeout'),
+        threshold: "CRITICAL",
+        name: 'connection_timeout',
+        label: 'Connection Timeout',
+        displayType: 'parameter',
+        apiProperty: 'source.uri.connection_timeout',
+        units: 'Seconds',
+        isValid: function () {
+          var value = this.get('value');
+          return numericUtils.isPositiveNumber(value);
+        }.property('value')
       })
     ]);
 

+ 0 - 13
ambari-web/app/models/alerts/alert_config.js

@@ -431,19 +431,6 @@ App.AlertConfigProperties = {
     }.property('value')
   }),
 
-  ConnectionTimeout: App.AlertConfigProperty.extend({
-    name: 'connection_timeout',
-    label: 'Connection Timeout',
-    displayType: 'textField',
-    classNames: 'alert-connection-timeout',
-    apiProperty: 'source.uri.connection_timeout',
-    unit: 'Seconds',
-    isValid: function () {
-      var value = this.get('value');
-      return numericUtils.isPositiveNumber(value);
-    }.property('value')
-  }),
-
   DefaultPort: App.AlertConfigProperty.extend({
     name: 'default_port',
     label: 'Default Port',

+ 3 - 2
ambari-web/app/styles/alerts.less

@@ -324,7 +324,7 @@
     padding-right: 13px;
   }
 
-  .alert-interval-input, .alert-connection-timeout {
+  .alert-interval-input {
     input {
       width: 20%;
     }
@@ -338,7 +338,8 @@
 
   .badge-container {
     height: 26px;
-    .alert-threshold-badge {
+    .alert-threshold-badge,
+    .alert-parameter-badge {
       line-height: 26px;
       height: 26px;
     }

+ 5 - 5
ambari-web/app/templates/main/alerts/configs/alert_config_parameter.hbs

@@ -17,13 +17,13 @@
 }}
 
 <div>
-  {{#if view.property.threshold}}
-    <div class="span2 badge-container">
+  <div class="span2 badge-container">
+    {{#if view.property.threshold}}
       <span {{bindAttr class="view.property.badgeCssClass :alert-parameter-badge :alert-state-single-host view.property.threshold:label"}}>
         {{view.property.badge}}
-        </span>&nbsp;
-    </div>
-  {{/if}}
+      </span>&nbsp;
+    {{/if}}
+  </div>
   <div rel="parameter-tooltip" {{bindAttr data-original-title="view.property.description" class="view.bigInput:span12:span3 view.property.units:input-append view.property.thresholdNotExists:stuck-left"}}>
     {{view Em.TextField valueBinding="view.property.value" disabledBinding="view.property.isDisabled" class ="view.bigInput:span12:span7"}}
     {{#if view.property.units}}