From 300e76e75450817d3870c7c5d18e3c865d5baff1 Mon Sep 17 00:00:00 2001 From: Feroze Mohideen Date: Wed, 28 Feb 2024 15:41:44 -0500 Subject: [PATCH] remove beta features enabled, add cluster vanity name, id, remove delete gpu (#4343) --- .../project_integration/preflight_check.go | 48 ------------------- .../ClusterProvisioningPlaceholder.tsx | 3 +- .../services-settings/tabs/Resources.tsx | 17 ++----- .../ClusterDashboard.tsx | 23 +++++++-- .../shared/NodeGroups.tsx | 46 +++++++++--------- .../src/main/home/onboarding/Onboarding.tsx | 3 +- .../main/home/project-settings/Metadata.tsx | 2 +- .../src/main/home/sidebar/ClusterList.tsx | 9 ++-- dashboard/src/main/home/sidebar/Sidebar.tsx | 12 ++--- 9 files changed, 56 insertions(+), 107 deletions(-) diff --git a/api/server/handlers/project_integration/preflight_check.go b/api/server/handlers/project_integration/preflight_check.go index c95f46674e..90a678c253 100644 --- a/api/server/handlers/project_integration/preflight_check.go +++ b/api/server/handlers/project_integration/preflight_check.go @@ -64,9 +64,6 @@ func (p *CreatePreflightCheckHandler) ServeHTTP(w http.ResponseWriter, r *http.R ctx, span := telemetry.NewSpan(r.Context(), "preflight-checks") defer span.End() project, _ := ctx.Value(types.ProjectScope).(*models.Project) - betaFeaturesEnabled := project.GetFeatureFlag(models.BetaFeaturesEnabled, p.Config().LaunchDarklyClient) - - telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "beta-features-enabled", Value: betaFeaturesEnabled}) cloudValues := &porterv1.PreflightCheckRequest{} err := helpers.UnmarshalContractObjectFromReader(r.Body, cloudValues) @@ -91,46 +88,6 @@ func (p *CreatePreflightCheckHandler) ServeHTTP(w http.ResponseWriter, r *http.R } } - if cloudValues.Contract != nil && cloudValues.Contract.Cluster != nil && cloudValues.Contract.Cluster.CloudProvider == porterv1.EnumCloudProvider_ENUM_CLOUD_PROVIDER_AZURE { - telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "new-endpoint", Value: true}) - checkResp, err := p.Config().ClusterControlPlaneClient.CloudContractPreflightCheck(ctx, - connect.NewRequest( - &porterv1.CloudContractPreflightCheckRequest{ - Contract: cloudValues.Contract, - }, - ), - ) - if err != nil { - err = telemetry.Error(ctx, span, err, "error calling preflight checks") - p.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(err, http.StatusInternalServerError)) - return - } - - if checkResp.Msg == nil { - err = telemetry.Error(ctx, span, nil, "no message received from preflight checks") - p.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(err, http.StatusInternalServerError)) - return - } - - errors := []PreflightCheckError{} - for _, val := range checkResp.Msg.FailingPreflightChecks { - if val.Message == "" || !contains(recognizedPreflightCheckKeys, val.Type) { - continue - } - - errors = append(errors, PreflightCheckError{ - Name: val.Type, - Error: PorterError{ - Message: val.Message, - Metadata: val.Metadata, - }, - }) - } - resp.Errors = errors - p.WriteResult(w, r, resp) - return - } - checkResp, err := p.Config().ClusterControlPlaneClient.PreflightCheck(ctx, connect.NewRequest(&input)) if err != nil { err = telemetry.Error(ctx, span, err, "error calling preflight checks") @@ -144,11 +101,6 @@ func (p *CreatePreflightCheckHandler) ServeHTTP(w http.ResponseWriter, r *http.R return } - if !betaFeaturesEnabled { - p.WriteResult(w, r, checkResp) - return - } - errors := []PreflightCheckError{} for key, val := range checkResp.Msg.PreflightChecks { if val.Message == "" || !contains(recognizedPreflightCheckKeys, key) { diff --git a/dashboard/src/components/ClusterProvisioningPlaceholder.tsx b/dashboard/src/components/ClusterProvisioningPlaceholder.tsx index 9c2beb3c1d..e0365d9bea 100644 --- a/dashboard/src/components/ClusterProvisioningPlaceholder.tsx +++ b/dashboard/src/components/ClusterProvisioningPlaceholder.tsx @@ -36,8 +36,7 @@ const ClusterProvisioningPlaceholder: React.FC = ( onClick={() => { if ( currentProject?.capi_provisioner_enabled && - currentProject?.simplified_view_enabled && - currentProject?.beta_features_enabled + currentProject?.simplified_view_enabled ) { pushFiltered( props, diff --git a/dashboard/src/main/home/app-dashboard/validate-apply/services-settings/tabs/Resources.tsx b/dashboard/src/main/home/app-dashboard/validate-apply/services-settings/tabs/Resources.tsx index 22d9ee2633..a7db32fe07 100644 --- a/dashboard/src/main/home/app-dashboard/validate-apply/services-settings/tabs/Resources.tsx +++ b/dashboard/src/main/home/app-dashboard/validate-apply/services-settings/tabs/Resources.tsx @@ -17,7 +17,6 @@ import { Context } from "shared/Context"; import GPUResources from "./GPUResources"; import IntelligentSlider from "./IntelligentSlider"; -import OldGPUResources from "./Old_GPUResources"; type ResourcesProps = { index: number; @@ -36,7 +35,6 @@ const Resources: React.FC = ({ maxRAM, maxGPU, service, - clusterContainsGPUNodes, isPredeploy = false, cluster, }) => { @@ -148,18 +146,9 @@ const Resources: React.FC = ({ )} /> - {currentProject?.gpu_enabled && - (currentProject?.beta_features_enabled ? ( - cluster && ( - - ) - ) : ( - - ))} + {currentProject?.gpu_enabled && cluster && ( + + )} {match(service.config) .with({ type: "job" }, () => null) .with({ type: "predeploy" }, () => null) diff --git a/dashboard/src/main/home/infrastructure-dashboard/ClusterDashboard.tsx b/dashboard/src/main/home/infrastructure-dashboard/ClusterDashboard.tsx index 48c5ed7605..dc190646aa 100644 --- a/dashboard/src/main/home/infrastructure-dashboard/ClusterDashboard.tsx +++ b/dashboard/src/main/home/infrastructure-dashboard/ClusterDashboard.tsx @@ -1,4 +1,4 @@ -import React, { useMemo, useState } from "react"; +import React, { useContext, useMemo, useState } from "react"; import _ from "lodash"; import { Link } from "react-router-dom"; import styled from "styled-components"; @@ -25,6 +25,7 @@ import { import { type ClientCluster } from "lib/clusters/types"; import { useClusterList } from "lib/hooks/useCluster"; +import { Context } from "shared/Context"; import { search } from "shared/search"; import { readableDate } from "shared/string_utils"; import infra from "assets/cluster.svg"; @@ -45,6 +46,7 @@ const ClusterDashboard: React.FC = () => { >("all"); const { clusters, isLoading } = useClusterList(); + const { user } = useContext(Context); const filteredClusters = useMemo(() => { const filteredBySearch = search(clusters, searchValue, { @@ -161,7 +163,9 @@ const ClusterDashboard: React.FC = () => { {filteredClusters.map((cluster: ClientCluster, i: number) => { return ( - + @@ -271,7 +275,7 @@ const List = styled.div` overflow: hidden; `; -const Block = styled.div` +const Block = styled.div<{ clusterId?: string }>` height: 150px; flex-direction: column; display: flex; @@ -285,6 +289,19 @@ const Block = styled.div` border: 1px solid #494b4f; :hover { border: 1px solid #7a7b80; + + ::after { + content: ${(props) => + !props.clusterId ? "''" : `"ID: ${props.clusterId}"`}; + position: absolute; + top: 2px; + right: 2px; + background: ${(props) => props.clusterId && `#ffffff44`}; + opacity: 0.3; + padding: 5px; + border-radius: 4px; + font-size: 12px; + } } animation: fadeIn 0.3s 0s; diff --git a/dashboard/src/main/home/infrastructure-dashboard/shared/NodeGroups.tsx b/dashboard/src/main/home/infrastructure-dashboard/shared/NodeGroups.tsx index 25f279a262..0eaa5c28da 100644 --- a/dashboard/src/main/home/infrastructure-dashboard/shared/NodeGroups.tsx +++ b/dashboard/src/main/home/infrastructure-dashboard/shared/NodeGroups.tsx @@ -29,7 +29,7 @@ const NodeGroups: React.FC = ({ availableMachineTypes }) => { const { fields: nodeGroups, append, - remove, + // remove, } = useFieldArray({ control, name: "cluster.config.nodeGroups", @@ -138,7 +138,7 @@ const NodeGroups: React.FC = ({ availableMachineTypes }) => { GPU node group - + {/* { e.stopPropagation(); @@ -147,7 +147,7 @@ const NodeGroups: React.FC = ({ availableMachineTypes }) => { > delete - + */} } > @@ -255,24 +255,24 @@ const I = styled.i` } `; -const ActionButton = styled.button` - position: relative; - border: none; - background: none; - color: white; - padding: 5px; - display: flex; - justify-content: center; - align-items: center; - border-radius: 50%; - cursor: pointer; - color: #aaaabb; - :hover { - color: white; - } +// const ActionButton = styled.button` +// position: relative; +// border: none; +// background: none; +// color: white; +// padding: 5px; +// display: flex; +// justify-content: center; +// align-items: center; +// border-radius: 50%; +// cursor: pointer; +// color: #aaaabb; +// :hover { +// color: white; +// } - > span { - font-size: 20px; - } - margin-right: 5px; -`; +// > span { +// font-size: 20px; +// } +// margin-right: 5px; +// `; diff --git a/dashboard/src/main/home/onboarding/Onboarding.tsx b/dashboard/src/main/home/onboarding/Onboarding.tsx index 0629c44500..5dcc065f10 100644 --- a/dashboard/src/main/home/onboarding/Onboarding.tsx +++ b/dashboard/src/main/home/onboarding/Onboarding.tsx @@ -163,8 +163,7 @@ const Onboarding = () => { const renderOnboarding = () => { if ( context?.currentProject?.simplified_view_enabled && - context?.currentProject?.capi_provisioner_enabled && - context?.currentProject?.beta_features_enabled + context?.currentProject?.capi_provisioner_enabled ) { return ; } else if (context?.currentProject?.capi_provisioner_enabled) { diff --git a/dashboard/src/main/home/project-settings/Metadata.tsx b/dashboard/src/main/home/project-settings/Metadata.tsx index 192adf0e93..580a9b5590 100644 --- a/dashboard/src/main/home/project-settings/Metadata.tsx +++ b/dashboard/src/main/home/project-settings/Metadata.tsx @@ -86,7 +86,7 @@ const Metadata: React.FC = ({ {clusters?.length > 0 && clusters.map((cluster, index) => <> - + ) } diff --git a/dashboard/src/main/home/sidebar/ClusterList.tsx b/dashboard/src/main/home/sidebar/ClusterList.tsx index 3d68481285..831d8cfe4b 100644 --- a/dashboard/src/main/home/sidebar/ClusterList.tsx +++ b/dashboard/src/main/home/sidebar/ClusterList.tsx @@ -87,8 +87,7 @@ const ClusterList: React.FC = (props) => { const renderOptionList = (): JSX.Element[] => { if ( currentProject?.simplified_view_enabled && - currentProject?.capi_provisioner_enabled && - currentProject?.beta_features_enabled + currentProject?.capi_provisioner_enabled ) { return clusterList.map((c) => ( { setExpanded(false); if ( currentProject?.simplified_view_enabled && - currentProject?.capi_provisioner_enabled && - currentProject?.beta_features_enabled + currentProject?.capi_provisioner_enabled ) { pushFiltered(props, "/infrastructure/new", []); } else { @@ -207,8 +205,7 @@ const ClusterList: React.FC = (props) => { onClick={() => { if ( currentProject?.simplified_view_enabled && - currentProject?.capi_provisioner_enabled && - currentProject?.beta_features_enabled + currentProject?.capi_provisioner_enabled ) { pushFiltered(props, "/infrastructure/new", []); } else { diff --git a/dashboard/src/main/home/sidebar/Sidebar.tsx b/dashboard/src/main/home/sidebar/Sidebar.tsx index 831abe7261..df91cd502d 100644 --- a/dashboard/src/main/home/sidebar/Sidebar.tsx +++ b/dashboard/src/main/home/sidebar/Sidebar.tsx @@ -213,8 +213,7 @@ class Sidebar extends Component { "delete", ]) && currentProject?.simplified_view_enabled && - currentProject?.capi_provisioner_enabled && - currentProject?.beta_features_enabled && ( + currentProject?.capi_provisioner_enabled && ( { ]) && !( currentProject?.simplified_view_enabled && - currentProject?.capi_provisioner_enabled && - currentProject?.beta_features_enabled + currentProject?.capi_provisioner_enabled ) && ( {