Skip to content

Commit

Permalink
Merge 73ca207 into e608da2
Browse files Browse the repository at this point in the history
  • Loading branch information
andimarc committed Oct 2, 2018
2 parents e608da2 + 73ca207 commit e76b6bb
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 65 deletions.
43 changes: 43 additions & 0 deletions client/src/app/controls/if-scenario/if-scenario.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Component, ElementRef, Input, OnChanges, SimpleChanges } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import { ScenarioCheckInput } from '../../shared/services/scenario/scenario.models';
import { ScenarioService } from '../../shared/services/scenario/scenario.service';

@Component({
selector: 'if-scenario, if-not-scenario',
template: `<ng-container *ngIf="show"><ng-content></ng-content></ng-container>`,
})
export class IfScenarioComponent implements OnChanges {
@Input() scenarioId: string;
@Input() input: ScenarioCheckInput;
@Input() showByDefault = false;

public show = false;

private _negate = false;
private _inputStream = new Subject<void>();

constructor(scenarioCheckService: ScenarioService, elementRef: ElementRef) {
this._negate = elementRef.nativeElement.tagName.toLowerCase() === 'if-not-scenario';

this._inputStream
.debounceTime(100)
.switchMap(_ => {
return scenarioCheckService.checkScenarioAsync(this.scenarioId, this.input);
})
.subscribe(result => {
const enabled = result.status === 'enabled';
this.show = this._negate ? !enabled : enabled;
});
}

ngOnInit() {
this.show = this.showByDefault;
}

ngOnChanges(changes: SimpleChanges) {
if ((changes['scenarioId'] || changes['input']) && this.scenarioId && this.input) {
this._inputStream.next();
}
}
}
2 changes: 1 addition & 1 deletion client/src/app/shared/models/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export class ScenarioIds {
public static readonly pythonSupported = 'PythonSupported';
public static readonly javaSupported = 'JavaSupported';
public static readonly defaultDocumentsSupported = 'DefaultDocumentsSupported';
public static readonly autoSwapSuuported = 'AutoSwapSuuported';
public static readonly autoSwapSupported = 'AutoSwapSupported';
public static readonly handlerMappingsSupported = 'HandlerMappingsSupported';
public static readonly virtualDirectoriesSupported = 'VirtualDirectoriesSupported';
public static readonly enableDiagnoseAndSolve = 'EnableDiagnoseAndSolve';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ export class XenonSiteEnvironment extends Environment {
runCheck: () => disabledResult
};

this.scenarioChecks[ScenarioIds.autoSwapSuuported] = {
id: ScenarioIds.autoSwapSuuported,
this.scenarioChecks[ScenarioIds.autoSwapSupported] = {
id: ScenarioIds.autoSwapSupported,
runCheck: (input: ScenarioCheckInput) => {
let winFxVersionStartsWithDocker = false;
if (input && input.site && input.site.properties && input.site.properties.siteProperties && input.site.properties.siteProperties.properties) {
const winFxVersion = input.site.properties.siteProperties.properties.find(prop => prop.name.toLowerCase() === 'windowsfxversion' );
const winFxVersion = input.site.properties.siteProperties.properties.find(prop => prop.name.toLowerCase() === 'windowsfxversion');
if (winFxVersion && winFxVersion.value && winFxVersion.value.toLowerCase().startsWith('docker|')) {
winFxVersionStartsWithDocker = true;
}
Expand Down
8 changes: 6 additions & 2 deletions client/src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ import { FlexListDirective } from '../controls/flex-list/flex-list.directive';
import { QuotaService } from './services/quota.service';
import { RemoveSpacesPipe } from './pipes/remove-spaces.pipe';
import { MarkdownModule } from 'ngx-markdown';
import { IfScenarioComponent } from './../controls/if-scenario/if-scenario.component';


export function ArmServiceFactory(
http: Http,
Expand Down Expand Up @@ -134,7 +136,8 @@ export function AiServiceFactory() {
CardInfoControlComponent,
InvalidmessageDirective,
FlexListDirective,
RemoveSpacesPipe
RemoveSpacesPipe,
IfScenarioComponent,
],
exports: [
CommonModule,
Expand Down Expand Up @@ -177,7 +180,8 @@ export function AiServiceFactory() {
InvalidmessageDirective,
NgUploaderModule,
FlexListDirective,
RemoveSpacesPipe
RemoveSpacesPipe,
IfScenarioComponent,
],
imports: [
FormsModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ <h3 class="first-config-heading">{{ 'feature_generalSettingsName' | translate }}
</pop-over>
</label>
<div class="setting-control-container">
<radio-selector
[control]="!!group ? group.controls['use32BitWorkerProcess'] : null"
[options]="use32BitWorkerProcessOptions"
[highlightDirty]="true"
check-scenario="EnablePlatform64"
[cs-input]="{site: siteArm}">
</radio-selector>
<if-scenario scenarioId="EnablePlatform64" [input]="{site: siteArm}">
<radio-selector
[control]="!!group ? group.controls['use32BitWorkerProcess'] : null"
[options]="use32BitWorkerProcessOptions"
[highlightDirty]="true">
</radio-selector>
</if-scenario>

<span check-scenario="EnablePlatform64" [cs-input]="{site: siteArm}" cs-enabledClass="hidden" cs-disabledClass="">
<if-not-scenario scenarioId="EnablePlatform64" [input]="{site: siteArm}">
<a tabindex="0" (click)="scaleUp()">{{'upgradeToEnable' | translate}}</a>
<pop-over [message]="use32BitWorkerProcessUpsell">
<span load-image="image/upsell.svg" class="icon-small"></span>
</pop-over>
</span>
</if-not-scenario>
</div>
</div>

Expand All @@ -140,19 +140,20 @@ <h3 class="first-config-heading">{{ 'feature_generalSettingsName' | translate }}
</pop-over>
</label>
<div class="setting-control-container">
<radio-selector
[control]="!!group ? group.controls['webSocketsEnabled'] : null"
[options]="webSocketsEnabledOptions"
[highlightDirty]="true"
check-scenario="WebSocketsEnabled"
[cs-input]="{site: siteArm}">
</radio-selector>
<span check-scenario="WebSocketsEnabled" [cs-input]="{site: siteArm}" cs-enabledClass="hidden" cs-disabledClass="">
<if-scenario scenarioId="WebSocketsEnabled" [input]="{site: siteArm}">
<radio-selector
[control]="!!group ? group.controls['webSocketsEnabled'] : null"
[options]="webSocketsEnabledOptions"
[highlightDirty]="true">
</radio-selector>
</if-scenario>

<if-not-scenario scenarioId="WebSocketsEnabled" [input]="{site: siteArm}">
<a tabindex="0" (click)="scaleUp()">{{'upgradeToEnable' | translate}}</a>
<pop-over [message]="webSocketUpsell">
<span load-image="image/upsell.svg" class="icon-small"></span>
</pop-over>
</span>
</if-not-scenario>
</div>
</div>

Expand All @@ -163,20 +164,20 @@ <h3 class="first-config-heading">{{ 'feature_generalSettingsName' | translate }}
</pop-over>
</label>
<div class="setting-control-container">
<radio-selector
[control]="!!group ? group.controls['alwaysOn'] : null"
[options]="alwaysOnOptions"
[highlightDirty]="true"
check-scenario="EnableAlwaysOn"
[cs-input]="{site: siteArm}">
</radio-selector>
<if-scenario scenarioId="EnableAlwaysOn" [input]="{site: siteArm}">
<radio-selector
[control]="!!group ? group.controls['alwaysOn'] : null"
[options]="alwaysOnOptions"
[highlightDirty]="true">
</radio-selector>
</if-scenario>

<span check-scenario="EnableAlwaysOn" [cs-input]="{site: siteArm}" cs-enabledClass="hidden" cs-disabledClass="">
<if-not-scenario scenarioId="EnableAlwaysOn" [input]="{site: siteArm}">
<a tabindex="0" (click)="scaleUp()">{{'upgradeToEnable' | translate}}</a>
<pop-over [message]="alwaysOnUpsell">
<span load-image="image/upsell.svg" class="icon-small"></span>
</pop-over>
</span>
</if-not-scenario>
</div>
</div>

Expand Down Expand Up @@ -204,7 +205,7 @@ <h3 class="first-config-heading">{{ 'feature_generalSettingsName' | translate }}
</div>
</ng-container>

<div *ngIf="clientAffinitySupported" class="setting-wrapper" [class.last]="!autoSwapSupported">
<div *ngIf="clientAffinitySupported" class="setting-wrapper">
<info-box
[infoText]="('clientAffinityInfoText' | translate)"
[infoLink]="FwLinks.clientAffinityLearnMore">
Expand All @@ -220,47 +221,49 @@ <h3 class="first-config-heading">{{ 'feature_generalSettingsName' | translate }}
</div>

<ng-container *ngIf="autoSwapSupported">
<div class="setting-wrapper" check-scenario="EnableAutoSwap" [cs-input]="{site: siteArm}" cs-enabledClass="" cs-disabledClass="last">
<info-box
*ngIf="isProductionSlot"
[infoText]="('autoSwapNotSupportedFromProd' | translate)"
check-scenario="EnableAutoSwap"
[cs-input]="{site: siteArm}">
</info-box>
<div class="setting-wrapper">
<if-scenario scenarioId="EnableAutoSwap" [input]="{site: siteArm}">
<info-box
*ngIf="isProductionSlot"
[infoText]="('autoSwapNotSupportedFromProd' | translate)">
</info-box>
</if-scenario>
<label class="setting-label">{{ 'autoSwapEnabledLabel' | translate }}</label>
<div class="setting-control-container">
<radio-selector
[control]="!!group ? group.controls['autoSwapEnabled'] : null"
[options]="autoSwapEnabledOptions"
[highlightDirty]="true"
(value)="updateAutoSwapSlotNameOptions($event)"
check-scenario="EnableAutoSwap"
[cs-input]="{site: siteArm}">
</radio-selector>
<if-scenario scenarioId="EnableAutoSwap" [input]="{site: siteArm}">
<radio-selector
[control]="!!group ? group.controls['autoSwapEnabled'] : null"
[options]="autoSwapEnabledOptions"
[highlightDirty]="true"
(value)="updateAutoSwapSlotNameOptions($event)">
</radio-selector>
</if-scenario>

<span check-scenario="EnableAutoSwap" [cs-input]="{site: siteArm}" cs-enabledClass="hidden" cs-disabledClass="">
<if-not-scenario scenarioId="EnableAutoSwap" [input]="{site: siteArm}">
<a tabindex="0" (click)="scaleUp()">{{'upgradeToEnable' | translate}}</a>
<pop-over [message]="autoSwapUpsell">
<span load-image="image/upsell.svg" class="icon-small"></span>
</pop-over>
</span>
</if-not-scenario>
</div>
</div>

<div class="setting-wrapper" check-scenario="EnableAutoSwap" [cs-input]="{site: siteArm}">
<label class="setting-label">{{ 'autoSwapSlotNameLabel' | translate }}</label>
<div class="setting-control-container">
<drop-down
[control]="!!group ? group.controls['autoSwapSlotName'] : null"
[options]="!!dropDownOptionsMap ? dropDownOptionsMap['autoSwapSlotName'] : []"
[highlightDirty]="true">
</drop-down>
<if-scenario scenarioId="EnableAutoSwap" [input]="{site: siteArm}">
<div class="setting-wrapper">
<label class="setting-label">{{ 'autoSwapSlotNameLabel' | translate }}</label>
<div class="setting-control-container">
<drop-down
[control]="!!group ? group.controls['autoSwapSlotName'] : null"
[options]="!!dropDownOptionsMap ? dropDownOptionsMap['autoSwapSlotName'] : []"
[highlightDirty]="true">
</drop-down>
</div>
</div>
</div>
</if-scenario>
</ng-container>

<ng-container *ngIf="FTPAccessSupported">
<div class="setting-wrapper last">
<div class="setting-wrapper">
<info-box
[infoText]="('FTPMessage' | translate)"
[infoLink]="FwLinks.FTPAccessLearnMore">
Expand Down Expand Up @@ -304,7 +307,7 @@ <h3>{{ 'feature_debuggingSettingsName' | translate }}</h3>
</div>
</div>

<div class="setting-wrapper last">
<div class="setting-wrapper">
<label class="setting-label">{{ 'remoteDebuggingVersionLabel' | translate }}</label>
<div class="setting-control-container">
<radio-selector
Expand Down Expand Up @@ -348,7 +351,7 @@ <h3>{{ 'feature_linuxRuntimeName' | translate }}</h3>
</div>
</div>

<div class="setting-wrapper last">
<div class="setting-wrapper">
<label class="setting-label">{{ 'appCommandLineLabel' | translate }}
<pop-over [message]="appCommandLineLabelHelp" position="right">
<span class="glyphicon glyphicon-info-sign button-title"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export class GeneralSettingsComponent extends ConfigSaveComponent implements OnC
javaSupported = false;
}

if (this._scenarioService.checkScenario(ScenarioIds.autoSwapSuuported, { site: siteArm }).status === 'disabled') {
if (this._scenarioService.checkScenario(ScenarioIds.autoSwapSupported, { site: siteArm }).status === 'disabled') {
autoSwapSupported = false;
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/app/site/site-config/site-config.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ h3{
width: 100%;
}

&.last{
&:last-child{
padding-bottom: 0px;
}

Expand Down

0 comments on commit e76b6bb

Please sign in to comment.