Skip to content

Commit

Permalink
Merge pull request #25 from Ho-Wan/develop
Browse files Browse the repository at this point in the history
v0.4.0
  • Loading branch information
ho-wan authored Feb 2, 2019
2 parents ccb69e2 + 4710977 commit 71692bf
Show file tree
Hide file tree
Showing 6 changed files with 241 additions and 169 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 0.4.0 (02 Feb 2019)
- Add user to card, add description to card functionality
- **WARNING** - Edit description will overwrite the existing description
- Update how error messages are handled.

## 0.3.0 (30 Jan 2019)
- Enable Add card functionality.
- Existing users will need to register new API token with write access to Trello.
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# VS Code - Trello Viewer
<a href="https://marketplace.visualstudio.com/items?itemName=Ho-Wan.vscode-trello-viewer" style="text-decoration : none" title="Go to VS marketplace">
<a href="https://marketplace.visualstudio.com/items?itemName=Ho-Wan.vscode-trello-viewer" title="Go to VS marketplace">
<img src="https://vsmarketplacebadge.apphb.com/version-short/ho-wan.vscode-trello-viewer.svg">
</a>
<a href="https://github.com/Ho-Wan/vscode-trello-viewer" title="Go to Github repo">
<img src="https://vsmarketplacebadge.apphb.com/installs/ho-wan.vscode-trello-viewer.svg">
</a>
<a href="https://dev.azure.com/hw-vscode/vscode-trello-viewer/_build/latest?definitionId=3?branchName=master">
<a href="https://dev.azure.com/hw-vscode/vscode-trello-viewer/_build/latest?definitionId=3?branchName=master" title="Go to Azure pipelines">
<img src="https://dev.azure.com/hw-vscode/vscode-trello-viewer/_apis/build/status/Ho-Wan.vscode-trello-viewer?branchName=master">
</a>

Welcome to Trello Viewer for VS Code! This extension provides the following features:

- Browse Trello boards, lists and cards.
- Add card to list and set the name of card.
- Browse Trello boards, lists and cards in the side bar.
- Add new cards, add user to card, add description to card.
- View selected card using the markdown previewer and open to the side.
- See formatted checklists and cover image for the card.
- Assign a favourite list to easily access cards.
Expand All @@ -34,10 +36,11 @@ Welcome to Trello Viewer for VS Code! This extension provides the following feat

- Trello boards, lists, and cards appears in left Side Bar.
- Clicking a board or list expands or collapses object.
- Click the 'plus' icon to add a card to the selected list.
- Clicking a card opens the markdown file as well as the previewer, opening this to the right side (editor column 2 by default).
- Clicking on the 'star' icon to the right of a list assigns this as your "favourite list", shown in the lower part of the side bar.
- Clicking on the icons in the side bar runs various commands, such as setting credentials, removing credentials, showing saved info, and refreshing views.
- Click the 'plus' icon to add a card to the selected list.
- Right click on a card to see options for card, such as assigning a user and editing the description.

## Trello Card Markdown Preview

Expand Down
34 changes: 33 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-trello-viewer",
"displayName": "Trello Viewer",
"description": "View Trello cards in VS Code, browse user's boards and lists.",
"version": "0.3.0",
"version": "0.4.0",
"publisher": "Ho-Wan",
"author": {
"name": "Ho-Wan To",
Expand Down Expand Up @@ -109,6 +109,14 @@
"light": "images/light/plus.svg",
"dark": "images/dark/plus.svg"
}
},
{
"command": "trelloViewer.addUserToCard",
"title": "Add user to card"
},
{
"command": "trelloViewer.editCardDescription",
"title": "Edit description of card"
}
],
"configuration": {
Expand Down Expand Up @@ -137,6 +145,14 @@
{
"command": "trelloViewer.addCard",
"when": "false"
},
{
"command": "trelloViewer.addUserToCard",
"when": "false"
},
{
"command": "trelloViewer.editCardDescription",
"when": "false"
}
],
"view/title": [
Expand Down Expand Up @@ -186,6 +202,22 @@
"command": "trelloViewer.addCard",
"when": "view == trelloViewFavoriteList && viewItem == list",
"group": "inline@4"
},
{
"command": "trelloViewer.addUserToCard",
"when": "view == trelloTreeView && viewItem == card"
},
{
"command": "trelloViewer.addUserToCard",
"when": "view == trelloViewFavoriteList && viewItem == card"
},
{
"command": "trelloViewer.editCardDescription",
"when": "view == trelloTreeView && viewItem == card"
},
{
"command": "trelloViewer.editCardDescription",
"when": "view == trelloViewFavoriteList && viewItem == card"
}
]
},
Expand Down
16 changes: 10 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as vscode from "vscode";
import { TrelloUtils, removeTempTrelloFile } from "./trello/TrelloUtils";
import { TrelloItem } from "./trello/TrelloItem";
import { TrelloTreeView } from "./trello/TrelloTreeView";
import { TrelloViewFavoriteList } from "./trello/TrelloViewFavoriteList";
import { TrelloCard } from "./trello/trelloComponents";
import { TrelloCard, TrelloList } from "./trello/trelloComponents";

export function activate(context: vscode.ExtensionContext) {
const trello = new TrelloUtils(context);
Expand All @@ -20,12 +19,17 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand("trelloViewer.resetCredentials", () => trello.resetCredentials());
vscode.commands.registerCommand("trelloViewer.showTrelloInfo", () => trello.showTrelloInfo());
vscode.commands.registerCommand("trelloViewer.resetFavoriteList", () => trello.resetFavoriteList());
vscode.commands.registerCommand("trelloViewer.setFavoriteListByClick", (trelloItem: TrelloItem) =>
trello.setFavoriteListByClick(trelloItem)
vscode.commands.registerCommand("trelloViewer.setFavoriteListByClick", (list: TrelloList) =>
trello.setFavoriteListByClick(list)
);
vscode.commands.registerCommand("trelloViewer.addCard", (trelloItem: TrelloItem) =>
trello.addCardToList(trelloItem)

vscode.commands.registerCommand("trelloViewer.addCard", (list: TrelloList) => trello.addCardToList(list));
vscode.commands.registerCommand("trelloViewer.addUserToCard", (card: TrelloCard) => trello.addUserToCard(card));

vscode.commands.registerCommand("trelloViewer.editCardDescription", (card: TrelloCard) =>
trello.editDescription(card)
);

vscode.commands.registerCommand("trelloViewer.showCard", (card: TrelloCard) => trello.showCard(card));
}

Expand Down
31 changes: 5 additions & 26 deletions src/test/TrelloUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ suite("TrelloUtils", () => {
})
);
trelloApiGetRequestStub.returns(data);
const trelloBoard: TrelloBoard = await trello.getBoardById(BOARD_ID, false);
const trelloBoard: TrelloBoard = await trello.getBoardById(BOARD_ID);

assert.equal(trelloBoard.id, BOARD_ID);
assert.equal(trelloBoard.name, "test_board");
Expand All @@ -69,7 +69,7 @@ suite("TrelloUtils", () => {
})
);
trelloApiGetRequestStub.returns(data);
const trelloList: TrelloList = await trello.getListById(LIST_ID, false);
const trelloList: TrelloList = await trello.getListById(LIST_ID);

assert.equal(trelloList.id, LIST_ID);
assert.equal(trelloList.name, "test_list");
Expand All @@ -93,7 +93,7 @@ suite("TrelloUtils", () => {
})
);
trelloApiGetRequestStub.returns(data);
const trelloCard: TrelloCard = await trello.getCardById(CARD_ID, false);
const trelloCard: TrelloCard = await trello.getCardById(CARD_ID);

assert.equal(trelloCard.id, CARD_ID);
assert.equal(trelloCard.idShort, '1');
Expand Down Expand Up @@ -121,7 +121,7 @@ suite("TrelloUtils", () => {
])
);
trelloApiGetRequestStub.returns(data);
const trelloLists: TrelloList[] = await trello.getListsFromBoard(BOARD_ID, false);
const trelloLists: TrelloList[] = await trello.getListsFromBoard(BOARD_ID);
assert.equal(trelloLists[0].id, "list_id_1");
assert.equal(trelloLists[1].id, "list_id_2");
});
Expand All @@ -142,35 +142,14 @@ suite("TrelloUtils", () => {
])
);
trelloApiGetRequestStub.returns(data);
const trelloCards = await trello.getCardsFromList(LIST_ID, false);
const trelloCards = await trello.getCardsFromList(LIST_ID);
assert.equal(trelloCards[0].id, "card_id_1");
assert.equal(trelloCards[1].id, "card_id_2");
});
});

suite("trelloApiGetRequest", () => {
const credentialsStub = sinon.stub(trello, "isCredentialsProvided");

suiteSetup(() => {
trelloApiGetRequestStub.restore();
});

setup(() => {
credentialsStub.reset();
});

suiteTeardown(() => {
credentialsStub.restore();
});

test("trelloApiGetRequest returns null if no credentials", async () => {
credentialsStub.returns(false);
const response = await trello.trelloApiGetRequest("test_id", {});
assert.equal(response, null);
});

test("trelloApiGetRequest returns response with correct data", async () => {
credentialsStub.returns(true);
const mockResponse: AxiosPromise = new Promise(r =>
r({
data: {
Expand Down
Loading

0 comments on commit 71692bf

Please sign in to comment.