apucher closed pull request #3564: [TE] frontend - harleyjj/create-alert - make
minor improvements to YA…
URL: https://github.com/apache/incubator-pinot/pull/3564
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/thirdeye/thirdeye-frontend/app/pods/self-serve/create-alert/controller.js
b/thirdeye/thirdeye-frontend/app/pods/self-serve/create-alert/controller.js
index 064f5841ce..3fd0819980 100644
--- a/thirdeye/thirdeye-frontend/app/pods/self-serve/create-alert/controller.js
+++ b/thirdeye/thirdeye-frontend/app/pods/self-serve/create-alert/controller.js
@@ -64,7 +64,7 @@ export default Controller.extend({
metricLookupCache: [],
metricHelpMailto: `mailto:${config.email}?subject=Metric Onboarding Request
(non-additive UMP or derived)`,
isForm: true,
- isAlertYamlDisabled: true,
+ disableYamlSave: true,
yamlAlertProps,
/**
@@ -74,6 +74,7 @@ export default Controller.extend({
graphConfig: {},
selectedFilters: JSON.stringify({}),
selectedWeeklyEffect: true,
+ alertYamlContent: null,
/**
* Object to cover basic ield 'presence' validation
@@ -404,6 +405,20 @@ export default Controller.extend({
}
),
+ /**
+ * sets Yaml value displayed to contents of alertYamlContent or
yamlAlertProps
+ * @method currentYamlValues
+ * @return {String}
+ */
+ currentYamlValues: computed(
+ 'yamlAlertProps',
+ 'alertYamlContent',
+ function() {
+ const inputYaml = this.get('alertYamlContent');
+ return (inputYaml ? inputYaml : this.get('yamlAlertProps'));
+ }
+ ),
+
/**
* Enables the submit button when all required fields are filled
* @method isSubmitDisabled
@@ -761,19 +776,28 @@ export default Controller.extend({
actions: {
/**
- * Navigate to Alert Page
+ * Clears YAML content, disables 'save changes' button, and moves to form
+ */
+ cancelAlertYaml() {
+ set(this, 'disableYamlSave', true);
+ set(this, 'alertYamlContent', null);
+ set(this, 'isForm', true);
+ },
+
+ /**
+ * Activates 'save changes' button and stores YAML content in
alertYamlContent
*/
onYMLSelector(value) {
- set(this, 'isAlertYamlDisabled', !this.get('isAlertYamlDisabled'));
+ set(this, 'disableYamlSave', false);
set(this, 'alertYamlContent', value);
- //this.transitionToRoute('manage.alert.explore', this.get('id'));
},
/**
- * Navigate to Alert Page
+ * Fired by save button in YAML UI
+ * Grabs YAML content and sends it
*/
saveAlertYaml() {
- set(this, 'isAlertYamlDisabled', !this.get('isAlertYamlDisabled'));
+ set(this, 'disableYamlSave', true);
const content = get(this, 'alertYamlContent');
const url = '/yaml';
const postProps = {
diff --git
a/thirdeye/thirdeye-frontend/app/pods/self-serve/create-alert/template.hbs
b/thirdeye/thirdeye-frontend/app/pods/self-serve/create-alert/template.hbs
index 6d08999e7f..817ff0adfe 100644
--- a/thirdeye/thirdeye-frontend/app/pods/self-serve/create-alert/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/self-serve/create-alert/template.hbs
@@ -10,7 +10,7 @@
onToggle=(action (mut isForm))
as |toggle|}}
{{#toggle.label value=isForm}}
- <span class="te-label te-label--flush">{{if isForm 'Form'
'YAML'}}</span>
+ <span class="te-label te-label--flush">{{if isForm 'YAML'
'Form'}}</span>
{{/toggle.label}}
{{toggle.switch theme='ios' onLabel='diff on' offLabel='diff off'}}
{{/x-toggle}}
@@ -423,7 +423,7 @@
<legend class="te-form__section-title">Define alert in YAML</legend>
{{ember-ace
lines=35
- value=yamlAlertProps
+ value=currentYamlValues
update=(action 'onYMLSelector')
mode="ace/mode/yaml"
}}
@@ -444,14 +444,14 @@
defaultText="Cancel"
type="outline-primary"
buttonType="cancel"
- onClick=(action (mut isForm))
+ onClick=(action "cancelAlertYaml")
class="te-button te-button--cancel"
}}
{{bs-button
defaultText="Save changes"
type="primary"
buttonType="submit"
- disabled=isAlertYamlDisabled
+ disabled=disableYamlSave
onClick=(action "saveAlertYaml")
class="te-button te-button--submit"
}}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]