Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/projects/projects.routes.ts
2500 views
1
/**
2
* Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { Project } from "@gitpod/gitpod-protocol";
8
import { TabEntry } from "../components/Header";
9
10
export const projectsPathMain = "/projects";
11
export const projectsPathMainWithParams = [projectsPathMain, ":projectName", ":resourceOrPrebuild?"].join("/");
12
13
export const projectsPathInstallGitHubApp = "/install-github-app";
14
15
export function getProjectTabs(project: Project | undefined): TabEntry[] {
16
if (!project) {
17
return [];
18
}
19
return [
20
{
21
title: "Branches",
22
link: `/projects/${project.id}`,
23
},
24
{
25
title: "Prebuilds",
26
link: `/projects/${project.id}/prebuilds`,
27
},
28
{
29
title: "Settings",
30
link: `/projects/${project.id}/settings`,
31
alternatives: getProjectSettingsMenu(project).flatMap((e) => e.link),
32
},
33
];
34
}
35
36
export function getProjectSettingsMenu(project?: Project) {
37
const slug = project?.id ?? "unknown";
38
return [
39
{
40
title: "General",
41
link: [`/projects/${slug}/settings`],
42
},
43
{
44
title: "Variables",
45
link: [`/projects/${slug}/variables`],
46
},
47
];
48
}
49
50