Skip to content

Commit

Permalink
fix(ui): fix key select box event
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
  • Loading branch information
bnjjj committed Jul 1, 2019
1 parent 1fed1b6 commit 43f1803
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 74 deletions.
85 changes: 32 additions & 53 deletions ui/src/app/shared/parameter/value/parameter.value.html
Original file line number Diff line number Diff line change
@@ -1,57 +1,44 @@
<ng-container [ngSwitch]="type" *ngIf="edit">
<div *ngSwitchCase="'number'" class="ui fluid input">
<input type="number" [(ngModel)]="editableValue" (change)="valueChanged()" (keydown)="sendValueChanged()" name="value">
<input type="number" [(ngModel)]="editableValue" (change)="valueChanged()" (keydown)="sendValueChanged()"
name="value">
</div>
<div *ngSwitchCase="'text'" class="ui form">
<codemirror [(ngModel)]="editableValue" [config]="codeMirrorConfig" (change)="changeCodeMirror()" #codeMirror (keydown)="sendValueChanged()"></codemirror>
<codemirror [(ngModel)]="editableValue" [config]="codeMirrorConfig" (change)="changeCodeMirror()" #codeMirror
(keydown)="sendValueChanged()"></codemirror>
</div>
<div *ngSwitchCase="'boolean'" class="ui checkbox">
<input type="checkbox" [(ngModel)]="editableValue" (change)="valueChanged();sendValueChanged()" name="value">
<label>{{ ' '}}</label>
</div>
<div *ngSwitchCase="'ssh-key'">
<ng-container *ngIf="keys">
<sui-select class="selection"
name="type"
[(ngModel)]="editableValue"
(ngModelChange)="sendValueChanged()"
[options]="keys.ssh"
labelField="name"
valueField="name"
[isSearchable]="true"
#sshkey>
<sui-select class="selection" name="type" [(ngModel)]="editableValue"
(ngModelChange)="valueChanged(); sendValueChanged()" [options]="keys.ssh" labelField="name"
valueField="name" [isSearchable]="true" #sshkey>
<sui-select-option *ngFor="let t of sshkey.filteredOptions" [value]="t">
</sui-select-option>
</sui-select>
</ng-container>
</div>
<div *ngSwitchCase="'pgp-key'">
<ng-container *ngIf="keys">
<sui-select class="selection"
name="type"
[(ngModel)]="editableValue"
(ngModelChange)="sendValueChanged()"
[options]="keys.pgp"
labelField="name"
valueField="name"
[isSearchable]="true"
#pgpkey>
<sui-select class="selection" name="type" [(ngModel)]="editableValue"
(ngModelChange)="valueChanged(); sendValueChanged()" [options]="keys.pgp" labelField="name"
valueField="name" [isSearchable]="true" #pgpkey>
<sui-select-option *ngFor="let t of pgpkey.filteredOptions" [value]="t">
</sui-select-option>
</sui-select>
</ng-container>
</div>
<div *ngSwitchCase="'list'">
<div class="ui fluid input" *ngIf="editList">
<input type="text" [(ngModel)]="editableValue" (change)="valueChanged()" (keydown)="sendValueChanged()" name="value" placeholder="value1;value2;value3">
<input type="text" [(ngModel)]="editableValue" (change)="valueChanged()" (keydown)="sendValueChanged()"
name="value" placeholder="value1;value2;value3">
</div>
<div *ngIf="!editList && editableValue && list">
<sm-select class="search fluid"
[(model)]="editableValue"
[options]="{'fullTextSearch': true}"
(modelChange)="valueChanged();sendValueChanged()"
(keydown)="sendValueChanged()"
name="value">
<sm-select class="search fluid" [(model)]="editableValue" [options]="{'fullTextSearch': true}"
(modelChange)="valueChanged();sendValueChanged()" (keydown)="sendValueChanged()" name="value">

<ng-container *ngIf="refValue">
<option *ngFor="let v of refValue" [value]="v">{{v}}</option>
Expand All @@ -65,53 +52,45 @@
</div>

<div *ngSwitchCase="'env'">
<sm-select class="search fluid"
[options]="{'fullTextSearch': true}"
[(model)]="editableValue"
(modelChange)="valueChanged()"
(onChange)="sendValueChanged()">
<option *ngFor="let env of projectRo?.environments" value="{{env.name}}">{{env.name}}</option>
</sm-select>
<sm-select class="search fluid" [options]="{'fullTextSearch': true}" [(model)]="editableValue"
(modelChange)="valueChanged()" (onChange)="sendValueChanged()">
<option *ngFor="let env of projectRo?.environments" value="{{env.name}}">{{env.name}}</option>
</sm-select>
</div>
<div *ngSwitchCase="'pipeline'">
<sm-select class="search fluid"
[options]="{'fullTextSearch': true}"
[(model)]="editableValue"
(modelChange)="valueChanged()"
(onChange)="sendValueChanged()">
<sm-select class="search fluid" [options]="{'fullTextSearch': true}" [(model)]="editableValue"
(modelChange)="valueChanged()" (onChange)="sendValueChanged()">
<option *ngFor="let pip of projectRo?.pipelines" value="{{pip.name}}">{{pip.name}}</option>
</sm-select>
</div>
<div *ngSwitchCase="'repository'">
<sm-select class="search fluid"
[options]="{'fullTextSearch': true}"
[model]="selectedRepoManager.name"
<sm-select class="search fluid" [options]="{'fullTextSearch': true}" [model]="selectedRepoManager.name"
(modelChange)="updateRepoManager($event)">
<option *ngFor="let r of repositoriesManager" value="{{r.name}}">{{r.name}}</option>
</sm-select>
<sm-select *ngIf="selectedRepoManager && selectedRepoManager.name !== 'Git Url'"
placeholder="{{'common_loading' | translate}}"
[options]="{'fullTextSearch': true}"
(modelChange)="valueRepoChanged($event)"
[(model)]="selectedRepo"
class="search item"
[disabled]="loadingRepos">
placeholder="{{'common_loading' | translate}}" [options]="{'fullTextSearch': true}"
(modelChange)="valueRepoChanged($event)" [(model)]="selectedRepo" class="search item"
[disabled]="loadingRepos">
<option *ngFor="let r of repositories" value="{{r.fullname}}">{{r.fullname}}</option>
</sm-select>
<input *ngIf="selectedRepoManager && selectedRepoManager.name === 'Git Url'" type="text" [(ngModel)]="editableValue" (change)="valueChanged()" (keydown)="sendValueChanged()" name="value" placeholder="{{'parameter_git_url' | translate }}">
<input *ngIf="selectedRepoManager && selectedRepoManager.name === 'Git Url'" type="text"
[(ngModel)]="editableValue" (change)="valueChanged()" (keydown)="sendValueChanged()" name="value"
placeholder="{{'parameter_git_url' | translate }}">
</div>
<div *ngSwitchDefault>
<input auto-complete autocomplete="off" type="text" [(ngModel)]="editableValue"
(change)="valueChanged()" (keydown)="sendValueChanged()" name="value" [source]="suggest" [min-chars]="3"
[no-match-found-text]="false">
<input auto-complete autocomplete="off" type="text" [(ngModel)]="editableValue" (change)="valueChanged()"
(keydown)="sendValueChanged()" name="value" [source]="suggest" [min-chars]="3"
[no-match-found-text]="false">
</div>
</ng-container>
<ng-container [ngSwitch]="type" *ngIf="!edit">
<div *ngSwitchCase="'text'" class="ui form">
<textarea readonly rows="{{_sharedService.getTextAreaheight(editableValue)}}">{{editableValue}}</textarea>
</div>
<div *ngSwitchCase="'boolean'" class="ui checkbox">
<input disabled type="checkbox" [(ngModel)]="editableValue" (change)="valueChanged()" (keydown)="sendValueChanged()" name="value">
<input disabled type="checkbox" [(ngModel)]="editableValue" (change)="valueChanged()"
(keydown)="sendValueChanged()" name="value">
<label>{{' '}}</label>
</div>
<div *ngSwitchDefault class="ui fluid input">
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/shared/vcs/vcs.strategy.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class VCSStrategyComponent implements OnInit {
displayVCSStrategy = false;
defaultKeyType = 'ssh';

@ViewChild('createKey', {static: false})
@ViewChild('createKey', { static: false })
sshModalTemplate: ModalTemplate<boolean, boolean, void>;
sshModal: SuiActiveModal<boolean, boolean, void>;

Expand Down
12 changes: 8 additions & 4 deletions ui/src/app/shared/vcs/vcs.strategy.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<div class="fourteen wide field">
<ng-container *ngFor="let c of connectionType.values()">
<div class="ui radio checkbox">
<input type="radio" id="connection-{{c}}" name="connection" [value]="c" [(ngModel)]="strategy.connection_type">
<input type="radio" id="connection-{{c}}" name="connection" [value]="c"
[(ngModel)]="strategy.connection_type">
<label for="connection-{{c}}">{{c}}</label>
</div>
</ng-container>
Expand All @@ -17,13 +18,15 @@
<ng-container *ngSwitchCase="connectionType.SSH">
<div class="inline fields">
<div class="two wide field">
<label>{{ 'vcs_ssh_key' | translate }} *<span class="keyLink" (click)="openCreateKeyModal('ssh')"
<label>{{ 'vcs_ssh_key' | translate }} *<span class="keyLink"
(click)="openCreateKeyModal('ssh')"
*ngIf="createOnProject">{{ 'key_or_create' | translate }}</span></label>
</div>
<div class="thirteen wide field">
<div class="ssh">
<app-parameter-value [editList]="false" [edit]="true" [type]="'ssh-key'" [keys]="keys"
[(value)]="strategy.ssh_key" (valueChange)="updatePublicKey($event)"></app-parameter-value>
[(value)]="strategy.ssh_key" (valueChange)="updatePublicKey($event)">
</app-parameter-value>
</div>
</div>
<div class="one wide field">
Expand Down Expand Up @@ -80,6 +83,7 @@
<ng-template let-context let-modal="modal" #createKey>
<div class="header">{{ 'keys_add_title' | translate }}</div>
<div class="content">
<app-keys-form [loading]="loading" (keyEvent)="addKey($event)" [defaultType]="defaultKeyType" prefix="proj-"></app-keys-form>
<app-keys-form [loading]="loading" (keyEvent)="addKey($event)" [defaultType]="defaultKeyType" prefix="proj-">
</app-keys-form>
</div>
</ng-template>
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {TranslateService} from '@ngx-translate/core';
import {Store} from '@ngxs/store';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Store } from '@ngxs/store';
import * as AU from 'ansi_up';
import {PermissionValue} from 'app/model/permission.model';
import {PipelineStatus} from 'app/model/pipeline.model';
import {Project} from 'app/model/project.model';
import {Workflow} from 'app/model/workflow.model';
import {WorkflowRun} from 'app/model/workflow.run.model';
import {WorkflowRunService} from 'app/service/workflow/run/workflow.run.service';
import {AutoUnsubscribe} from 'app/shared/decorator/autoUnsubscribe';
import {ToastService} from 'app/shared/toast/ToastService';
import {WorkflowState, WorkflowStateModel} from 'app/store/workflow.state';
import {finalize} from 'rxjs/operators';
import {Subscription} from 'rxjs/Subscription';
import { PermissionValue } from 'app/model/permission.model';
import { PipelineStatus } from 'app/model/pipeline.model';
import { Project } from 'app/model/project.model';
import { Workflow } from 'app/model/workflow.model';
import { WorkflowRun } from 'app/model/workflow.run.model';
import { WorkflowRunService } from 'app/service/workflow/run/workflow.run.service';
import { AutoUnsubscribe } from 'app/shared/decorator/autoUnsubscribe';
import { ToastService } from 'app/shared/toast/ToastService';
import { WorkflowState, WorkflowStateModel } from 'app/store/workflow.state';
import { finalize } from 'rxjs/operators';
import { Subscription } from 'rxjs/Subscription';

@Component({
selector: 'app-workflow-run-summary',
Expand Down Expand Up @@ -48,8 +48,12 @@ export class WorkflowRunSummaryComponent {
pipelineStatusEnum = PipelineStatus;
permissionEnum = PermissionValue;

constructor(private _workflowRunService: WorkflowRunService,
private _toast: ToastService, private _translate: TranslateService, private _store: Store) {
constructor(
private _workflowRunService: WorkflowRunService,
private _toast: ToastService,
private _translate: TranslateService,
private _store: Store
) {
this.subWR = this._store.select(WorkflowState.getCurrent()).subscribe((state: WorkflowStateModel) => {
this.workflow = state.workflow;
this.workflowRun = state.workflowRun;
Expand All @@ -60,6 +64,10 @@ export class WorkflowRunSummaryComponent {
this.author = tagTriggeredBy.value;
}
}
if (this.workflowRun.status === this.pipelineStatusEnum.FAIL &&
(!this.workflowRun.workflow || this.workflowRun.workflow.workflow_data == null)) {
this.showInfos = true;
}
}
});
}
Expand Down

0 comments on commit 43f1803

Please sign in to comment.