Skip to content

Commit

Permalink
Merge ae5c00f into 58031ed
Browse files Browse the repository at this point in the history
  • Loading branch information
shimedh committed Oct 6, 2018
2 parents 58031ed + ae5c00f commit 6fd64d9
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 6 deletions.
16 changes: 13 additions & 3 deletions client/src/app/function-dev/function-dev.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,19 @@ <h3>{{'functionDev_githubSelect' | translate}}</h3>

<button *ngIf="scriptFile?.isDirty && !isStandalone"
class="custom-button-invert"
[disabled]="!runValid"
[disabled]="!runValid || !isRunEnabled"
[class.dirty]="scriptFile?.isDirty"
[title]="(runHoverText | translate)"
[attr.aria-describedby]="(runHoverText | translate)"
(click)="runFunction()">
<i class="fa fa-play"></i> {{ 'functionDev_saveAndRun' | translate }} </button>

<button *ngIf="!scriptFile?.isDirty && !isStandalone"
class="custom-button-invert"
[disabled]="!runValid"
[disabled]="!runValid || !isRunEnabled"
[class.dirty]="scriptFile?.isDirty"
[title]="(runHoverText | translate)"
[attr.aria-describedby]="(runHoverText | translate)"
(click)="runFunction()">
<i class="fa fa-play"></i> {{ 'run' | translate }} </button>

Expand Down Expand Up @@ -173,7 +177,7 @@ <h3>{{'functionDev_githubSelect' | translate}}</h3>
</file-explorer>
</div>

<div *ngIf="rightTab === 'run'" class="dev-full dev-border dev-flex-column">
<div *ngIf="rightTab === 'run' && isRunEnabled" class="dev-full dev-border dev-flex-column">

<div class="dev-full dev-flex-column run-container" *ngIf="functionInfo" [class.run-container-http]="isHttpFunction">

Expand Down Expand Up @@ -236,6 +240,12 @@ <h3>{{'functionDev_githubSelect' | translate}}</h3>
</button>
</div>
</div>

<info-box
*ngIf="rightTab === 'run' && !isRunEnabled"
class="dev-full dev-border dev-flex-column"
[infoText]="('testFunctionNotSupportedForGitHubWebhook' | translate)">
</info-box>
</div>
</aside>

Expand Down
11 changes: 8 additions & 3 deletions client/src/app/function-dev/function-dev.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { FunctionKeys } from '../shared/models/function-key';
import { MonacoHelper } from '../shared/Utilities/monaco.helper';
import { AccessibilityHelper } from '../shared/Utilities/accessibility-helper';
import { LogService } from '../shared/services/log.service';
import { LogCategories } from '../shared/models/constants';
import { LogCategories, WebhookTypes } from '../shared/models/constants';
import { ArmUtil } from '../shared/Utilities/arm-utils';

type FileSelectionEvent = VfsObject | [VfsObject, monaco.editor.IMarkerData[], monaco.editor.IMarkerData];
Expand Down Expand Up @@ -80,6 +80,8 @@ export class FunctionDevComponent extends FunctionAppContextComponent implements
public showFunctionKey = false;
public showFunctionInvokeUrlModal = false;
public showFunctionKeyModal = false;
public isRunEnabled = true;
public runHoverText: string;

public rightTab: string;
public bottomTab: string;
Expand Down Expand Up @@ -283,7 +285,10 @@ export class FunctionDevComponent extends FunctionAppContextComponent implements
delete this.webHookType;
}

this.showFunctionKey = this.webHookType === 'github';
this.showFunctionKey = this.webHookType.toLowerCase() === WebhookTypes.github;

this.isRunEnabled = !this.showFunctionKey;
this.runHoverText = this.isRunEnabled ? PortalResources.run : PortalResources.testFunctionNotSupportedForGitHubWebhook;

inputBinding = (this.functionInfo.config && this.functionInfo.config.bindings
? this.functionInfo.config.bindings.find(e => !!e.authLevel)
Expand Down Expand Up @@ -442,7 +447,7 @@ export class FunctionDevComponent extends FunctionAppContextComponent implements
clientId = keyWithValue.name;
}

if (this.webHookType.toLowerCase() !== 'genericjson') {
if (this.webHookType.toLowerCase() !== WebhookTypes.genericjson) {
code = '';
}
}
Expand Down
5 changes: 5 additions & 0 deletions client/src/app/shared/models/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,3 +556,8 @@ export class ContainerConstants {
public static readonly dockerComposeQSLink = 'https://go.microsoft.com/fwlink/?linkid=873149';
public static readonly kubeQSLink = 'https://go.microsoft.com/fwlink/?linkid=873150';
}

export class WebhookTypes {
public static readonly github = 'github';
public static readonly genericjson = 'genericjson';
}
1 change: 1 addition & 0 deletions client/src/app/shared/models/portal-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@
public static functionNew_nameError = 'functionNew_nameError';
public static functionDev_loading = 'functionDev_loading';
public static test = 'test';
public static testFunctionNotSupportedForGitHubWebhook = 'testFunctionNotSupportedForGitHubWebhook';
public static runtimeVersion = 'runtimeVersion';
public static runtimeImage = 'runtimeImage';
public static runtimeImagev1 = 'runtimeImagev1';
Expand Down
5 changes: 5 additions & 0 deletions client/src/sass/controls/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
color: darken($primary-color-dark, 10%);
border-color: darken($primary-color, 10%);
}

&:disabled {
background: $disabled-color;
cursor: arrow;
}
}

.button-block{
Expand Down
3 changes: 3 additions & 0 deletions server/Resources/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,9 @@
<data name="test" xml:space="preserve">
<value>Test</value>
</data>
<data name="testFunctionNotSupportedForGitHubWebhook" xml:space="preserve">
<value>Test is not supported for Github webhook functions.</value>
</data>
<data name="runtimeVersion" xml:space="preserve">
<value>Runtime version</value>
</data>
Expand Down

0 comments on commit 6fd64d9

Please sign in to comment.