Skip to content

Commit

Permalink
MC-848 Removing project id from the edit URL, skipping the check for …
Browse files Browse the repository at this point in the history
…projectID
  • Loading branch information
knsv committed Oct 6, 2023
1 parent 3dd1a82 commit 9e7de6e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export async function activate(context: vscode.ExtensionContext) {

mermaidChartProvider.refresh();
// Add a console.log() statement to ensure the view is registered
console.log("Mermaid Charts view registered.");
console.log("Mermaid Charts view registered");
}

// This method is called when your extension is deactivated
Expand Down
20 changes: 8 additions & 12 deletions src/mermaidAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ export class MermaidChart {
return projects.data;
}

public async getEditURL(
document: Pick<MCDocument, "documentID" | "major" | "minor" | "projectID">
) {
public async getEditURL(document: Pick<MCDocument, "documentID">) {
const url = `${this.baseURL}${this.URLS.diagram(document).edit}`;
return url;
}
Expand Down Expand Up @@ -247,7 +245,7 @@ export class MermaidChart {
documents: {
get: (documentID: string) => {
return `/rest-api/documents/${documentID}`;
}
},
},
projects: {
list: `/rest-api/projects`,
Expand All @@ -266,17 +264,15 @@ export class MermaidChart {
return {
html: base + "html",
svg: base + "svg",
png: base + 'png'
png: base + "png",
};
},
diagram: (
d: Pick<MCDocument, "projectID" | "documentID" | "major" | "minor">
) => {
const base = `/app/projects/${d.projectID}/diagrams/${d.documentID}/version/v${d.major}.${d.minor}`;
diagram: (d: Pick<MCDocument, "documentID">) => {
// const base = `/app/projects/${d.projectID}/diagrams/${d.documentID}/version/v${d.major}.${d.minor}`;
return {
self: base,
edit: `/diagrams/${d.documentID}/`,
view: base + "/view",
// self: base,
edit: `/app/diagrams/${d.documentID}?ref=vscode`,
// view: base + "/view",
} as const;
},
} as const;
Expand Down
19 changes: 8 additions & 11 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,16 @@ export async function editMermaidChart(
uuid: string,
provider: MermaidChartProvider
) {
const project = provider.getProjectOfDocument(uuid);
const projectUuid = project?.uuid;
if (!projectUuid) {
vscode.window.showErrorMessage(
"Diagram not found in project. Diagram might have moved to a different project."
);
return;
}
// const project = provider.getProjectOfDocument(uuid);
// const projectUuid = project?.uuid;
// if (!projectUuid) {
// vscode.window.showErrorMessage(
// "Diagram not found in project. Diagram might have moved to a different project."
// );
// return;
// }
const editUrl = await mcAPI.getEditURL({
documentID: uuid,
projectID: projectUuid,
major: "0",
minor: "1",
});
vscode.env.openExternal(vscode.Uri.parse(editUrl));
}
Expand Down

0 comments on commit 9e7de6e

Please sign in to comment.