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

Refactoring #84

Merged
merged 1 commit into from
Sep 19, 2018
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export class LogTableWebview {

//Get path to resource on disk
let extensionPath = vscode.extensions.getExtension("PeterJausovec.vscode-docker").extensionPath;
const scriptFile = vscode.Uri.file(path.join(extensionPath, 'commands', 'azureCommands', 'acr-build-logs-utils', 'logScripts.js')).with({ scheme: 'vscode-resource' });
const resizingScript = vscode.Uri.file(path.join(extensionPath, 'commands', 'azureCommands', 'acr-build-logs-utils', 'resizable.js')).with({ scheme: 'vscode-resource' });
const styleFile = vscode.Uri.file(path.join(extensionPath, 'commands', 'azureCommands', 'acr-build-logs-utils', 'style', 'stylesheet.css')).with({ scheme: 'vscode-resource' });
const iconStyle = vscode.Uri.file(path.join(extensionPath, 'commands', 'azureCommands', 'acr-build-logs-utils', 'style', 'fabric-components', 'css', 'vscmdl2-icons.css')).with({ scheme: 'vscode-resource' });
const scriptFile = vscode.Uri.file(path.join(extensionPath, 'commands', 'azureCommands', 'acr-logs-utils', 'logScripts.js')).with({ scheme: 'vscode-resource' });
const resizingScript = vscode.Uri.file(path.join(extensionPath, 'commands', 'azureCommands', 'acr-logs-utils', 'resizable.js')).with({ scheme: 'vscode-resource' });
const styleFile = vscode.Uri.file(path.join(extensionPath, 'commands', 'azureCommands', 'acr-logs-utils', 'style', 'stylesheet.css')).with({ scheme: 'vscode-resource' });
const iconStyle = vscode.Uri.file(path.join(extensionPath, 'commands', 'azureCommands', 'acr-logs-utils', 'style', 'fabric-components', 'css', 'vscmdl2-icons.css')).with({ scheme: 'vscode-resource' });
//Populate Webview
this.panel.webview.html = this.getBaseHtml(scriptFile, resizingScript, styleFile, iconStyle);
this.setupIncomingListeners();
Expand Down Expand Up @@ -89,7 +89,7 @@ export class LogTableWebview {
}

//HTML Content Loaders
/** Create the table in which to push the build logs */
/** Create the table in which to push the logs */
private getBaseHtml(scriptFile: vscode.Uri, resizingScript: vscode.Uri, stylesheet: vscode.Uri, iconStyles: vscode.Uri): string {
return `<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -129,7 +129,7 @@ export class LogTableWebview {

<thead id = "tableHead" class = 'fixed solidBackground'>
<td></td>
<th><span class="colTitle" tabindex="0">Build ID<span class="sort"> </span></span></th>
<th><span class="colTitle" tabindex="0">ID<span class="sort"> </span></span></th>
<th><span class="colTitle" tabindex="0">Task<span class="sort"> </span></span></th>
<th><span class="colTitle" tabindex="0">Status<span class="sort"> </span></span></th>
<th><span class="colTitle" tabindex="0">Created<span class="sort">&#160<i class="ms-Icon ms-Icon--ChevronDown"></i></span></span></th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { TaskNode } from "../../explorer/models/taskNode";
import { getResourceGroupName, getSubscriptionFromRegistry } from '../../utils/Azure/acrTools';
import { AzureUtilityManager } from '../../utils/azureUtilityManager';
import { quickPickACRRegistry } from '../utils/quick-pick-azure'
import { accessLog } from "./acr-build-logs-utils/logFileManager";
import { LogData } from "./acr-build-logs-utils/tableDataManager";
import { LogTableWebview } from "./acr-build-logs-utils/tableViewManager";
import { accessLog } from "./acr-logs-utils/logFileManager";
import { LogData } from "./acr-logs-utils/tableDataManager";
import { LogTableWebview } from "./acr-logs-utils/tableViewManager";

/** This command is used through a right click on an azure registry, repository or image in the Docker Explorer. It is used to view build logs for a given item. */
export async function viewBuildLogs(context: AzureRegistryNode | AzureImageTagNode | TaskNode): Promise<void> {
/** This command is used through a right click on an azure registry, repository or image in the Docker Explorer. It is used to view ACR logs for a given item. */
export async function viewACRLogs(context: AzureRegistryNode | AzureImageTagNode | TaskNode): Promise<void> {
let registry: Registry;
let subscription: Subscription;
if (!context) {
Expand Down Expand Up @@ -61,7 +61,7 @@ function hasValidLogContent(context: any, logData: LogData): boolean {
} else {
itemType = 'registry';
}
vscode.window.showInformationMessage(`This ${itemType} has no associated build logs`);
vscode.window.showInformationMessage(`This ${itemType} has no associated logs`);
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as acrTools from '../../utils/Azure/acrTools';
import { AzureUtilityManager } from "../../utils/azureUtilityManager";
import { quickPickACRRegistry, quickPickSubscription, quickPickTask } from '../utils/quick-pick-azure';

export async function runBuildTask(context?: TaskNode): Promise<any> {
export async function runTask(context?: TaskNode): Promise<any> {
let taskName: string;
let subscription: Subscription;
let resourceGroup: ResourceGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AzureUtilityManager } from "../../utils/azureUtilityManager";
import { quickPickACRRegistry, quickPickSubscription, quickPickTask } from '../utils/quick-pick-azure';
import { openTask } from "./task-utils/showTaskManager";

export async function showBuildTaskProperties(context?: TaskNode): Promise<any> {
export async function showTaskProperties(context?: TaskNode): Promise<any> {
let subscription: Subscription;
let registry: Registry;
let resourceGroup: ResourceGroup;
Expand All @@ -28,17 +28,6 @@ export async function showBuildTaskProperties(context?: TaskNode): Promise<any>

const client = AzureUtilityManager.getInstance().getContainerRegistryManagementClient(subscription);
let item: any = await client.tasks.get(resourceGroup.name, registry.name, task);

/*
try {
const steps = await client.buildSteps.get(resourceGroup.name, registry.name, buildTask, `${buildTask}StepName`);
item.properties = steps;
} catch (error) {
ext.outputChannel.append(error);
ext.outputChannel.append("Build Step not available for this image due to update in API");
}
*/

let indentation = 1;
let replacer;
openTask(JSON.stringify(item, replacer, indentation), task);
Expand Down
14 changes: 7 additions & 7 deletions dockerExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ import {
TransportKind
} from "vscode-languageclient/lib/main";
import { queueBuild } from "./commands/azureCommands/acr-build";
import { viewBuildLogs } from "./commands/azureCommands/acr-build-logs";
import { LogContentProvider } from "./commands/azureCommands/acr-build-logs-utils/logFileManager";
import { viewACRLogs } from "./commands/azureCommands/acr-logs";
import { LogContentProvider } from "./commands/azureCommands/acr-logs-utils/logFileManager";
import { createRegistry } from "./commands/azureCommands/create-registry";
import { deleteAzureImage } from "./commands/azureCommands/delete-image";
import { deleteAzureRegistry } from "./commands/azureCommands/delete-registry";
import { deleteRepository } from "./commands/azureCommands/delete-repository";
import { pullFromAzure } from "./commands/azureCommands/pull-from-azure";
import { runBuildTask } from "./commands/azureCommands/run-buildTask";
import { showBuildTaskProperties } from "./commands/azureCommands/show-buildTask";
import { runTask } from "./commands/azureCommands/run-task";
import { showTaskProperties } from "./commands/azureCommands/show-task";
import { TaskContentProvider } from "./commands/azureCommands/task-utils/showTaskManager";
import { buildImage } from "./commands/build-image";
import {
Expand Down Expand Up @@ -440,9 +440,9 @@ function registerDockerCommands(azureAccount: AzureAccount): void {
registerAzureCommand("vscode-docker.delete-ACR-Repository", deleteRepository);
registerAzureCommand("vscode-docker.create-ACR-Registry", createRegistry);
registerAzureCommand("vscode-docker.pullFromAzure", pullFromAzure);
registerAzureCommand("vscode-docker.acrBuildLogs", viewBuildLogs);
registerAzureCommand("vscode-docker.run-ACR-BuildTask", runBuildTask);
registerAzureCommand("vscode-docker.show-ACR-buildTask", showBuildTaskProperties);
registerAzureCommand("vscode-docker.acrLogs", viewACRLogs);
registerAzureCommand("vscode-docker.run-ACR-Task", runTask);
registerAzureCommand("vscode-docker.show-ACR-Task", showTaskProperties);
registerCommand("vscode-docker.ACR-queueBuild", queueBuild);
}

Expand Down
4 changes: 2 additions & 2 deletions explorer/models/azureRegistryNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export class AzureRegistryNode extends NodeBase {
const registryChildNodes: NodeBase[] = [];

let iconPath = {
light: path.join(__filename, '..', '..', '..', '..', 'images', 'light', 'buildTasks_light.svg'),
dark: path.join(__filename, '..', '..', '..', '..', 'images', 'dark', 'buildTasks_dark.svg')
light: path.join(__filename, '..', '..', '..', '..', 'images', 'light', 'tasks_light.svg'),
dark: path.join(__filename, '..', '..', '..', '..', 'images', 'dark', 'tasks_dark.svg')
};

//Pushing single TaskRootNode under the current registry. All the following nodes added to registryNodes are type AzureRepositoryNode
Expand Down
File renamed without changes
File renamed without changes
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"activationEvents": [
"onLanguage:dockerfile",
"onLanguage:yaml",
"onCommand:vscode-docker.acrBuildLogs",
"onCommand:vscode-docker.acrLogs",
"onCommand:vscode-docker.api.configure",
"onCommand:vscode-docker.ACR-queueBuild",
"onCommand:vscode-docker.image.build",
Expand All @@ -55,9 +55,9 @@
"onCommand:vscode-docker.browseDockerHub",
"onCommand:vscode-docker.browseAzurePortal",
"onCommand:vscode-docker.explorer.refresh",
"onCommand:vscode-docker.show-ACR-buildTask",
"onCommand:vscode-docker.show-ACR-Task",
"onCommand:vscode-docker.delete-ACR-Registry",
"onCommand:vscode-docker.run-ACR-BuildTask",
"onCommand:vscode-docker.run-ACR-Task",
"onCommand:vscode-docker.delete-ACR-Repository",
"onCommand:vscode-docker.delete-ACR-Image",
"onCommand:vscode-docker.connectCustomRegistry",
Expand Down Expand Up @@ -247,11 +247,11 @@
"when": "view == dockerExplorer && viewItem == azureImageNode"
},
{
"command": "vscode-docker.run-ACR-BuildTask",
"command": "vscode-docker.run-ACR-Task",
"when": "view == dockerExplorer && viewItem == taskNode"
},
{
"command": "vscode-docker.show-ACR-buildTask",
"command": "vscode-docker.show-ACR-Task",
"when": "view == dockerExplorer && viewItem == taskNode"
},
{
Expand All @@ -267,7 +267,7 @@
"when": "view == dockerExplorer && viewItem =~ /^(azureRegistryNode|azureRepositoryNode|azureImageNode)$/"
},
{
"command": "vscode-docker.acrBuildLogs",
"command": "vscode-docker.acrLogs",
"when": "view == dockerExplorer && viewItem =~ /^(azureRegistryNode|azureImageTagNode|taskNode)$/"
},
{
Expand Down Expand Up @@ -655,12 +655,12 @@
"category": "Docker"
},
{
"command": "vscode-docker.run-ACR-BuildTask",
"command": "vscode-docker.run-ACR-Task",
"title": "Run Task",
"category": "Docker"
},
{
"command": "vscode-docker.show-ACR-buildTask",
"command": "vscode-docker.show-ACR-Task",
"title": "Show Task Properties",
"category": "Docker"
},
Expand All @@ -675,7 +675,7 @@
"category": "Docker"
},
{
"command": "vscode-docker.acrBuildLogs",
"command": "vscode-docker.acrLogs",
"title": "View Azure logs",
"category": "Docker"
},
Expand Down