From 14ea5e8643b74b6f6e2e9a2cb3d31783e5c93877 Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Mon, 15 Jan 2024 14:23:46 +0100 Subject: [PATCH] ReadyWidget generalized --- web/src/FluxState.js | 32 +++++++------------------------- web/src/Service.jsx | 6 +++--- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/web/src/FluxState.js b/web/src/FluxState.js index 02ee961..92047db 100644 --- a/web/src/FluxState.js +++ b/web/src/FluxState.js @@ -41,7 +41,7 @@ export function Kustomizations(props){
- +
@@ -87,14 +87,11 @@ export function HelmReleases(props) {
- + {message}
- {/* { !ready && */} - Attempted applying {lastAttemptedHash.slice(0, 8)} at {dateLabel} - {/* } */}
) @@ -158,7 +155,7 @@ export function GitRepositories(props){
- +
@@ -172,12 +169,13 @@ export function GitRepositories(props){ } export function ReadyWidget(props) { - const { gitRepository, displayMessage } = props - const readyConditions = jp.query(gitRepository.status, '$..conditions[?(@.type=="Ready")]'); + const { resource, displayMessage, label } = props + + const readyConditions = jp.query(resource.status, '$..conditions[?(@.type=="Ready")]'); const readyCondition = readyConditions.length === 1 ? readyConditions[0] : undefined const ready = readyCondition && readyConditions[0].status === "True" - const readyLabel = ready ? "Ready" : "Not Ready" + const readyLabel = ready ? label ? label : "Ready" : "Not Ready" const color = ready ? "bg-teal-400" : "bg-orange-400 animate-pulse" const messageColor = ready ? "text-neutral-600 field" : "bg-orange-400" @@ -237,22 +235,6 @@ export function ArtifactWidget(props) { ) } -export function HelmStatusWidget(props) { - const { helmRelease } = props - - const readyConditions = jp.query(helmRelease.status, '$..conditions[?(@.type=="Ready")].status'); - const ready = readyConditions.includes("True") - - const label = ready ? "Installed" : "Not Ready" - - return ( - - - {label} - - ) -} - export function HelmRevisionWidget(props) { const { helmRelease } = props diff --git a/web/src/Service.jsx b/web/src/Service.jsx index 0bda202..167221f 100644 --- a/web/src/Service.jsx +++ b/web/src/Service.jsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { RevisionWidget, ReadyWidget, HelmStatusWidget } from './FluxState'; +import { RevisionWidget, ReadyWidget } from './FluxState'; import jp from 'jsonpath'; import { Logs } from './Logs' import { Describe } from './Describe' @@ -209,7 +209,7 @@ function Service(props) {

Sync

-
+
@@ -217,7 +217,7 @@ function Service(props) {

Helm Status

-
+
({helmRelease.metadata.namespace}/{helmRelease.metadata.name})