Fix duration missed for failed jobs

Signed-off-by: FangyuanCheng <fangyuanc@vmware.com>
This commit is contained in:
FangyuanCheng 2019-04-19 15:42:33 +08:00
parent 6b45b5ef7c
commit f2316601d8
4 changed files with 23 additions and 17 deletions

View File

@ -15,8 +15,8 @@
<div class="form-group"> <div class="form-group">
<label class="form-group-label-override required">{{'DESTINATION.PROVIDER' | translate}}</label> <label class="form-group-label-override required">{{'DESTINATION.PROVIDER' | translate}}</label>
<div class="form-select"> <div class="form-select">
<div class="select providerSelect pull-left"> <div class="select inputWidth pull-left">
<select name="adapter" id="adapter" [(ngModel)]="target.type" [disabled]="testOngoing || controlEnabled"> <select name="adapter" id="adapter" (change)="adapterChange($event)" [(ngModel)]="target.type" [disabled]="testOngoing || editDisabled">
<option *ngFor="let adapter of adapterList" value="{{adapter}}">{{adapter}}</option> <option *ngFor="let adapter of adapterList" value="{{adapter}}">{{adapter}}</option>
</select> </select>
</div> </div>
@ -29,7 +29,7 @@
<label class="col-md-8" for="destination_name" aria-haspopup="true" role="tooltip" [class.invalid]="targetName.errors && (targetName.dirty || targetName.touched)" <label class="col-md-8" for="destination_name" aria-haspopup="true" role="tooltip" [class.invalid]="targetName.errors && (targetName.dirty || targetName.touched)"
[class.valid]="targetName.valid" class="tooltip tooltip-validation tooltip-sm tooltip-bottom-left"> [class.valid]="targetName.valid" class="tooltip tooltip-validation tooltip-sm tooltip-bottom-left">
<input type="text" id="destination_name" [disabled]="testOngoing" [readonly]="!editable" [(ngModel)]="target.name" <input type="text" id="destination_name" [disabled]="testOngoing" [readonly]="!editable" [(ngModel)]="target.name"
name="targetName" size="20" #targetName="ngModel" required> name="targetName" size="25" #targetName="ngModel" required>
<span class="tooltip-content" *ngIf="targetName.errors && targetName.errors.required && (targetName.dirty || targetName.touched)"> <span class="tooltip-content" *ngIf="targetName.errors && targetName.errors.required && (targetName.dirty || targetName.touched)">
{{ 'DESTINATION.NAME_IS_REQUIRED' | translate }} {{ 'DESTINATION.NAME_IS_REQUIRED' | translate }}
</span> </span>
@ -46,8 +46,8 @@
translate }}</label> translate }}</label>
<label class="col-md-8" for="destination_url" aria-haspopup="true" role="tooltip" [class.invalid]="targetEndpoint.errors && (targetEndpoint.dirty || targetEndpoint.touched)" <label class="col-md-8" for="destination_url" aria-haspopup="true" role="tooltip" [class.invalid]="targetEndpoint.errors && (targetEndpoint.dirty || targetEndpoint.touched)"
[class.valid]="targetEndpoint.valid" class="tooltip tooltip-validation tooltip-sm tooltip-bottom-left"> [class.valid]="targetEndpoint.valid" class="tooltip tooltip-validation tooltip-sm tooltip-bottom-left">
<input type="text" id="destination_url" [disabled]="testOngoing || controlEnabled" [readonly]="!editable" [(ngModel)]="target.url" <input type="text" id="destination_url" [disabled]="testOngoing || editDisabled || controlEnabled" [readonly]="!editable" [(ngModel)]="target.url"
size="20" name="endpointUrl" #targetEndpoint="ngModel" required placeholder="http(s)://192.168.1.1"> size="25" name="endpointUrl" #targetEndpoint="ngModel" required placeholder="http(s)://192.168.1.1">
<span class="tooltip-content" *ngIf="targetEndpoint.errors && targetEndpoint.errors.required && (targetEndpoint.dirty || targetEndpoint.touched)"> <span class="tooltip-content" *ngIf="targetEndpoint.errors && targetEndpoint.errors.required && (targetEndpoint.dirty || targetEndpoint.touched)">
{{ 'DESTINATION.URL_IS_REQUIRED' | translate }} {{ 'DESTINATION.URL_IS_REQUIRED' | translate }}
</span> </span>
@ -58,14 +58,14 @@
<label for="destination_access_key" class="col-md-4 form-group-label-override">{{ 'DESTINATION.ACCESS_ID' | <label for="destination_access_key" class="col-md-4 form-group-label-override">{{ 'DESTINATION.ACCESS_ID' |
translate }}</label> translate }}</label>
<input type="text" placeholder="Access ID" class="col-md-8" id="destination_access_key" [disabled]="testOngoing" [readonly]="!editable" <input type="text" placeholder="Access ID" class="col-md-8" id="destination_access_key" [disabled]="testOngoing" [readonly]="!editable"
[(ngModel)]="target.credential.access_key" size="23" name="access_key" #access_key="ngModel"> [(ngModel)]="target.credential.access_key" size="28" name="access_key" #access_key="ngModel">
</div> </div>
<!-- access_secret --> <!-- access_secret -->
<div class="form-group"> <div class="form-group">
<label for="destination_password" class="col-md-4 form-group-label-override">{{ 'DESTINATION.ACCESS_SECRET' | <label for="destination_password" class="col-md-4 form-group-label-override">{{ 'DESTINATION.ACCESS_SECRET' |
translate }}</label> translate }}</label>
<input type="password" placeholder="Access Secret" class="col-md-8" id="destination_password" [disabled]="testOngoing" [readonly]="!editable" <input type="password" placeholder="Access Secret" class="col-md-8" id="destination_password" [disabled]="testOngoing" [readonly]="!editable"
[(ngModel)]="target.credential.access_secret" size="23" name="access_secret" #access_secret="ngModel"> [(ngModel)]="target.credential.access_secret" size="28" name="access_secret" #access_secret="ngModel">
</div> </div>
<!-- Verify Remote Cert --> <!-- Verify Remote Cert -->
<div class="form-group"> <div class="form-group">

View File

@ -12,10 +12,6 @@
height: 30px; height: 30px;
} }
.providerSelect {
width: 180px;
}
.inputWidth { .inputWidth {
width: 182px; width: 216px;
} }

View File

@ -32,7 +32,7 @@ import { Endpoint } from "../service/interface";
import { clone, compareValue, isEmptyObject } from "../utils"; import { clone, compareValue, isEmptyObject } from "../utils";
const FAKE_PASSWORD = "rjGcfuRu"; const FAKE_PASSWORD = "rjGcfuRu";
const DOCKERHUB_URL = "https://registry-1.docker.io";
@Component({ @Component({
selector: "hbr-create-edit-endpoint", selector: "hbr-create-edit-endpoint",
templateUrl: "./create-edit-endpoint.component.html", templateUrl: "./create-edit-endpoint.component.html",
@ -41,6 +41,7 @@ const FAKE_PASSWORD = "rjGcfuRu";
export class CreateEditEndpointComponent export class CreateEditEndpointComponent
implements AfterViewChecked, OnDestroy, OnInit { implements AfterViewChecked, OnDestroy, OnInit {
modalTitle: string; modalTitle: string;
editDisabled: boolean = false;
controlEnabled: boolean = false; controlEnabled: boolean = false;
createEditDestinationOpened: boolean; createEditDestinationOpened: boolean;
staticBackdrop: boolean = true; staticBackdrop: boolean = true;
@ -178,7 +179,7 @@ export class CreateEditEndpointComponent
// Open the modal now // Open the modal now
this.open(); this.open();
this.controlEnabled = true; this.editDisabled = true;
this.forceRefreshView(2000); this.forceRefreshView(2000);
}, },
error => this.errorHandler.error(error) error => this.errorHandler.error(error)
@ -190,6 +191,17 @@ export class CreateEditEndpointComponent
.subscribe(res => (this.modalTitle = res)); .subscribe(res => (this.modalTitle = res));
// Directly open the modal // Directly open the modal
this.open(); this.open();
this.editDisabled = false;
}
}
adapterChange($event): void {
let selectValue = this.targetForm.controls.adapter.value;
if (selectValue === 'dockerHub') {
this.targetForm.controls.endpointUrl.setValue(DOCKERHUB_URL);
this.controlEnabled = true;
} else {
this.targetForm.controls.endpointUrl.setValue("");
this.controlEnabled = false; this.controlEnabled = false;
} }
} }

View File

@ -474,9 +474,7 @@ export class ReplicationComponent implements OnInit, OnDestroy {
if (!j) { if (!j) {
return; return;
} }
if (j.status === "Failed") {
return "-";
}
let start_time = new Date(j.start_time).getTime(); let start_time = new Date(j.start_time).getTime();
let end_time = new Date(j.end_time).getTime(); let end_time = new Date(j.end_time).getTime();
let timesDiff = end_time - start_time; let timesDiff = end_time - start_time;