Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark Task Complete #4

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions atoll-extension-main.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
},
{
"path": "../atoll-rest-fetch"
},
{
"path": "../atoll-rich-types"
}
],
"settings": {
Expand Down
69 changes: 43 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
"name": "atoll-extension",
"displayName": "Atoll Extension",
"description": "Use Atoll from within VS Code",
"version": "0.3.4",
"version": "0.4.0",
"repository": {
"type": "git",
"url": "https://github.com/51ngul4r1ty/atoll-extensions.git"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"engines": {
"vscode": "1.66.2"
"vscode": ">=1.67.0"
},
"categories": [
"Other"
Expand Down Expand Up @@ -67,7 +71,8 @@
"webpack-cli": "4.9.2"
},
"dependencies": {
"@atoll/client-sdk": "0.18.1",
"@atoll/client-sdk": "1.0.0",
"@atoll/rich-types": "0.1.1",
"axios": "0.27.2"
}
}
29 changes: 26 additions & 3 deletions src/chooseStoryCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { window, ExtensionContext, QuickPickOptions } from "vscode";

// libraries
import type { SprintBacklogResourceItem } from "@atoll/api-types";
import { atollClient } from "@atoll/client-sdk";
import { atollClient, mapApiToBacklogItemStatus } from "@atoll/client-sdk";

// state
import { state } from "./extensionState";

// utils
import { logError, logInfo, logWarning, MessageStyle } from "./logger";
import { BacklogItemStatus } from "@atoll/rich-types";

const buildUniqueBacklogItemName = (backlogItem: SprintBacklogResourceItem) => {
const parts: string[] = [];
Expand Down Expand Up @@ -59,7 +60,7 @@ export async function chooseStory(context: ExtensionContext) {
const backlogItemsUri = atollClient.buildFullUri(backlogItemsRelativeUri);
const sprintBacklogItems = await atollClient.fetchSprintBacklogItemsByUri(backlogItemsUri);

if (sprintBacklogItems === null) {
if (sprintBacklogItems === null || sprintBacklogItems.length === 0) {
logInfo(
"There are no sprint backlog items available - please add sprint backlog items first!",
MessageStyle.OutputChannelAndMessage
Expand Down Expand Up @@ -93,7 +94,29 @@ export async function chooseStory(context: ExtensionContext) {
state.currentBacklogItemId = matchingSBI.id;
state.currentBacklogItemFriendlyId = id;
state.currentBacklogItemStoryPhrase = matchingSBI.storyPhrase;

const existingStatus = mapApiToBacklogItemStatus(matchingSBI.status);
if (
existingStatus === BacklogItemStatus.None ||
existingStatus === BacklogItemStatus.NotStarted ||
existingStatus === BacklogItemStatus.InProgress
) {
const backlogItemRelativeUri = atollClient.findLinkUriByRel(matchingSBI.links, "related:backlog-item-part");
if (!backlogItemRelativeUri) {
logError(
'Unable to update backlog item status to "In Progress"- ' +
`cannot find backlogitem self link for ID "${matchingSBI.id}"`
);
} else {
// backlog item part ID: 93ee88b671244b99a985d1a164f6e577
// url: http://localhost:8500/api/v1/backlog-item-parts/93ee88b671244b99a985d1a164f6e577
// PATCH
// sprint backlog items may return backlogItemPartId?
// why doesn't it provide a link to the backlog item part?
const backlogItemPartsUri = atollClient.buildFullUri(backlogItemRelativeUri);
const result = await atollClient.updateBacklogItemPartStatusByUri(backlogItemPartsUri, BacklogItemStatus.InProgress);
console.log(result);
}
}
await state.saveSettings(context);

logInfo(`Backlog item "${id} - ${matchingSBI.storyPhrase}" selected.`, MessageStyle.OutputChannelAndMessage);
Expand Down
22 changes: 2 additions & 20 deletions src/connectCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { state } from "./extensionState";

// utils
import { logDebug } from "./logger";
import * as notificationBridge from "./notificationBridge";

export async function disconnect(context: ExtensionContext) {
if (!atollClient.isConnected()) {
Expand Down Expand Up @@ -78,26 +79,7 @@ export async function connect(context: ExtensionContext) {
}
const password = rawPassword?.trim() || "";
window.showInformationMessage(`Connecting to "${serverUrl}" using "${userName}"...`);
const handleNotification = async (message: string, level: string) => {
switch (level) {
case "info": {
window.showInformationMessage(message);
break;
}
case "warn": {
window.showWarningMessage(message);
break;
}
case "error": {
window.showErrorMessage(message);
break;
}
default: {
throw new Error(`Unexpected level "${level}" with message "${message}"`);
}
}
};
const connectionResult = await atollClient.connect(serverUrl || "", userName, password, handleNotification);
const connectionResult = await atollClient.connect(serverUrl || "", userName, password, notificationBridge.handleNotification);
if (connectionResult === null) {
window.showInformationMessage("Successfully connected to Atoll server - loading projects...");
state.atollServerUrl = serverUrl;
Expand Down
Loading