From 84db0015fce1ee04e00d072b981cd425911d0c3b Mon Sep 17 00:00:00 2001
From: Domonkos Gulyas <domonkos.gulyas@ess.eu>
Date: Mon, 4 Sep 2023 06:57:20 +0000
Subject: [PATCH] CE-2017: Remove deployment and undeployment comments

---
 .../IOC/ChangeHostAdmin/ChangeHostAdmin.js    | 17 +------------
 .../IOC/IOCDeployDialog/IOCDeployDialog.js    | 12 +---------
 .../IOC/IOCLiveStatus/IOCLiveStatus.js        |  9 -------
 .../IOCUndeployDialog/IOCUndeployDialog.js    | 15 +-----------
 src/components/Job/JobDetails.js              |  1 -
 .../deployments/DeploymentDetails.js          |  1 -
 src/mocks/fixtures/DeploymentInfoDetails.json |  3 ---
 src/mocks/fixtures/IOCDetails.json            |  1 -
 .../fixtures/OperationDeploymentDetails.json  |  3 +--
 src/mocks/fixtures/ccce-api.json              | 24 -------------------
 10 files changed, 4 insertions(+), 82 deletions(-)

diff --git a/src/components/IOC/ChangeHostAdmin/ChangeHostAdmin.js b/src/components/IOC/ChangeHostAdmin/ChangeHostAdmin.js
index aa984133..69cf3eee 100644
--- a/src/components/IOC/ChangeHostAdmin/ChangeHostAdmin.js
+++ b/src/components/IOC/ChangeHostAdmin/ChangeHostAdmin.js
@@ -57,7 +57,6 @@ export default function ChangeHostAdmin({
     ioc.id,
     onError
   );
-  const [comment, setComment] = useState("");
 
   useEffect(() => {
     if (updatedIoc) {
@@ -92,8 +91,7 @@ export default function ChangeHostAdmin({
 
   const modifyHost = () => {
     updateHost({
-      hostCSEntryId: host.csEntryHost.id,
-      comment: comment
+      hostCSEntryId: host.csEntryHost.id
     });
   };
 
@@ -191,19 +189,6 @@ export default function ChangeHostAdmin({
                   filterOptions={(options, state) => options}
                 />
               </Grid>
-              <Grid
-                item
-                xs={12}
-              >
-                <TextField
-                  id="comment"
-                  autoComplete="off"
-                  label="Deployment comment"
-                  variant="outlined"
-                  onChange={(event) => setComment(event.target.value)}
-                  fullWidth
-                />
-              </Grid>
               <Grid
                 item
                 xs={12}
diff --git a/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js b/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js
index 0a2f0dd1..19a94f52 100644
--- a/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js
+++ b/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js
@@ -73,12 +73,10 @@ export function IOCDeployDialog({
 
   const onSubmit = (event) => {
     event.preventDefault();
-    const { comment: commentText, git: gitText } = event.currentTarget.elements;
-    const comment = commentText.value;
+    const { git: gitText } = event.currentTarget.elements;
     const git = gitText.value;
 
     submitCallback({
-      comment: comment,
       sourceUrl: git,
       sourceVersion: gitVersion,
       hostCSEntryId: host
@@ -130,14 +128,6 @@ export function IOCDeployDialog({
           {hasActiveDeployment ? "Deploy revision" : "Deploy"}
         </DialogTitle>
         <DialogContent>
-          <TextField
-            autoComplete="off"
-            className={classes.textField}
-            id="comment"
-            label="Deployment comment"
-            variant="outlined"
-            fullWidth
-          />
           <TextField
             autoComplete="off"
             className={classes.textField}
diff --git a/src/components/IOC/IOCLiveStatus/IOCLiveStatus.js b/src/components/IOC/IOCLiveStatus/IOCLiveStatus.js
index 398b95f1..f9d2ad36 100644
--- a/src/components/IOC/IOCLiveStatus/IOCLiveStatus.js
+++ b/src/components/IOC/IOCLiveStatus/IOCLiveStatus.js
@@ -58,7 +58,6 @@ export function IOCLiveStatus({ ioc }) {
       ) : (
         grayOutNoText
       ),
-      "Deployment comment": grayOutNoText,
       "Deployed on":
         iocHasDeployment && ioc.activeDeployment?.host.csEntryIdValid ? (
           <Typography>
@@ -80,14 +79,6 @@ export function IOCLiveStatus({ ioc }) {
       "Created by": ioc.createdBy
     };
 
-    // show comment only for deployments and where comment field is filled
-    if (ioc.activeDeployment && !ioc.activeDeployment.isUndeployment) {
-      subset["Deployment comment"] =
-        ioc.activeDeployment?.comment?.length > 0
-          ? ioc.activeDeployment?.comment
-          : grayOutNoText;
-    }
-
     return subset;
   }, []);
 
diff --git a/src/components/IOC/IOCUndeployDialog/IOCUndeployDialog.js b/src/components/IOC/IOCUndeployDialog/IOCUndeployDialog.js
index 5cbde483..1fc84a3e 100644
--- a/src/components/IOC/IOCUndeployDialog/IOCUndeployDialog.js
+++ b/src/components/IOC/IOCUndeployDialog/IOCUndeployDialog.js
@@ -2,7 +2,6 @@ import React from "react";
 import { styled } from "@mui/material/styles";
 import {
   Button,
-  TextField,
   Dialog,
   DialogActions,
   DialogContent,
@@ -36,12 +35,8 @@ export function IOCUndeployDialog({
 
   const onSubmit = (event) => {
     event.preventDefault();
-    const { comment: commentText } = event.currentTarget.elements;
-    const comment = commentText.value;
 
-    submitCallback({
-      comment: comment
-    });
+    submitCallback();
   };
 
   return (
@@ -56,14 +51,6 @@ export function IOCUndeployDialog({
             Do you really want to undeploy {ioc.namingName} from{" "}
             {ioc.activeDeployment.host.fqdn}?
           </DialogContentText>
-          <TextField
-            autoComplete="off"
-            className={classes.textField}
-            id="comment"
-            label="Undeployment comment"
-            variant="outlined"
-            fullWidth
-          />
           {error ? (
             <Alert
               severity="error"
diff --git a/src/components/Job/JobDetails.js b/src/components/Job/JobDetails.js
index 6c9c8b3a..42d19f28 100644
--- a/src/components/Job/JobDetails.js
+++ b/src/components/Job/JobDetails.js
@@ -92,7 +92,6 @@ export function JobDetails({ operation, job }) {
         revision={operation.gitShortReference}
       />
     ),
-    comment: operation.comment ? operation.comment : "",
     host: calculateHostText(),
     user: operation.createdBy,
     repository: (
diff --git a/src/components/deployments/DeploymentDetails.js b/src/components/deployments/DeploymentDetails.js
index b74bd82d..2b7bca3b 100644
--- a/src/components/deployments/DeploymentDetails.js
+++ b/src/components/deployments/DeploymentDetails.js
@@ -100,7 +100,6 @@ export function DeploymentDetails({ deployment, deploymentJob }) {
         revision={deployment?.sourceVersion}
       />
     ),
-    comment: deployment.comment?.length > 0 ? deployment.comment : "---",
     host: calculateHostText(),
     user: deployment.createdBy,
     repository: (
diff --git a/src/mocks/fixtures/DeploymentInfoDetails.json b/src/mocks/fixtures/DeploymentInfoDetails.json
index d88267ae..6347c39e 100644
--- a/src/mocks/fixtures/DeploymentInfoDetails.json
+++ b/src/mocks/fixtures/DeploymentInfoDetails.json
@@ -8,7 +8,6 @@
     "gitProjectId": 4801,
     "sourceVersion": "ee3ae2a8b9e7e83e4eb511eee340716e9d541056",
     "endDate": "2022-02-11T12:29:29.595+00:00",
-    "comment": "",
     "host": {
       "csEntryId": 1060,
       "fqdn": "jsparger-test.cslab.esss.lu.se"
@@ -28,7 +27,6 @@
     "gitProjectId": 5215,
     "sourceVersion": "0.0.1",
     "endDate": "2022-02-11T12:30:57.888+00:00",
-    "comment": "",
     "host": {
       "csEntryId": 1060,
       "fqdn": "jsparger-test.cslab.esss.lu.se"
@@ -48,7 +46,6 @@
     "gitProjectId": 5215,
     "sourceVersion": "0.0.1",
     "endDate": "2022-02-11T13:06:32.280+00:00",
-    "comment": "",
     "host": {
       "csEntryId": 1060,
       "fqdn": "jsparger-test.cslab.esss.lu.se"
diff --git a/src/mocks/fixtures/IOCDetails.json b/src/mocks/fixtures/IOCDetails.json
index 6655d631..5772cafb 100644
--- a/src/mocks/fixtures/IOCDetails.json
+++ b/src/mocks/fixtures/IOCDetails.json
@@ -33,7 +33,6 @@
       "gitProjectId": 4801,
       "sourceVersion": "ee3ae2a8b9e7e83e4eb511eee340716e9d541056",
       "endDate": "2022-04-06T07:35:20.736+00:00",
-      "comment": "",
       "iocName": "CCCE:SC-IOC-001",
       "host": {
         "csEntryId": 4195,
diff --git a/src/mocks/fixtures/OperationDeploymentDetails.json b/src/mocks/fixtures/OperationDeploymentDetails.json
index fb8c8fd0..3b850968 100644
--- a/src/mocks/fixtures/OperationDeploymentDetails.json
+++ b/src/mocks/fixtures/OperationDeploymentDetails.json
@@ -19,6 +19,5 @@
   },
   "awxJobId": 374182,
   "awxJobUrl": null,
-  "alerts": [],
-  "comment": "First deploy"
+  "alerts": []
 }
diff --git a/src/mocks/fixtures/ccce-api.json b/src/mocks/fixtures/ccce-api.json
index f4f19b60..6811ef1d 100644
--- a/src/mocks/fixtures/ccce-api.json
+++ b/src/mocks/fixtures/ccce-api.json
@@ -3456,9 +3456,6 @@
             "type": "string",
             "format": "date-time"
           },
-          "comment": {
-            "type": "string"
-          },
           "iocName": {
             "type": "string"
           },
@@ -3508,9 +3505,6 @@
           "hostCSEntryId": {
             "type": "integer",
             "format": "int64"
-          },
-          "comment": {
-            "type": "string"
           }
         },
         "description": "IOC to update"
@@ -3583,15 +3577,6 @@
         },
         "description": "IOC to create"
       },
-      "Undeployment": {
-        "type": "object",
-        "properties": {
-          "comment": {
-            "type": "string"
-          }
-        },
-        "description": "Undeployment parameters"
-      },
       "DeploymentHostInfo": {
         "type": "object",
         "properties": {
@@ -3662,9 +3647,6 @@
       "UpdateAndDeployIoc": {
         "type": "object",
         "properties": {
-          "comment": {
-            "type": "string"
-          },
           "sourceVersion": {
             "type": "string"
           },
@@ -4461,9 +4443,6 @@
             "type": "string",
             "format": "date-time"
           },
-          "comment": {
-            "type": "string"
-          },
           "host": {
             "$ref": "#/components/schemas/HostWithFqdn"
           },
@@ -4599,9 +4578,6 @@
             "items": {
               "$ref": "#/components/schemas/Alert"
             }
-          },
-          "comment": {
-            "type": "string"
           }
         }
       },
-- 
GitLab