diff --git a/scripts/runcommand.py b/scripts/runcommand.py index b6062ef..4e20ae5 100644 --- a/scripts/runcommand.py +++ b/scripts/runcommand.py @@ -106,7 +106,7 @@ total = time.time() - start_time nonce = ''.join(random.SystemRandom().choice(string.hexdigits + string.digits) for _ in range(10)) message = {} message["nonce"] = nonce -message["message"] = json.dumps({"output":out, "time_taken": total, "result": 1}) +message["message"] = json.dumps({"output":out, "time_taken": total, "result": exitcode}) message["signature"] = hashlib.sha256(message["message"] + nonce + HASH).hexdigest() message["message"] = encrypt(SHARED_KEY, message["message"]) print curl_post(URL, {"data": json.dumps(message)}).getvalue() \ No newline at end of file diff --git a/web/application/models/Histories.php b/web/application/models/Histories.php index 763184e..db54d4f 100644 --- a/web/application/models/Histories.php +++ b/web/application/models/Histories.php @@ -7,6 +7,18 @@ class Histories extends \system\engine\HF_Model { public $jobs_id; public $run_date; public $time_taken; - public $result; + public $result = null; public $nonce; + + public $h2o_safe = true; + + public function getTRClass() { + if ($this->result == null) { + return ""; + } elseif ($this->result == 0) { + return "success"; + } else { + return "danger"; + } + } } \ No newline at end of file diff --git a/web/application/models/Jobs.php b/web/application/models/Jobs.php index 47b5894..84ef567 100644 --- a/web/application/models/Jobs.php +++ b/web/application/models/Jobs.php @@ -9,7 +9,7 @@ class Jobs extends \system\engine\HF_Model { public $cron; public $failScript; public $last_run; - public $last_result; + public $last_result = null; public $user_id; public $hash; public $sharedkey; @@ -39,4 +39,14 @@ class Jobs extends \system\engine\HF_Model { } } + + public function getTRClass() { + if ($this->last_run == "" || $this->last_result == null) { + return ""; + } elseif ($this->last_result == 0) { + return "success"; + } else { + return "danger"; + } + } } \ No newline at end of file diff --git a/web/application/views/history.html b/web/application/views/history.html index ec8ea53..ea23dd9 100644 --- a/web/application/views/history.html +++ b/web/application/views/history.html @@ -47,11 +47,7 @@ {% endif %} {% for history in histories %} - {% if history.result != 0 %} - - {% else %} - - {% endif %} + View {{history.run_date}} {{history.time_taken}} diff --git a/web/application/views/main.html b/web/application/views/main.html index d50f88d..11ccbee 100644 --- a/web/application/views/main.html +++ b/web/application/views/main.html @@ -22,11 +22,7 @@ {% for job in jobs %} - {% if job.last_result != 0 %} - - {% else %} - - {% endif %} + Edit {{job.jobName}} {{job.getRunType}}