From 90055b74672439fde98c7001346856b7127d904f Mon Sep 17 00:00:00 2001
From: cjenkscybercom <christina.jenks@knowit.se>
Date: Thu, 2 Nov 2023 10:47:37 +0100
Subject: [PATCH] CE-2223: move job detail alerts to top of page, reword
 messages

---
 src/api/DataTypes.js             | 10 ++++-----
 src/components/Job/JobDetails.js | 37 ++++++++++++++++++--------------
 2 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/src/api/DataTypes.js b/src/api/DataTypes.js
index be3e4908..15d1ced0 100644
--- a/src/api/DataTypes.js
+++ b/src/api/DataTypes.js
@@ -1,14 +1,14 @@
 const jobMessages = {
-  queued: "job is queued on job server",
+  queued: "job is queued on the server",
   running: "job is running",
-  failed: "job failed",
+  failed: "job has failed",
   successful: "job was successful"
 };
 const typeMap = {
   DEPLOY: "Deployment",
   UNDEPLOY: "Undeployment",
-  START: "Start command",
-  STOP: "Stop command"
+  START: "Start Command",
+  STOP: "Stop Command"
 };
 export class AWXJobDetails {
   constructor(operationType, job) {
@@ -31,7 +31,7 @@ export class AWXJobDetails {
     return this.job?.status.toLowerCase();
   }
   message() {
-    const stem = this.job ? `The ${this.typeLabel()}: ` : "";
+    const stem = this.job ? `${this.typeLabel()}: ` : "";
     const info = this.job
       ? jobMessages[this.job.status.toLowerCase()]
       : "Fetching data";
diff --git a/src/components/Job/JobDetails.js b/src/components/Job/JobDetails.js
index 7d683b75..16a74f1a 100644
--- a/src/components/Job/JobDetails.js
+++ b/src/components/Job/JobDetails.js
@@ -102,19 +102,32 @@ export function JobDetails({ operation, job }) {
       : "-"
   };
 
+  const finishedJobAlerts = finishedJob ? (
+    <Grid
+      item
+      xs={12}
+    >
+      <AlertBannerList alerts={[alert].concat(jobAlert)} />
+    </Grid>
+  ) : null;
+
+  const unFinishedJobsWithAlerts =
+    !finishedJob && alert ? (
+      <Grid
+        item
+        xs={12}
+      >
+        <AlertBannerList alerts={[alert]} />
+      </Grid>
+    ) : null;
+
   return (
     <Grid
       container
       spacing={1}
     >
-      {finishedJob && (
-        <Grid
-          item
-          xs={12}
-        >
-          <AlertBannerList alerts={[alert].concat(jobAlert)} />
-        </Grid>
-      )}
+      {finishedJobAlerts}
+      {unFinishedJobsWithAlerts}
       <Grid
         item
         xs={12}
@@ -143,14 +156,6 @@ export function JobDetails({ operation, job }) {
           </CardContent>
         </Card>
       </Grid>
-      {!finishedJob && alert && (
-        <Grid
-          item
-          xs={12}
-        >
-          <AlertBannerList alerts={[alert]} />
-        </Grid>
-      )}
       <AccessControl
         allowedRoles={["DeploymentToolAdmin", "DeploymentToolIntegrator"]}
         renderNoAccess={() => <></>}
-- 
GitLab