Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show only infobox in test panel and disable Run button for GitHub webhook functions #3269

Merged
merged 5 commits into from
Oct 8, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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-label]="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-label]="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)">
shimedh marked this conversation as resolved.
Show resolved Hide resolved
</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 && 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
7 changes: 7 additions & 0 deletions client/src/sass/controls/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
&:disabled {
background: $disabled-color;
cursor: arrow;
color: $disabled-color;
}
}

Expand All @@ -44,6 +45,12 @@
color: darken($primary-color-dark, 10%);
border-color: darken($primary-color, 10%);
}

&:disabled {
shimedh marked this conversation as resolved.
Show resolved Hide resolved
background: $disabled-color;
cursor: arrow;
color: $disabled-color
}
}

.button-block{
Expand Down
7 changes: 5 additions & 2 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>Testing is not supported for GitHub webhook functions.</value>
</data>
<data name="runtimeVersion" xml:space="preserve">
<value>Runtime version</value>
</data>
Expand Down Expand Up @@ -1319,7 +1322,7 @@
<value>Deployment options</value>
</data>
<data name="feature_deploymentSourceInfo" xml:space="preserve">
<value>Configure and manage deployment options for your app, including continuous deployment from VSTS, Github and Bitbucket as well as trigger deployments from OneDrive, Dropbox, external Git and more.</value>
<value>Configure and manage deployment options for your app, including continuous deployment from VSTS, GitHub and Bitbucket as well as trigger deployments from OneDrive, Dropbox, external Git and more.</value>
</data>
<data name="feature_deploymentCredsName" xml:space="preserve">
<value>Deployment credentials</value>
Expand Down Expand Up @@ -3008,7 +3011,7 @@ Set to "External URL" to use an API definition that is hosted elsewhere.</value>
<value>Sync content from a OneDrive cloud folder.</value>
</data>
<data name="githubDesc" xml:space="preserve">
<value>Configure continuous integration with a Github repo.</value>
<value>Configure continuous integration with a GitHub repo.</value>
</data>
<data name="vstsDesc" xml:space="preserve">
<value>Configure continuous integration with a VSTS repo.</value>
Expand Down