You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by an...@apache.org on 2019/10/08 13:07:44 UTC
[incubator-dlab] 01/01: [DLAB-1143]: added extra check on endpoint
statuses
This is an automated email from the ASF dual-hosted git repository.
ankovalyshyn pushed a commit to branch DLAB-1143
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit a0edef95c0afaec8b173f7c1372f43ab608ebf5d
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Tue Oct 8 16:05:24 2019 +0300
[DLAB-1143]: added extra check on endpoint statuses
---
.../project-list/project-list.component.html | 7 ++-----
.../project/project-list/project-list.component.ts | 24 +++++++++-------------
.../webapp/src/app/core/util/checkUtils.ts | 8 ++++++++
3 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
index b05c3ba..9000ef6 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
@@ -78,16 +78,13 @@
<th mat-header-cell *matHeaderCellDef class="project-actions"></th>
<td mat-cell *matCellDef="let element" class="project-actions">
<span>
- <!-- [ngClass]="{'not-active' : element.status !== 'ACTIVE' && element.status !== 'NOT_ACTIVE' }" -->
- <!-- [ngClass]="{'not-allowed' : element.status !== 'ACTIVE' && element.status !== 'NOT_ACTIVE' }" -->
<a (click)="editProject(element)">
<mat-icon>mode_edit</mat-icon>
</a>
</span>
<span>
- <!-- [ngClass]="{'not-active' : element.status !== 'ACTIVE' && element.status !== 'NOT_ACTIVE' && element.status !== 'FAILED' }" -->
- <!-- [ngClass]="{'not-allowed' : element.status !== 'ACTIVE' && element.status !== 'NOT_ACTIVE' && element.status !== 'FAILED' }" -->
- <a (click)="deleteProject(element)" [ngClass]="{'not-allowed' : isInProgress(element)}">
+ <a (click)="deleteProject(element)"
+ [ngClass]="{'not-allowed' : isInProgress(element), 'not-allowed' : !isActiveEndpoint(element) }">
<mat-icon>delete_forever</mat-icon>
</a>
</span>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
index c8772f8..b3ba969 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
@@ -25,6 +25,7 @@ import { Subscription } from 'rxjs';
import { ProjectDataService } from '../project-data.service';
import { ProjectService } from '../../../core/services';
import { Project, Endpoint } from '../project.component';
+import { CheckUtils } from '../../../core/util';
@Component({
selector: 'project-list',
@@ -88,19 +89,14 @@ export class ProjectListComponent implements OnInit, OnDestroy {
return project.endpoints.some(e => e.status !== 'RUNNING' && e.status !== 'STOPPED' && e.status !== 'TERMINATED' && e.status !== 'FAILED')
}
- private toEndpointStatus(status) {
- if (status === 'CREATING') {
- return 'CONNECTING';
- } else if (status === 'STARTING') {
- return 'CONNECTING';
- } else if (status === 'RUNNING') {
- return 'CONNECTED';
- } else if (status === 'STOPPING') {
- return 'DISCONNECTING';
- } else if (status === 'STOPPED') {
- return 'DISCONNECTED';
- } else {
- return status;
+ public isActiveEndpoint(project) {
+ if (project) {
+ return project.endpoints.some(e => e.status !== 'TERMINATED')
+ console.log('all dead');
}
}
-}
+
+ public toEndpointStatus(status) {
+ return CheckUtils.endpointStatus[status] || status;
+ }
+}
\ No newline at end of file
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/checkUtils.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/checkUtils.ts
index 3b3d3e3..994d18a 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/util/checkUtils.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/util/checkUtils.ts
@@ -48,4 +48,12 @@ export class CheckUtils {
str = str.replace(/\\/g, "%");
return unescape(str);
}
+
+ public static endpointStatus = {
+ CREATING: 'CONNECTING',
+ STARTING: 'CONNECTING',
+ RUNNING: 'CONNECTED',
+ STOPPING: 'DISCONNECTING',
+ STOPPED: 'DISCONNECTED'
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org