Skip to content

Commit

Permalink
Merge 045bf02 into 91ca2db
Browse files Browse the repository at this point in the history
  • Loading branch information
hartra344 committed Sep 24, 2018
2 parents 91ca2db + 045bf02 commit 98eaddf
Show file tree
Hide file tree
Showing 23 changed files with 651 additions and 285 deletions.
4 changes: 4 additions & 0 deletions client/src/app/shared/models/portal-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,10 @@
public static swapSourceChangesHeading = 'swapSourceChangesHeading';
public static swapTargetChangesHeading = 'swapTargetChangesHeading';
public static swapActionLabel = 'swapActionLabel';
public static frameworkVersion = 'frameworkVersion';
public static startupCommand = 'startupCommand';
public static pathToApplicationCode = 'pathToApplicationCode';
public static preview = 'preview';
public static swapDiffsNoChange = 'swapDiffsNoChange';
public static swapDiffNotSet = 'swapDiffNotSet';
public static extensionUninstallError = 'extensionUninstallError';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ export class LinuxSiteEnvironment extends Environment {
};

this.scenarioChecks[ScenarioIds.vstsKuduSource] = {
id: ScenarioIds.onedriveSource,
runCheck: () => ({ status: 'disabled' }),
id: ScenarioIds.vstsKuduSource,
runCheck: () => ({
status: 'disabled',
}),
};

this.scenarioChecks[ScenarioIds.onedriveSource] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface ProviderCard {
description: string;
authorizedStatus: 'loadingAuth' | 'notAuthorized' | 'authorized' | 'none';
enabled: boolean;
hidden?: boolean;
errorMessage?: string;
authenticatedId?: string;
scenarioId?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<wizard navBarLayout="large-filled-symbols" #wizard StepNumber>
<app-step-source-control wizardStep title="{{'sourceControl' | translate}}"></app-step-source-control>
<app-step-build-provider wizardStep title="{{'buildProvider' | translate}}" *ngIf="showBuildStep"></app-step-build-provider>
<app-step-configure [canExit]="buildConfigValid.bind(this)" wizardStep title="{{'configure' | translate}}" *ngIf="showConfigureStep"></app-step-configure>
<app-step-configure [canExit]="buildConfigValid" wizardStep title="{{'configure' | translate}}" *ngIf="showConfigureStep"></app-step-configure>
<app-step-test wizardStep title="{{'test' | translate}}" *ngIf="showTestStep"></app-step-test>
<app-step-deployment-slot wizardStep title="{{'deploy' | translate}}" *ngIf="showDeployStep"></app-step-deployment-slot>
<app-step-complete wizardCompletionStep enableBackLinks title="{{'summary' | translate}}" *ngIf="showSummaryStep"></app-step-complete>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export class DeploymentCenterSetupComponent implements OnChanges {
flaskProjectName: ['flaskProjectName', []],
djangoSettingsModule: ['DjangoProjectName.settings', []]
}),
nodejsTaskRunner: [null, []]
nodejsTaskRunner: [null, []],
frameworkVersion: ['', []],
startupCommand: ['', []],
}),
deploymentSlotSetting: this._fb.group({
newDeploymentSlot: [false, []],
Expand All @@ -64,7 +66,7 @@ export class DeploymentCenterSetupComponent implements OnChanges {
this.wizard.wizardForm &&
this.wizard.wizardForm.controls['buildProvider'] &&
this.wizard.wizardForm.controls['buildProvider'].value;
return buildProvider === 'vsts';
return buildProvider === 'vsts' && !this.wizard.isLinuxApp;
}

get showDeployStep() {
Expand Down Expand Up @@ -115,18 +117,19 @@ export class DeploymentCenterSetupComponent implements OnChanges {
}
}

get showSummaryStep() {
const sourceProvider = this.wizard && this.wizard.wizardValues && this.wizard.wizardValues.sourceProvider;
return sourceProvider && sourceProvider !== 'ftp' && sourceProvider !== 'webdeploy';
}

// This is ran when the user attempts to exit the configuration step of the wizard
buildConfigValid(direction: MovingDirection) {
// Arrow notation removes the need for .bind(this) in html
public buildConfigValid = (direction: MovingDirection) => {
if (direction === MovingDirection.Forwards) {
this.wizard.markSectionAsTouched(this.wizard.buildSettings);
this.wizard.markSectionAsTouched(this.wizard.sourceSettings);
return this.wizard.buildSettings.valid && this.wizard.sourceSettings.valid;
}
return true;
}

get showSummaryStep() {
const sourceProvider = this.wizard && this.wizard.wizardValues && this.wizard.wizardValues.sourceProvider;
return sourceProvider && sourceProvider !== 'ftp' && sourceProvider !== 'webdeploy';
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="selectionContainer" flex-list>
<div *ngFor="let card of providerCards" [class.selected]="wizard?.wizardValues?.buildProvider === card.id" [class.cardDisabled]="!card.enabled"
[class.cardContainer]="card.enabled" (click)="chooseBuildProvider(card)" id="{{card.id}}">
[class.cardContainer]="card.enabled" (click)="chooseBuildProvider(card)" id="{{card.id}}" [hidden]="card.hidden">
<div class="cardHeader">
<img [src]="card.icon" [style.background-color]="card.color" /> {{card.name}}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { ScenarioService } from '../../../../shared/services/scenario/scenario.s
import { ReplaySubject } from 'rxjs/ReplaySubject';
import { CacheService } from '../../../../shared/services/cache.service';
import { of } from 'rxjs/observable/of';
// tslint:disable-next-line:import-blacklist
import { Subject } from 'rxjs';

describe('StepBuildProviderComponent', () => {
let buildStepTest: StepBuildProviderComponent;
Expand Down Expand Up @@ -82,6 +84,13 @@ class MockDeploymentCenterStateManager {
buildProvider: 'kudu',
};

wizardForm = {
controls: {
sourceProvider: {
valueChanges: new Subject(),
},
},
};
public siteArmObj$ = new ReplaySubject<any>();
constructor() {
this.siteArmObj$.next({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class StepBuildProviderComponent {
},
{
id: 'vsts',
name: this._translateService.instant(PortalResources.vstsBuildServerTitle),
name: `${this._translateService.instant(PortalResources.vstsBuildServerTitle)}(${this._translateService.instant(PortalResources.preview)})`,
icon: 'image/deployment-center/vsts.svg',
color: '#2B79DA',
description: this._translateService.instant(PortalResources.vstsBuildServerDesc),
Expand All @@ -36,18 +36,20 @@ export class StepBuildProviderComponent {
},
];

private _vstsKuduSourceScenarioBlocked = false;
private _currentSourceControlProvider: string;
constructor(
public wizard: DeploymentCenterStateManager,
private _translateService: TranslateService,
scenarioService: ScenarioService) {
private _scenarioService: ScenarioService) {

// runs scenario checker for each provider to determine if it should be enabled or not
// if not enabled then it pulls error message from scenario checker
wizard.siteArmObj$
.concatMap(siteObj => {
return from(this.providerCards).switchMap((provider: ProviderCard) => {
if (provider.scenarioId) {
return forkJoin(of(provider), scenarioService.checkScenarioAsync(provider.scenarioId, { site: siteObj }));
return forkJoin(of(provider), this._scenarioService.checkScenarioAsync(provider.scenarioId, { site: siteObj }));
} else {
return of([null, null]);
}
Expand All @@ -60,15 +62,26 @@ export class StepBuildProviderComponent {
}
});

this.wizard.wizardForm.controls.sourceProvider.valueChanges.subscribe((provider) => {
if (provider !== this._currentSourceControlProvider) {
this._currentSourceControlProvider = provider;
const kuduCard = this.providerCards.find(x => x.id === 'kudu');
if (provider === 'vsts' && this._vstsKuduSourceScenarioBlocked) {
this.chooseBuildProvider({ id: 'vsts', enabled: true } as ProviderCard);
kuduCard.hidden = true;
} else {
this.chooseBuildProvider({ id: 'kudu', enabled: true } as ProviderCard);
kuduCard.hidden = false;
}
}
});
// this says if kudu should be hidden then default to vsts instead
wizard.siteArmObj$
.map(siteObj => {
return scenarioService.checkScenario(ScenarioIds.vstsKuduSource, { site: siteObj });
return this._scenarioService.checkScenario(ScenarioIds.vstsKuduSource, { site: siteObj });
})
.subscribe(result => {
if (result.status === 'disabled') {
wizard.wizardValues = { ...wizard.wizardValues, buildProvider: 'vsts' };
}
this._vstsKuduSourceScenarioBlocked = result.status === 'disabled';
});
}

Expand Down

0 comments on commit 98eaddf

Please sign in to comment.