* fixes #201, #207
This commit is contained in:
Chris Dias 2018-02-02 10:09:03 -08:00 коммит произвёл GitHub
Родитель 0be65aaa9a
Коммит 0b3fb8f52e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 28 добавлений и 16 удалений

Просмотреть файл

@ -34,18 +34,19 @@ function computeItems(folder: vscode.WorkspaceFolder, uris: vscode.Uri[]): vscod
async function compose(command: string, message: string, dockerComposeFileUri?: vscode.Uri) {
let folder: vscode.WorkspaceFolder;
if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length === 1) {
if (!vscode.workspace.workspaceFolders) {
vscode.window.showErrorMessage('Docker compose can only run if VS Code is opened on a folder.');
return;
}
if (vscode.workspace.workspaceFolders.length === 1) {
folder = vscode.workspace.workspaceFolders[0];
} else {
folder = await (<any>vscode).window.showWorkspaceFolderPick();
}
if (!folder) {
if (!vscode.workspace.workspaceFolders) {
vscode.window.showErrorMessage('Docker compose can only run if VS Code is opened on a folder.');
} else {
vscode.window.showErrorMessage('Docker compose can only run if a workspace folder is picked in VS Code.');
}
return;
}
@ -69,6 +70,8 @@ async function compose(command: string, message: string, dockerComposeFileUri?:
const build: string = configOptions.get('dockerComposeBuild', true) ? '--build': '';
const detached: string = configOptions.get('dockerComposeDetached', true) ? '-d' : '';
terminal.sendText(`cd ${folder.uri.fsPath}`);
terminal.sendText(command.toLowerCase() === 'up' ? `docker-compose -f ${selectedItem.file} ${command} ${detached} ${build}` : `docker-compose -f ${selectedItem.file} ${command}`);
terminal.show();
if (reporter) {

Просмотреть файл

@ -201,19 +201,19 @@ export class AzureRepositoryNode extends NodeBase {
});
for (let i = 0; i < tags.length; i++) {
created = '';
let manifest = JSON.parse(await request.get('https://' + element.repository + '/v2/' + element.label + '/manifests/latest', {
auth: { bearer: accessTokenARC }
}));
created = moment(new Date(JSON.parse(manifest.history[0].v1Compatibility).created)).fromNow();
node = new AzureImageNode(`${element.label}:${tags[i]} (${created})`, 'azureImageNode');
node = new AzureImageNode(`${element.label}:${tags[i]}`, 'azureImageNode');
node.azureAccount = element.azureAccount;
node.password = element.password;
node.registry = element.registry;
node.serverUrl = element.repository;
node.subscription = element.subscription;
node.userName = element.userName;
node.created = moment(new Date(JSON.parse(manifest.history[0].v1Compatibility).created)).fromNow();
imageNodes.push(node);
}
@ -230,8 +230,9 @@ export class AzureImageNode extends NodeBase {
) {
super(label);
}
public azureAccount: AzureAccount
public created: string;
public password: string;
public registry: ContainerModels.Registry;
public serverUrl: string;
@ -239,8 +240,12 @@ export class AzureImageNode extends NodeBase {
public userName: string;
getTreeItem(): vscode.TreeItem {
let displayName: string = this.label;
displayName = `${displayName} (${this.created})`;
return {
label: this.label,
label: `${displayName}`,
collapsibleState: vscode.TreeItemCollapsibleState.None,
contextValue: this.contextValue
}
@ -249,7 +254,7 @@ export class AzureImageNode extends NodeBase {
export class AzureNotSignedInNode extends NodeBase {
constructor() {
super('Sign in to Azure...');
super('Click here to sign in to Azure...');
}
getTreeItem(): vscode.TreeItem {

Просмотреть файл

@ -79,15 +79,14 @@ export class DockerHubRepositoryNode extends NodeBase {
async getChildren(element: DockerHubRepositoryNode): Promise<DockerHubImageNode[]> {
const imageNodes: DockerHubImageNode[] = [];
let node: DockerHubImageNode;
let created: string = '';
const myTags: dockerHub.Tag[] = await dockerHub.getRepositoryTags({namespace: element.repository.namespace, name: element.repository.name});
for (let i = 0; i < myTags.length; i++) {
created = moment(new Date(myTags[i].last_updated)).fromNow();
node = new DockerHubImageNode(`${element.repository.name}:${myTags[i].name} (${created})`, 'dockerHubImageTag');
node = new DockerHubImageNode(`${element.repository.name}:${myTags[i].name}`, 'dockerHubImageTag');
node.password = element.password;
node.userName = element.userName;
node.repository = element.repository;
node.created = moment(new Date(myTags[i].last_updated)).fromNow();;
imageNodes.push(node);
}
@ -109,10 +108,15 @@ export class DockerHubImageNode extends NodeBase {
public userName: string;
public password: string;
public repository: any;
public created: string;
getTreeItem(): vscode.TreeItem {
let displayName: string = this.label;
displayName = `${displayName} (${this.created})`;
return {
label: this.label,
label: `${displayName}`,
collapsibleState: vscode.TreeItemCollapsibleState.None,
contextValue: this.contextValue
}