Просмотр исходного кода

generalize websocket to look in context

Alexander Belanger 4 лет назад
Родитель
Сommit
dbc554e629

+ 5 - 2
dashboard/src/components/porter-form/field-components/ResourceList.tsx

@@ -3,10 +3,12 @@ import { ResourceListField } from "../types";
 import { Context } from "shared/Context";
 import { Context } from "shared/Context";
 import { useWebsockets } from "shared/hooks/useWebsockets";
 import { useWebsockets } from "shared/hooks/useWebsockets";
 import ExpandableResource from "../../ExpandableResource";
 import ExpandableResource from "../../ExpandableResource";
+import { PorterFormContext } from "components/porter-form/PorterFormContextProvider";
 import styled from "styled-components";
 import styled from "styled-components";
 
 
 const ResourceList: React.FC<ResourceListField> = (props) => {
 const ResourceList: React.FC<ResourceListField> = (props) => {
   const { currentCluster, currentProject } = useContext(Context);
   const { currentCluster, currentProject } = useContext(Context);
+  const { formState } = useContext(PorterFormContext);
 
 
   const {
   const {
     newWebsocket,
     newWebsocket,
@@ -16,8 +18,9 @@ const ResourceList: React.FC<ResourceListField> = (props) => {
   } = useWebsockets();
   } = useWebsockets();
 
 
   useEffect(() => {
   useEffect(() => {
-    let apiEndpoint = `/api/projects/${currentProject.id}/clusters/${currentCluster.id}/namespaces/cert-manager/releases/cert-manager/0/form_stream?`;
-    apiEndpoint += "resource=certificates&group=cert-manager.io&version=v1";
+    let { group, version, resource } = props.context.config;
+    let apiEndpoint = `/api/projects/${currentProject.id}/clusters/${currentCluster.id}/namespaces/${formState.variables.namespace}/releases/${formState.variables.currentChart.name}/0/form_stream?`;
+    apiEndpoint += `resource=${resource}&group=${group}&version=${version}`;
 
 
     const wsConfig = {
     const wsConfig = {
       onmessage(evt: MessageEvent) {
       onmessage(evt: MessageEvent) {

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

@@ -39,6 +39,13 @@ export interface ServiceIPListField extends GenericField {
 export interface ResourceListField extends GenericField {
 export interface ResourceListField extends GenericField {
   type: "resource-list";
   type: "resource-list";
   value: any[];
   value: any[];
+  context?: {
+    config?: {
+      group: string
+      version: string
+      resource: string
+    }
+  },
   settings?: {
   settings?: {
     options?: {
     options?: {
       "resource-button": any,
       "resource-button": any,

+ 3 - 0
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedChart.tsx

@@ -733,6 +733,9 @@ const ExpandedChart: React.FC<Props> = (props) => {
                   valuesToOverride={{
                   valuesToOverride={{
                     namespace: props.namespace,
                     namespace: props.namespace,
                     clusterId: currentCluster.id,
                     clusterId: currentCluster.id,
+                    currentChart: {
+                      name: currentChart.name,
+                    },
                   }}
                   }}
                   renderTabContents={renderTabContents}
                   renderTabContents={renderTabContents}
                   isReadOnly={
                   isReadOnly={

+ 1 - 0
docs/.obsidian/app.json

@@ -0,0 +1 @@
+{}

+ 3 - 0
docs/.obsidian/appearance.json

@@ -0,0 +1,3 @@
+{
+  "baseFontSize": 16
+}

+ 14 - 0
docs/.obsidian/core-plugins.json

@@ -0,0 +1,14 @@
+[
+  "file-explorer",
+  "global-search",
+  "switcher",
+  "graph",
+  "backlink",
+  "page-preview",
+  "note-composer",
+  "command-palette",
+  "markdown-importer",
+  "word-count",
+  "open-with-default-app",
+  "file-recovery"
+]

+ 22 - 0
docs/.obsidian/graph.json

@@ -0,0 +1,22 @@
+{
+  "collapse-filter": true,
+  "search": "",
+  "showTags": false,
+  "showAttachments": false,
+  "hideUnresolved": false,
+  "showOrphans": true,
+  "collapse-color-groups": true,
+  "colorGroups": [],
+  "collapse-display": true,
+  "showArrow": false,
+  "textFadeMultiplier": 0,
+  "nodeSizeMultiplier": 1,
+  "lineSizeMultiplier": 1,
+  "collapse-forces": true,
+  "centerStrength": 0.518713248970312,
+  "repelStrength": 10,
+  "linkStrength": 1,
+  "linkDistance": 250,
+  "scale": 1,
+  "close": false
+}

+ 1 - 0
docs/.obsidian/hotkeys.json

@@ -0,0 +1 @@
+{}

+ 93 - 0
docs/.obsidian/workspace

@@ -0,0 +1,93 @@
+{
+  "main": {
+    "id": "309f18c26378913f",
+    "type": "split",
+    "children": [
+      {
+        "id": "f58e1d6a32f9a290",
+        "type": "leaf",
+        "state": {
+          "type": "empty",
+          "state": {}
+        }
+      }
+    ],
+    "direction": "vertical"
+  },
+  "left": {
+    "id": "4757786da4583166",
+    "type": "split",
+    "children": [
+      {
+        "id": "17aa13ac191f8815",
+        "type": "tabs",
+        "children": [
+          {
+            "id": "b8bd38b92e51e242",
+            "type": "leaf",
+            "state": {
+              "type": "file-explorer",
+              "state": {}
+            }
+          },
+          {
+            "id": "52a03d067b5101da",
+            "type": "leaf",
+            "state": {
+              "type": "search",
+              "state": {
+                "query": "",
+                "matchingCase": false,
+                "explainSearch": false,
+                "collapseAll": false,
+                "extraContext": false,
+                "sortOrder": "alphabetical"
+              }
+            }
+          }
+        ]
+      }
+    ],
+    "direction": "horizontal",
+    "width": 300
+  },
+  "right": {
+    "id": "1580eeb02c06ed90",
+    "type": "split",
+    "children": [
+      {
+        "id": "d465ba3903c798ac",
+        "type": "tabs",
+        "children": [
+          {
+            "id": "9e449783f24a7833",
+            "type": "leaf",
+            "state": {
+              "type": "backlink",
+              "state": {
+                "collapseAll": false,
+                "extraContext": false,
+                "sortOrder": "alphabetical",
+                "showSearch": false,
+                "searchQuery": "",
+                "backlinkCollapsed": false,
+                "unlinkedCollapsed": true
+              }
+            }
+          }
+        ]
+      }
+    ],
+    "direction": "horizontal",
+    "width": 300
+  },
+  "active": "f58e1d6a32f9a290",
+  "lastOpenFiles": [
+    "developing/frontend-guide.md",
+    "developing/frontend-roadmap.md",
+    "getting-started/aws.md",
+    "developing/analytics.md",
+    "deploy/applications/deploying-django-application-non-docker.md",
+    "deploy/addons/mongo.md"
+  ]
+}