This is an automated email from the ASF dual-hosted git repository.

hshpak pushed a commit to branch 
fix/DATALAB-2842/button-visibility-of-edge-node-recreation
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit beca36b82079707df8ba4cc0c729153cf6bc2dcc
Author: Hennadii_Shpak <[email protected]>
AuthorDate: Thu Jul 7 14:40:12 2022 +0300

    fixed condition for disable recreate btn
---
 .../resources/webapp/src/app/core/util/checkEndpointList.ts   | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/core/util/checkEndpointList.ts
 
b/services/self-service/src/main/resources/webapp/src/app/core/util/checkEndpointList.ts
index 721521abe..b2a3cb683 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/core/util/checkEndpointList.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/core/util/checkEndpointList.ts
@@ -20,11 +20,8 @@
 import { ModifiedEndpoint } from '../../administration/project/project.model';
 
 export const checkEndpointList = (endpointList: ModifiedEndpoint[]): boolean 
=> {
-  return endpointList.every(({status, endpointStatus}) => {
-      const isEdgeNodeInactive = status === 'TERMINATED' || status === 
'FAILED';
-      const isEndpointInactive = !endpointStatus || endpointStatus === 
'INACTIVE';
-    console.log('isEdgeNodeInactive', isEdgeNodeInactive, 
'isEndpointInactive', isEndpointInactive, 'isEdgeNodeInactive && 
isEndpointInactive', isEdgeNodeInactive && isEndpointInactive);
-      return isEdgeNodeInactive && isEndpointInactive;
-    }
-  );
+  const isAllEdgeNodeInactive = endpointList.every(({status}) => status === 
'TERMINATED' || status === 'FAILED');
+  const isAllInactiveEdgeNodeHaveInactiveEndpoint =  
endpointList.filter(({status}) => status === 'TERMINATED' || status === 
'FAILED')
+    .every(({endpointStatus}) => !endpointStatus || endpointStatus === 
'INACTIVE');
+  return !isAllEdgeNodeInactive || isAllInactiveEdgeNodeHaveInactiveEndpoint;
 };


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to