Skip to content

Commit b70e746

Browse files
authored
Increase project name max length (#18941)
* Increase project name max length * 💄 * 💄
1 parent 30a4280 commit b70e746

File tree

5 files changed

+26
-12
lines changed

5 files changed

+26
-12
lines changed

components/dashboard/src/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function Header(p: HeaderProps) {
2929
return (
3030
<div className="app-container border-gray-200 dark:border-gray-800">
3131
<div className="flex pb-8 pt-6">
32-
<div>
32+
<div className="w-full">
3333
{p.complexTitle ? p.complexTitle : <Heading1 tracking="tight">{p.title}</Heading1>}
3434
{typeof p.subtitle === "string" ? (
3535
<Subheading tracking="wide">{p.subtitle}</Subheading>

components/dashboard/src/components/typography/headings.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ export const Heading1: FC<HeadingProps> = ({ id, color, tracking, className, chi
1818
return (
1919
<h1
2020
id={id}
21-
className={classNames(getHeadingColor(color), getTracking(tracking), "font-bold text-4xl", className)}
21+
className={classNames(
22+
getHeadingColor(color),
23+
getTracking(tracking),
24+
"font-bold text-4xl truncate",
25+
className,
26+
)}
2227
>
2328
{children}
2429
</h1>

components/dashboard/src/projects/ProjectListItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ type ProjectLinkProps = {
136136
};
137137
const ProjectLink: FunctionComponent<ProjectLinkProps> = ({ project }) => {
138138
return (
139-
<Link to={`/projects/${project.id}`}>
139+
<Link to={`/projects/${project.id}`} className="truncate" title={project.name}>
140140
<span className="text-xl font-semibold">{project.name}</span>
141141
</Link>
142142
);

components/dashboard/src/projects/ProjectSettings.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { InputField } from "../components/forms/InputField";
2424
import { SelectInputField } from "../components/forms/SelectInputField";
2525
import debounce from "lodash.debounce";
2626

27+
const MAX_PROJECT_NAME_LENGTH = 100;
28+
2729
export function ProjectSettingsPage(props: { project?: Project; children?: React.ReactNode }) {
2830
return (
2931
<PageWithSubMenu
@@ -49,8 +51,8 @@ export default function ProjectSettingsView() {
4951
let badProjectName: string | undefined;
5052
if (project) {
5153
badProjectName = projectName.length > 0 ? undefined : "Project name can not be blank.";
52-
if (projectName.length > 32) {
53-
badProjectName = "Project name can not be longer than 32 characters.";
54+
if (projectName.length > MAX_PROJECT_NAME_LENGTH) {
55+
badProjectName = `Project name can not be longer than ${MAX_PROJECT_NAME_LENGTH} characters.`;
5456
}
5557
}
5658
const history = useHistory();
@@ -221,7 +223,7 @@ export default function ProjectSettingsView() {
221223
<Heading2>Project Name</Heading2>
222224
<form onSubmit={updateProjectName}>
223225
<TextInputField
224-
hint="The name can be up to 32 characters long."
226+
hint={`The name can be up to ${MAX_PROJECT_NAME_LENGTH} characters long.`}
225227
value={projectName}
226228
error={badProjectName}
227229
onChange={setProjectName}

components/server/src/projects/projects-service.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import { TransactionalContext } from "@gitpod/gitpod-db/lib/typeorm/transactiona
3232
import { ScmService } from "./scm-service";
3333
import { daysBefore, isDateSmaller } from "@gitpod/gitpod-protocol/lib/util/timeutil";
3434

35+
const MAX_PROJECT_NAME_LENGTH = 100;
36+
3537
@injectable()
3638
export class ProjectsService {
3739
constructor(
@@ -205,8 +207,11 @@ export class ProjectsService {
205207
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "Clone URL must be less than 1k characters.");
206208
}
207209

208-
if (name.length > 32) {
209-
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "Project name cannot be longer than 32 characters.");
210+
if (name.length > MAX_PROJECT_NAME_LENGTH) {
211+
throw new ApplicationError(
212+
ErrorCodes.BAD_REQUEST,
213+
`Project name cannot be longer than ${MAX_PROJECT_NAME_LENGTH} characters.`,
214+
);
210215
}
211216

212217
try {
@@ -245,7 +250,7 @@ export class ProjectsService {
245250

246251
const project = Project.create({
247252
// Default to repository name
248-
name: name || parsedUrl.repo.substring(0, 32),
253+
name: name || parsedUrl.repo.substring(0, MAX_PROJECT_NAME_LENGTH),
249254
cloneUrl,
250255
teamId,
251256
appInstallationId,
@@ -369,9 +374,11 @@ export class ProjectsService {
369374
const partial: PartialProject = { id: partialProject.id };
370375
if (partialProject.name) {
371376
partialProject.name = partialProject.name.trim();
372-
// check it is between 0 and 32 characters
373-
if (partialProject.name.length > 32) {
374-
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "Project name must be less than 32 characters.");
377+
if (partialProject.name.length > MAX_PROJECT_NAME_LENGTH) {
378+
throw new ApplicationError(
379+
ErrorCodes.BAD_REQUEST,
380+
`Project name must be less than ${MAX_PROJECT_NAME_LENGTH} characters.`,
381+
);
375382
}
376383
if (partialProject.name.length === 0) {
377384
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "Project name must not be empty.");

0 commit comments

Comments
 (0)