summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/custom_metrics/constants.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/custom_metrics/constants.js')
-rw-r--r--app/assets/javascripts/custom_metrics/constants.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/assets/javascripts/custom_metrics/constants.js b/app/assets/javascripts/custom_metrics/constants.js
new file mode 100644
index 00000000000..2526445fdf9
--- /dev/null
+++ b/app/assets/javascripts/custom_metrics/constants.js
@@ -0,0 +1,12 @@
+export const queryTypes = {
+ business: 'business',
+ response: 'response',
+ system: 'system',
+};
+
+export const formDataValidator = val => {
+ const fieldNames = Object.keys(val);
+ const requiredFields = ['title', 'query', 'yLabel', 'unit', 'group', 'legend'];
+
+ return requiredFields.every(name => fieldNames.includes(name));
+};