-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a validation layer on the client build config.
- Loading branch information
Showing
11 changed files
with
273 additions
and
96 deletions.
There are no files selected for viewing
4 changes: 0 additions & 4 deletions
4
client/app/components/client-binary-list/client-binary-list.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 64 additions & 58 deletions
122
client/app/experiment-client-settings/config-variable-row/config-variable-row.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,72 @@ | ||
<div class="config-row flex-container flex-align-items-center" *ngIf="variableName && config"> | ||
<div class="label"> | ||
<span>{{label}}</span> | ||
<sup class="changed-mark" [style.visibility]="compareValues(originalValue, config[variableName])? 'hidden' : null">Edited</sup> | ||
</div> | ||
<ng-container [ngSwitch]="type"> | ||
<input *ngSwitchCase="'text'" type="text" class="text-type form-control" [placeholder]="hintText" [value]="config[variableName]==undefined? null : config[variableName]" | ||
(input)="onTextChanged($event.target.value)"> | ||
<input *ngSwitchCase="'password'" type="password" class="text-type form-control" [placeholder]="hintText" [value]="config[variableName]==undefined? null : config[variableName]" | ||
(input)="onTextChanged($event.target.value)"> | ||
<mat-slide-toggle *ngSwitchCase="'boolean'" [checked]="config[variableName]" (change)="config[variableName] = $event.checked"></mat-slide-toggle> | ||
<div *ngSwitchCase="'jsonFile'" class="json-file-type flex-filler"> | ||
<div class="flex-container flex-align-items-center"> | ||
<button class="mat-button-small" *ngIf="config[variableName] && !compareValues(originalValue, config[variableName])" mat-button | ||
(click)="rollback()">Discard change</button> | ||
<div class="flex-filler"></div> | ||
<div class="fileopen"> | ||
<label for="packageFileInput"> | ||
<small>Read from JSON File...</small> | ||
</label> | ||
<input id="packageFileInput" type="file" accept="application/json" (change)="onJsonFileChanged($event.target.files)"> | ||
</div> | ||
</div> | ||
<div class="validation-container" [class.invalid]="validationFailedMessage"> | ||
|
||
<textarea class="form-control" rows="5" *ngIf="config[variableName]" [disabled]="true">{{jsonObjToString(config[variableName])}}</textarea> | ||
<div class="config-row flex-container flex-align-items-center" *ngIf="variableName && config"> | ||
<div class="label"> | ||
<span>{{label}}</span> | ||
<sup class="changed-mark" [style.visibility]="compareValues(originalValue, config[variableName])? 'hidden' : null">Edited</sup> | ||
</div> | ||
<ng-container [ngSwitch]="type"> | ||
<input *ngSwitchCase="'text'" type="text" class="text-type form-control" [class.is-invalid]="validationFailedMessage!=null" [placeholder]="hintText" [value]="config[variableName]==undefined? null : config[variableName]" | ||
(input)="onTextChanged($event.target.value)"> | ||
<input *ngSwitchCase="'password'" type="password" class="text-type form-control" [class.is-invalid]="validationFailedMessage!=null" [placeholder]="hintText" [value]="config[variableName]==undefined? null : config[variableName]" | ||
(input)="onTextChanged($event.target.value)"> | ||
<mat-slide-toggle *ngSwitchCase="'boolean'" [checked]="config[variableName]" (change)="config[variableName] = $event.checked"></mat-slide-toggle> | ||
<div *ngSwitchCase="'jsonFile'" class="json-file-type flex-filler"> | ||
<div class="flex-container flex-align-items-center"> | ||
<button class="mat-button-small" *ngIf="config[variableName] && !compareValues(originalValue, config[variableName])" mat-button | ||
(click)="rollback()">Discard change</button> | ||
<div class="flex-filler"></div> | ||
<div class="fileopen"> | ||
<label for="packageFileInput"> | ||
<small>Read from JSON File...</small> | ||
</label> | ||
<input id="packageFileInput" type="file" accept="application/json" (change)="onJsonFileChanged($event.target.files)"> | ||
</div> | ||
</div> | ||
|
||
<div *ngSwitchCase="'jksFile'" class="jks-file-type flex-filler"> | ||
<div class="file-description small" *ngIf="originalValue"> | ||
<b>A kestore file is registered. original file hash:</b> | ||
<span class="hash"> | ||
{{originalValue}} | ||
</span> | ||
<textarea class="form-control" [class.is-invalid]="validationFailedMessage!=null" rows="5" *ngIf="config[variableName]" [disabled]="true">{{jsonObjToString(config[variableName])}}</textarea> | ||
</div> | ||
<div class="flex-container flex-align-items-center"> | ||
<button class="mat-button-small" *ngIf="config[variableName] && !compareValues(originalValue, config[variableName])" mat-button | ||
(click)="rollback()">Discard change</button> | ||
<div class="flex-filler"></div> | ||
<input class="text-right" id="android-keystore-input" type="file" accept=".jks" (change)="onAndroidKeystoreFileChanged($event.target.files)"> | ||
|
||
<div *ngSwitchCase="'jksFile'" class="jks-file-type flex-filler"> | ||
<div class="file-description small" *ngIf="originalValue"> | ||
<b>A kestore file is registered. original file hash:</b> | ||
<span class="hash"> | ||
{{originalValue}} | ||
</span> | ||
</div> | ||
<div class="flex-container flex-align-items-center"> | ||
<button class="mat-button-small" *ngIf="config[variableName] && !compareValues(originalValue, config[variableName])" mat-button | ||
(click)="rollback()">Discard change</button> | ||
<div class="flex-filler"></div> | ||
<input class="text-right" id="android-keystore-input" type="file" accept=".jks" (change)="onAndroidKeystoreFileChanged($event.target.files)"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div *ngSwitchCase="'sourceCode'" class="source-code-input"> | ||
<div class="flex-container"> | ||
<mat-form-field class="mat-form-no-vertical-padding"> | ||
<mat-select [value]="config[variableName]? config[variableName].sourceType : null" required="true" (selectionChange)="sourceCodeTypeChanged($event.value)"> | ||
<mat-option value="file">Upload source code as zip</mat-option> | ||
<mat-option value="github">Github</mat-option> | ||
</mat-select> | ||
</mat-form-field> | ||
<ng-container [ngSwitch]="config[variableName].sourceType"> | ||
<input *ngSwitchCase="'file'" class="text-right" id="sourcecode-zip-input" type="file" accept=".zip" (change)="onSourceCodeZipFileChanged($event.target.files)"> | ||
<div class="github-container" *ngSwitchCase="'github'"> | ||
<mat-checkbox class="small" [checked]="config[variableName].data !=null ? config[variableName].data.useOfficial : false" (change)="onSourceCodeUseOfficialChecked($event.checked)">Use the official repo</mat-checkbox> | ||
<input *ngIf="config[variableName].data && config[variableName].data.useOfficial !== true" class="form-control" type="text" | ||
placeholder="muclipse/omnitrack_android" | ||
[value] = "(config[variableName].data || {'repository': ''}).repository || ''" | ||
(input) = "onSourceCodeRepositoryChanged($event.target.value)" | ||
> | ||
<div *ngSwitchCase="'sourceCode'" class="source-code-input"> | ||
<div class="flex-container"> | ||
<mat-form-field class="mat-form-no-vertical-padding"> | ||
<mat-select [value]="config[variableName]? config[variableName].sourceType : null" required="true" (selectionChange)="sourceCodeTypeChanged($event.value)"> | ||
<mat-option value="file">Upload source code as zip</mat-option> | ||
<mat-option value="github">Github</mat-option> | ||
</mat-select> | ||
</mat-form-field> | ||
<ng-container [ngSwitch]="config[variableName].sourceType"> | ||
<input *ngSwitchCase="'file'" class="text-right" id="sourcecode-zip-input" type="file" accept=".zip" (change)="onSourceCodeZipFileChanged($event.target.files)"> | ||
<div class="github-container" *ngSwitchCase="'github'"> | ||
<mat-checkbox class="small" [checked]="config[variableName].data !=null ? config[variableName].data.useOfficial : false" | ||
(change)="onSourceCodeUseOfficialChecked($event.checked)">Use the official repo</mat-checkbox> | ||
<input *ngIf="config[variableName].data && config[variableName].data.useOfficial !== true" class="form-control" type="text" | ||
placeholder="muclipse/omnitrack_android" [value]="(config[variableName].data || {'repository': ''}).repository || ''" | ||
(input)="onSourceCodeRepositoryChanged($event.target.value)"> | ||
|
||
</div> | ||
</ng-container> | ||
</div> | ||
</ng-container> | ||
</div> | ||
</div> | ||
</div> | ||
</ng-container> | ||
</div> | ||
</ng-container> | ||
</div> | ||
<div class="invalid-message small text-color-danger"> | ||
{{validationFailedMessage}} | ||
</div> | ||
|
||
</div> |
19 changes: 16 additions & 3 deletions
19
client/app/experiment-client-settings/config-variable-row/config-variable-row.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
#sourcecode-zip-input{ | ||
#sourcecode-zip-input { | ||
margin-left: 0.5rem; | ||
} | ||
|
||
.github-container{ | ||
.github-container { | ||
margin-left: 1rem; | ||
} | ||
} | ||
|
||
.validation-container { | ||
&.invalid { | ||
margin-top: 4px; | ||
margin-bottom: 4px; | ||
background: #ffecec; | ||
border-radius: 6px; | ||
} | ||
|
||
.invalid-message{ | ||
padding: 0.5rem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.