Index: /branches/amp_3_7_2/src/webui/webui/htdocs/new/src/hive/controller/snapshot_controller.py
===================================================================
--- /branches/amp_3_7_2/src/webui/webui/htdocs/new/src/hive/controller/snapshot_controller.py	(revision 2862)
+++ /branches/amp_3_7_2/src/webui/webui/htdocs/new/src/hive/controller/snapshot_controller.py	(working copy)
@@ -51,6 +51,17 @@
         if request.method != "POST":
             return json_response({"status": "Failed", "message": "POST required"}, 405)
 
+        status_data = get_status_for_export()
+
+        if status_data.get("status") == "In Progress":
+            return json_response(
+                {
+                    "status": "Error",
+                    "message": "An Export operation is already in progress. Please try again once it completes"
+                },
+                400
+            )
+
         try:
             body = json.loads(request.body) if request.body else {}
         except:
@@ -97,6 +108,16 @@
 # IMPORT
 # ============================================================
 def import_snapshot(request):
+    status_data = get_status_for_import()
+
+    if status_data.get("status") == "In Progress":
+        return json_response(
+            {
+                "status": "Error",
+                "message": "An Import operation is already in progress. Please try again once it completes"
+            },
+            400
+        )
     try:
         try:
             body = json.loads(request.body)
@@ -159,95 +180,60 @@
         return json_response({"status": "unknown", "message": "Import log not found"}, 200)
 
     try:
-        with open(LOG_FILE_IMPORT) as f:
-            lines = f.readlines()
+        result = get_status_for_import()
 
-        # Find last import start marker
-        start_idx = None
-        for i in range(len(lines) - 1, -1, -1):
-            if "STARTING ELASTICSEARCH SNAPSHOT IMPORT" in lines[i]:
-                start_idx = i
-                break
-
-        # If no marker found, consider entire log
-        relevant_lines = lines[start_idx:] if start_idx is not None else lines
-
-        # Only inspect last N lines of the CURRENT run
-        relevant_lines = relevant_lines[-10:]
-
-        result = {"status": "In Progress"}
-
-        for line in relevant_lines:
-            line_lower = line.lower()
-            # Check for failures - look for "error:" to avoid matching "errors": false in JSON
-            # Also check for "exception" for stack traces
-            if "error:" in line_lower or "exception" in line_lower:
-                ts = extract_timestamp(line)
-                msg = extract_error_message(line)
-                result = {
-                    "status": "Failed",
-                    "failed_at": ts,
-                    "message": msg
-                }
-
-            # Check for success (overrides failure if it comes later)
-            if ("SNAPSHOT RESTORED SUCCESSFULLY" in line
-                    or "DATE RANGE RESTORE COMPLETED" in line):
-                ts = extract_timestamp(line)
-                result = {
-                    "status": "Successful",
-                    "completed_at": ts
-                }
-
         return json_response(result)
 
     except Exception as e:
         oper_log("error", "system", "Import status exception: {}".format(str(e)))
         return json_response({"status": "Failed", "message": "Error fetching import status"}, 500)
+
+
+def get_status_for_import():
+    with open(LOG_FILE_IMPORT) as f:
+        lines = f.readlines()
+    # Find last import start marker
+    start_idx = None
+    for i in range(len(lines) - 1, -1, -1):
+        if "STARTING ELASTICSEARCH SNAPSHOT IMPORT" in lines[i]:
+            start_idx = i
+            break
+    # If no marker found, consider entire log
+    relevant_lines = lines[start_idx:] if start_idx is not None else lines
+    # Only inspect last N lines of the CURRENT run
+    relevant_lines = relevant_lines[-10:]
+    result = {"status": "In Progress"}
+    for line in relevant_lines:
+        line_lower = line.lower()
+        # Check for failures - look for "error:" to avoid matching "errors": false in JSON
+        # Also check for "exception" for stack traces
+        if "error:" in line_lower or "exception" in line_lower:
+            ts = extract_timestamp(line)
+            msg = extract_error_message(line)
+            result = {
+                "status": "Failed",
+                "failed_at": ts,
+                "message": msg
+            }
 
+        # Check for success (overrides failure if it comes later)
+        if ("SNAPSHOT RESTORED SUCCESSFULLY" in line
+                or "DATE RANGE RESTORE COMPLETED" in line):
+            ts = extract_timestamp(line)
+            result = {
+                "status": "Successful",
+                "completed_at": ts
+            }
+    return result
 
+
 def get_export_status():
     if not os.path.exists(LOG_FILE_EXPORT):
         return json_response({"status": "unknown", "message": "Export log not found"}, 200)
 
     try:
-        with open(LOG_FILE_EXPORT, "r") as f:
-            lines = f.readlines()
+        result = get_status_for_export()
 
-        # Find last import start marker
-        start_idx = None
-        for i in range(len(lines) - 1, -1, -1):
-            if "STARTING ELASTICSEARCH SNAPSHOT EXPORT" in lines[i]:
-                start_idx = i
-                break
-
-        # If no marker found, consider entire log
-        relevant_lines = lines[start_idx:] if start_idx is not None else lines
-
-        # Only inspect last N lines of the CURRENT run
-        relevant_lines = relevant_lines[-10:]
-        result = {"status": "In Progress"}
-
-        for line in relevant_lines:
-            line_lower = line.lower()
-            # Check for failures
-            if "error:" in line_lower or "exception" in line_lower:
-                ts = extract_timestamp(line)
-                msg = extract_error_message(line)
-                result = {
-                    "status": "Failed",
-                    "failed_at": ts,
-                    "message": msg
-                }
-
-            # Check for success (overrides failure if it comes later)
-            if "SNAPSHOT CREATED SUCCESSFULLY" in line:
-                ts = extract_timestamp(line)
-                result = {
-                    "status": "Successful",
-                    "completed_at": ts
-                }
-
         return json_response(result)
 
     except Exception as e:
@@ -255,6 +241,42 @@
         return json_response({"status": "Failed", "message": "Error fetching export status"}, 500)
 
 
+def get_status_for_export():
+    with open(LOG_FILE_EXPORT, "r") as f:
+        lines = f.readlines()
+    # Find last import start marker
+    start_idx = None
+    for i in range(len(lines) - 1, -1, -1):
+        if "STARTING ELASTICSEARCH SNAPSHOT EXPORT" in lines[i]:
+            start_idx = i
+            break
+    # If no marker found, consider entire log
+    relevant_lines = lines[start_idx:] if start_idx is not None else lines
+    # Only inspect last N lines of the CURRENT run
+    relevant_lines = relevant_lines[-10:]
+    result = {"status": "In Progress"}
+    for line in relevant_lines:
+        line_lower = line.lower()
+        # Check for failures
+        if "error:" in line_lower or "exception" in line_lower:
+            ts = extract_timestamp(line)
+            msg = extract_error_message(line)
+            result = {
+                "status": "Failed",
+                "failed_at": ts,
+                "message": msg
+            }
+
+        # Check for success (overrides failure if it comes later)
+        if "SNAPSHOT CREATED SUCCESSFULLY" in line:
+            ts = extract_timestamp(line)
+            result = {
+                "status": "Successful",
+                "completed_at": ts
+            }
+    return result
+
+
 def extract_error_message(line):
     """
     Extracts a meaningful error message from a log line.
