JoeFuentes-WebDev commented on a change in pull request #6448:
URL: https://github.com/apache/incubator-pinot/pull/6448#discussion_r560610345



##########
File path: 
thirdeye/thirdeye-frontend/app/pods/components/alert-details/template.hbs
##########
@@ -40,102 +29,88 @@
               <p>Click "Rerun Preview" to get the preview for your updated 
configuration</p>
             {{/if}}
           </div>
-        {{/if}}
-        {{#if dataIsCurrent}}
-          <div class="col-xs-12 preview">
-            <div class="col-xs-2 no-padding">
-              <label class="te-label te-label--display">Display Window
-                <span>
-                  <i class="glyphicon glyphicon-question-sign"></i>
-                  {{#tooltip-on-element class="te-tooltip"}}
-                    This is the maximum display period in days. You can zoom 
into the chart further using the mouse wheel.
-                  {{/tooltip-on-element}}
-                </span>
-              </label>
-            </div>
-            <div class="col-xs-4 no-padding">
-              {{date-range-picker
-                class="te-range-picker"
-                alwaysShowCalendars=true
-                timePicker=true
-                timePicker24Hour=true
-                timePickerIncrement=pill.timePickerIncrement
-                start=pill.activeRangeStart
-                end=pill.activeRangeEnd
-                ranges=pill.predefinedRanges
-                showCustomRangeLabel=false
-                format=pill.uiDateFormat
-                serverFormat="YYYY-MM-DD HH:mm"
-                applyAction=(action "onRangeSelection")
-              }}
-            </div>
-          </div>
-
-          {{#if alertId}}
-
-          <div class="te-content-block__performance-health-wrapper">
-            <!-- Anomalies, Response Rate, Precision, Recall -->
-            <div class="te-horizontal-cards 
te-content-block__alert-performance">
-              <h4 class="te-self-serve__block-title">
-                <label for="select-dimension" class="control-label te-label">
-                  Alert Performance
-                  <span>
-                    <i class="glyphicon glyphicon-question-sign"></i>
-                    {{#tooltip-on-element class="te-tooltip"}}
-                      All estimated performance numbers are based on reviewed 
anomalies.
-                    {{/tooltip-on-element}}
-                  </span>
-                </label>
-              </h4>
-              {{!-- Alert anomaly stats cards --}}
-              {{#if performanceStatsTaskInstance.isRunning }}
-                <div class="spinner-wrapper spinner-wrapper--card">
-                  {{ember-spinner lines=30 radius=20 length=0 width=10 
opacity=0 trail=75 color='blue'}}
-                </div>
-              {{else}}  
-                {{stats-cards
-                  stats=computedStats
-                  areTwoSetsOfAnomalies=areTwoSetsOfAnomalies
-                  isEditMode=isEditMode
-                }}
-              {{/if}}
-            </div>
+          {{#if showDetails}}
+            {{#unless dataIsCurrent}}
+            <div class="detection-yaml-msg">Alert configuration has 
changed.</div>
+            {{/unless}}  
+          {{/if}}
 
-            {{detection-health
-              health=detectionHealth
-              selectedRule=selectedRule
-            }}
-          </div>
-          {{else}}
-            <!-- Anomalies, Response Rate, Precision, Recall -->
-            <div class="te-horizontal-cards te-content-block">
-              <h4 class="te-self-serve__block-title">
-                <label for="select-dimension" class="control-label te-label">
-                  Alert Performance
-                  <span>
-                    <i class="glyphicon glyphicon-question-sign"></i>
-                    {{#tooltip-on-element class="te-tooltip"}}
-                      All estimated performance numbers are based on reviewed 
anomalies.
-                    {{/tooltip-on-element}}
-                  </span>
-                </label>
-              </h4>
-              {{!-- Alert anomaly stats cards --}}
-              {{#if performanceStatsTaskInstance.isRunning }}
-                <div class="spinner-wrapper spinner-wrapper--card">
-                  {{ember-spinner lines=30 radius=20 length=0 width=10 
opacity=0 trail=75 color='blue'}}
-                </div>
-              {{else}}  
-                {{stats-cards
-                  stats=computedStats
-                  areTwoSetsOfAnomalies=areTwoSetsOfAnomalies
-                  isEditMode=isEditMode
+        {{/if}}
+      {{/if}}
+    {{/if}}
+    {{!-- display window + Dropdown --}}
+    {{#unless isPreviewLoading}}
+      {{#unless disablePreviewButton}}
+      <div class="col-xs-12 preview">
+        <div class="col-xs-2 no-padding">
+          <label class="te-label te-label--display">Display Window
+            <span>
+              <i class="glyphicon glyphicon-question-sign"></i>
+              {{#tooltip-on-element class="te-tooltip"}}
+                This is the maximum display period in days. You can zoom into 
the chart further using the mouse wheel.
+              {{/tooltip-on-element}}
+            </span>
+          </label>
+        </div>
+        <div class="col-xs-4 no-padding">
+          {{date-range-picker
+            class="te-range-picker"
+            alwaysShowCalendars=true
+            timePicker=true
+            timePicker24Hour=true
+            timePickerIncrement=pill.timePickerIncrement
+            start=pill.activeRangeStart
+            end=pill.activeRangeEnd
+            ranges=pill.predefinedRanges
+            showCustomRangeLabel=false
+            format=pill.uiDateFormat
+            serverFormat="YYYY-MM-DD HH:mm"
+            applyAction=(action "onRangeSelection")
+          }}
+        </div>
+      </div>
+      {{/unless}}
+    {{/unless}}
+    {{!-- draw chart & table--}}
+    {{#if showDetails}}
+      {{#if dataIsCurrent}}
+        {{#unless isPreviewLoading}}
+            {{!-- Stats Cards --}}
+            <div class="te-content-block__performance-health-wrapper">    
+              <!-- Anomalies, Response Rate, Precision, Recall -->
+              <div class="te-horizontal-cards te-content-block{{if alertId 
'__alert-performance'}}" >
+                <h4 class="te-self-serve__block-title">
+                  <label for="select-dimension" class="control-label te-label">
+                    Alert Performance
+                    <span>
+                      <i class="glyphicon glyphicon-question-sign"></i>
+                      {{#tooltip-on-element class="te-tooltip"}}
+                        All estimated performance numbers are based on 
reviewed anomalies.
+                      {{/tooltip-on-element}}
+                    </span>
+                  </label>
+                </h4>
+                {{!-- Alert anomaly stats cards --}}
+                {{#if performanceStatsTaskInstance.isRunning }}
+                  <div class="spinner-wrapper spinner-wrapper--card">
+                    {{ember-spinner lines=30 radius=20 length=0 width=10 
opacity=0 trail=75 color='blue'}}
+                  </div>
+                {{else}}  
+                  {{stats-cards
+                    stats=computedStats
+                    areTwoSetsOfAnomalies=areTwoSetsOfAnomalies
+                    isEditMode=isEditMode
+                  }}
+                {{/if}}
+              </div>
+              {{#if alertId}}
+                {{detection-health
+                health=detectionHealth
+                selectedRule=selectedRule
                 }}
               {{/if}}

Review comment:
       Agreed.  That said, this is an improvement over the original template. 
   I'll take a look at reducing the nested ifs but I can't promise much 
improvement at this stage
   - the functional refactoring may offer an opportunity to move the 
conditionals from the `template` 
   -into the `component/controller`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to