This is an automated email from the ASF dual-hosted git repository.
hshpak pushed a commit to branch DATALAB-2697
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
The following commit(s) were added to refs/heads/DATALAB-2697 by this push:
new 2607c9a added action pipe
new 187f0c0 Merge pull request #1447 from
GennadiyShpak/feat/DATALAB-2697/Support-possibility-to-start-instance
2607c9a is described below
commit 2607c9a541a9f0bc53b7bfa8c258da4cc12054bd
Author: Hennadii_Shpak <[email protected]>
AuthorDate: Tue Mar 8 22:18:21 2022 +0200
added action pipe
---
.../src/app/administration/management/index.ts | 2 +
.../management-grid/management-grid.component.ts | 2 +-
.../convert-action-type.pipe.ts | 48 ++++++++++++++++++++++
.../core/pipes/convert-action-type-pipe/index.ts | 30 ++++++++++++++
4 files changed, 81 insertions(+), 1 deletion(-)
diff --git
a/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts
b/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts
index ca34114..fa74fe0 100644
---
a/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts
+++
b/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts
@@ -39,6 +39,7 @@ import { SsnMonitorComponent } from
'./ssn-monitor/ssn-monitor.component';
import {EndpointsComponent, EndpointTestResultDialogComponent} from
'./endpoints/endpoints.component';
import { ProjectModule } from '../project';
import {CheckboxModule} from '../../shared/checkbox';
+import { ConvertActionTypePipeModule } from
'../../core/pipes/convert-action-type-pipe';
export * from './management.component';
@@ -54,6 +55,7 @@ export * from './management.component';
FormControlsModule,
DirectivesModule,
MaterialModule,
+ ConvertActionTypePipeModule,
CheckboxModule
],
declarations: [
diff --git
a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
index d762610..a122af1 100644
---
a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
+++
b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
@@ -387,7 +387,7 @@ export class ManagementGridComponent implements OnInit,
AfterViewInit, AfterView
'stopped': data.action==='stop', 'terminated': data.action
=== 'terminate'
}"
>
- {{data.action === 'stop' ? 'Stopped' : 'Terminated'}}
+ {{data.action | convertactiontype}}
</div>
</div>
<div class="clusters-list-item" *ngFor="let cluster of
notebook?.resources">
diff --git
a/services/self-service/src/main/resources/webapp/src/app/core/pipes/convert-action-type-pipe/convert-action-type.pipe.ts
b/services/self-service/src/main/resources/webapp/src/app/core/pipes/convert-action-type-pipe/convert-action-type.pipe.ts
new file mode 100644
index 0000000..e1459fc
--- /dev/null
+++
b/services/self-service/src/main/resources/webapp/src/app/core/pipes/convert-action-type-pipe/convert-action-type.pipe.ts
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { Pipe, PipeTransform } from '@angular/core';
+import { ActionsType } from
'../../../administration/management/management.model';
+
+const actionTypes = {
+ stopped: 'Stopped',
+ terminated: ' Terminated',
+ started: 'Started'
+}
+
+@Pipe({ name: 'convertactiontype' })
+
+export class ConvertActionTypePipe implements PipeTransform {
+ transform(value: string,): string {
+ if(value === ActionsType.stop) {
+ return actionTypes.stopped
+ }
+
+ if(value === ActionsType.start) {
+ return actionTypes.started
+ }
+
+ if(value === ActionsType.terminate) {
+ return actionTypes.terminated
+ }
+ else {
+ return 'Unknown type'
+ }
+ }
+}
diff --git
a/services/self-service/src/main/resources/webapp/src/app/core/pipes/convert-action-type-pipe/index.ts
b/services/self-service/src/main/resources/webapp/src/app/core/pipes/convert-action-type-pipe/index.ts
new file mode 100644
index 0000000..fcf8e0e
--- /dev/null
+++
b/services/self-service/src/main/resources/webapp/src/app/core/pipes/convert-action-type-pipe/index.ts
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { ConvertActionTypePipe } from './convert-action-type.pipe';
+
+@NgModule({
+ imports: [CommonModule],
+ declarations: [ConvertActionTypePipe],
+ exports: [ConvertActionTypePipe]
+})
+
+export class ConvertActionTypePipeModule { }
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]