From 95c458dfa5442b98cf6300c06c7ba74fbe1d47cc Mon Sep 17 00:00:00 2001 From: Alex Tugarev Date: Thu, 28 Sep 2023 07:39:05 +0000 Subject: [PATCH 01/24] [protocol] Add PrebuildSettings to ProjectSettings --- .../src/projects/ProjectSettings.tsx | 16 +++--- .../src/teams-projects-protocol.ts | 57 ++++++++++++++++--- .../server/src/prebuilds/prebuild-manager.ts | 6 +- 3 files changed, 59 insertions(+), 20 deletions(-) diff --git a/components/dashboard/src/projects/ProjectSettings.tsx b/components/dashboard/src/projects/ProjectSettings.tsx index 132874511d0db3..bbff743acf099e 100644 --- a/components/dashboard/src/projects/ProjectSettings.tsx +++ b/components/dashboard/src/projects/ProjectSettings.tsx @@ -4,7 +4,7 @@ * See License.AGPL.txt in the project root for license information. */ -import { Project, ProjectSettings } from "@gitpod/gitpod-protocol"; +import { Project, ProjectSettings, PrebuildSettings } from "@gitpod/gitpod-protocol"; import { useCallback, useContext, useState, Fragment, useMemo, useEffect } from "react"; import { useHistory } from "react-router"; import { CheckboxInputField } from "../components/forms/CheckboxInputField"; @@ -106,7 +106,7 @@ export default function ProjectSettingsView() { ); const setPrebuildBranchStrategy = useCallback( - async (value: ProjectSettings.PrebuildBranchStrategy) => { + async (value: PrebuildSettings.BranchStrategy) => { if (!project) { return; } @@ -115,15 +115,15 @@ export default function ProjectSettingsView() { return; } const update: ProjectSettings = {}; - if (value === "defaultBranch") { + if (value === "default-banch") { update.prebuildDefaultBranchOnly = true; update.prebuildBranchPattern = ""; } - if (value === "allBranches") { + if (value === "all-branches") { update.prebuildDefaultBranchOnly = false; update.prebuildBranchPattern = ""; } - if (value === "selectedBranches") { + if (value === "matched-branches") { update.prebuildDefaultBranchOnly = false; update.prebuildBranchPattern = "**"; } @@ -230,13 +230,13 @@ export default function ProjectSettingsView() { label="Build branches" value={prebuildBranchStrategy} containerClassName="max-w-md ml-6 text-sm" - onChange={(val) => setPrebuildBranchStrategy(val as ProjectSettings.PrebuildBranchStrategy)} + onChange={(val) => setPrebuildBranchStrategy(val as PrebuildSettings.BranchStrategy)} > - {prebuildBranchStrategy === "selectedBranches" && ( + {prebuildBranchStrategy === "matched-branches" && (