Updated kanbn dependency

This commit is contained in:
Gordon
2021-04-24 20:33:01 +01:00
parent 6deb8ec191
commit b4a97db224
9 changed files with 777 additions and 25 deletions

View File

@ -13,12 +13,14 @@ export default class KanbnBoardPanel {
private readonly _extensionPath: string;
private readonly _workspacePath: string;
private readonly _kanbn: typeof import("@basementuniverse/kanbn/src/main");
private readonly _kanbnFolderName: string;
private _disposables: vscode.Disposable[] = [];
public static createOrShow(
extensionPath: string,
workspacePath: string,
kanbn: typeof import("@basementuniverse/kanbn/src/main")
kanbn: typeof import("@basementuniverse/kanbn/src/main"),
kanbnFolderName: string
) {
const column = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn : undefined;
@ -30,7 +32,8 @@ export default class KanbnBoardPanel {
extensionPath,
workspacePath,
column || vscode.ViewColumn.One,
kanbn
kanbn,
kanbnFolderName
);
}
}
@ -71,11 +74,13 @@ export default class KanbnBoardPanel {
extensionPath: string,
workspacePath: string,
column: vscode.ViewColumn,
kanbn: typeof import("@basementuniverse/kanbn/src/main")
kanbn: typeof import("@basementuniverse/kanbn/src/main"),
kanbnFolderName: string
) {
this._extensionPath = extensionPath;
this._workspacePath = workspacePath;
this._kanbn = kanbn;
this._kanbnFolderName = kanbnFolderName;
// Create and show a new webview panel
this._panel = vscode.window.createWebviewPanel(KanbnBoardPanel.viewType, "Kanbn Board", column, {
@ -88,7 +93,7 @@ export default class KanbnBoardPanel {
// Restrict the webview to only loading content from allowed paths
localResourceRoots: [
vscode.Uri.file(path.join(this._extensionPath, "build")),
vscode.Uri.file(path.join(this._workspacePath, this._kanbn.getFolderName())),
vscode.Uri.file(path.join(this._workspacePath, this._kanbnFolderName)),
vscode.Uri.file(path.join(this._extensionPath, "node_modules", "vscode-codicons", "dist")),
],
});
@ -125,6 +130,7 @@ export default class KanbnBoardPanel {
this._extensionPath,
this._workspacePath,
this._kanbn,
this._kanbnFolderName,
message.taskId,
message.columnName
);
@ -141,12 +147,24 @@ export default class KanbnBoardPanel {
// Create a task
case "kanbn.addTask":
KanbnTaskPanel.show(this._extensionPath, this._workspacePath, this._kanbn, null, message.columnName);
KanbnTaskPanel.show(
this._extensionPath,
this._workspacePath,
this._kanbn,
this._kanbnFolderName,
null,
message.columnName
);
return;
// Open a burndown chart
case "kanbn.burndown":
KanbnBurndownPanel.createOrShow(this._extensionPath, this._workspacePath, this._kanbn);
KanbnBurndownPanel.createOrShow(
this._extensionPath,
this._workspacePath,
this._kanbn,
this._kanbnFolderName
);
KanbnBurndownPanel.update();
return;
@ -198,7 +216,7 @@ export default class KanbnBoardPanel {
scheme: "vscode-resource",
});
const customStyleUri = vscode.Uri.file(
path.join(this._workspacePath, this._kanbn.getFolderName(), "board.css")
path.join(this._workspacePath, this._kanbnFolderName, "board.css")
).with({ scheme: "vscode-resource" });
const codiconsUri = vscode.Uri.file(
path.join(this._extensionPath, "node_modules", "vscode-codicons", "dist", "codicon.css")

View File

@ -11,6 +11,7 @@ export default class KanbnBurndownPanel {
private readonly _extensionPath: string;
private readonly _workspacePath: string;
private readonly _kanbn: typeof import("@basementuniverse/kanbn/src/main");
private readonly _kanbnFolderName: string;
private sprintMode: boolean = true;
private sprint: string = '';
private startDate: string = '';
@ -20,7 +21,8 @@ export default class KanbnBurndownPanel {
public static async createOrShow(
extensionPath: string,
workspacePath: string,
kanbn: typeof import("@basementuniverse/kanbn/src/main")
kanbn: typeof import("@basementuniverse/kanbn/src/main"),
kanbnFolderName: string
) {
const column = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn : undefined;
@ -32,7 +34,8 @@ export default class KanbnBurndownPanel {
extensionPath,
workspacePath,
column || vscode.ViewColumn.One,
kanbn
kanbn,
kanbnFolderName
);
}
}
@ -73,11 +76,13 @@ export default class KanbnBurndownPanel {
extensionPath: string,
workspacePath: string,
column: vscode.ViewColumn,
kanbn: typeof import("@basementuniverse/kanbn/src/main")
kanbn: typeof import("@basementuniverse/kanbn/src/main"),
kanbnFolderName: string
) {
this._extensionPath = extensionPath;
this._workspacePath = workspacePath;
this._kanbn = kanbn;
this._kanbnFolderName = kanbnFolderName;
// Create and show a new webview panel
this._panel = vscode.window.createWebviewPanel(KanbnBurndownPanel.viewType, "Burndown Chart", column, {
@ -90,7 +95,7 @@ export default class KanbnBurndownPanel {
// Restrict the webview to only loading content from allowed paths
localResourceRoots: [
vscode.Uri.file(path.join(this._extensionPath, "build")),
vscode.Uri.file(path.join(this._workspacePath, this._kanbn.getFolderName())),
vscode.Uri.file(path.join(this._workspacePath, this._kanbnFolderName)),
vscode.Uri.file(path.join(this._extensionPath, "node_modules", "vscode-codicons", "dist")),
],
});
@ -160,7 +165,7 @@ export default class KanbnBurndownPanel {
scheme: "vscode-resource",
});
const customStyleUri = vscode.Uri.file(
path.join(this._workspacePath, this._kanbn.getFolderName(), "board.css")
path.join(this._workspacePath, this._kanbnFolderName, "board.css")
).with({ scheme: "vscode-resource" });
const codiconsUri = vscode.Uri.file(
path.join(this._extensionPath, "node_modules", "vscode-codicons", "dist", "codicon.css")

View File

@ -61,6 +61,7 @@ export default class KanbnTaskPanel {
private readonly _extensionPath: string;
private readonly _workspacePath: string;
private readonly _kanbn: typeof import("@basementuniverse/kanbn/src/main");
private readonly _kanbnFolderName: string;
private readonly _panelUuid: string;
private _taskId: string | null;
private _columnName: string | null;
@ -70,6 +71,7 @@ export default class KanbnTaskPanel {
extensionPath: string,
workspacePath: string,
kanbn: typeof import("@basementuniverse/kanbn/src/main"),
kanbnFolderName: string,
taskId: string | null,
columnName: string | null
) {
@ -82,6 +84,7 @@ export default class KanbnTaskPanel {
workspacePath,
column || vscode.ViewColumn.One,
kanbn,
kanbnFolderName,
taskId,
columnName,
panelUuid
@ -95,6 +98,7 @@ export default class KanbnTaskPanel {
workspacePath: string,
column: vscode.ViewColumn,
kanbn: typeof import("@basementuniverse/kanbn/src/main"),
kanbnFolderName: string,
taskId: string | null,
columnName: string | null,
panelUuid: string
@ -102,6 +106,7 @@ export default class KanbnTaskPanel {
this._extensionPath = extensionPath;
this._workspacePath = workspacePath;
this._kanbn = kanbn;
this._kanbnFolderName = kanbnFolderName;
this._taskId = taskId;
this._columnName = columnName;
this._panelUuid = panelUuid;
@ -117,7 +122,7 @@ export default class KanbnTaskPanel {
// Restrict the webview to only loading content from allowed paths
localResourceRoots: [
vscode.Uri.file(path.join(this._extensionPath, "build")),
vscode.Uri.file(path.join(this._workspacePath, this._kanbn.getFolderName())),
vscode.Uri.file(path.join(this._workspacePath, this._kanbnFolderName)),
vscode.Uri.file(path.join(this._extensionPath, "node_modules", "vscode-codicons", "dist")),
],
});
@ -260,7 +265,7 @@ export default class KanbnTaskPanel {
scheme: "vscode-resource",
});
const customStyleUri = vscode.Uri.file(
path.join(this._workspacePath, this._kanbn.getFolderName(), "board.css")
path.join(this._workspacePath, this._kanbnFolderName, "board.css")
).with({ scheme: "vscode-resource" });
const codiconsUri = vscode.Uri.file(
path.join(this._extensionPath, "node_modules", "vscode-codicons", "dist", "codicon.css")

View File

@ -64,7 +64,12 @@ export async function activate(context: vscode.ExtensionContext) {
// If kanbn is initialised, view the kanbn board
if (await kanbn.initialised()) {
KanbnBoardPanel.createOrShow(context.extensionPath, vscode.workspace.workspaceFolders[0].uri.fsPath, kanbn);
KanbnBoardPanel.createOrShow(
context.extensionPath,
vscode.workspace.workspaceFolders[0].uri.fsPath,
kanbn,
await kanbn.getFolderName()
);
KanbnBoardPanel.update();
} else {
vscode.window.showErrorMessage("You need to initialise Kanbn before viewing the Kanbn board.");
@ -88,7 +93,14 @@ export async function activate(context: vscode.ExtensionContext) {
// If kanbn is initialised, open the task webview
if (await kanbn.initialised()) {
KanbnTaskPanel.show(context.extensionPath, vscode.workspace.workspaceFolders[0].uri.fsPath, kanbn, null, null);
KanbnTaskPanel.show(
context.extensionPath,
vscode.workspace.workspaceFolders[0].uri.fsPath,
kanbn,
await kanbn.getFolderName(),
null,
null
);
} else {
vscode.window.showErrorMessage("You need to initialise Kanbn before adding a new task.");
}
@ -110,7 +122,12 @@ export async function activate(context: vscode.ExtensionContext) {
// If kanbn is initialised, view the burndown chart
if (await kanbn.initialised()) {
KanbnBurndownPanel.createOrShow(context.extensionPath, vscode.workspace.workspaceFolders[0].uri.fsPath, kanbn);
KanbnBurndownPanel.createOrShow(
context.extensionPath,
vscode.workspace.workspaceFolders[0].uri.fsPath,
kanbn,
await kanbn.getFolderName()
);
KanbnBurndownPanel.update();
} else {
vscode.window.showErrorMessage("You need to initialise Kanbn before viewing the burndown chart.");
@ -132,8 +149,9 @@ export async function activate(context: vscode.ExtensionContext) {
// Initialise file watcher
const uri = vscode.workspace.workspaceFolders[0].uri.fsPath;
const kanbnFolderName = await kanbn.getFolderName();
const fileWatcher = vscode.workspace.createFileSystemWatcher(
new vscode.RelativePattern(uri, `${kanbn.getFolderName()}/**.*`)
new vscode.RelativePattern(uri, `${kanbnFolderName}/**.*`)
);
fileWatcher.onDidChange(() => {
kanbnStatusBarItem.update();