Browse Source

filter empty annotations (#3788)

ianedwards 2 years ago
parent
commit
6b7e24f865

+ 3 - 4
dashboard/src/lib/porter-apps/services.ts

@@ -231,10 +231,9 @@ export function serializeService(service: ClientService): SerializedService {
             name: domain.name.value,
           })),
           ingressAnnotations: Object.fromEntries(
-            config.ingressAnnotations.map((annotation) => [
-              annotation.key,
-              annotation.value,
-            ])
+            config.ingressAnnotations
+              .filter((a) => a.key.length > 0 && a.value.length > 0)
+              .map((annotation) => [annotation.key, annotation.value])
           ),
           private: config.private?.value,
         },

+ 4 - 2
dashboard/src/main/home/app-dashboard/app-view/tabs/Settings.tsx

@@ -19,7 +19,7 @@ const Settings: React.FC = () => {
   const queryClient = useQueryClient();
   const history = useHistory();
   const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
-  const { porterApp, clusterId, projectId } = useLatestRevision();
+  const { porterApp, clusterId, projectId, latestProto } = useLatestRevision();
   const { updateAppStep } = useAppAnalytics();
   const [isDeleting, setIsDeleting] = useState(false);
 
@@ -139,7 +139,9 @@ const Settings: React.FC = () => {
 
   return (
     <StyledSettingsTab>
-      {currentProject?.preview_envs_enabled && <PreviewEnvironmentSettings />}
+      {currentProject?.preview_envs_enabled && !!latestProto.build ? (
+        <PreviewEnvironmentSettings />
+      ) : null}
       <Text size={16}>Delete "{porterApp.name}"</Text>
       <Spacer y={0.5} />
       <Text color="helper">