Pārlūkot izejas kodu

update applet with proposed action button

Alexander Belanger 4 gadi atpakaļ
vecāks
revīzija
13f9b4f3d7

+ 25 - 7
api/server/handlers/release/get.go

@@ -143,14 +143,32 @@ tabs:
   - name: section_one
     contents: 
     - type: heading
-      label: 💾 Certificates
+      label: Certificates
     - type: resource-list
+      settings:
+        options:
+          resource-button:
+            name: "Manual Refresh"
+            description: "This will delete the existing certificate resource."
+            actions:
+            - delete:
+                scope: release
+                relative_uri: /crd
       value: |
         .items[] | { 
-            name: "\(.spec.dnsNames | join(","))", 
-            label: "\(.metadata.namespace)/\(.metadata.name)",
-            status: .status.conditions[0].reason,
-            timestamp: .status.conditions[0].lastTransitionTime,
-            message: [.status.conditions[].message] | unique | join(","),
-            data: {}
+          metadata: .metadata,
+          name: "\(.spec.dnsNames | join(","))", 
+          label: "\(.metadata.namespace)/\(.metadata.name)",
+          status: (
+            ([.status.conditions[].type] | index("Ready")) as $index | (
+              if $index then (
+                if .status.conditions[$index].status == "True" then "Ready" else "Not Ready" end
+              ) else (
+                "Not Ready"
+              ) end
+            )
+          ),
+          timestamp: .status.conditions[0].lastTransitionTime | fromdate | strftime("%Y-%m-%d"),
+          message: [.status.conditions[].message] | unique | join(","),
+          data: {}
         }`

+ 5 - 1
dashboard/src/components/ExpandableResource.tsx

@@ -6,6 +6,7 @@ import ResourceTab from "./ResourceTab";
 
 type PropsType = {
   resource: any;
+  button: any;
   handleClick?: () => void;
   selected?: boolean;
   isLast?: boolean;
@@ -19,7 +20,10 @@ export default class ExpandableResource extends Component<
   StateType
 > {
   render() {
-    let { resource } = this.props;
+    let { resource, button } = this.props;
+
+    console.log("BUTTON IS", button, resource);
+
     return (
       <ResourceTab
         label={resource.label}

+ 1 - 0
dashboard/src/components/porter-form/field-components/ResourceList.tsx

@@ -11,6 +11,7 @@ const ResourceList: React.FC<ResourceListField> = (props) => {
           return (
             <ExpandableResource
               key={i}
+              button={props?.settings?.options["resource-button"]}
               resource={resource}
               isLast={i === props.value.length - 1}
               roundAllCorners={true}

+ 5 - 0
dashboard/src/components/porter-form/types.ts

@@ -39,6 +39,11 @@ export interface ServiceIPListField extends GenericField {
 export interface ResourceListField extends GenericField {
   type: "resource-list";
   value: any[];
+  settings?: {
+    options?: {
+      "resource-button": any,
+    }
+  }
 }
 
 export interface VeleroBackupField extends GenericField {