From 00e8b6621a7ddf13222144d4acf80421204a23cc Mon Sep 17 00:00:00 2001
From: George Goldberg <george@gberg.me>
Date: Tue, 1 Aug 2017 13:11:29 +0100
Subject: PLT-6595 (Client): Elasticsearch indexing system console UI (#6991)

* PLT-6595: System Console for Elasticsearch Job Management.

* Fixing UI issues

* Fixing colors

* ESLint Fixes.

* Update test snapshots.

* Fixing cancel button

* Fix review comments.

* Config capitalisation.

* Review fixes.
---
 webapp/actions/job_actions.jsx | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 webapp/actions/job_actions.jsx

(limited to 'webapp/actions/job_actions.jsx')

diff --git a/webapp/actions/job_actions.jsx b/webapp/actions/job_actions.jsx
new file mode 100644
index 000000000..75d70faec
--- /dev/null
+++ b/webapp/actions/job_actions.jsx
@@ -0,0 +1,34 @@
+// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import * as JobsActions from 'mattermost-redux/actions/jobs';
+
+import store from 'stores/redux_store.jsx';
+const dispatch = store.dispatch;
+const getState = store.getState;
+
+export function createJob(job, success, error) {
+    JobsActions.createJob(job)(dispatch, getState).then(
+        (data) => {
+            if (data && success) {
+                success(data);
+            } else if (data == null && error) {
+                const serverError = getState().requests.jobs.createJob.error;
+                error({id: serverError.server_error_id, ...serverError});
+            }
+        }
+    );
+}
+
+export function cancelJob(jobId, success, error) {
+    JobsActions.cancelJob(jobId)(dispatch, getState).then(
+        (data) => {
+            if (data && success) {
+                success(data);
+            } else if (data == null && error) {
+                const serverError = getState().requests.jobs.cancelJob.error;
+                error({id: serverError.server_error_id, ...serverError});
+            }
+        }
+    );
+}
-- 
cgit v1.2.3-1-g7c22

