You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2022/10/31 21:54:10 UTC

[camel-karavan] branch main updated: Fix #509

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

marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git


The following commit(s) were added to refs/heads/main by this push:
     new a769969  Fix #509
a769969 is described below

commit a769969ee37c650df8a36a9e80bd9ac0bffd21e9
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Mon Oct 31 17:54:03 2022 -0400

    Fix #509
---
 .../src/main/webapp/src/dashboard/DashboardPage.tsx  | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/karavan-app/src/main/webapp/src/dashboard/DashboardPage.tsx b/karavan-app/src/main/webapp/src/dashboard/DashboardPage.tsx
index 3790cc2..f69a984 100644
--- a/karavan-app/src/main/webapp/src/dashboard/DashboardPage.tsx
+++ b/karavan-app/src/main/webapp/src/dashboard/DashboardPage.tsx
@@ -121,9 +121,6 @@ export class DashboardPage extends React.Component<Props, State> {
                     ))}
                 </ToggleGroup>
             </ToolbarItem>
-            {/*<ToolbarItem>*/}
-            {/*    <Button variant="link" icon={<RefreshIcon/>} onClick={e => this.onGetProjects()}/>*/}
-            {/*</ToolbarItem>*/}
             <ToolbarItem>
                 <TextInput className="text-field" type="search" id="search" name="search"
                            autoComplete="off" placeholder="Search deployment by name"
@@ -173,6 +170,15 @@ export class DashboardPage extends React.Component<Props, State> {
         });
     }
 
+    getCamelStatusByEnvironments(name: string): [string, CamelStatus | undefined] [] {
+        const camelStatuses = this.state.camelStatuses;
+        return this.getSelectedEnvironments().map(e => {
+            const env: string = e as string;
+            const status = camelStatuses.find(d => d.projectId === name && d.env === env);
+            return [env, status];
+        });
+    }
+
     getProject(name: string): Project | undefined {
         return this.state.projects.filter(p => p.projectId === name)?.at(0);
     }
@@ -289,13 +295,13 @@ export class DashboardPage extends React.Component<Props, State> {
                                     </Td>
                                     <Td modifier={"fitContent"}>
                                         <Flex direction={{default: "column"}}>
-                                            {this.getServiceByEnvironments(deployment).map(value => (
+                                            {this.getCamelStatusByEnvironments(deployment).map(value => (
                                                 <FlexItem key={value[0]}>
                                                     <LabelGroup numLabels={4} className="camel-label-group">
-                                                        <Label color={false ? "green" : "red"}
+                                                        <Label color={value[1]?.consumerStatus === "UP" ? "green" : "red"}
                                                                className="table-label"
-                                                               icon={false ? <UpIcon/> : <DownIcon/>}>
-                                                            {"Context"}
+                                                               icon={value[1]?.consumerStatus === "UP" ? <UpIcon/> : <DownIcon/>}>
+                                                            {value[1]?.consumerStatus}
                                                         </Label>
                                                     </LabelGroup>
                                                 </FlexItem>