Skip to content

Commit

Permalink
Merge branch 'main' into ft/gut-feeling
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptronicek authored Nov 15, 2023
2 parents a6b7505 + 5b57da8 commit 7f0e6fa
Show file tree
Hide file tree
Showing 120 changed files with 4,370 additions and 1,590 deletions.
1 change: 1 addition & 0 deletions .github/actions/preview-create/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ TF_VAR_preview_name="$(previewctl get-name --branch "${INPUT_NAME}")"
export TF_VAR_preview_name
export TF_VAR_infra_provider="${INPUT_INFRASTRUCTURE_PROVIDER}"
export TF_VAR_with_large_vm="${INPUT_LARGE_VM}"
export TF_VAR_gce_use_spot="${INPUT_PREEMPTIBLE}"
export TF_INPUT=0
export TF_IN_AUTOMATION=true
leeway run dev/preview:create-preview
4 changes: 4 additions & 0 deletions .github/actions/preview-create/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ inputs:
description: "Whether to use a larger VM for the env"
required: true
default: false
preemptible:
description: "Whether to use preemptible VMs for the env"
required: true
default: true
sa_key:
description: "The service account key to use when authenticating with GCP"
required: true
Expand Down
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ gitpod:summary
- [ ] /werft with-large-vm
- [x] /werft with-gce-vm
If enabled this will create the environment on GCE infra
- [x] /werft preemptible
Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
- [ ] with-integration-tests=all
Valid options are `all`, `workspace`, `webapp`, `ide`, `jetbrains`, `vscode`, `ssh`. If enabled, `with-preview` and `with-large-vm` will be enabled.
- [ ] with-monitoring
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
with_large_vm: ${{ contains( steps.pr-details.outputs.pr_body, '[X] /werft with-large-vm') || (steps.output.outputs.with_integration_tests != '') }}
publish_to_npm: ${{ contains( steps.pr-details.outputs.pr_body, '[X] /werft publish-to-npm') }}
publish_to_jbmp: ${{ contains( steps.pr-details.outputs.pr_body, '[X] /werft publish-to-jb-marketplace') }}
with_preemptible: ${{ contains( steps.pr-details.outputs.pr_body, '[X] /werft preemptible') }}
with_dedicated_emulation: ${{ contains( steps.pr-details.outputs.pr_body, '[X] with-dedicated-emulation') }}
analytics: ${{ steps.output.outputs.analytics }}
workspace_feature_flags: ${{ steps.output.outputs.workspace_feature_flags }}
Expand Down Expand Up @@ -135,6 +136,7 @@ jobs:
infrastructure_provider: ${{ needs.configuration.outputs.preview_infra_provider }}
previewctl_hash: ${{ needs.build-previewctl.outputs.previewctl_hash }}
large_vm: ${{ needs.configuration.outputs.with_large_vm }}
preemptible: ${{ needs.configuration.outputs.with_preemptible }}
recreate_vm: ${{ inputs.recreate_vm }}

build-gitpod:
Expand Down
5 changes: 5 additions & 0 deletions components/common-go/experiments/configcat.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
teamNameAttribute = "team_name"
vscodeClientIDAttribute = "vscode_client_id"
gitpodHost = "gitpod_host"
component = "component"
)

func newConfigCatClient(config configcat.Config) *configCatClient {
Expand Down Expand Up @@ -85,6 +86,10 @@ func attributesToUser(attributes Attributes) *configcat.UserData {
custom[gitpodHost] = attributes.GitpodHost
}

if attributes.Component != "" {
custom[component] = attributes.Component
}

return &configcat.UserData{
Identifier: attributes.UserID,
Email: attributes.UserEmail,
Expand Down
1 change: 1 addition & 0 deletions components/common-go/experiments/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const (
OIDCServiceEnabledFlag = "oidcServiceEnabled"
SupervisorPersistServerAPIChannelWhenStartFlag = "supervisor_persist_serverapi_channel_when_start"
SupervisorUsePublicAPIFlag = "supervisor_experimental_publicapi"
ServiceWaiterSkipComponentsFlag = "service_waiter_skip_components"
)

func IsPersonalAccessTokensEnabled(ctx context.Context, client Client, attributes Attributes) bool {
Expand Down
30 changes: 26 additions & 4 deletions components/common-go/experiments/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ type Attributes struct {
VSCodeClientID string

GitpodHost string

// Component is using in components/service-waiter
// Feature Flag key is `service_waiter_skip_component`
Component string
}

type ClientOpt func(o *options)
Expand All @@ -45,10 +49,25 @@ func WithGitpodProxy(gitpodHost string) ClientOpt {
}
}

func WithPollInterval(interval time.Duration) ClientOpt {
return func(o *options) {
o.pollInterval = interval
}
}

func WithDefaultClient(defaultClient Client) ClientOpt {
return func(o *options) {
o.defaultClient = defaultClient
o.hasDefaultClient = true
}
}

type options struct {
pollInterval time.Duration
baseURL string
sdkKey string
pollInterval time.Duration
baseURL string
sdkKey string
defaultClient Client
hasDefaultClient bool
}

// NewClient constructs a new experiments.Client. This is NOT A SINGLETON.
Expand All @@ -66,10 +85,13 @@ func NewClient(opts ...ClientOpt) Client {
}

if opt.sdkKey == "" {
if opt.hasDefaultClient {
return opt.defaultClient
}
return NewAlwaysReturningDefaultValueClient()
}
logger := log.Log.Dup()
logger.Level = logrus.ErrorLevel
logger.Logger.SetLevel(logrus.ErrorLevel)
return newConfigCatClient(configcat.Config{
SDKKey: opt.sdkKey,
BaseURL: opt.baseURL,
Expand Down
1 change: 1 addition & 0 deletions components/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@bufbuild/protobuf": "^1.3.3",
"@connectrpc/connect": "1.1.2",
"@connectrpc/connect-web": "1.1.2",
"@gitpod/gitpod-protocol": "0.1.5",
Expand Down
14 changes: 7 additions & 7 deletions components/dashboard/src/app/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ const TeamGitIntegrations = React.lazy(() => import(/* webpackPrefetch: true */
const NewProject = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/NewProject"));
const Projects = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/Projects"));
const Project = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/Project"));
const Events = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/Events"));
const ProjectSettings = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/ProjectSettings"));
const ProjectVariables = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/ProjectVariables"));
const Prebuilds = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/Prebuilds"));
Expand All @@ -77,9 +76,11 @@ const WorkspacesSearch = React.lazy(() => import(/* webpackPrefetch: true */ "..
const ProjectsSearch = React.lazy(() => import(/* webpackPrefetch: true */ "../admin/ProjectsSearch"));
const TeamsSearch = React.lazy(() => import(/* webpackPrefetch: true */ "../admin/TeamsSearch"));
const Usage = React.lazy(() => import(/* webpackPrefetch: true */ "../Usage"));
const RepositoryListPage = React.lazy(() => import(/* webpackPrefetch: true */ "../repositories/list/RepositoryList"));
const RepositoryDetailPage = React.lazy(
() => import(/* webpackPrefetch: true */ "../repositories/detail/RepositoryDetail"),
const ConfigurationListPage = React.lazy(
() => import(/* webpackPrefetch: true */ "../repositories/list/RepositoryList"),
);
const ConfigurationGeneral = React.lazy(
() => import(/* webpackPrefetch: true */ "../repositories/detail/ConfigurationDetailGeneral"),
);

export const AppRoutes = () => {
Expand Down Expand Up @@ -210,16 +211,15 @@ export const AppRoutes = () => {
<Route exact path="/sso" component={SSO} />

<Route exact path={`/projects/:projectSlug`} component={Project} />
<Route exact path={`/projects/:projectSlug/events`} component={Events} />
<Route exact path={`/projects/:projectSlug/prebuilds`} component={Prebuilds} />
<Route exact path={`/projects/:projectSlug/settings`} component={ProjectSettings} />
<Route exact path={`/projects/:projectSlug/variables`} component={ProjectVariables} />
<Route exact path={`/projects/:projectSlug/:prebuildId`} component={Prebuild} />

{repoConfigListAndDetail && (
<>
<Route exact path="/repositories" component={RepositoryListPage} />
<Route exact path="/repositories/:id" component={RepositoryDetailPage} />
<Route exact path="/repositories" component={ConfigurationListPage} />
<Route exact path="/repositories/:id" component={ConfigurationGeneral} />
</>
)}
{/* basic redirect for old team slugs */}
Expand Down
4 changes: 3 additions & 1 deletion components/dashboard/src/components/ConfirmationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ export const ConfirmationModal: FC<Props> = ({
{isEntity(children) ? (
<div className="w-full p-4 mb-2 bg-gray-100 dark:bg-gray-700 rounded-xl group">
<p className="text-base text-gray-800 dark:text-gray-100 font-semibold">{children.name}</p>
{children.description && <p className="text-gray-500 truncate">{children.description}</p>}
{children.description && (
<p className="text-gray-500 dark:text-gray-300 truncate">{children.description}</p>
)}
</div>
) : (
children
Expand Down
22 changes: 11 additions & 11 deletions components/dashboard/src/components/PageWithSubMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import { Separator } from "./Separator";
export interface PageWithSubMenuProps {
title: string;
subtitle: string;
subMenu: {
title: string;
link: string[];
}[];
subMenu: SubmenuItemProps[];
tabs?: TabEntry[];
children: React.ReactNode;
}
Expand Down Expand Up @@ -53,12 +50,13 @@ export function PageWithSubMenu(p: PageWithSubMenuProps) {
);
}

type SubmenuItemProps = {
export type SubmenuItemProps = {
title: string;
link: string[];
icon?: React.ReactNode;
};

const SubmenuItem: FC<SubmenuItemProps> = ({ title, link }) => {
export const SubmenuItem: FC<SubmenuItemProps> = ({ title, link, icon }) => {
const location = useLocation();
const itemRef = useRef<HTMLLIElement>(null);

Expand All @@ -69,17 +67,19 @@ const SubmenuItem: FC<SubmenuItemProps> = ({ title, link }) => {
}
}, [link, location.pathname]);

let classes = "flex block py-2 px-4 rounded-md whitespace-nowrap max-w-52";
let classes = "flex justify-between block rounded-md py-2 px-4 whitespace-nowrap max-w-52";

if (link.some((l) => l === location.pathname)) {
const isCurrent = link.some((l) => l === location.pathname);
if (isCurrent) {
classes += " bg-gray-300 text-gray-800 dark:bg-gray-800 dark:text-gray-50";
} else {
classes += " hover:bg-gray-100 dark:hover:bg-gray-800";
classes += " hover:bg-gray-100 dark:hover:bg-gray-800 dark:text-gray-400";
}

return (
<Link to={link[0]} key={title} className="md:w-full">
<Link to={link[0]} key={title} className="md:w-full rounded-md">
<li ref={itemRef} className={classes}>
{title}
{title} {icon}
</li>
</Link>
);
Expand Down
6 changes: 3 additions & 3 deletions components/dashboard/src/components/PrebuildLogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ export default function PrebuildLogs(props: PrebuildLogsProps) {
// Try get hold of a recent WorkspaceInfo
try {
const request = new GetWorkspaceRequest();
request.id = props.workspaceId;
request.workspaceId = props.workspaceId;
const response = await workspaceClient.getWorkspace(request);
setWorkspace({
instanceId: response.item?.status?.instanceId,
phase: response.item?.status?.phase?.name,
instanceId: response.workspace?.status?.instanceId,
phase: response.workspace?.status?.phase?.name,
});
} catch (err) {
console.error(err);
Expand Down
49 changes: 49 additions & 0 deletions components/dashboard/src/components/WidePageWithSubmenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Copyright (c) 2023 Gitpod GmbH. All rights reserved.
* Licensed under the GNU Affero General Public License (AGPL).
* See License.AGPL.txt in the project root for license information.
*/

import classNames from "classnames";
import { Separator } from "./Separator";
import { cn } from "@podkit/lib/cn";
import { SubmenuItem, SubmenuItemProps } from "./PageWithSubMenu";

export interface PageWithSubMenuProps {
/**
* The name of the navigation menu, as read by screen readers.
*/
navTitle?: string;
subMenu: SubmenuItemProps[];
children: React.ReactNode;
}

export function WidePageWithSubMenu(p: PageWithSubMenuProps) {
return (
<div className="w-full">
<div className={cn("app-container flex flex-col md:flex-row")}>
{/* TODO: extract into SubMenu component and show scrolling indicators */}
<nav aria-label={p.navTitle}>
<ul
className={classNames(
// Handle flipping between row and column layout
"flex flex-row md:flex-col items-center",
"w-full md:w-52 overflow-auto md:overflow-visible",
"pt-4 pb-4 md:pb-0",
"space-x-2 md:space-x-0 md:space-y-2",
"tracking-wide text-gray-500",
)}
>
{p.subMenu.map((e) => {
return <SubmenuItem title={e.title} link={e.link} key={e.title} icon={e.icon} />;
})}
</ul>
</nav>
<div className="md:ml-4 w-full pt-1 mb-40">
<Separator className="md:hidden" />
<div className="pt-4 md:pt-0">{p.children}</div>
</div>
</div>
</div>
);
}
4 changes: 2 additions & 2 deletions components/dashboard/src/components/forms/TextInputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* See License.AGPL.txt in the project root for license information.
*/

import classNames from "classnames";
import { FunctionComponent, memo, ReactNode, useCallback } from "react";
import { useId } from "../../hooks/useId";
import { InputField } from "./InputField";
import { cn } from "@podkit/lib/cn";

type TextInputFieldTypes = "text" | "password" | "email" | "url";

Expand Down Expand Up @@ -97,7 +97,7 @@ export const TextInput: FunctionComponent<TextInputProps> = memo(
return (
<input
id={id}
className={classNames("w-full max-w-lg dark:text-[#A8A29E]", className)}
className={cn("w-full max-w-lg dark:text-[#A8A29E]", className)}
value={value}
type={type}
placeholder={placeholder}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Copyright (c) 2023 Gitpod GmbH. All rights reserved.
* Licensed under the GNU Affero General Public License (AGPL).
* See License.AGPL.txt in the project root for license information.
*/

import { LinkButton } from "@podkit/buttons/LinkButton";
import { cn } from "@podkit/lib/cn";
import { ChevronLeft } from "lucide-react";
import type { FC } from "react";
import { MiddleDot } from "../../typography/MiddleDot";
import { Heading3 } from "@podkit/typography/Headings";

interface BreadcrumbPageNavProps {
/**
* The title of the current page.
*/
pageTitle: string;
/**
* The description of the current page.
*/
pageDescription?: string;
/**
* The link to the previous page.
*/
backLink?: string;
className?: string;
}

export const BreadcrumbNav: FC<BreadcrumbPageNavProps> = ({ pageTitle, pageDescription, backLink, className }) => {
return (
<section className={cn("flex flex-row items-center justify-start gap-2 w-full py-4 app-container", className)}>
{backLink && (
<LinkButton
variant={"ghost"}
className="py-1 px-0 hover:bg-gray-200 dark:hover:bg-gray-800 dark:hover:text-gray-200"
href={backLink}
>
<ChevronLeft size={24} />
</LinkButton>
)}
<Heading3 asChild>
<h1>{pageTitle}</h1>
</Heading3>
<MiddleDot />
<p className="text-gray-900 dark:text-gray-300 text-lg">{pageDescription}</p>
</section>
);
};
4 changes: 2 additions & 2 deletions components/dashboard/src/components/podkit/buttons/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export const buttonVariants = cva(
outline: "border border-input bg-transparent hover:bg-kumquat-ripe hover:text-gray-600",
secondary:
"bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-500 dark:text-gray-100 hover:text-gray-600",
ghost: "hover:bg-kumquat-ripe hover:text-gray-600",
ghost: "bg-transparent hover:bg-gray-100 hover:text-gray-600 text-gray-500",
link: "text-gray-500 dark:text-gray-100 underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2",
sm: "h-8 rounded-md px-3 text-xs",
lg: "h-10 rounded-md px-8",
icon: "h-9 w-9",
icon: "h-9 w-9 p-0 rounded-sm",
},
},
defaultVariants: {
Expand Down
Loading

0 comments on commit 7f0e6fa

Please sign in to comment.