提交 aac08d3b 编写于 作者: T Tomas Vik

refactor(gitlab_project): fetch project.webUrl to fix openers

上级 dc4a869e
......@@ -45,7 +45,7 @@ class DataProvider {
const actionText = actions[pipeline.status] || '';
const message = `Pipeline #${pipeline.id} ${statusText} · ${actionText} ${timeAgo}`;
const url = `${this.project.web_url}/pipelines/${pipeline.id}`;
const url = `${this.project.webUrl}/pipelines/${pipeline.id}`;
return new ExternalUrlItem(message, url);
}
......
......@@ -132,6 +132,7 @@ const queryGetProject = gql`
id
name
fullPath
webUrl
group {
id
}
......
......@@ -7,6 +7,7 @@ export interface GqlProject {
id: string;
name: string;
fullPath: string;
webUrl: string;
group?: GqlGroup;
}
......@@ -29,6 +30,10 @@ export class GitLabProject {
return this.gqlProject.fullPath;
}
get webUrl(): string {
return this.gqlProject.webUrl;
}
get groupRestId(): number | undefined {
return this.gqlProject.group && getRestIdFromGraphQLId(this.gqlProject.group.id);
}
......
......@@ -24,7 +24,7 @@ async function getLink(linkTemplate, workspaceFolder) {
const user = await gitLabService.fetchCurrentUser();
const project = await gitLabService.fetchCurrentProject(workspaceFolder);
return linkTemplate.replace('$userId', user.id).replace('$projectUrl', project.web_url);
return linkTemplate.replace('$userId', user.id).replace('$projectUrl', project.webUrl);
}
async function openLink(linkTemplate, workspaceFolder) {
......@@ -58,7 +58,7 @@ async function getActiveFile() {
}
const branchName = await createGitService(workspaceFolder).fetchTrackingBranchName();
const filePath = editor.document.uri.path.replace(`${workspaceFolder}/`, '');
const fileUrl = `${currentProject.web_url}/blob/${branchName}/${filePath}`;
const fileUrl = `${currentProject.webUrl}/blob/${branchName}/${filePath}`;
let anchor = '';
if (editor.selection) {
......@@ -101,7 +101,7 @@ async function openCreateNewMr() {
const project = await gitLabService.fetchCurrentProject(workspaceFolder);
const branchName = await createGitService(workspaceFolder).fetchTrackingBranchName();
openUrl(`${project.web_url}/merge_requests/new?merge_request%5Bsource_branch%5D=${branchName}`);
openUrl(`${project.webUrl}/merge_requests/new?merge_request%5Bsource_branch%5D=${branchName}`);
}
async function openProjectPage() {
......@@ -121,7 +121,7 @@ async function openCurrentPipeline(workspaceFolder) {
const pipeline = await gitLabService.fetchLastPipelineForCurrentBranch(workspaceFolder);
if (pipeline) {
openUrl(`${project.web_url}/pipelines/${pipeline.id}`);
openUrl(`${project.webUrl}/pipelines/${pipeline.id}`);
}
}
}
......@@ -135,7 +135,7 @@ async function compareCurrentBranch() {
lastCommitId = await createGitService(workspaceFolder).fetchLastCommitId();
if (project && lastCommitId) {
openUrl(`${project.web_url}/compare/master...${lastCommitId}`);
openUrl(`${project.webUrl}/compare/master...${lastCommitId}`);
}
}
......
......@@ -103,7 +103,7 @@ async function showSearchInputFor(noteableType) {
);
const queryString = await parseQuery(query, noteableType);
await openers.openUrl(`${project.web_url}/${noteableType}${queryString}`);
await openers.openUrl(`${project.webUrl}/${noteableType}${queryString}`);
}
async function showIssueSearchInput() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册