This is an automated email from the ASF dual-hosted git repository.

xhsun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b31ff6  [TE] frontend - harleyjj/yaml-editor - increases toast 
timeout from 4 seconds to 10 seconds (#4004)
4b31ff6 is described below

commit 4b31ff6e7fe09f69eb4b2e39f49009c191da65ea
Author: Harley Jackson <harleyy...@gmail.com>
AuthorDate: Fri Mar 22 07:36:36 2019 -0700

    [TE] frontend - harleyjj/yaml-editor - increases toast timeout from 4 
seconds to 10 seconds (#4004)
---
 .../app/pods/components/alert-details/component.js  |  4 ++--
 .../app/pods/components/yaml-editor/component.js    | 21 +++++++++++----------
 .../app/pods/manage/explore/route.js                | 12 +++++++-----
 .../thirdeye-frontend/app/pods/manage/yaml/route.js |  9 +++++----
 thirdeye/thirdeye-frontend/app/utils/constants.js   | 18 ++++++++++++------
 5 files changed, 37 insertions(+), 27 deletions(-)

diff --git 
a/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js 
b/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js
index 37433f4..978eb61 100644
--- a/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js
+++ b/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js
@@ -17,6 +17,7 @@ import Component from '@ember/component';
 import { computed, observer, set, get, getProperties } from '@ember/object';
 import { later } from '@ember/runloop';
 import { checkStatus, humanizeFloat, postProps } from 
'thirdeye-frontend/utils/utils';
+import { toastOptions } from 'thirdeye-frontend/utils/constants';
 import { colorMapping, toColor, makeTime, toMetricLabel, extractTail } from 
'thirdeye-frontend/utils/rca-utils';
 import { getYamlPreviewAnomalies,
   getAnomaliesByAlertId,
@@ -496,7 +497,6 @@ export default Component.extend({
       isPreviewMode,
       alertId
     } = this.getProperties('analysisRange', 'notifications', 'isPreviewMode', 
'alertId');
-
     //detection alert fetch
     const start = analysisRange[0];
     const end = analysisRange[1];
@@ -547,7 +547,7 @@ export default Component.extend({
         });
       }
     } catch (error) {
-      notifications.error(error.body.message);
+      notifications.error(error.body.message, toastOptions);
     }
 
     return {
diff --git 
a/thirdeye/thirdeye-frontend/app/pods/components/yaml-editor/component.js 
b/thirdeye/thirdeye-frontend/app/pods/components/yaml-editor/component.js
index 7f39068..1785d45 100644
--- a/thirdeye/thirdeye-frontend/app/pods/components/yaml-editor/component.js
+++ b/thirdeye/thirdeye-frontend/app/pods/components/yaml-editor/component.js
@@ -24,7 +24,7 @@
 import Component from '@ember/component';
 import {computed, set, get, getProperties, setProperties} from '@ember/object';
 import {checkStatus} from 'thirdeye-frontend/utils/utils';
-import {yamlAlertProps, yamlAlertSettings} from 
'thirdeye-frontend/utils/constants';
+import {yamlAlertProps, yamlAlertSettings, toastOptions} from 
'thirdeye-frontend/utils/constants';
 import yamljs from 'yamljs';
 import RSVP from "rsvp";
 import fetch from 'fetch';
@@ -141,7 +141,7 @@ export default Component.extend({
       const json = yield response.json();
       return json.filterBy('yaml');
     } catch (error) {
-      notifications.error('Failed to retrieve subscription groups.', 'Error');
+      notifications.error('Failed to retrieve subscription groups.', 'Error', 
toastOptions);
     }
   }).drop(),
 
@@ -404,12 +404,12 @@ export default Component.extend({
               set(this, 'subscriptionMsg', result.subscriptionMsg);
             }
             if (result.detectionAlertConfigId && result.detectionConfigId) {
-              notifications.success('Created alert successfully.', 'Created');
+              notifications.success('Created alert successfully.', 'Created', 
toastOptions);
             }
           }
         });
       }).catch((error) => {
-        notifications.error('Create alert failed.', error);
+        notifications.error('Create alert failed.', error, toastOptions);
       });
     },
 
@@ -425,6 +425,7 @@ export default Component.extend({
         alertId,
         subscriptionGroupId
       } = getProperties(this, 'detectionYaml', 'subscriptionYaml', 
'notifications', 'alertId', 'subscriptionGroupId');
+
       //PUT alert
       const alert_url = `/yaml/${alertId}`;
       const alertPostProps = {
@@ -438,12 +439,12 @@ export default Component.extend({
         const alert_json = await alert_result.json();
         if (alert_status !== 200) {
           set(this, 'errorMsg', get(alert_json, 'message'));
-          notifications.error('Failed to save the detection configuration.', 
'Error');
+          notifications.error('Failed to save the detection configuration.', 
'Error', toastOptions);
         } else {
-          notifications.success('Detection configuration saved successfully', 
'Done', alert_json);
+          notifications.success('Detection configuration saved successfully', 
'Done', toastOptions);
         }
       } catch (error) {
-        notifications.error('Error while saving detection config.', error);
+        notifications.error('Error while saving detection config.', error, 
toastOptions);
       }
       //PUT settings
       const setting_url = `/yaml/subscription/${subscriptionGroupId}`;
@@ -458,12 +459,12 @@ export default Component.extend({
         const settings_json = await settings_result.json();
         if (settings_status !== 200) {
           set(this, 'errorMsg', get(settings_json, 'message'));
-          notifications.error('Failed to save the subscription 
configuration.', 'Error');
+          notifications.error('Failed to save the subscription 
configuration.', 'Error', toastOptions);
         } else {
-          notifications.success('Subscription configuration saved 
successfully', 'Done', settings_json);
+          notifications.success('Subscription configuration saved 
successfully', 'Done', toastOptions);
         }
       } catch (error) {
-        notifications.error('Error while saving subscription config', error);
+        notifications.error('Error while saving subscription config', error, 
toastOptions);
       }
     }
   }
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/explore/route.js 
b/thirdeye/thirdeye-frontend/app/pods/manage/explore/route.js
index af7b89e..d3cc243 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/explore/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/explore/route.js
@@ -7,6 +7,7 @@ import Route from '@ember/routing/route';
 import RSVP from 'rsvp';
 import { set, get } from '@ember/object';
 import { inject as service } from '@ember/service';
+import { toastOptions } from 'thirdeye-frontend/utils/constants';
 import yamljs from 'yamljs';
 import moment from 'moment';
 
@@ -20,6 +21,7 @@ export default Route.extend({
       headers: { 'content-type': 'application/json' }
     };
     const notifications = get(this, 'notifications');
+
     //detection alert fetch
     const detectionUrl = `/detection/${alertId}`;
     try {
@@ -27,7 +29,7 @@ export default Route.extend({
       const detection_status  = get(detection_result, 'status');
       const detection_json = await detection_result.json();
       if (detection_status !== 200) {
-        notifications.error('Retrieval of alert yaml failed.', 'Error');
+        notifications.error('Retrieval of alert yaml failed.', 'Error', 
toastOptions);
       } else {
         if (detection_json.yaml) {
           const detectionInfo = yamljs.parse(detection_json.yaml);
@@ -54,7 +56,7 @@ export default Route.extend({
         }
       }
     } catch (error) {
-      notifications.error('Retrieving alert yaml failed.', error);
+      notifications.error('Retrieving alert yaml failed.', error, 
toastOptions);
     }
 
     //subscription group fetch
@@ -64,12 +66,12 @@ export default Route.extend({
       const settings_status  = get(settings_result, 'status');
       const settings_json = await settings_result.json();
       if (settings_status !== 200) {
-        notifications.error('Retrieving subscription groups failed.', 'Error');
+        notifications.error('Retrieving subscription groups failed.', 'Error', 
toastOptions);
       } else {
         set(this, 'subscriptionGroups', settings_json);
       }
     } catch (error) {
-      notifications.error('Retrieving subscription groups failed.', error);
+      notifications.error('Retrieving subscription groups failed.', error, 
toastOptions);
     }
 
     let subscribedGroups = "";
@@ -79,7 +81,7 @@ export default Route.extend({
         if (groups.hasOwnProperty(key)) {
           let group = groups[key];
           if (subscribedGroups === "") {
-            subscribedGroups = group.name
+            subscribedGroups = group.name;
           } else {
             subscribedGroups = subscribedGroups + ", " + group.name;
           }
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/yaml/route.js 
b/thirdeye/thirdeye-frontend/app/pods/manage/yaml/route.js
index d88f574..1779c4a 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/yaml/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/yaml/route.js
@@ -9,6 +9,7 @@ import { set, get } from '@ember/object';
 import { inject as service } from '@ember/service';
 import yamljs from 'yamljs';
 import moment from 'moment';
+import { toastOptions } from 'thirdeye-frontend/utils/constants';
 
 export default Route.extend({
   notifications: service('toast'),
@@ -28,7 +29,7 @@ export default Route.extend({
       const detection_status  = get(detection_result, 'status');
       const detection_json = await detection_result.json();
       if (detection_status !== 200) {
-        notifications.error('Retrieval of alert yaml failed.', 'Error');
+        notifications.error('Retrieval of alert yaml failed.', 'Error', 
toastOptions);
       } else {
         if (detection_json.yaml) {
           const detectionInfo = yamljs.parse(detection_json.yaml);
@@ -51,7 +52,7 @@ export default Route.extend({
         }
       }
     } catch (error) {
-      notifications.error('Retrieving alert yaml failed.', error);
+      notifications.error('Retrieving alert yaml failed.', error, 
toastOptions);
     }
 
     //subscription group fetch
@@ -61,12 +62,12 @@ export default Route.extend({
       const settings_status  = get(settings_result, 'status');
       const settings_json = await settings_result.json();
       if (settings_status !== 200) {
-        notifications.error('Retrieving subscription groups failed.', 'Error');
+        notifications.error('Retrieving subscription groups failed.', 'Error', 
toastOptions);
       } else {
         set(this, 'subscriptionGroups', settings_json);
       }
     } catch (error) {
-      notifications.error('Retrieving subscription groups failed.', error);
+      notifications.error('Retrieving subscription groups failed.', error, 
toastOptions);
     }
 
     let subscribedGroups = "";
diff --git a/thirdeye/thirdeye-frontend/app/utils/constants.js 
b/thirdeye/thirdeye-frontend/app/utils/constants.js
index 7bbe8b0..454d4a6 100644
--- a/thirdeye/thirdeye-frontend/app/utils/constants.js
+++ b/thirdeye/thirdeye-frontend/app/utils/constants.js
@@ -5,11 +5,6 @@ export const deleteProps = {
   credentials: 'include'
 };
 
-export default {
-  deleteProps
-};
-
-
 export const yamlAlertProps = `# Below is a sample template for setting up a 
WoW percentage rule. You may refer the documentation for more examples and 
update the fields accordingly.
 
 # Give a name for this anomaly detection pipeline (should be unique)
@@ -51,7 +46,7 @@ application: thirdeye-internal
 # The default notification type. See additional settings for details and 
exploring other notification types like dimension alerter.
 type: DEFAULT_ALERTER_PIPELINE
 
-# List of detection names that you want to subscribe. Copy-paste the detection 
name from the above anomaly detection config here. 
+# List of detection names that you want to subscribe. Copy-paste the detection 
name from the above anomaly detection config here.
 subscribedDetections:
   - name_of_the_detection_above
 
@@ -80,3 +75,14 @@ referenceLinks:
 - "Thirdeye FAQs": "http://go/thirdeyefaqs";
 
 `;
+
+export const toastOptions = {
+  timeOut: 10000
+};
+
+export default {
+  deleteProps,
+  yamlAlertProps,
+  yamlAlertSettings,
+  toastOptions
+};


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

Reply via email to