mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 05:51:32 +01:00
close pull request
This commit is contained in:
@@ -11,9 +11,12 @@ const vscode = acquireVsCodeApi();
|
||||
function handleMessage(event: any) {
|
||||
const message = event.data; // The json data that the extension sent
|
||||
switch (message.command) {
|
||||
case 'initialize':
|
||||
case 'pr.initialize':
|
||||
renderPullRequest(message.pullrequest);
|
||||
break;
|
||||
case 'pr.update':
|
||||
updatePullRequest(message.pullrequest);
|
||||
break;
|
||||
case 'checked-out':
|
||||
updateCheckoutButton(true);
|
||||
break;
|
||||
@@ -35,6 +38,12 @@ function renderPullRequest(pullRequest: any) {
|
||||
addEventListeners();
|
||||
}
|
||||
|
||||
function updatePullRequest(pullRequest: any) {
|
||||
if (pullRequest.state || pullRequest.body || pullRequest.author || pullRequest.title) {
|
||||
setTitleHTML(pullRequest);
|
||||
}
|
||||
}
|
||||
|
||||
function setTitleHTML(pr: any) {
|
||||
document.getElementById('title')!.innerHTML = `
|
||||
<div class="prIcon"><svg width="64" height="64" class="octicon octicon-git-compare" viewBox="0 0 14 16" version="1.1" aria-hidden="true"><path fill="#FFFFFF" fill-rule="evenodd" d="M5 12H4c-.27-.02-.48-.11-.69-.31-.21-.2-.3-.42-.31-.69V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V11c.03.78.34 1.47.94 2.06.6.59 1.28.91 2.06.94h1v2l3-3-3-3v2zM2 1.8c.66 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2C1.35 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2zm11 9.48V5c-.03-.78-.34-1.47-.94-2.06-.6-.59-1.28-.91-2.06-.94H9V0L6 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 12 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg></div>
|
||||
@@ -70,6 +79,13 @@ function addEventListeners() {
|
||||
});
|
||||
(<HTMLTextAreaElement>document.getElementById('commentTextArea')!).value = '';
|
||||
});
|
||||
|
||||
document.getElementById('close-button')!.addEventListener('click', () => {
|
||||
(<HTMLButtonElement>document.getElementById('close-button')).disabled = true;
|
||||
vscode.postMessage({
|
||||
command: 'pr.close'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function appendComment(comment: any) {
|
||||
|
||||
Reference in New Issue
Block a user