Skip to content

Commit

Permalink
Merge pull request #40 from JetBrains/v8-refactoring
Browse files Browse the repository at this point in the history
V8 refactoring
  • Loading branch information
rugpanov committed Jul 13, 2018
2 parents 0ba7b1d + 8bca293 commit 4a2c5c8
Show file tree
Hide file tree
Showing 62 changed files with 1,278 additions and 1,008 deletions.
57 changes: 56 additions & 1 deletion package-lock.json

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

72 changes: 30 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
}
},
{
"command": "teamcity.backToEmptyDataProvider",
"command": "teamcity.backToChangesDataProvider",
"title": "Back to the previous step",
"category": "TeamCity",
"icon": {
Expand Down Expand Up @@ -112,11 +112,6 @@
"dark": "resources/icons/dark/pretested-commit.svg"
}
},
{
"command": "teamcity.showOutput",
"title": "Show TeamCity output",
"category": "TeamCity"
},
{
"command": "teamcity.showMyChanges",
"title": "Show my changes",
Expand Down Expand Up @@ -233,11 +228,6 @@
],
"views": {
"teamcity": [
{
"id": "teamcityEmptyExplorer",
"name": "",
"when": "teamcity-explorer == EmptyDataProvider"
},
{
"id": "teamcityResourceExplorer",
"name": "",
Expand All @@ -250,7 +240,7 @@
},
{
"id": "teamcityChangesProvider",
"name": "",
"name": "My Changes",
"when": "teamcity-explorer == ChangesProvider"
},
{
Expand Down Expand Up @@ -279,7 +269,7 @@
"when": "never"
},
{
"command": "teamcity.backToEmptyDataProvider",
"command": "teamcity.backToChangesDataProvider",
"when": "never"
},
{
Expand Down Expand Up @@ -342,10 +332,6 @@
"command": "teamcity.preTestedCommit",
"when": "never"
},
{
"command": "teamcity.preTestedCommit",
"when": "never"
},
{
"command": "teamcity.refreshMyChanges",
"when": "never"
Expand All @@ -358,21 +344,11 @@
"view/title": [
{
"command": "teamcity.selectFilesForRemoteRun",
"when": "view == teamcityEmptyExplorer",
"when": "view == teamcityChangesProvider && teamcity-show-remote-run-button == true",
"group": "navigation@1"
},
{
"command": "teamcity.showMyChanges",
"when": "view == teamcityEmptyExplorer",
"group": "navigation@2"
},
{
"command": "teamcity.signOut",
"when": "view == teamcityEmptyExplorer",
"group": "@1"
},
{
"command": "teamcity.backToEmptyDataProvider",
"command": "teamcity.backToChangesDataProvider",
"when": "view == teamcityResourceExplorer",
"group": "navigation@1"
},
Expand All @@ -388,7 +364,12 @@
},
{
"command": "teamcity.signOut",
"when": "view == teamcityResourceExplorer",
"when": "view == teamcityResourceExplorer && teamcity-signed-in == true",
"group": "@1"
},
{
"command": "teamcity.signIn",
"when": "view == teamcityResourceExplorer && teamcity-signed-in == false",
"group": "@1"
},
{
Expand All @@ -413,17 +394,17 @@
},
{
"command": "teamcity.signOut",
"when": "view == teamcityBuildsExplorer",
"when": "view == teamcityBuildsExplorer && teamcity-signed-in == true",
"group": "@1"
},
{
"command": "teamcity.backToEmptyDataProvider",
"when": "view == teamcityChangesProvider",
"group": "navigation@1"
"command": "teamcity.signOut",
"when": "view == teamcityChangesProvider && teamcity-signed-in == true",
"group": "@1"
},
{
"command": "teamcity.signOut",
"when": "view == teamcityChangesProvider",
"command": "teamcity.signIn",
"when": "view == teamcityChangesProvider && teamcity-signed-in == false",
"group": "@1"
},
{
Expand Down Expand Up @@ -542,11 +523,6 @@
"type": "string",
"description": "Specifies the logging level for the extension (error, warn, info, debug)."
},
"teamcity.show.welcome": {
"type": "boolean",
"default": true,
"description": "Specifies whether the extension should show the welcome message after the login operation or not."
},
"teamcity.credentials.persistent": {
"type": "boolean",
"default": true,
Expand All @@ -556,10 +532,20 @@
"type": "string",
"description": "Stores the last used url and username."
},
"teamcity.git.changesFromIndex": {
"teamcity.experimental.git.support": {
"type": "boolean",
"default": false,
"description": "Enable an experimental git support."
},
"teamcity.experimental.git.changesFromIndex": {
"type": "boolean",
"default": false,
"description": "Git specific. Specifies whether the extension should collect changes from the index or not. When set to false, changes are collected from the working tree."
},
"teamcity.experimental.tfvc.pretestedSupport": {
"type": "boolean",
"default": false,
"description": "Enable an experimental tfvc pre-tested commit support."
}
}
}
Expand All @@ -578,6 +564,7 @@
"@types/chai": "^4.1.2",
"@types/mocha": "^2.2.32",
"@types/node": "^6.0.40",
"@types/opn": "^5.1.0",
"@types/pako": "^1.0.0",
"@types/pify": "^3.0.1",
"@types/portscanner": "^2.1.0",
Expand Down Expand Up @@ -613,6 +600,7 @@
"mock-require": "^3.0.1",
"node-forge": "^0.7.1",
"node-gyp": "^3.6.2",
"opn": "^5.3.0",
"pako": "^1.0.5",
"path": "^0.12.7",
"pify": "^3.0.0",
Expand Down
5 changes: 2 additions & 3 deletions src/bll/commands/OpenInBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import {BuildConfig} from "../entities/buildconfig";
import {TYPES} from "../utils/constants";
import {CredentialsStore} from "../credentialsstore/credentialsstore";
import {commands, Uri} from "vscode";
import { ChangeItem } from "../entities/presentable/changeitem";
import { Change } from "../entities/change";
import {instance} from "ts-mockito";
import {ChangeItem} from "../entities/presentable/changeitem";
import {Change} from "../entities/change";

@injectable()
export class OpenInBrowser implements Command {
Expand Down
2 changes: 1 addition & 1 deletion src/bll/commands/command.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
interface Command {
exec(args?: any[]): Promise<void>;
exec(args?: any[]): Promise<void | boolean>;
}
55 changes: 28 additions & 27 deletions src/bll/commands/getsuitableconfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,55 @@ import {RemoteBuildServer} from "../../dal/remotebuildserver";
import {XmlParser} from "../utils/xmlparser";
import {CvsProviderProxy} from "../../dal/cvsproviderproxy";
import {inject, injectable} from "inversify";
import {TYPES} from "../utils/constants";
import {Output} from "../../view/output";
import {Constants, TYPES} from "../utils/constants";
import {Project} from "../entities/project";
import {IResourceProvider} from "../../view/dataproviders/interfaces/iresourceprovider";
import {IBuildProvider} from "../../view/dataproviders/interfaces/ibuildprovider";
import {GitProvider} from "../../dal/gitprovider";
import {Context} from "../../view/Context";
import {WindowProxy} from "../moduleproxies/window-proxy";
import {BuildConfig} from "../entities/buildconfig";
import {MessageManager} from "../../view/messagemanager";
import opn = require("opn");

@injectable()
export class GetSuitableConfigs implements Command {

private readonly cvsProvider: CvsProviderProxy;
private readonly resourceProvider: IResourceProvider;
private readonly buildProvider: IBuildProvider;
private readonly remoteBuildServer: RemoteBuildServer;
private readonly xmlParser: XmlParser;
private readonly output: Output;

public constructor(@inject(TYPES.CvsProviderProxy) cvsProvider: CvsProviderProxy,
@inject(TYPES.ResourceProvider) resourceProvider: IResourceProvider,
@inject(TYPES.BuildProvider) buildProvider: IBuildProvider,
@inject(TYPES.RemoteBuildServer) remoteBuildServer: RemoteBuildServer,
@inject(TYPES.XmlParser) xmlParser: XmlParser,
@inject(TYPES.Output) output: Output,
public constructor(@inject(TYPES.CvsProviderProxy) private readonly cvsProvider: CvsProviderProxy,
@inject(TYPES.ResourceProvider) private readonly resourceProvider: IResourceProvider,
@inject(TYPES.BuildProvider) private readonly buildProvider: IBuildProvider,
@inject(TYPES.RemoteBuildServer) private readonly remoteBuildServer: RemoteBuildServer,
@inject(TYPES.XmlParser) private readonly xmlParser: XmlParser,
@inject(TYPES.MessageManager) private readonly myMessageManager: MessageManager,
@inject(TYPES.Context) private readonly context: Context,
@inject(TYPES.WindowProxy) private readonly windowsProxy: WindowProxy) {
this.cvsProvider = cvsProvider;
this.resourceProvider = resourceProvider;
this.buildProvider = buildProvider;
this.remoteBuildServer = remoteBuildServer;
this.xmlParser = xmlParser;
this.output = output;
//
}

public async exec(args?: any[]): Promise<void> {
public async exec(args?: any[]): Promise<void | boolean> {
Logger.logInfo("GetSuitableConfigs: starts");
const checkInArray: CheckInInfo[] = this.getCheckInArray();
const projectPromise : Promise<Project[]> = this.getProjectsWithSuitableBuilds(checkInArray);
this.windowsProxy.showWithProgress("Looking for suitable build configurations...", projectPromise);

const projects: Project[] = await projectPromise;

if (!projects && this.cvsProvider.hasGitProvider()) {
const learnMore: {title: string} = {title: "Learn More..."};
const textToShow: string = `${MessageConstants.SUITABLE_BUILDS_NOT_FOUND}. ` +
`${MessageConstants.GIT_SUPPORT_LIMITATIONS_WARNING}`;
const result = await this.myMessageManager.showErrorMessage(textToShow, learnMore);
if (result && result.title === learnMore.title) {
opn(Constants.GIT_SUPPORT_WIKI_PAGE);
}
return false;
} else if (!projects) {
throw new Error(MessageConstants.SUITABLE_BUILDS_NOT_FOUND);
}

this.buildProvider.setContent(projects);
const showPreTestedCommit: boolean = this.shouldShowPreTestedCommit(checkInArray);
this.context.showPreTestedCommitButton(showPreTestedCommit);
this.output.appendLine(MessageConstants.PLEASE_SPECIFY_BUILDS);
this.output.show();

Logger.logInfo("GetSuitableConfigs: finished");
}

Expand All @@ -65,13 +66,13 @@ export class GetSuitableConfigs implements Command {
}
}

private async getProjectsWithSuitableBuilds(checkInArray: CheckInInfo[]): Promise<Project[]> {
private async getProjectsWithSuitableBuilds(checkInArray: CheckInInfo[]): Promise<Project[] | undefined> {
const tcFormattedFilePaths: string[] = await this.cvsProvider.getFormattedFileNames(checkInArray);
const shortBuildConfigNames: string[] =
await this.remoteBuildServer.getSuitableConfigurations(tcFormattedFilePaths);
if (!shortBuildConfigNames || shortBuildConfigNames.length === 0) {
Logger.logError(`[GetSuitableConfig]: ${MessageConstants.SUITABLE_BUILDS_NOT_FOUND}`);
return Promise.reject(MessageConstants.SUITABLE_BUILDS_NOT_FOUND);
return undefined;
}
const projectsWithRelatedBuildsXmls: string[] =
await this.remoteBuildServer.getRelatedBuilds(shortBuildConfigNames);
Expand Down
Loading

0 comments on commit 4a2c5c8

Please sign in to comment.