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/06/05 15:15:17 UTC
[incubator-dlab] branch feature/projects updated: [DLAB-747]: moved
and extended resources grid model
This is an automated email from the ASF dual-hosted git repository.
ankovalyshyn pushed a commit to branch feature/projects
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/feature/projects by this push:
new 4ded100 [DLAB-747]: moved and extended resources grid model
4ded100 is described below
commit 4ded100aa0dd1e1f3982f6af819e804c8814c03f
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Wed Jun 5 18:15:02 2019 +0300
[DLAB-747]: moved and extended resources grid model
---
.../resources-grid/create-resource.model.ts | 25 -----------
.../resources-grid/resources-grid.component.ts | 50 ++++------------------
.../resources-grid/resources-grid.model.ts | 42 +++++++++++++++++-
.../src/app/resources/resources.component.ts | 4 +-
4 files changed, 51 insertions(+), 70 deletions(-)
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/create-resource.model.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/create-resource.model.ts
deleted file mode 100644
index 9209b09..0000000
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/create-resource.model.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-
-export class CreateResourceModel {
- constructor(
- public name: string,
- public count: string
- ) { }
-}
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
index 4bb212d..fc2eaf0 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
@@ -23,8 +23,8 @@ import { ToastrService } from 'ngx-toastr';
import { MatDialog } from '@angular/material';
import { UserResourceService } from '../../core/services';
-import { CreateResourceModel } from './create-resource.model';
-import { ResourcesGridRowModel } from './resources-grid.model';
+
+import { ExploratoryModel } from './resources-grid.model';
import { FilterConfigurationModel } from './filter-configuration.model';
import { GeneralEnvironmentStatus } from '../../administration/management/management.model';
import { ConfirmationDialogType } from '../../shared';
@@ -48,17 +48,16 @@ import { DICTIONARY } from '../../../dictionary/global.dictionary';
export class ResourcesGridComponent implements OnInit {
readonly DICTIONARY = DICTIONARY;
- environments: Array<ResourcesGridRowModel>;
- filteredEnvironments: Array<ResourcesGridRowModel> = [];
+ environments: Array<ExploratoryModel>;
+ filteredEnvironments: Array<ExploratoryModel> = [];
filterConfiguration: FilterConfigurationModel;
filterForm: FilterConfigurationModel = new FilterConfigurationModel('', [], [], [], '');
- model = new CreateResourceModel('', '');
+
isOutscreenDropdown: boolean;
collapseFilterRow: boolean = false;
filtering: boolean = false;
activeFiltering: boolean = false;
healthStatus: GeneralEnvironmentStatus;
- delimitersRegex = /[-_]?/g;
public filteringColumns: Array<any> = [
{ title: 'Environment name', name: 'name', className: 'th_name', filtering: {} },
@@ -84,7 +83,7 @@ export class ResourcesGridComponent implements OnInit {
}
getDefaultFilterConfiguration(): void {
- const data: Array<ResourcesGridRowModel> = this.environments;
+ const data: Array<ExploratoryModel> = this.environments;
const shapes = [], statuses = [], resources = [];
data.forEach((item: any) => {
@@ -107,8 +106,8 @@ export class ResourcesGridComponent implements OnInit {
applyFilter_btnClick(config: FilterConfigurationModel) {
this.filtering = true;
- // let filteredData: Array<ResourcesGridRowModel> = this.environments.map(env => (<any>Object).assign({}, env));
- let filteredData: Array<ResourcesGridRowModel> = this.environments.map(env => (<any>Object).create(env));
+ // let filteredData: Array<ExploratoryModel> = this.environments.map(env => (<any>Object).assign({}, env));
+ let filteredData: Array<ExploratoryModel> = this.environments.map(env => (<any>Object).create(env));
const containsStatus = (list, selectedItems) => {
return list.filter((item: any) => { if (selectedItems.indexOf(item.status) !== -1) return item; });
};
@@ -199,7 +198,7 @@ export class ResourcesGridComponent implements OnInit {
buildGrid(): void {
this.userResourceService.getUserProvisionedResources()
.subscribe((result) => {
- this.environments = this.loadEnvironments(result.exploratory, result.shared);
+ this.environments = ExploratoryModel.loadEnvironments(result.exploratory, result.shared);
this.getDefaultFilterConfiguration();
(this.environments.length) ? this.getUserPreferences() : this.filteredEnvironments = [];
@@ -215,37 +214,6 @@ export class ResourcesGridComponent implements OnInit {
return false;
}
- loadEnvironments(exploratoryList: Array<any>, sharedDataList: any): Array<ResourcesGridRowModel> {
- if (exploratoryList && sharedDataList) {
- return exploratoryList.map((value) => {
- return new ResourcesGridRowModel(value.exploratory_name,
- value.template_name,
- value.image,
- value.status,
- value.shape,
- value.computational_resources,
- value.up_time,
- value.exploratory_url,
- sharedDataList.edge_node_ip,
- value.exploratory_user,
- value.exploratory_pass,
- sharedDataList[DICTIONARY.bucket_name],
- sharedDataList[DICTIONARY.shared_bucket_name],
- value.error_message,
- value[DICTIONARY.billing.cost],
- value[DICTIONARY.billing.currencyCode],
- value.billing,
- value.libs,
- sharedDataList[DICTIONARY.user_storage_account_name],
- sharedDataList[DICTIONARY.shared_storage_account_name],
- sharedDataList[DICTIONARY.datalake_name],
- sharedDataList[DICTIONARY.datalake_user_directory_name],
- sharedDataList[DICTIONARY.datalake_shared_directory_name],
- );
- });
- }
- }
-
getUserPreferences(): void {
this.userResourceService.getUserPreferences()
.subscribe((result: FilterConfigurationModel) => {
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.model.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.model.ts
index edd2af6..93d3d0a 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.model.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.model.ts
@@ -16,8 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
+import { DICTIONARY } from '../../../dictionary/global.dictionary';
+
+export class ExploratoryModel {
+ readonly DICTIONARY = DICTIONARY;
-export class ResourcesGridRowModel {
constructor(
public name: Array<any>,
public template_name: string,
@@ -41,6 +44,41 @@ export class ResourcesGridRowModel {
public shared_account_name: string,
public datalake_name: string,
public datalake_directory: string,
- public datalake_shared_directory: string
+ public datalake_shared_directory: string,
+ public project: string,
+ public endpoint: string,
) { }
+
+ public static loadEnvironments(exploratoryList: Array<any>, sharedDataList: any): Array<ExploratoryModel> {
+ if (exploratoryList && sharedDataList) {
+ return exploratoryList.map((value) => {
+ return new ExploratoryModel(value.exploratory_name,
+ value.template_name,
+ value.image,
+ value.status,
+ value.shape,
+ value.computational_resources,
+ value.up_time,
+ value.exploratory_url,
+ sharedDataList.edge_node_ip,
+ value.exploratory_user,
+ value.exploratory_pass,
+ sharedDataList[DICTIONARY.bucket_name],
+ sharedDataList[DICTIONARY.shared_bucket_name],
+ value.error_message,
+ value[DICTIONARY.billing.cost],
+ value[DICTIONARY.billing.currencyCode],
+ value.billing,
+ value.libs,
+ sharedDataList[DICTIONARY.user_storage_account_name],
+ sharedDataList[DICTIONARY.shared_storage_account_name],
+ sharedDataList[DICTIONARY.datalake_name],
+ sharedDataList[DICTIONARY.datalake_user_directory_name],
+ sharedDataList[DICTIONARY.datalake_shared_directory_name],
+ value.project,
+ value.endpoint
+ );
+ });
+ }
+ }
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
index f6725cf..d59e4a0 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
@@ -24,7 +24,7 @@ import { MatDialog } from '@angular/material';
import { ResourcesGridComponent } from './resources-grid/resources-grid.component';
import { ExploratoryEnvironmentCreateComponent } from './exploratory/create-environment';
-import { ResourcesGridRowModel } from './resources-grid/resources-grid.model';
+import { ExploratoryModel } from './resources-grid/resources-grid.model';
import { HealthStatusService } from '../core/services';
import { ManageUngitComponent } from './manage-ungit/manage-ungit.component';
@@ -35,7 +35,7 @@ import { ManageUngitComponent } from './manage-ungit/manage-ungit.component';
})
export class ResourcesComponent implements OnInit {
- public exploratoryEnvironments: Array<ResourcesGridRowModel> = [];
+ public exploratoryEnvironments: Array<ExploratoryModel> = [];
public healthStatus: any;
@ViewChild(ResourcesGridComponent) resourcesGrid: ResourcesGridComponent;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org