Skip to content

Commit d306bac

Browse files
AlexTugarevroboquat
authored andcommitted
review comments
1 parent 4b56946 commit d306bac

File tree

11 files changed

+16
-24
lines changed

11 files changed

+16
-24
lines changed

components/dashboard/src/components/PrebuildLogs.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ export default function PrebuildLogs(props: { workspaceId?: string }) {
108108
}, [ workspaceInstance?.status.phase ]);
109109

110110
return <>
111-
{/* <div className="capitalize">{workspaceInstance?.status.phase}</div> */}
112111
<Suspense fallback={<div />}>
113112
<WorkspaceLogs classes="h-64 w-full" logsEmitter={logsEmitter} errorMessage={error?.message} />
114113
</Suspense>

components/dashboard/src/projects/Prebuild.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default function () {
4747
return (<h1 className="tracking-tight">{prebuild.branch} <span className="text-gray-200">#{prebuild.branchPrebuildNumber}</span></h1>);
4848
};
4949

50-
const renderSubbitle = () => {
50+
const renderSubtitle = () => {
5151
if (!prebuild) {
5252
return "";
5353
}
@@ -71,7 +71,7 @@ export default function () {
7171
};
7272

7373
return <>
74-
<Header title={renderTitle()} subtitle={renderSubbitle()} />
74+
<Header title={renderTitle()} subtitle={renderSubtitle()} />
7575
<div className="w-full"><PrebuildLogs workspaceId={prebuild?.buildWorkspaceId}/></div>
7676
</>
7777

components/dashboard/src/projects/Project.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export default function () {
117117
}
118118

119119
const onNewWorkspace = (branch: Project.BranchDetails) => {
120-
window.location.href = gitpodHostUrl.withContext(`${branch.branchUrl}`).toString();
120+
window.location.href = gitpodHostUrl.withContext(`${branch.url}`).toString();
121121
}
122122

123123
const triggerPrebuild = (branch: Project.BranchDetails) => {
@@ -191,7 +191,9 @@ export default function () {
191191
{prebuild ? (<><div className="inline-block align-text-bottom mr-2 w-4 h-4">{statusIcon}</div>{status}</>) : (<span></span>)}
192192
</div>
193193
<span className="flex-grow" />
194-
<button className={`primary mr-2 py-2 ${branch.isDefault ? "" : "opacity-0"} group-hover:opacity-100`} onClick={() => onNewWorkspace(branch)}>New Workspace</button>
194+
<a href={gitpodHostUrl.withContext(`${branch.url}`).toString()}>
195+
<button className={`primary mr-2 py-2 ${branch.isDefault ? "" : "opacity-0"} group-hover:opacity-100`}>New Workspace</button>
196+
</a>
195197
<ItemFieldContextMenu className="py-0.5" menuEntries={branchContextMenu(branch)} />
196198
</ItemField>
197199
</Item>

components/dashboard/src/service/service-mock.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const gitpodServiceMock = createServiceMock({
8686
return {
8787
branches: [{
8888
name: "main",
89-
branchUrl: "branchUrl",
89+
url: "branchUrl",
9090
changeDate: t1,
9191
changeAuthor: u1.fullName!,
9292
changeAuthorAvatar: u1.avatarUrl,

components/dashboard/src/workspaces/workspace-model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class WorkspaceModel implements Disposable, Partial<GitpodClient> {
136136
return (
137137
info.workspace.pinned ||
138138
(!!info.latestInstance && info.latestInstance.status?.phase !== 'stopped')
139-
);
139+
) && !info.workspace.softDeleted;
140140
}
141141

142142
public getAllFetchedWorkspaces(): Map<string, WorkspaceInfo> {

components/gitpod-db/src/project-db.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ export interface ProjectDB {
1111
findProjectById(projectId: string): Promise<Project | undefined>;
1212
findProjectByCloneUrl(cloneUrl: string): Promise<Project | undefined>;
1313
findProjectsByCloneUrl(cloneUrls: string[]): Promise<Project[]>;
14-
findProjectById(projectId: string): Promise<Project | undefined>;
15-
findProject(teamId: string, projectName: string): Promise<Project | undefined>;
14+
findProjectByTeamAndName(teamId: string, projectName: string): Promise<Project | undefined>;
1615
findProjectByInstallationId(installationId: string): Promise<Project | undefined>;
1716
findProjectsByTeam(teamId: string): Promise<Project[]>;
1817
storeProject(project: Project): Promise<Project>;
1918
setProjectConfiguration(projectId: string, config: ProjectConfig): Promise<void>;
2019
markDeleted(projectId: string): Promise<void>;
21-
}
20+
}

components/gitpod-db/src/typeorm/project-db-impl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class ProjectDBImpl implements ProjectDB {
4545
return result;
4646
}
4747

48-
public async findProject(teamId: string, projectName: string): Promise<Project | undefined> {
48+
public async findProjectByTeamAndName(teamId: string, projectName: string): Promise<Project | undefined> {
4949
const projects = await this.findProjectsByTeam(teamId);
5050
return projects.find(p => p.name === projectName);
5151
}

components/gitpod-protocol/src/gitpod-service.ts

-2
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,6 @@ export namespace GitpodServer {
307307
}
308308
export interface CreateWorkspaceOptions {
309309
contextUrl: string;
310-
branch?: string;
311-
projectId?: string;
312310
mode?: CreateWorkspaceMode;
313311
forceDefaultConfig?: boolean;
314312
}

components/gitpod-protocol/src/teams-projects-protocol.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export namespace Project {
3939

4040
export interface BranchDetails {
4141
name: string;
42-
branchUrl: string;
42+
url: string;
4343
isDefault: boolean;
4444

4545
// Latest commit

components/server/src/auth/resource-access.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* See License-AGPL.txt in the project root for license information.
55
*/
66

7-
import { ContextURL, GitpodToken, Project, Snapshot, Team, TeamMemberInfo, Token, User, UserEnvVar, Workspace, WorkspaceInstance } from "@gitpod/gitpod-protocol";
7+
import { ContextURL, GitpodToken, Snapshot, Team, TeamMemberInfo, Token, User, UserEnvVar, Workspace, WorkspaceInstance } from "@gitpod/gitpod-protocol";
88
import { HostContextProvider } from "./host-context-provider";
99

1010
declare var resourceInstance: GuardedResource;
@@ -21,7 +21,6 @@ export type GuardedResource =
2121
GuardedContentBlob |
2222
GuardEnvVar |
2323
GuardedTeam |
24-
// GuardedProject |
2524
GuardedWorkspaceLog
2625
;
2726

@@ -89,11 +88,6 @@ export interface GuardedTeam {
8988
members: TeamMemberInfo[];
9089
}
9190

92-
export interface GuardedProject {
93-
kind: "project";
94-
subject: Project;
95-
}
96-
9791
export interface GuardedGitpodToken {
9892
kind: "gitpodToken";
9993
subject: GitpodToken;

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class ProjectsService {
2828
}
2929

3030
async getProjectOverview(user: User, teamId: string, projectName: string): Promise<Project.Overview | undefined> {
31-
const project = await this.projectDB.findProject(teamId, projectName);
31+
const project = await this.projectDB.findProjectByTeamAndName(teamId, projectName);
3232
if (!project) {
3333
return undefined;
3434
}
@@ -60,7 +60,7 @@ export class ProjectsService {
6060
const { name, commit } = branch;
6161
result.push({
6262
name,
63-
branchUrl: `${repository.webUrl}/tree/${branch.name}`, // todo: compute in repositoryProvider
63+
url: `${repository.webUrl}/tree/${branch.name}`, // todo: compute in repositoryProvider
6464
changeAuthor: commit.author,
6565
changeDate: commit.authorDate,
6666
changeHash: commit.sha,
@@ -93,7 +93,7 @@ export class ProjectsService {
9393

9494
async findPrebuilds(user: User, params: FindPrebuildsParams): Promise<PrebuildInfo[]> {
9595
const { teamId, projectName, prebuildId } = params;
96-
const project = await this.projectDB.findProject(teamId, projectName);
96+
const project = await this.projectDB.findProjectByTeamAndName(teamId, projectName);
9797
if (!project) {
9898
return [];
9999
}

0 commit comments

Comments
 (0)