diff --git a/src/app/core/http-shared/http-shared.service.ts b/src/app/core/http-shared/http-shared.service.ts index fc71fad13d0fd1a1c04792c7943dfd80209088d9..1f61474d71ac7a66473eb4b45b72c598a0d0da15 100644 --- a/src/app/core/http-shared/http-shared.service.ts +++ b/src/app/core/http-shared/http-shared.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; +import { HttpClient, HttpParams } from '@angular/common/http'; @Injectable({ providedIn: 'root', diff --git a/src/app/core/services/design-studio.service.ts b/src/app/core/services/design-studio.service.ts index bcf87a352354a06ffac4e01fe2ab9d54ae902703..f3fa23a4915bf1bbceedcd23832d4358bc278848 100644 --- a/src/app/core/services/design-studio.service.ts +++ b/src/app/core/services/design-studio.service.ts @@ -1,1416 +1,42 @@ import { Injectable } from '@angular/core'; import { HttpSharedService } from '../http-shared/http-shared.service'; -import { HttpClient } from '@angular/common/http'; import { apiConfig } from '../config'; import { UrlBuildService } from './url-build.service'; -import { - catchError, - firstValueFrom, - map, - Observable, - tap, - throwError, -} from 'rxjs'; +import { catchError, firstValueFrom, map } from 'rxjs'; import { BrowserStorageService } from './storage/browser-storage.service'; @Injectable({ providedIn: 'root', }) export class DesignStudioService { - userId$: Observable<string | undefined>; userId!: string; + userDetails!: any; + constructor( private readonly _httpSharedService: HttpSharedService, private urlBuildService: UrlBuildService, - private http: HttpClient, private browserStorageService: BrowserStorageService, ) { - this.userId$ = this.browserStorageService.getUserDetails().pipe( + this.browserStorageService.getUserDetailsObservable().pipe( map((details) => { console.log({ details }); - this.userId = details?.userId || ''; + + this.userDetails = details; + return details?.userId; }), ); } - getSiteConfig() { - return new Promise((resolve, reject) => { - try { - const response = { - status: null, - status_code: 0, - response_detail: 'SiteConfiguration fetched Successfully', - response_code: null, - response_body: { - created: '2021-09-15T20:11:30Z', - modified: '2023-11-06T21:36:24Z', - configKey: 'site_config', - configValue: - '{"fields":[{"type":"text","name":"siteInstanceName","label":"Site Instance Name","required":"true","data":"Graphene Dev02"},{"type":"heading","name":"ConnectionConfig","label":"Connection Configuration","required":"true","subFields":[{"type":"text","name":"socketTimeout","label":"Socket Timeout","required":"true","data":"300"},{"type":"text","name":"connectionTimeout","label":"Connection Timeout","required":"true","data":"10"}]},{"type":"select","name":"enableOnBoarding","label":"Enable On-Boarding","options":[{"name":"Enabled"},{"name":"Disabled"}],"required":true,"data":{"name":"Enabled"}},{"type":"select","name":"EnableDCAE","label":"Enable DCAE","options":[{"name":"Enabled"},{"name":"Disabled"}],"required":true,"data":{"name":"Disabled"}}]}', - userId: '12345678-abcd-90ab-cdef-1234567890ab', - }, - content: null, - error_code: '100', - }; - resolve(response); - } catch (error) { - reject(error); - } - }); - } - - getVersion() { - return new Promise((resolve, reject) => { - try { - const response = 3.1; - resolve(response); - } catch (error) { - reject(error); - } - }); - } - getCloudEnabled() { - return new Promise((resolve, reject) => { - try { - const response = { - status: true, - status_code: 200, - response_detail: 'Success', - response_code: null, - response_body: - '[ { "cloudEnabled": "true", "cloudName": "azure", "cloudDisplayText": "Microsoft Azure", "imageUrl": "/images/deploy-cloud/microsoft_azure.png" }, { "cloudEnabled": "false", "cloudName": "gcp", "cloudDisplayText": "Google Cloud Platform", "imageUrl": "/images/deploy-cloud/google_cloud_platform.png" }, { "cloudEnabled": "true", "cloudName": "deploylocal", "cloudDisplayText": "Deploy To Local", "imageUrl": "/images/deploy-cloud/deploy_to_local.png" }, { "cloudEnabled": "false", "cloudName": "whitebox", "cloudDisplayText": "Deploy To White Box", "imageUrl": "/images/deploy-cloud/deploy_to_whitebox.png" }]', - content: null, - error_code: null, - }; - resolve(response); - } catch (error) { - reject(error); - } - }); - } - - getModeltype() { - return new Promise((resolve, reject) => { - try { - const response = { - status: null, - status_code: 0, - response_detail: 'ML Solutions Categories fetched Successfully', - response_code: null, - response_body: [ - { - code: 'DS', - name: 'Data Sources', - }, - { - code: 'DN', - name: 'Deep Neural Network', - }, - { - code: 'SY', - name: 'Symbolic', - }, - { - code: 'UT', - name: 'Utility', - }, - { - code: 'LL', - name: 'LLM', - }, - { - code: 'GA', - name: 'GenAI', - }, - { - code: 'CL', - name: 'Classification', - }, - { - code: 'DT', - name: 'Data Transformer', - }, - { - code: 'PR', - name: 'Prediction', - }, - { - code: 'RG', - name: 'Regression', - }, - ], - content: null, - error_code: '100', - }; - resolve(response); - } catch (error) { - reject(error); - } - }); - } - - getToolkitType() { - return new Promise((resolve, reject) => { - try { - const response = { - status: null, - status_code: 0, - response_detail: 'ML Solutions Categories fetched Successfully', - response_code: null, - response_body: [ - { - code: 'CP', - name: 'Composite Solution', - }, - { - code: 'MN', - name: 'Model Node', - }, - { - code: 'SF', - name: 'Shared Folder', - }, - { - code: 'DB', - name: 'Database', - }, - { - code: 'ME', - name: 'Metrics', - }, - { - code: 'BR', - name: 'Data Broker', - }, - { - code: 'CC', - name: 'C/C++', - }, - { - code: 'CO', - name: 'Collator', - }, - { - code: 'DA', - name: 'Data Source', - }, - { - code: 'DS', - name: 'Design Studio', - }, - { - code: 'H2', - name: 'H2O', - }, - { - code: 'IN', - name: 'Initializer', - }, - { - code: 'JS', - name: 'Java Spark', - }, - { - code: 'ON', - name: 'ONAP', - }, - { - code: 'OR', - name: 'Orchestrator', - }, - { - code: 'OX', - name: 'ONNX', - }, - { - code: 'PB', - name: 'Probe', - }, - { - code: 'PF', - name: 'PFA', - }, - { - code: 'RC', - name: 'R', - }, - { - code: 'SK', - name: 'Scikit-Learn', - }, - { - code: 'SP', - name: 'Splitter', - }, - { - code: 'TC', - name: 'Training Client', - }, - { - code: 'TF', - name: 'TensorFlow', - }, - ], - content: null, - error_code: '100', - }; - resolve(response); - } catch (error) { - reject(error); - } - }); - } - - getAccessType() { - return new Promise((resolve, reject) => { - try { - const response = { - status: null, - status_code: 0, - response_detail: 'ML Solutions Access type fetched Successfully', - response_code: null, - response_body: [ - { - code: 'PB', - name: 'Public', - }, - { - code: 'RS', - name: 'Restricted', - }, - ], - content: null, - error_code: '100', - }; - resolve(response); - } catch (error) { - reject(error); - } - }); - } - - getCatalog() { - return new Promise((resolve, reject) => { - try { - const response = { - items: [ - { - solutionId: '070ae960-c96e-458f-a237-6b90eca12169', - solutionRevisionId: 'c27acab6-9da4-41b1-b4a6-3b2b346d6dfe', - solutionName: 'ai4iot-data-source', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Tiago Veiga', - toolKit: 'SK', - category: 'DS', - createdDate: '2022-07-30-18-38-28-000', - duplicateSolution: false, - }, - { - solutionId: '08771a9e-e973-4298-bb77-8583b333adf0', - solutionRevisionId: '71b24b5d-f516-4f7a-9198-5da4efc1d22a', - solutionName: 'ai4iot-visualization', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Tiago Veiga', - toolKit: 'SK', - category: 'DT', - createdDate: '2022-07-30-18-45-38-000', - duplicateSolution: false, - }, - { - solutionId: '1c456769-55e7-479a-aa97-13906642e30a', - solutionRevisionId: '42f15921-d265-4922-8632-cc3907ce8c2a', - solutionName: 'i-nergy-load-forecasting', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: - 'Institute of Communication and Computer Systems. I NERGY', - toolKit: 'SK', - category: 'PR', - createdDate: '2022-07-30-18-29-18-000', - duplicateSolution: false, - }, - { - solutionId: '21dc8806-d59b-4370-96cb-4f189c0346ce', - solutionRevisionId: '6112fcbd-f61a-4ff2-9add-db4051a06115', - solutionName: 'trainer-model', - version: '1.0.0', - onBoarder: 'Swetha Lakshmana Murthy', - author: 'Swetha Lakshmana Murthy', - provider: 'Swetha Lakshmana Murthy', - toolKit: 'TF', - category: 'CL', - createdDate: '2023-07-21-14-48-58-000', - duplicateSolution: false, - }, - { - solutionId: '240bca8d-d223-4e0a-bb9c-5285c47ccf81', - solutionRevisionId: 'd288ef00-3827-457d-a534-e8e5d5728713', - solutionName: 'SharedFolderProvider', - version: '1.0.0', - onBoarder: 'Acumos Admin', - author: 'Acumos Admin', - provider: 'Fraunhofer IAIS', - toolKit: 'SF', - category: 'DT', - createdDate: '2021-09-16-15-39-38-000', - duplicateSolution: false, - }, - { - solutionId: '246833a2-4057-4e07-bea6-5119c68d5e91', - solutionRevisionId: '2b5a145a-ee9d-4471-b626-396654e87fd7', - solutionName: 'aspsolver-clingo-oneshot', - version: '1.0.0', - onBoarder: 'Martin Welss', - author: 'Martin Welss', - provider: 'Peter Schueller', - toolKit: 'SK', - category: 'CL', - createdDate: '2022-07-12-21-26-18-000', - duplicateSolution: false, - }, - { - solutionId: '2ebf4bdd-f4f1-4350-8f36-ea4ecf596fce', - solutionRevisionId: '387bc7a5-c16e-4dd6-a26f-9970a86d7721', - solutionName: 'sentimentanalysisdatabroker', - version: '1.0.0', - onBoarder: 'Chaitali P', - author: 'Chaitali P', - provider: 'Fraunhofer IAIS', - toolKit: 'TF', - category: 'PR', - createdDate: '2021-09-17-13-22-32-000', - duplicateSolution: false, - }, - { - solutionId: '2f9fac17-f401-4b8e-839f-068001a3c2c2', - solutionRevisionId: '3f4f110e-9874-41d9-ae91-a6a376e9d547', - solutionName: 'NewsDatabroker', - version: '1.0.0', - onBoarder: 'Martin Welss', - author: 'Martin Welss', - provider: 'Fraunhofer IAIS', - toolKit: 'SK', - category: 'DS', - createdDate: '2021-09-24-07-49-23-000', - duplicateSolution: false, - }, - { - solutionId: '307981d2-3121-44cc-b5d5-81d775a0cff1', - solutionRevisionId: '4a78e09b-57ab-46d5-bd75-c9de42c3bed8', - solutionName: 'NewsClassifier', - version: '1.0.0', - onBoarder: 'Swetha Lakshmana Murthy', - author: 'Swetha Lakshmana Murthy', - provider: 'Swetha Lakshmana Murthy', - toolKit: 'TF', - category: 'CL', - createdDate: '2023-07-21-14-35-02-000', - duplicateSolution: false, - }, - { - solutionId: '3553c4cf-046d-422c-9103-3a25b31b6de6', - solutionRevisionId: 'e47b8783-d691-4d82-9eb5-280b63cb8c25', - solutionName: 'ai4eu-cuh-medaplus', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'MedaPlus AI for healthcare', - toolKit: 'SK', - category: 'DT', - createdDate: '2022-08-05-15-48-13-000', - duplicateSolution: false, - }, - { - solutionId: '3f8727c5-154c-4ae5-a901-7487bfab530b', - solutionRevisionId: '4d796cd4-860a-4f18-8098-2969aefddcc2', - solutionName: 'sudoku-tutorial-gui-stream', - version: '1.0.0', - onBoarder: 'Martin Welss', - author: 'Martin Welss', - provider: 'Peter Schueller', - toolKit: 'SK', - category: 'DS', - createdDate: '2022-07-13-08-24-49-000', - duplicateSolution: false, - }, - { - solutionId: '40c5f2ba-5cd3-4d02-abd0-bce2bbedc036', - solutionRevisionId: 'bea7f9cf-0b51-430c-b554-2e8c7dfe65d4', - solutionName: 'WorkerCard-Preprocessing', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Kenzo Milleville', - toolKit: 'SK', - category: 'PR', - createdDate: '2022-07-19-07-56-45-000', - duplicateSolution: false, - }, - { - solutionId: '41102815-3c0c-466e-bb2b-46294073802d', - solutionRevisionId: 'cdf2b916-8308-4ab3-9590-2b7dd6e72bb0', - solutionName: 'LionForests', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Ioannis Mollas', - toolKit: 'SK', - category: 'DT', - createdDate: '2022-07-19-08-59-53-000', - duplicateSolution: false, - }, - { - solutionId: '4198b30c-ccdd-461f-97bb-c4fb8842109a', - solutionRevisionId: 'e54f37f3-dac0-4604-8a5e-e2b7dc0b6544', - solutionName: 'ML-Assistant-for-Vibration-Monitoring', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Viking Analytics AB', - toolKit: 'SK', - category: 'CL', - createdDate: '2022-07-04-13-28-23-000', - duplicateSolution: false, - }, - { - solutionId: '440a3fcb-5a20-4800-a829-14bf2531ee0f', - solutionRevisionId: '0c0ac284-955d-446d-9b2b-ff7d46387a6a', - solutionName: 'recognaizepreprocessing', - version: '1.0.1', - onBoarder: 'Tobias Elvermann', - author: 'Tobias Elvermann', - toolKit: 'TF', - category: 'DT', - createdDate: '2022-01-05-07-30-26-000', - duplicateSolution: false, - }, - { - solutionId: '440a3fcb-5a20-4800-a829-14bf2531ee0f', - solutionRevisionId: '2036bbcc-4999-4ec8-a7fe-b64c2aec7724', - solutionName: 'recognaizepreprocessing', - version: '1.0.0', - onBoarder: 'Tobias Elvermann', - author: 'Tobias Elvermann', - provider: 'Fraunhofer IAIS', - toolKit: 'TF', - category: 'DT', - createdDate: '2021-09-17-12-11-49-000', - duplicateSolution: false, - }, - { - solutionId: '47c1e48e-45e5-40f2-8354-578bfc044176', - solutionRevisionId: '46bb648e-c1fd-49c6-a92e-4629d375be7d', - solutionName: 'IoTxKG', - version: '1.0.0', - onBoarder: 'Tobias Elvermann', - author: 'Tobias Elvermann', - provider: 'Sebastian Heil', - toolKit: 'SK', - category: 'CL', - createdDate: '2022-07-04-07-57-09-000', - duplicateSolution: false, - }, - { - solutionId: '4a1b544e-7308-419c-af11-ba4630b7b33e', - solutionRevisionId: 'bfdde331-a136-4b2d-b13b-03b07d786742', - solutionName: 'innerpageanalysis', - version: '1.0.0', - onBoarder: 'Tobias Elvermann', - author: 'Tobias Elvermann', - provider: 'Ehsan Darestani Farahani', - toolKit: 'SK', - category: 'CL', - createdDate: '2022-07-13-12-33-52-000', - duplicateSolution: false, - }, - { - solutionId: '4cf2148e-571f-486c-a87d-18bd8653a5c9', - solutionRevisionId: '718e1b3f-d5c5-4911-834e-d7476436d462', - solutionName: 'recognaizeocr', - version: '1.0.0', - onBoarder: 'Tobias Elvermann', - author: 'Tobias Elvermann', - provider: 'Fraunhofer IAIS', - toolKit: 'TF', - category: 'DT', - createdDate: '2021-09-17-12-13-48-000', - duplicateSolution: false, - }, - { - solutionId: '5d836235-b448-433b-ab2a-8f9db466104a', - solutionRevisionId: '2825c9e9-e5d9-48dd-ab0e-c9f0a33afc97', - solutionName: 'ai4industry-skillmatcher-dummy', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Peter Schueller', - toolKit: 'SK', - category: 'DT', - createdDate: '2022-08-04-10-37-04-000', - duplicateSolution: false, - }, - { - solutionId: '5e627e44-8cf3-4793-b2a5-f63c94024b88', - solutionRevisionId: 'd1358a4a-636f-4944-bd80-392cf0054241', - solutionName: 'YoloV5', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'PhysicalAI', - toolKit: 'SK', - category: 'DS', - createdDate: '2022-08-05-15-03-49-000', - duplicateSolution: false, - }, - { - solutionId: '60957699-97b0-4e19-987b-b5efcd81e283', - solutionRevisionId: 'a3608dd9-22db-431f-8e1c-9bef556751e6', - solutionName: 'AI4Agri-qualitypredictor', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Sergio Salmeron', - toolKit: 'SK', - category: 'PR', - createdDate: '2022-07-30-18-59-12-000', - duplicateSolution: false, - }, - { - solutionId: '6153f0c7-89c8-40b4-b731-ec84ba2c446f', - solutionRevisionId: '017baf91-4d19-4b46-ac6f-c095db1aa7f7', - solutionName: 'hppmodel', - version: '1.0.0', - onBoarder: 'Sangamithra Panneer Selvam', - author: 'Sangamithra Panneer Selvam', - provider: 'Sangamithra Panneer Selvam', - toolKit: 'TF', - category: 'PR', - createdDate: '2023-09-28-18-03-11-000', - duplicateSolution: false, - }, - { - solutionId: '61dec13d-8441-40b1-8019-d68f4cd61370', - solutionRevisionId: '3521f632-b029-4a9f-a159-57525f819fb8', - solutionName: 'ai4industry-gui', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Peter Schueller', - toolKit: 'SK', - category: 'DT', - createdDate: '2022-08-04-09-31-25-000', - duplicateSolution: false, - }, - { - solutionId: '620ec698-4027-414a-8b9f-8d6503cbf35b', - solutionRevisionId: '86e0f4fd-694a-4ba2-ba9f-bb3db1dc850f', - solutionName: 'coverpageanalysis', - version: '1.0.0', - onBoarder: 'Tobias Elvermann', - author: 'Tobias Elvermann', - provider: 'Ehsan Darestani Farahani', - toolKit: 'SK', - category: 'CL', - createdDate: '2022-07-20-06-27-53-000', - duplicateSolution: false, - }, - { - solutionId: '639bc7c3-c1d3-4260-9a0c-d446cb886d9f', - solutionRevisionId: '9fbb5ef6-f443-4953-812d-c13c47eed6ed', - solutionName: 'recognaizeui', - version: '1.0.0', - onBoarder: 'Chaitali P', - author: 'Chaitali P', - provider: 'Fraunhofer IAIS', - toolKit: 'SK', - category: 'DS', - createdDate: '2021-09-17-11-56-34-000', - duplicateSolution: false, - }, - { - solutionId: '639bc7c3-c1d3-4260-9a0c-d446cb886d9f', - solutionRevisionId: 'c4b06844-c41b-4036-9021-e4bddba83591', - solutionName: 'recognaizeui', - version: '1.0.1', - onBoarder: 'Martin Welss', - author: 'Martin Welss', - toolKit: 'SK', - category: 'DS', - createdDate: '2022-08-17-20-16-43-000', - duplicateSolution: false, - }, - { - solutionId: '6958c0df-f06e-44d5-97f5-d0b593f2e186', - solutionRevisionId: '4e0ef62e-e884-4cde-8477-79d6f1b8caab', - solutionName: 'speech2text-en', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Gabriele De Luca', - toolKit: 'SK', - category: 'DT', - createdDate: '2022-07-30-18-12-17-000', - duplicateSolution: false, - }, - { - solutionId: '72cf5390-27f6-4877-b3e5-8d6b339ef5c8', - solutionRevisionId: '556da743-0c0b-44b9-be86-6ac40a45aea1', - solutionName: 'AI4agriNDVI', - version: '1.0.0', - onBoarder: 'Martin Welss', - author: 'Martin Welss', - provider: 'DLR', - toolKit: 'SK', - category: 'RG', - createdDate: '2022-07-01-20-19-11-000', - duplicateSolution: false, - }, - { - solutionId: '7be990b3-1987-4076-9c7c-7c1561deb15b', - solutionRevisionId: 'f27de166-90aa-4be6-ad55-36a6c41f8ecd', - solutionName: - 'traffic-scene-segmentation-deeplab-xception65-cityscapes', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Fraunhofer IAIS', - toolKit: 'SK', - category: 'PR', - createdDate: '2022-08-04-13-23-32-000', - duplicateSolution: false, - }, - { - solutionId: '8b661182-16e0-469b-ae0d-302649fa07d1', - solutionRevisionId: 'a6bc64a4-30b4-4689-8bed-f09f3e2fbdcf', - solutionName: 'sudoku-design-evaluator-stream', - version: '1.0.0', - onBoarder: 'Martin Welss', - author: 'Martin Welss', - provider: 'Peter Schueller', - toolKit: 'SK', - category: 'CL', - createdDate: '2022-07-13-07-56-01-000', - duplicateSolution: false, - }, - { - solutionId: '8bef5404-92fc-47e5-985a-6811cf2bc0d7', - solutionRevisionId: '67054e68-f123-466a-a3cb-de0b21156e2a', - solutionName: 'AI4Agri-frontend', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Javier Villazan', - toolKit: 'SK', - category: 'DS', - createdDate: '2022-07-30-19-09-27-000', - duplicateSolution: false, - }, - { - solutionId: '958390c9-35d5-47a3-9aac-40c9c66014e2', - solutionRevisionId: '628a51da-3b3a-40a2-8785-ec2caf15f209', - solutionName: 'sentimentanalysismodel', - version: '1.0.0', - onBoarder: 'Chaitali P', - author: 'Chaitali P', - provider: 'Fraunhofer IAIS', - toolKit: 'TF', - category: 'PR', - createdDate: '2021-09-17-13-24-01-000', - duplicateSolution: false, - }, - { - solutionId: '9c71947a-8ece-4dff-a466-96752b02d2fe', - solutionRevisionId: 'd36b5ac6-7439-460c-9cdd-43ae6159299b', - solutionName: 'recognaizesegmentation', - version: '1.0.0', - onBoarder: 'Tobias Elvermann', - author: 'Tobias Elvermann', - provider: 'Fraunhofer IAIS', - toolKit: 'TF', - category: 'DT', - createdDate: '2021-09-17-12-06-52-000', - duplicateSolution: false, - }, - { - solutionId: '9f0cb688-4c20-4e95-b15a-0d0bebba66ed', - solutionRevisionId: '07e5d9a9-aa38-4bf3-9967-4b854a8bbf80', - solutionName: 'ai4industry-planner', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Peter Schueller', - toolKit: 'SK', - category: 'DT', - createdDate: '2022-08-04-09-43-58-000', - duplicateSolution: false, - }, - { - solutionId: 'a3fa1b6d-8407-4186-86cf-f827babb61e2', - solutionRevisionId: '96d6c3ad-3438-4991-8669-ce420f68bd1d', - solutionName: 'cnext-decision-intelligence', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Cnext', - toolKit: 'SK', - category: 'PR', - createdDate: '2022-08-04-12-52-53-000', - duplicateSolution: false, - }, - { - solutionId: 'a7838c96-7c2e-4324-96f5-de39e06df849', - solutionRevisionId: '23a1da1a-afdb-4320-abb0-d80eac23a7d1', - solutionName: 'audio-file-broker', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Gabriele De Luca', - toolKit: 'SK', - category: 'DS', - createdDate: '2022-07-30-18-21-22-000', - duplicateSolution: false, - }, - { - solutionId: 'abb19627-1cdc-4666-b048-0259e865da0b', - solutionRevisionId: '547b7f6f-cf1f-42ee-bd51-9e895c935d50', - solutionName: 'ner-trainingconfig', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Fraunhofer IAIS', - toolKit: 'SK', - category: 'DS', - createdDate: '2022-12-05-16-23-12-000', - duplicateSolution: false, - }, - { - solutionId: 'b0baf808-d8a8-4076-98e9-1fd7877c7bc0', - solutionRevisionId: '883f021c-9579-4db7-bc89-786bd8b3c894', - solutionName: 'Time-prediction-for-example-manufacturing', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Joachim Koehler', - toolKit: 'SK', - category: 'RG', - createdDate: '2022-08-04-12-16-07-000', - duplicateSolution: false, - }, - { - solutionId: 'b42b4e1d-6fa1-4252-8485-06ecc449c681', - solutionRevisionId: '4f7938fd-a0df-46d9-976d-274be3fc6b39', - solutionName: 'ai4iot-calibration', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Tiago Veiga', - toolKit: 'SK', - category: 'PR', - createdDate: '2022-07-30-18-52-48-000', - duplicateSolution: false, - }, - { - solutionId: 'd42472f3-eeaf-44d3-a470-f18fa9535e87', - solutionRevisionId: '511c685c-ce9b-4205-8d05-f2c47d1c5028', - solutionName: 'ner-model', - version: '1.0.1', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - toolKit: 'SK', - category: 'PR', - createdDate: '2022-12-13-13-52-07-000', - duplicateSolution: false, - }, - { - solutionId: 'd42472f3-eeaf-44d3-a470-f18fa9535e87', - solutionRevisionId: 'e1a20fad-ba0e-4650-9eb1-e680bdf14a7b', - solutionName: 'ner-model', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Fraunhofer IAIS', - toolKit: 'SK', - category: 'PR', - createdDate: '2022-10-04-08-30-40-000', - duplicateSolution: false, - }, - { - solutionId: 'dcdd71f8-af91-4216-bac6-7ba30ada877f', - solutionRevisionId: '5224634c-c45a-4a22-8cc3-3e79ee2292e5', - solutionName: 'Tensorboard', - version: '1.0.1', - onBoarder: 'Martin Welss', - author: 'Martin Welss', - toolKit: 'TF', - category: 'DT', - createdDate: '2022-07-04-12-51-45-000', - duplicateSolution: false, - }, - { - solutionId: 'dcdd71f8-af91-4216-bac6-7ba30ada877f', - solutionRevisionId: 'e46f4043-7532-40ea-b4b5-6a9c5a80c8f7', - solutionName: 'Tensorboard', - version: '1.0.0', - onBoarder: 'Martin Welss', - author: 'Martin Welss', - provider: 'Fraunhofer IAIS', - toolKit: 'TF', - category: 'DT', - createdDate: '2021-09-24-09-44-38-000', - duplicateSolution: false, - }, - { - solutionId: 'e00358f1-06be-4439-8a46-a3b21d68ee49', - solutionRevisionId: 'ec7123d3-f3ea-4835-b688-05ae82bf7575', - solutionName: 'hppdatabroker', - version: '1.0.0', - onBoarder: 'Sangamithra Panneer Selvam', - author: 'Sangamithra Panneer Selvam', - provider: 'Sangamithra Panneer Selvam', - toolKit: 'TF', - category: 'PR', - createdDate: '2023-09-28-17-59-30-000', - duplicateSolution: false, - }, - { - solutionId: 'f6846b55-5bec-4796-8670-1dd11656c91c', - solutionRevisionId: 'b453c788-f20c-4e4b-a110-6be1f2ab224c', - solutionName: 'ner-databroker', - version: '1.0.0', - onBoarder: 'Andel Gugu', - author: 'Andel Gugu', - provider: 'Fraunhofer IAIS', - toolKit: 'SK', - category: 'DS', - createdDate: '2022-10-04-08-15-15-000', - duplicateSolution: false, - }, - { - solutionId: '0968973f-be2f-414f-ab82-a55ad3201b45', - solutionRevisionId: '03860107-2670-4c73-a19a-3b4bda92824c', - solutionName: 'model-test', - version: '1.0.3', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-06-04-10-20-27-000', - duplicateSolution: false, - }, - { - solutionId: '0968973f-be2f-414f-ab82-a55ad3201b45', - solutionRevisionId: '112a5936-eae0-4c04-ba4d-509bbabc6189', - solutionName: 'model-test', - version: '1.0.10', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-06-04-13-35-15-000', - duplicateSolution: false, - }, - { - solutionId: '0968973f-be2f-414f-ab82-a55ad3201b45', - solutionRevisionId: '2dd0a468-fb06-4e1d-a1e1-e4bcb20aa7d3', - solutionName: 'model-test', - version: '1.0.7', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-06-04-10-37-51-000', - duplicateSolution: false, - }, - { - solutionId: '0968973f-be2f-414f-ab82-a55ad3201b45', - solutionRevisionId: '364b7b17-5141-44fa-a50a-860635713329', - solutionName: 'model-test', - version: '1.0.5', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-06-04-10-34-36-000', - duplicateSolution: false, - }, - { - solutionId: '0968973f-be2f-414f-ab82-a55ad3201b45', - solutionRevisionId: '3fb239b7-4a36-4ca3-abb4-30cd1f831115', - solutionName: 'model-test', - version: '1.0.1', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-05-30-19-29-50-000', - duplicateSolution: false, - }, - { - solutionId: '0968973f-be2f-414f-ab82-a55ad3201b45', - solutionRevisionId: '8372138a-268d-44cc-a0fd-ef3096b6e6bc', - solutionName: 'model-test', - version: '1.0.9', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-06-04-13-22-16-000', - duplicateSolution: false, - }, - { - solutionId: '0968973f-be2f-414f-ab82-a55ad3201b45', - solutionRevisionId: 'a7699e9c-9e88-4c4c-af60-036765d90ef7', - solutionName: 'model-test', - version: '1.0.2', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-05-30-19-31-10-000', - duplicateSolution: false, - }, - { - solutionId: '0968973f-be2f-414f-ab82-a55ad3201b45', - solutionRevisionId: 'b1a9559b-e201-4faa-8692-e6928205b5e2', - solutionName: 'model-test', - version: '1.0.8', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-06-04-13-17-50-000', - duplicateSolution: false, - }, - { - solutionId: '0968973f-be2f-414f-ab82-a55ad3201b45', - solutionRevisionId: 'b70620b1-6a91-45a1-9b68-79e0a13e496e', - solutionName: 'model-test', - version: '1.0.4', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-06-04-10-29-43-000', - duplicateSolution: false, - }, - { - solutionId: '0968973f-be2f-414f-ab82-a55ad3201b45', - solutionRevisionId: 'bffc7d08-7a8a-4429-85cd-f4865e8f76a8', - solutionName: 'model-test', - version: '1.0.0', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-05-30-17-09-16-000', - duplicateSolution: false, - }, - { - solutionId: '0968973f-be2f-414f-ab82-a55ad3201b45', - solutionRevisionId: 'f7573766-3585-4969-a637-88e600730264', - solutionName: 'model-test', - version: '1.0.6', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-06-04-10-37-00-000', - duplicateSolution: false, - }, - { - solutionId: '30ed65c9-1c57-474f-b7a5-65ebe1688ba5', - solutionRevisionId: 'c5e535d3-c5d1-447c-afad-c10fa7924f4c', - solutionName: 'model-test-4', - version: '1.0.0', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - toolKit: 'BR', - category: 'CL', - createdDate: '2024-05-30-19-43-21-000', - duplicateSolution: false, - }, - { - solutionId: '5651d17b-0edb-4770-9d57-5da73ea417f6', - solutionRevisionId: 'bd9e4988-4037-4435-a250-8f5d79a7032f', - solutionName: 'model-test-5-test-5', - version: '1.0.0', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - toolKit: 'BR', - category: 'CL', - createdDate: '2024-05-30-19-44-40-000', - duplicateSolution: false, - }, - { - solutionId: '7d5c891c-0461-4d72-900e-04f2d49d206c', - solutionRevisionId: '447a502f-4da6-43df-a55c-6d80703ad43e', - solutionName: 'model-test-3', - version: '1.0.0', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - createdDate: '2024-05-30-19-40-01-000', - duplicateSolution: false, - }, - { - solutionId: 'a847f714-dfde-4e3c-b295-ef23b770ebe1', - solutionRevisionId: 'c963e827-58ff-45e1-b449-ebe6047321d6', - solutionName: 'model-test6', - version: '1.0.0', - onBoarder: 'Kawtar Laariche', - author: 'Kawtar Laariche', - toolKit: 'BR', - category: 'CL', - createdDate: '2024-06-19-11-13-23-000', - duplicateSolution: false, - }, - ], - }; - resolve(response); - } catch (error) { - reject(error); - } - }); - } - - getCompositeSolutions() { - return new Promise((resolve, reject) => { - try { - const response = { - items: [ - { - solutionId: '409dcaf6-9086-42ff-a6b7-244edf59071d', - solutionName: 'recognaize-solution', - version: '2', - ownerId: 'Martin Welss', - provider: 'Fraunhofer IAIS', - toolKit: 'CP', - category: 'PR', - description: 'null', - visibilityLevel: 'PB', - isDuplicateSolution: 'false', - created: '2022-08-17-20-22-03-000', - icon: 'null', - }, - { - solutionId: '61a33ac7-323f-4492-b3bb-fc9482218af9', - solutionName: 'AI4IndustryPilot', - version: '2', - ownerId: 'Andel Gugu', - provider: 'Raoul Blankertz', - toolKit: 'CP', - category: 'PR', - description: 'null', - visibilityLevel: 'PB', - isDuplicateSolution: 'false', - created: '2022-08-04-12-29-10-000', - icon: 'null', - }, - { - solutionId: '64f3c1d3-fbf4-4de3-a5a4-27eeaf616614', - solutionName: 'Sudoku-Tutorial', - version: '1', - ownerId: 'Martin Welss', - provider: 'Peter Schueller', - toolKit: 'CP', - category: 'PR', - description: 'null', - visibilityLevel: 'PB', - isDuplicateSolution: 'false', - created: '2022-07-13-09-38-05-000', - icon: 'null', - }, - { - solutionId: '9f4b4eb1-d115-4970-9e5f-6d67663efcba', - solutionName: 'houseprice-pipeline', - version: '1', - ownerId: 'Sangamithra Panneer Selvam', - provider: 'Acumos', - toolKit: 'CP', - category: 'PR', - description: 'null', - visibilityLevel: 'PB', - isDuplicateSolution: 'false', - created: '2023-09-28-18-14-08-000', - icon: 'null', - }, - { - solutionId: 'b0b2eae5-d722-4a5a-9818-f726eb07af86', - solutionName: 'TrainingPipeline', - version: 'v2', - ownerId: 'Swetha Lakshmana Murthy', - provider: 'Swetha Lakshmana Murthy', - toolKit: 'CP', - category: 'CL', - description: 'null', - visibilityLevel: 'PB', - isDuplicateSolution: 'false', - created: '2023-07-24-07-22-43-000', - icon: 'null', - }, - { - solutionId: 'bda223d1-2f0a-487c-92e2-9ac6202f2591', - solutionName: 'named-entity-recognition', - version: '1.0', - ownerId: 'Andel Gugu', - provider: 'Fraunhofer IAIS', - toolKit: 'CP', - category: 'PR', - description: 'null', - visibilityLevel: 'PB', - isDuplicateSolution: 'false', - created: '2023-01-04-10-15-53-000', - icon: 'null', - }, - { - solutionId: 'fb13977a-6d91-4bb0-8077-c0f08cfa7b01', - solutionName: 'sentiment-analysis-pipeline', - version: '1', - ownerId: 'Martin Welss', - provider: 'Fraunhofer IAIS', - toolKit: 'CP', - category: 'CL', - description: 'null', - visibilityLevel: 'PB', - isDuplicateSolution: 'false', - created: '2022-08-21-21-03-53-000', - icon: 'null', - }, - ], - }; - resolve(response); - } catch (error) { - reject(error); - } - }); - } - - createNewCompositeSolution() { - return new Promise((resolve, reject) => { - try { - const response = { - cid: '12d23d23d-d23c23c2c-2c223-gb34f5h', - success: 'true', - errorMessage: '', - }; - resolve(response); - } catch (error) { - reject(error); - } - }); - } - - displayProperties() { - return new Promise((resolve, reject) => { - try { - const response = { - self: { - version: '1.0.0', - name: 'ai4eu-cuh-medaplus', - description: {}, - component_type: 'Docker', - }, - streams: {}, - services: { - calls: [ - { - config_key: 'getData', - request: { - streaming: false, - format: [ - { - messageName: 'Response', - messageargumentList: [ - { role: '', name: 'data', tag: '1', type: 'string' }, - ], - }, - ], - version: '', - }, - response: { format: [], version: '' }, - }, - { - config_key: 'mountVolume', - request: { - streaming: false, - format: [ - { - messageName: 'SharedFolderStatus', - messageargumentList: [ - { role: '', name: 'success', tag: '1', type: 'bool' }, - ], - }, - ], - version: '', - }, - response: { format: [], version: '' }, - }, - ], - provides: [ - { - route: 'getData', - request: { - streaming: false, - format: [ - { - messageName: 'Request', - messageargumentList: [ - { role: '', name: 'path', tag: '1', type: 'string' }, - ], - }, - ], - version: '', - }, - response: { format: [], version: '' }, - }, - { - route: 'mountVolume', - request: { - streaming: false, - format: [ - { - messageName: 'SharedFolderRequest', - messageargumentList: [ - { role: '', name: 'path', tag: '1', type: 'string' }, - ], - }, - ], - version: '', - }, - response: { format: [], version: '' }, - }, - ], - }, - parameters: [], - auxiliary: {}, - artifacts: [], - }; - resolve(response); - } catch (error) { - reject(error); - } - }); - } - - async getProtoBufJSON(solutionId: string, version: string): Promise<any> { - // Retrieve the userId from the Observable - const userId = await firstValueFrom(this.userId$); - - // Handle the case where userId is undefined - if (!userId) { - throw new Error('User ID is undefined'); - } - - const url = this.urlBuildService.buildUrl( - apiConfig.urlDesignStudioProtobuf, - { - userId, - solutionId, - version, - }, - ); - - return firstValueFrom( - this._httpSharedService - .get(url) - .pipe(catchError((error) => throwError(error))), - ); - } - - getTypeInfo() { - return new Promise((resolve, reject) => { - try { - const response = { - self: { - version: '1.0.0', - name: 'ai4eu-cuh-medaplus', - description: {}, - component_type: 'Docker', - }, - streams: {}, - services: { - calls: [ - { - config_key: 'getData', - request: { - streaming: false, - format: [ - { - messageName: 'Response', - messageargumentList: [ - { role: '', name: 'data', tag: '1', type: 'string' }, - ], - }, - ], - version: '', - }, - response: { format: [], version: '' }, - }, - { - config_key: 'mountVolume', - request: { - streaming: false, - format: [ - { - messageName: 'SharedFolderStatus', - messageargumentList: [ - { role: '', name: 'success', tag: '1', type: 'bool' }, - ], - }, - ], - version: '', - }, - response: { format: [], version: '' }, - }, - ], - provides: [ - { - route: 'getData', - request: { - streaming: false, - format: [ - { - messageName: 'Request', - messageargumentList: [ - { role: '', name: 'path', tag: '1', type: 'string' }, - ], - }, - ], - version: '', - }, - response: { format: [], version: '' }, - }, - { - route: 'mountVolume', - request: { - streaming: false, - format: [ - { - messageName: 'SharedFolderRequest', - messageargumentList: [ - { role: '', name: 'path', tag: '1', type: 'string' }, - ], - }, - ], - version: '', - }, - response: { format: [], version: '' }, - }, - ], - }, - parameters: [], - auxiliary: {}, - artifacts: [], - }; - resolve(response); - } catch (error) { - reject(error); - } - }); - } - - async getFetchJsonTOSCA(solutionId: string, version: string): Promise<any> { - // Retrieve the userId from the Observable - const userId = await firstValueFrom(this.userId$); - - // Handle the case where userId is undefined - if (!userId) { - throw new Error('User ID is undefined'); - } - - const url = this.urlBuildService.buildUrl( - apiConfig.urlDesignStudioTypeInfo, - { userId, solutionId, version }, - ); + const urlGetCloudEnabledUrl = apiConfig.apiBackendURL + '/api/cloudEnabled'; return firstValueFrom( - this._httpSharedService - .get(url) - .pipe(catchError((error) => throwError(error))), + this._httpSharedService.get(urlGetCloudEnabledUrl).pipe( + catchError((error) => { + throw error; + }), + ), ); } @@ -1428,46 +54,14 @@ export class DesignStudioService { }); } - async addNode(solutionId: string, version: string): Promise<any> { - // Retrieve the userId from the Observable - const userId = await firstValueFrom(this.userId$); - - // Handle the case where userId is undefined - if (!userId) { - throw new Error('User ID is undefined'); - } - - const url = this.urlBuildService.buildUrl( - apiConfig.urlDesignStudioAddNode, - { userId, solutionId, version }, - ); - - return firstValueFrom( - this._httpSharedService - .get(url) - .pipe(catchError((error) => throwError(error))), - ); - } - httpGet(url: string, params: any) { - console.log({ url }); - console.log({ params }); - return firstValueFrom( - this._httpSharedService - .get(apiConfig.apiBackendURL + '/' + url, params) - .pipe( - tap((result) => { - console.log({ result }); - }), - ), + this._httpSharedService.get(apiConfig.apiBackendURL + '/' + url, params), ); } - httpPost(url: string, body: any) { - console.log({ url }); - console.log({ body }); + httpPost(url: string, params: any, body: any) { const urlPost = apiConfig.apiBackendURL + '/' + url; - return firstValueFrom(this._httpSharedService.post(urlPost, body)); + return firstValueFrom(this._httpSharedService.post(urlPost, params, body)); } } diff --git a/src/app/core/services/storage/browser-storage.service.ts b/src/app/core/services/storage/browser-storage.service.ts index 6adc6e01f7406f999ca60fadc68175b911fcb72b..1c793867996153732d302061909fcc547c976349 100644 --- a/src/app/core/services/storage/browser-storage.service.ts +++ b/src/app/core/services/storage/browser-storage.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { BehaviorSubject, Observable } from 'rxjs'; +import { BehaviorSubject, firstValueFrom, Observable } from 'rxjs'; import { UserDetails } from 'src/app/shared/models'; @Injectable({ @@ -21,10 +21,14 @@ export class BrowserStorageService { return userDetailString ? JSON.parse(userDetailString) : null; } - getUserDetails(): Observable<UserDetails | null> { + getUserDetailsObservable(): Observable<UserDetails | null> { return this.userDetailSource.asObservable(); } + getUserDetail() { + return firstValueFrom(this.userDetailSource.asObservable()); + } + setUserDetail(userDetail: UserDetails): void { const storage = sessionStorage.getItem('rm') ? sessionStorage diff --git a/src/app/features/dashboard/catalogs/catalogs.component.ts b/src/app/features/dashboard/catalogs/catalogs.component.ts index ac3d27d1cb8f8f45b67b76d89632cce6f363e99d..101cccc1b23649b40280106861dfb05a5a2355ef 100644 --- a/src/app/features/dashboard/catalogs/catalogs.component.ts +++ b/src/app/features/dashboard/catalogs/catalogs.component.ts @@ -69,7 +69,7 @@ export class CatalogsComponent implements OnInit { public dialog: MatDialog, ) { this.userId$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => details?.userId)); paginatorInt.itemsPerPageLabel = 'Showing'; } diff --git a/src/app/features/dashboard/design-studio/design-studio.component.ts b/src/app/features/dashboard/design-studio/design-studio.component.ts index 0b8409aaab2272c349d4191b00f5994ba852dd0e..c30f7f64cf429f6b42ae692d8d096974d298093b 100644 --- a/src/app/features/dashboard/design-studio/design-studio.component.ts +++ b/src/app/features/dashboard/design-studio/design-studio.component.ts @@ -2,14 +2,16 @@ import { Component, OnInit } from '@angular/core'; import { UpgradeModule } from '@angular/upgrade/static'; import { downgradeInjectable } from '@angular/upgrade/static'; import { DesignStudioService } from 'src/app/core/services/design-studio.service'; +import { BrowserStorageService } from 'src/app/core/services/storage/browser-storage.service'; declare var angular: any; angular .module('designStudio') - .factory('ApiService', downgradeInjectable(DesignStudioService)); + .factory('ApiService', downgradeInjectable(DesignStudioService)) + .factory('browserStorageService', downgradeInjectable(BrowserStorageService)); @Component({ - selector: 'app-design-studio', + selector: 'gp-design-studio', templateUrl: './design-studio.component.html', styleUrl: './design-studio.component.scss', }) diff --git a/src/app/features/dashboard/my-models/my-models.component.ts b/src/app/features/dashboard/my-models/my-models.component.ts index d21bafe89241d3dc9bdf13420eb7f6d5508ce04b..5b513c72045eec83773b33175cdeaa4630bb7edb 100644 --- a/src/app/features/dashboard/my-models/my-models.component.ts +++ b/src/app/features/dashboard/my-models/my-models.component.ts @@ -112,7 +112,7 @@ export class MyModelsComponent implements OnInit { private browserStorageService: BrowserStorageService, ) { this.userId$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => details?.userId)); } @@ -255,9 +255,11 @@ export class MyModelsComponent implements OnInit { ngOnInit(): void { this.destroy$.add( - this.browserStorageService.getUserDetails().subscribe((details) => { - this.loginUserId = details?.userId ?? ''; - }), + this.browserStorageService + .getUserDetailsObservable() + .subscribe((details) => { + this.loginUserId = details?.userId ?? ''; + }), ); this.sortByFilter = environment.ui_system_config.marketplace_sort_by; this.loadPublicSolutions(); diff --git a/src/app/features/dashboard/navbar/navbar.component.ts b/src/app/features/dashboard/navbar/navbar.component.ts index 2edb3e40dc460eaf9ba89c7abcee0f24fd0e6e4c..9fd8399e9a0987fccf37ff08364ba9653848b089 100644 --- a/src/app/features/dashboard/navbar/navbar.component.ts +++ b/src/app/features/dashboard/navbar/navbar.component.ts @@ -34,7 +34,7 @@ export class NavbarComponent { private browserStorageService: BrowserStorageService, ) { this.firstName$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => details?.firstName)); } diff --git a/src/app/features/dashboard/on-boarding-model/on-boarding-model.component.ts b/src/app/features/dashboard/on-boarding-model/on-boarding-model.component.ts index 883e55c53de28ba7d14714be093e618b2bbd7e1d..fbc44de291913cc5934594dbcfc3cacb8308c23b 100644 --- a/src/app/features/dashboard/on-boarding-model/on-boarding-model.component.ts +++ b/src/app/features/dashboard/on-boarding-model/on-boarding-model.component.ts @@ -117,7 +117,7 @@ export class OnBoardingModelComponent implements OnInit { }); this.userId$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => details?.userId)); } ngOnInit(): void { @@ -140,9 +140,11 @@ export class OnBoardingModelComponent implements OnInit { }); this.subscription.add( - this.browserStorageService.getUserDetails().subscribe((details) => { - this.userId = details?.userId ?? ''; - }), + this.browserStorageService + .getUserDetailsObservable() + .subscribe((details) => { + this.userId = details?.userId ?? ''; + }), ); } diff --git a/src/app/features/login/local-login/local-login.component.ts b/src/app/features/login/local-login/local-login.component.ts index 866f1d410f50bae176860c2d541c98eca2229d6c..c8894c7be5421e41cea2a969c6b843fec6cced48 100644 --- a/src/app/features/login/local-login/local-login.component.ts +++ b/src/app/features/login/local-login/local-login.component.ts @@ -115,7 +115,12 @@ export class LocalLoginComponent implements OnInit, OnDestroy { emailId: userDetails?.emailId || '', lastName: userDetails?.lastName || '', }); - sessionStorage.setItem('rm', remember ? 'true' : 'false'); + this.browserStorageService + .getUserDetailsObservable() + .subscribe((details) => { + console.log({ details }); + }), + sessionStorage.setItem('rm', remember ? 'true' : 'false'); this.router.navigate(['/dashboard/home']); if (this.dialogRef) this.dialogRef.close(); }, diff --git a/src/app/features/marketplace/marketplace.component.ts b/src/app/features/marketplace/marketplace.component.ts index 625914df6e4068ed7768e53084eae1c5788aa605..de4ed50055cbded616615607ae2f634b2b1c0580 100644 --- a/src/app/features/marketplace/marketplace.component.ts +++ b/src/app/features/marketplace/marketplace.component.ts @@ -105,7 +105,7 @@ export class MarketplaceComponent { private browserStorageService: BrowserStorageService, ) { this.userId$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => details?.userId)); } @@ -189,9 +189,11 @@ export class MarketplaceComponent { ngOnInit(): void { this.destroy$.add( - this.browserStorageService.getUserDetails().subscribe((details) => { - this.loginUserId = details?.userId ?? ''; - }), + this.browserStorageService + .getUserDetailsObservable() + .subscribe((details) => { + this.loginUserId = details?.userId ?? ''; + }), ); this.sortByFilter = environment.ui_system_config.marketplace_sort_by; this.loadPublicSolutions(); diff --git a/src/app/features/model-details/model-details.component.ts b/src/app/features/model-details/model-details.component.ts index b754df78b03ca8ddc5edb7cd8c00ba7e26bcbaf1..5daad7b1a6f18ef0c05b987b7ec278f7570743d8 100644 --- a/src/app/features/model-details/model-details.component.ts +++ b/src/app/features/model-details/model-details.component.ts @@ -121,7 +121,7 @@ export class ModelDetailsComponent implements OnInit { }[]; userId$: Observable<string | undefined> = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => details?.userId)); isLoggedIn$: Observable<boolean>; userId!: string; @@ -159,7 +159,7 @@ export class ModelDetailsComponent implements OnInit { private jwtTokenService: JwtTokenService, ) { this.isLoggedIn$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => !!details?.userId)); this.data$ = this.activatedRoute.params.pipe( @@ -250,7 +250,7 @@ export class ModelDetailsComponent implements OnInit { } ngOnInit() { - this.browserStorageService.getUserDetails().subscribe((res) => { + this.browserStorageService.getUserDetailsObservable().subscribe((res) => { this.firstName = res?.firstName ?? ''; this.lastName = res?.lastName ?? ''; }); diff --git a/src/app/routes.ts b/src/app/routes.ts index a395fbb9a43686702832ae83267ad0a6a11bb194..143088b58b7a84a9efcd40c3cbe817fe14bd539d 100644 --- a/src/app/routes.ts +++ b/src/app/routes.ts @@ -113,8 +113,18 @@ const routeConfig: Routes = [ }, { path: 'catalogs', component: CatalogsComponent }, { path: 'myModels', component: MyModelsComponent }, - { path: 'onBoardingModel', component: OnBoardingModelComponent }, - { path: 'designStudio', component: DesignStudioComponent }, + { + path: 'onBoardingModel', + component: OnBoardingModelComponent, + }, + { + path: 'designStudio', + component: DesignStudioComponent, + loadChildren: () => + import( + './features/dashboard/design-studio/design-studio.module' + ).then((m) => m.DesignStudioModule), + }, { path: 'siteAdmin', component: SiteAdminComponent }, { path: 'manageLicense', component: ManageLicenseComponent }, { path: 'publishRequest', component: PublishRequestComponent }, @@ -144,6 +154,7 @@ const routeConfig: Routes = [ }, { path: 'designStudio', + canActivate: [authGuard], loadChildren: () => import('./features/dashboard/design-studio/design-studio.module').then( (m) => m.DesignStudioModule, diff --git a/src/app/shared/common/shared-item-base/shared-item-base.component.ts b/src/app/shared/common/shared-item-base/shared-item-base.component.ts index c41c13517c6af11d99f6f90777874fd4016098af..c6c08097f181787cd1a2616cce0e1dfbd75a98ea 100644 --- a/src/app/shared/common/shared-item-base/shared-item-base.component.ts +++ b/src/app/shared/common/shared-item-base/shared-item-base.component.ts @@ -48,10 +48,12 @@ export abstract class SharedItemBaseComponent { ngOnInit(): void { this.destroy$.add( - this.browserStorageService.getUserDetails().subscribe((details) => { - this.userId = details?.userId ?? ''; - this.initAfterUserId(); - }), + this.browserStorageService + .getUserDetailsObservable() + .subscribe((details) => { + this.userId = details?.userId ?? ''; + this.initAfterUserId(); + }), ); } diff --git a/src/app/shared/components/create-edit-license-profile/create-edit-license-profile.component.ts b/src/app/shared/components/create-edit-license-profile/create-edit-license-profile.component.ts index 646bf06ceadd658bbb55fdc7b65b4b48870a96ba..801b9a454340deab5bdd5fb6d0454e238bdf2e8e 100644 --- a/src/app/shared/components/create-edit-license-profile/create-edit-license-profile.component.ts +++ b/src/app/shared/components/create-edit-license-profile/create-edit-license-profile.component.ts @@ -74,7 +74,7 @@ export class CreateEditLicenseProfileComponent implements OnInit { private browserStorageService: BrowserStorageService, ) { this.userId$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => details?.userId)); } diff --git a/src/app/shared/components/home/home.component.ts b/src/app/shared/components/home/home.component.ts index bc5a48c3836d2018fa1ee3e5ed10044cc08fb72c..7ba15f6316ad8702fee27000e035f6b793d9bc06 100644 --- a/src/app/shared/components/home/home.component.ts +++ b/src/app/shared/components/home/home.component.ts @@ -36,7 +36,7 @@ export class HomeComponent { private browserStorageService: BrowserStorageService, ) { this.userId$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => details?.userId)); } diff --git a/src/app/shared/components/model-details-artifacts/model-details-artifacts.component.ts b/src/app/shared/components/model-details-artifacts/model-details-artifacts.component.ts index 4aa5ad16253a6c71648b61f47ad9f91866e4575d..614428c3d8fcf4cb61635def331c1edc7ac3847e 100644 --- a/src/app/shared/components/model-details-artifacts/model-details-artifacts.component.ts +++ b/src/app/shared/components/model-details-artifacts/model-details-artifacts.component.ts @@ -48,7 +48,7 @@ export class ModelDetailsArtifactsComponent implements OnInit { private jwtTokenService: JwtTokenService, ) { this.isUserIdAvailable$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => !!details?.userId)); } @@ -93,7 +93,7 @@ export class ModelDetailsArtifactsComponent implements OnInit { downloadArtifact(artifactId: string, artifactType: string): void { combineLatest([ - this.browserStorageService.getUserDetails(), + this.browserStorageService.getUserDetailsObservable(), this.jwtTokenService.getToken(), ]).subscribe({ next: ([userDetails, jwtToken]) => { diff --git a/src/app/shared/components/model-details-license-profile/model-details-license-profile.component.ts b/src/app/shared/components/model-details-license-profile/model-details-license-profile.component.ts index c142aca2412239e7505573cfded343ddcc36c031..c0a00ba83cc73531ebf7d31b3e7ccb3921c5ce8b 100644 --- a/src/app/shared/components/model-details-license-profile/model-details-license-profile.component.ts +++ b/src/app/shared/components/model-details-license-profile/model-details-license-profile.component.ts @@ -50,10 +50,10 @@ export class ModelDetailsLicenseProfileComponent implements OnInit { private cd: ChangeDetectorRef, ) { this.isUserIdAvailable$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => !!details?.userId)); this.userId$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => details?.userId)); } @@ -64,9 +64,11 @@ export class ModelDetailsLicenseProfileComponent implements OnInit { }), ); this.subscription.add( - this.browserStorageService.getUserDetails().subscribe((details) => { - this.userId = details?.userId ?? ''; - }), + this.browserStorageService + .getUserDetailsObservable() + .subscribe((details) => { + this.userId = details?.userId ?? ''; + }), ); this.activatedRoute.parent?.paramMap.subscribe((paramMap) => { this.solutionId = paramMap.get('solutionId') || ''; diff --git a/src/app/shared/components/publish-to-marketplace-page/publish-to-marketplace-page.component.ts b/src/app/shared/components/publish-to-marketplace-page/publish-to-marketplace-page.component.ts index 5d849781c2c6c2c9dc684a9463c63df87469850f..3b6eabdd05460771fe691bafbc560309895df9c7 100644 --- a/src/app/shared/components/publish-to-marketplace-page/publish-to-marketplace-page.component.ts +++ b/src/app/shared/components/publish-to-marketplace-page/publish-to-marketplace-page.component.ts @@ -342,9 +342,11 @@ export class PublishToMarketplacePageComponent implements OnInit { }); this.subscription.add( - this.browserStorageService.getUserDetails().subscribe((details) => { - this.userId = details?.userId ?? ''; - }), + this.browserStorageService + .getUserDetailsObservable() + .subscribe((details) => { + this.userId = details?.userId ?? ''; + }), ); this.publishToMarketPlaceForm.valueChanges .pipe(takeUntil(this.onDestroy)) diff --git a/src/app/shared/components/upload-license-profile/upload-license-profile.component.ts b/src/app/shared/components/upload-license-profile/upload-license-profile.component.ts index d24978b264a191123ad83eb79b4f4da1f3388476..464058154a75666055d8a97cb64ef4683ee4da0c 100644 --- a/src/app/shared/components/upload-license-profile/upload-license-profile.component.ts +++ b/src/app/shared/components/upload-license-profile/upload-license-profile.component.ts @@ -93,7 +93,7 @@ export class UploadLicenseProfileComponent implements OnInit, OnDestroy { public dialogRef: MatDialogRef<UploadLicenseProfileComponent>, ) { this.userId$ = this.browserStorageService - .getUserDetails() + .getUserDetailsObservable() .pipe(map((details) => details?.userId)); } ngOnDestroy(): void { diff --git a/src/legacy/design-studio.component.js b/src/legacy/design-studio.component.js index 73bb922254656e2634daf915f0e43db4a26424ba..e198f8089ce13af99015b072ba542c8e84e56c21 100644 --- a/src/legacy/design-studio.component.js +++ b/src/legacy/design-studio.component.js @@ -122,7 +122,11 @@ appDesignStudio.directive('droppable', function () { } }); - element[0].addEventListener('drop', scope.handleDrop, false); + element[0].addEventListener('drop', function (e) { + scope.$apply(function() { + scope.handleDrop(e); + }); + }, false); element[0].addEventListener('dragover', scope.handleDragOver, false); } @@ -132,7 +136,12 @@ appDesignStudio.directive('droppable', function () { return { restrict: 'A', link: function (scope, element, attrs) { - element[0].addEventListener('dragstart', scope.handleDragStart, false); + // Listen for drag start + element[0].addEventListener('dragstart', function (e) { + scope.$apply(function() { + scope.handleDragStart(e, scope.val); // Pass 'val' from ng-repeat + }); + }, false); element[0].addEventListener('dragend', scope.handleDragEnd, false); } } @@ -145,7 +154,7 @@ appDesignStudio.component( templateUrl : projectRoot + '/design-studio.template.html', controller : ACController } -).service('browserStorageService', function() { +)/*.service('browserStorageService', function() { this.setUserDetail = function(detail) { if (sessionStorage.getItem('rm')) { localStorage.setItem('userDetail', detail); @@ -274,19 +283,27 @@ appDesignStudio.component( this.removeFavCatStorage = function() { sessionStorage.removeItem('favCatStorage'); } -}) +})*/ ACController.$inject = ['$scope','$http','$q','$window','$rootScope','$mdDialog','$injector','browserStorageService', 'ApiService']; function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $injector, browserStorageService, ApiService) { - browserStorageService.setUserDetail(JSON.stringify(["Kawtar", "9b36ce33-ec9c-48e3-964f-5fd7e75ede6c", "klaariche"])); - + // browserStorageService.setUserDetail(JSON.stringify(["Kawtar", "9b36ce33-ec9c-48e3-964f-5fd7e75ede6c", "klaariche"])); + componentHandler.upgradeAllRegistered(); $scope.is_ie = false || !!document.documentMode; + browserStorageService.getUserDetail().then(function (userDetailsData) { + + $scope.userDetails = userDetailsData; + console.log("$scope.userDetails", $scope.userDetails) + }) + //$scope.userDetails = JSON.parse(browserStorageService.getUserDetail()); + //["Kawtar","9b36ce33-ec9c-48e3-964f-5fd7e75ede6c","klaariche"] + // console.log("$scope.userDetails JSON.parse(browserStorageService.getUserDetail()",$scope.userDetails) + - $scope.userDetails = JSON.parse(browserStorageService.getUserDetail()); if($scope.userDetails === null){ var modalService = $injector.get('$mdDialog'); modalService.show({ @@ -379,10 +396,20 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject opacity: 0.5 } }; + + + + browserStorageService.getUserDetail().then(function (userDetailsData) { - if (browserStorageService.getUserDetail()) { - $scope.auth = browserStorageService.getAuthToken(); - } + var userDetails = userDetailsData; + console.log("userDetailsData", userDetailsData) + //userDetails "[\"Kawtar\",\"9b36ce33-ec9c-48e3-964f-5fd7e75ede6c\",\"klaariche\"]" + if (userDetails) { + $scope.auth = browserStorageService.getAuthToken(); + } + }) + + $scope.getDeployMenu = () => { // console.log("getDeployMenu"); @@ -398,12 +425,23 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } } - $scope.handleDragStart = function(e){ + $scope.handleDragStart = function (e,n) { console.log('handleDragStart called!'); + console.log('handleDragStart called node', n); + console.log('handleDragStart called this',this); + console.log('handleDragStart called innerHTML', e.target.innerHTML); + $scope.solutionDetails = n; + console.log('Solution details during drag:', $scope.solutionDetails); + + // Assuming that you have a node ID or a way to access the node being. dragged + + + + e.target.style.opacity = '0.4'; - this.style.opacity = '0.4'; - e.dataTransfer.setData('text', this.innerHTML); + e.dataTransfer.setData('text', e.target.innerHTML); }; + $scope.handleDragEnd = function(e){ console.log('handleDragEnd called!'); @@ -411,20 +449,24 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject this.style.opacity = '1.0'; }; $scope.handleDragOver = function (e) { + console.log('handleDragOver called!'); - e.preventDefault(); // Necessary. Allows us to drop. e.dataTransfer.dropEffect = 'move'; // See the section return false; }; $scope.handleDrop = function(e){ console.log('handleDrop called!'); + console.log("handleDrop called! e",e) $scope.canvas = true; e.preventDefault(); var bound = _diagram.root().node().getBoundingClientRect(); var pos = _diagram.invertCoord([e.clientX - bound.left, - e.clientY - bound.top]); + e.clientY - bound.top]); + + var type = e.dataTransfer.getData('text'); + console.log("handleDrop called! type",type) var max = 0; var getrev; var revision; var revRemove; var res = type.split("("); @@ -493,17 +535,20 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject $scope.requireCalls= tgif.services.calls; $scope.capabilityProvides=tgif.services.provides; draggedNodes.set(data.nodeId, $scope.solutionDetails); + console.log("here is solutions Details are called", $scope.solutionDetails) var url= build_url(options.protobuf, { - userId: get_userId(), + userId: $rootScope.userId, solutionId : nodeId, version : nodeVersion }); // $http.get(url).success(function(proto){ ApiService.httpGet(url).then(function (proto) { + console.log("ProtoBuf JSON Success (Local):", proto); $scope.protoNode=proto; var protoJson=proto; jsonProtoNode.set($scope.solutionDetails.solutionName,protoJson); - }).catch(function(response){ + }).catch(function (response) { + console.log("protobuf response",response) document.getElementById("loading").style.display = "none"; $scope.titlemsg = ALERT; $scope.msg = "Cannot drop this item onto the canvas, Error details: Failed to fetch the ProtoBuf JSON for "+type+" ("+nodeVersion+")"; @@ -567,8 +612,8 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject var url = "", nodeDetails; var ndata = { fixed: true, - px: pos[0], - py: pos[1] + px: Math.floor(pos[0]), + py: Math.floor(pos[1]) }; switch($scope.solutionDetails.toolKit){ case 'CO': @@ -626,9 +671,9 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject data.modelName = type; if(_solutionId){ - console.log('A') + console.log('options.addNode if(_solutionId)') url = build_url(options.addNode, { - userId: get_userId(), + userId: $rootScope.userId, solutionId : _solutionId, version : nodeVersion @@ -648,12 +693,14 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } else if(_cid){ - console.log('B') + console.log('options.addNode else if(_cid)') url = build_url(options.addNode, { - userId: get_userId(), + userId: $rootScope.userId, cid: _cid }); + console.log("options.addNode else if(_cid) url", url) + console.log("options.addNode else if(_cid) url",url) nodeDetails = { 'name' : data.name, 'nodeId' : data.nodeId, @@ -678,9 +725,12 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject set_dirty(true); - document.getElementById("loading").style.display = "block"; - ApiService.httpPost(url,nodeDetails) - .then(function(response) { + document.getElementById("loading").style.display = "block"; + // ApiService.httpPost(options.addNode, {userId: get_userId(),cid: _cid},nodeDetails) + console.log("url drag drop", url) + ApiService.httpPost(url,undefined, nodeDetails) + .then(function (response) { + console.log("addNode", response) document.getElementById("loading").style.display = "none"; $scope.cleardis= false; nodeIdCnt++; @@ -690,7 +740,8 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject update_ports(); _drawGraphs.createNode(pos, data); set_dirty(true); - }).catch(function(response){ + }).catch(function (response) { + console.log("add node catch", response) document.getElementById("loading").style.display = "none"; $scope.titlemsg = ALERT; $scope.msg = "Please click on New to create a new Solution"; @@ -770,43 +821,48 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } - $scope.newSolution = function(parameter) { - if(_dirty && $scope.solutionName != null){$scope.CloseOrNew = 'new';$scope.showsaveConfirmationPopup(); } - else{ - maybe_save_solution().then(function(cat2) { - function new_solution(result) { - _cid = result.cid; - _solution = {nodes: [], edges: []}; - $scope.solutionName = null; - $scope.solutionDescription = null; - $scope.solutionVersion = null; - - reset(); - if (parameter == 'new'){ - $scope.titlemsg ="New Solution"; - $scope.msg = "Create a new Composite Solution"; - $scope.showok = true; - $scope.showpopup(); - } - - display_solution(_solution); - load_catalog(); - _solutionId = ''; + $scope.newSolution = function (parameter) { + console.log("newSolution function parameter", parameter); + if (_dirty && $scope.solutionName != null) { + $scope.CloseOrNew = 'new'; + $scope.showsaveConfirmationPopup(); + } else { + maybe_save_solution().then(function (cat2) { + function new_solution(result) { + _cid = result.cid; + _solution = { nodes: [], edges: [] }; + $scope.solutionName = null; + $scope.solutionDescription = null; + $scope.solutionVersion = null; + + reset(); + if (parameter == 'new') { + $scope.titlemsg = "New Solution"; + $scope.msg = "Create a new Composite Solution"; + $scope.showok = true; + $scope.showpopup(); } - var userId = get_userId(), - url = build_url(options.create, {userId: userId}); - $(".ds-grid-bg").css("background", "url('../images/grid.png')"); - $scope.closeDisabledCheck = !$scope.closeDisabledCheck; - countComSol += 1; - $scope.namedisabled = false; - changeNode = new Object(); - $scope.canvas=false; - ApiService.httpPost(url) - .then(new_solution); - // ApiService.createNewCompositeSolution().then(new_solution); - - });} - }; + console.log("here display_solution is called inside new solution", _solution); + display_solution(_solution); + load_catalog(); + _solutionId = ''; + } + + const userId = $rootScope.userId; // Use $rootScope.userId + if (!userId) { + console.error("User ID is not set."); + return; + } + + const url = build_url(options.create, { userId: userId }); + + console.log("New Solution URL:", url); + ApiService.httpPost(url).then(new_solution); + }); + } +}; + + $scope.loadSolution = function(entry) { $scope.solDet = entry; $scope.loadSol = true; @@ -814,10 +870,11 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject else{ if(entry.toolKit === 'CP' || entry.toolKit === 'DS') { var url = build_url(options.read, { - userId:get_userId(), + userId:$rootScope.userId, solutionId: entry.solutionId, version: entry.version - }); + }); + $scope.selectedIndex = entry.solutionName+entry.version; var changeNode = new Object(); ApiService.httpGet(url) @@ -860,7 +917,8 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject n.fixedPos = {x: +n.ndata.px, y: +n.ndata.py}; }); $(".ds-grid-bg").css("background", "url('../images/grid.png')"); - $scope.closeDisabled = false; + $scope.closeDisabled = false; + console.log("here display_solution is called inside loadSolution") display_solution(_solution); } }).catch(function(result){ @@ -889,8 +947,10 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject return; } $scope.storesolutionName = $scope.solutionName; + console.log("saveSolution $scope.solutionName",$scope.solutionName) save_solution($scope.solutionName) - .then(function() { + .then(function () { + console.log("successfully saved") $scope.namedisabled = true; load_catalog(); _dirty = false; @@ -901,7 +961,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject $scope.deleteSolution = function(val) { var url =''; url = build_url(options.deleteCompositeSolution, { - userid:get_userId(), + userid:$rootScope.userId, solutionid :val.solutionId, // solutionid : version : val.version, // version : }); @@ -1032,13 +1092,13 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject fModelUrl: function(model) { if(this.fModelToolKit(model) === 'DS') { return build_url(options.read, { - userId:get_userId(), + userId:$rootScope.userId, solutionId: this.fModelId(model), version: this.fModelVersion(model) }); } else { return build_url(options.typeinfo, { - userId:get_userId(), + userId:$rootScope.userId, solutionId: this.fModelId(model), version: this.fModelVersion(model) }); @@ -1106,38 +1166,12 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject if(element) element.focus(); } - - function get_userId() { - var userDetail = browserStorageService.getUserDetail(); - console.log("userDetails", userDetail); - if(!userDetail){ - var modalService = $injector.get('$mdDialog'); - modalService.show({ - templateUrl: '../app/header/sign-in-promt-modal-box.html', - clickOutsideToClose: true, - controller : function DialogController($scope ) { - $scope.closeDialog = function() { - modalService.hide(); - $rootScope.showAdvancedLogin(); - //$state.go('home'); - } } - }); - } - if(typeof userDetail === 'string'){ - userDetail = JSON.parse(userDetail); - console.log("userDetail parsed ",userDetail); - return userDetail["userId"]; - }} function get_catalog() { - var userId = get_userId(); + var userId = $rootScope.userId; return ApiService.httpGet(build_url(options.catalog, {userId: userId})); - } - /* function get_catalog() { - return ApiService.getCatalog() - } */ - + } // canvas var _diagram, _rendered = false, _drawGraphs, _solution, _ports = []; @@ -1186,6 +1220,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } function display_solution(solution) { + console.log("display solution starts", solution) $('#deleteHide').hide(); $scope.console = null; $('#validateActive').removeClass('active'); @@ -1202,7 +1237,11 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject _ports = []; /*$scope.readSolutionArray = true;*/ var i=0; - nodes.forEach(function(n) { + nodes.forEach(function (n) { + + console.log("Display solution functio inside forEach") + console.log("Display solution functio inside forEach", n) + script = []; var lastChar = n.nodeId.slice(-1); var res = n.nodeId.split(lastChar); @@ -1211,10 +1250,12 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } _ports = _ports.concat(_catalog.ports(n.nodeId, n.type.name,n.requirements, n.capabilities, script)); var url= build_url(options.protobuf, { - userId: get_userId(), + userId: $rootScope.userId, solutionId : n.nodeSolutionId, version : n.nodeVersion }); + console.log("display solution url proto"); + console.log("display solution url proto", url) ApiService.httpGet(url).then(function(proto){ protoJsonRead.set(res[0],proto); }); @@ -1223,7 +1264,12 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject }); */ var type = res[0]; - $scope.solutionDetails=_components.get(type+'+'+n.nodeVersion); + console.log("Display solution function _components", _components); + + $scope.solutionDetails = _components.get(type + '+' + n.nodeVersion); + + console.log("Display solution function $scope.solutionDetails") + console.log("Display solution function $scope.solutionDetails", $scope.solutionDetails) draggedNodes.set(n.nodeId, $scope.solutionDetails); }); @@ -1382,7 +1428,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject }); }); - + console.log("end display solution $scope.solutionDetails",$scope.solutionDetails) } // @@ -1396,7 +1442,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject _solution.nodes = _drawGraphs.nodeCrossfilter().all(); _solution.edges = _drawGraphs.edgeCrossfilter().all(); - var userId = get_userId(); + var userId = $rootScope.userId; if(!userId) throw new Error('not logged in!'); @@ -1409,19 +1455,25 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject description: $scope.solutionDescription, ignoreLesserVersionConflictFlag: false }; + if(_solutionId) args.solutionId = _solutionId; else if(_cid) args.cid = _cid; if(updateOldSol){args.ignoreLesserVersionConflictFlag = true} - var url = build_url(options.save, args); - return ApiService.httpPost(url).then(function(result) { + var url = build_url(options.save, args); + console.log("save_solution options.args",args) + console.log("save_solution options.save",options.save) + console.log("save_solution url",url) + return ApiService.httpPost(url).then(function (result) { + console.log("save_solution ", result); // result.duplicate = 'duplicate'; if(result.errorCode){ $scope.titlemsg = ALERT; $scope.msg= "Solution not saved "; $scope.showpopup(); - enteredOk = true; + enteredOk = true; + } else if(result.duplicate){ $scope.titlemsg = ALERT; @@ -1456,7 +1508,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject $scope.validateCompSolu = function(){ var args = { - userId: get_userId(), + userId: $rootScope.userId, solutionName: $scope.solutionName, solutionId: _solutionId, version:$scope.solutionVersion @@ -1763,14 +1815,14 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject if(_solutionId){ params = { - userid: get_userId(), + userid: $rootScope.userId, solutionid: _solutionId, version: $scope.solutionVersion, nodeid: lport.nodeId }; } else if(_cid){ params = { - userid: get_userId(), + userid: $rootScope.userId, cid: _cid, nodeid: lport.nodeId }; @@ -1836,8 +1888,11 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject mapper.render(); } - $scope.getProperties=function(solutionHover,clickVersion,clickRevision){ - + $scope.getProperties = function (solution, solutionHover, clickVersion, clickRevision) { + console.log("getProperties getProperties getProperties getProperties getProperties getProperties getProperties getProperties"); + console.log("getProperties solution", solution); + console.log("getProperties solutionHover", solutionHover); + var compsHover = _catalog.models().filter(function(comp) { return _catalog.fModelName(comp) === solutionHover; }); @@ -1848,7 +1903,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject $scope.showSplitter = null; $scope.showProperties=null; $scope.showLink=null; - compsHover.forEach(function(n){ + compsHover.forEach(function (n) { if(n.solutionName === solutionHover && n.version === clickVersion && n.solutionRevisionId === clickRevision) $scope.solutionDetails=n; }); @@ -1858,7 +1913,8 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject if(compsHover.length === 1) display_properties(_catalog.fModelUrl(compsHover[0])); } else - $scope.packageName=null; + $scope.packageName = null; + }; var _ionicons = { @@ -2039,7 +2095,8 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject update_ports: update_ports }); - function initialize_canvas() { + function initialize_canvas() { + console.log("initialize canvas") _diagram = dc_graph.diagram('#canvas'); _diagram // use width and height of parent, <section // droppable=true> @@ -2523,7 +2580,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } if(_solutionId){ params = { - userId:get_userId(), + userId:$rootScope.userId, version : $scope.solutionVersion, solutionId: _solutionId, @@ -2538,7 +2595,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } else if(_cid){ params = { - userId:get_userId(), + userId:$rootScope.userId, cid: _cid, linkId: e.linkId, @@ -2642,14 +2699,14 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject var url = ''; if(_solutionId){ url = build_url(options.modifyLink, { - userid: get_userId(), + userid: $rootScope.userId, solutionid:_solutionId, linkid: edgeId, linkname:text, }); } else { url = build_url(options.modifyLink, { - userid: get_userId(), + userid: $rootScope.userId, cid:_cid, linkid: edgeId, linkname:text, @@ -2679,10 +2736,15 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject select_nodes_group.on('set_changed.show-info', function(nodes) { $scope.showProperties = false; if(nodes.length == 0){$('#deleteHide').hide();deleteShow = 0}else {$('#deleteHide').show();deleteShow = 1;}; - setTimeout(function() { + setTimeout(function () { + console.log("setTimeout") if(nodes.length>1) + { + console.log("setTimeout nodes.length>1") throw new Error('not expecting multiple select'); - else if(nodes.length === 1) { + } + else if (nodes.length === 1) { + console.log("setTimeout nodes.length === 1") select_edges_group.set_changed([], false); select_ports_group.set_changed([], true); @@ -2693,6 +2755,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject var comps = draggedNodes.get(selectedNodeId); $scope.solutionDetails = draggedNodes.get(selectedNodeId); + console.log("Initialize canvas $scope.solutionDetails",$scope.solutionDetails) if(Object.keys(changeNode).length !== 0 && changeNode[nodes[0]]){ $scope.nodeNameUI = changeNode[nodes[0]]; @@ -2877,7 +2940,8 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject else {$('#deleteHide').show();} }); - select_ports_group.on('set_changed.show-info', function(ports) { + select_ports_group.on('set_changed.show-info', function (ports) { + console.log("inside select_ports_group where is select_nodes_group set to empty") var portType, port_info; if(ports.length>0) { $scope.nodeIdDB = ports[0].node; @@ -2909,7 +2973,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject port_info = nodetype.replaceAll('[[', '[').replaceAll(']]', ']'); } else port_info = null; var url = build_url(options.getMatchingModels, { - userid: get_userId(), + userid: $rootScope.userId, solutionid: $scope.nodeSolutionDetails.solutionId, version : $scope.nodeSolutionDetails.version, portType: portType, @@ -2978,7 +3042,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject var url = ''; if(_solutionId){ url = build_url(options.deleteNode, { - userId: get_userId(), + userId: $rootScope.userId, solutionId : _solutionId, nodeId: nodes[0], version : $scope.solutionVersion @@ -2986,7 +3050,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } else{ url = build_url(options.deleteNode, { - userId: get_userId(), + userId: $rootScope.userId, cid : _cid, nodeId: nodes[0], }); @@ -3086,7 +3150,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject var url = ''; if(_solutionId){ url = build_url(options.deleteLink, { - userId: get_userId(), + userId: $rootScope.userId, solutionId : _solutionId, linkId: edges[0], version : $scope.solutionVersion @@ -3094,7 +3158,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } else{ url = build_url(options.deleteLink, { - userId: get_userId(), + userId: $rootScope.userId, cid : _cid, linkId: edges[0] }); @@ -3433,7 +3497,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject gropts.tipsDisable = [port_tips, node_tips]; gropts.negativeTip = negative_tips; gropts.positiveTip = positive_tips; - + console.log("inside initialize canvas scope solutionDetails",$scope.solutionDetails) function modify_node(nodeId, name, pos) { var ndata = {}; @@ -3447,7 +3511,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject var url; if(_solutionId){ url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, solutionid:_solutionId, nodeid: nodeId, nodename: name, @@ -3456,7 +3520,7 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject }); } else { url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, cid:_cid, nodeid: nodeId, nodename: name, @@ -3518,187 +3582,89 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject }; $scope.enableDeployToCloud(); - document.getElementById("loading").style.display = "block"; - function load_catalog() { - - // return get_catalog() - // .success(function(data) { - // document.getElementById("loading").style.display = "none"; - // angular.forEach(data.items, function(value, key) { - // if(data.items.solutionName != "Text_Class_09102017_IST2"){ - - // } - // data.items[key].description = $(data.items[key].description).text(); - // }); - // _catalog = catalog_readers[options.catformat](data); - - // _components = d3.map(_catalog.models(), _catalog.fModelKey); - - // // PALETTE - // // throw out any models which don't have a category, - // // to avoid "null drawer" - // // also throw out composite solutions, for now - - // // we're unable to load them - // // (maybe we could display them but it would be a - // // little misleading) - // // also throw out iris, because, well, it's iris - // models = _catalog.models().filter(function(model) { - // return _catalog.fModelCategory(model) && - // _catalog.fModelName(model) !== 'iris'; - // }); - - // $scope.palette.categories = d3.nest().key(_catalog.fModelCategory) - // .sortKeys(d3.ascending) - // .entries(models); - // $http({ - // method : 'GET', - // url : '/api/filter/modeltype' - // }).success(function(data, status, headers, config) { - // $scope.categoryNames = data.response_body; - // }).error(function(data, status, headers, config) { - // // called asynchronously if an error occurs - // // or server returns response with an error - // // status. - // $scope.categoryNames = []; - // }); - - // $http({ - // method : 'GET', - // url : '/api/filter/toolkitType' - // }).success(function(data, status, headers, config) { - // $scope.toolKitTypes = data.response_body; - // }).error(function(data, status, headers, config) { - // // called asynchronously if an error occurs - // // or server returns response with an error - // // status. - // $scope.toolKitTypes = []; - // }); - - // $http({ - // method : 'GET', - // url : '/api/filter/accesstype' - // }).success(function(data, status, headers, config) { - // $scope.accessTypes = data.response_body; - // }).error(function(data, status, headers, config) { - // // called asynchronously if an error occurs - // // or server returns response with an error - // // status. - // $scope.accessTypes = []; - // }); - // $scope.initIndexLeft=false; - // $scope.showOther = true; - // $scope.setActionLeft = function(index){ - // if(index==$scope.selectedIndexLeft){ - // $scope.selectedIndexLeft=-1; - // } else{ - // $scope.selectedIndexLeft=index; - // $scope.initIndexLeft=true; - // $scope.showOther = false; - - // } - - // }; - // }).error(function(response){ - // document.getElementById("loading").style.display = "none"; - // $scope.titlemsg = ALERT; - // $scope.msg = response.message; - // $scope.showpopup(); - // $scope.palette.categories=[]; - - // }); - - return get_catalog() - .then(function(data) { + document.getElementById("loading").style.display = "block"; + + + function load_catalog() { + const userId = $rootScope.userId; // Use $rootScope.userId + if (!userId) { + console.error("User ID is not set."); + return Promise.reject("User ID is not set"); + } + + const url = build_url(options.catalog, { userId: userId }); + + return ApiService.httpGet(url) + .then(function (data) { + console.log("loadSolution validationState", $scope.validationState); document.getElementById("loading").style.display = "none"; - angular.forEach(data.items, function(value, key) { - if(data.items.solutionName != "Text_Class_09102017_IST2"){ + angular.forEach(data.items, function (value, key) { + if (data.items.solutionName != "Text_Class_09102017_IST2") { + // ... } data.items[key].description = $(data.items[key].description).text(); }); + _catalog = catalog_readers[options.catformat](data); - _components = d3.map(_catalog.models(), _catalog.fModelKey); - - // PALETTE - // throw out any models which don't have a category, - // to avoid "null drawer" - // also throw out composite solutions, for now - - // we're unable to load them - // (maybe we could display them but it would be a - // little misleading) - // also throw out iris, because, well, it's iris - models = _catalog.models().filter(function(model) { + + console.log("get_catalog function _components", _components); + + models = _catalog.models().filter(function (model) { return _catalog.fModelCategory(model) && _catalog.fModelName(model) !== 'iris'; }); - + $scope.palette.categories = d3.nest().key(_catalog.fModelCategory) .sortKeys(d3.ascending) .entries(models); - ApiService.getModeltype().then(function(data, status, headers, config) { - $scope.categoryNames = data.response_body; - }).catch(function(data, status, headers, config) { - // called asynchronously if an error occurs - // or server returns response with an error - // status. - $scope.categoryNames = []; - }); - - ApiService.getToolkitType().then(function(data, status, headers, config) { - $scope.toolKitTypes = data.response_body; - }).catch(function(data, status, headers, config) { - // called asynchronously if an error occurs - // or server returns response with an error - // status. - $scope.toolKitTypes = []; - }); - - ApiService.getAccessType().then(function(data, status, headers, config) { - $scope.accessTypes = data.response_body; - }).catch(function(data, status, headers, config) { - // called asynchronously if an error occurs - // or server returns response with an error - // status. - $scope.accessTypes = []; - }); - $scope.initIndexLeft=false; - $scope.showOther = true; - $scope.setActionLeft = function(index){ - if(index==$scope.selectedIndexLeft){ - $scope.selectedIndexLeft=-1; - } else{ - $scope.selectedIndexLeft=index; - $scope.initIndexLeft=true; - $scope.showOther = false; - - } - - }; - }).catch(function(response){ + // Additional API calls + return Promise.all([ + ApiService.httpGet('/api/filter/modeltype').then(data => { + $scope.categoryNames = data.response_body; + }).catch(() => { + $scope.categoryNames = []; + }), + ApiService.httpGet('/api/filter/toolkitType').then(data => { + $scope.toolKitTypes = data.response_body; + }).catch(() => { + $scope.toolKitTypes = []; + }), + ApiService.httpGet('/api/filter/accesstype').then(data => { + $scope.accessTypes = data.response_body; + }).catch(() => { + $scope.accessTypes = []; + }) + ]); + }) + .catch(function (response) { document.getElementById("loading").style.display = "none"; $scope.titlemsg = ALERT; $scope.msg = response.message; $scope.showpopup(); - $scope.palette.categories=[]; - + $scope.palette.categories = []; }); - } +} + function load_initial_solution() { + console.log("load_initial_solution load_initial_solution") var catsol; if(options.solutionId) catsol = _catalog.models().find(function(sol){return sol.solutionId === options.solutionId}); else if(options.solutionName) catsol = _catalog.models().find(function(sol){return sol.solutionName === options.solutionName}); - if(catsol) - $scope.loadSolution(catsol); + if (catsol) { + console.log("load_initial_solution catsol catsol") + $scope.loadSolution(catsol);} } initialize_canvas(); load_catalog().then(load_initial_solution); $scope.newSolution('old'); + console.log("solution after $scope.newSolution('old')",_solution) // Function for closing composite solution $scope.closeComSol = function(){ @@ -3707,14 +3673,14 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject var url = ""; if(_solutionId){ url = build_url(options.closeCompositeSolution , { - userId: get_userId(), + userId: $rootScope.userId, solutionId : _solutionId, solutionVersion : $scope.solutionVersion }); } else if(_cid){ url = build_url(options.closeCompositeSolution , { - userId: get_userId(), + userId: $rootScope.userId, cid: _cid, }); } @@ -3765,14 +3731,14 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject var url = ""; if(_solutionId){ url = build_url(options.clearCompositeSolution , { - userId: get_userId(), + userId: $rootScope.userId, solutionId : _solutionId, solutionVersion : $scope.solutionVersion }); } else if(_cid){ url = build_url(options.clearCompositeSolution , { - userId: get_userId(), + userId: $rootScope.userId, cid: _cid, }); } @@ -3971,62 +3937,54 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject updateOldSol=true; save_solution(solutionNameSave); }; - function solutionPrPB(){ - var tempArr = 'PB', url = ''; - $scope.publicCS = []; - $scope.privateCS = []; - url = build_url(options.getCompositeSolutions, { - userId: get_userId(), - visibilityLevel : tempArr - }); - ApiService.httpGet(url) - .then(function(data) { - angular.forEach(data.items, function(value,key){ - if(value.visibilityLevel === 'PB'){ - $scope.publicCS.push(value); - } else if(value.visibilityLevel === 'PR'){ - $scope.privateCS.push(value); - } - }); - }) - .catch(function(response){ - $scope.publicCS = []; - $scope.privateCS = []; - }); - } - /* function solutionPrPB(){ - var tempArr = 'PB', url = ''; - $scope.publicCS = []; - $scope.privateCS = []; - - ApiService.getCompositeSolutions() - .then(function(data) { - angular.forEach(data.items, function(value,key){ - if(value.visibilityLevel === 'PB'){ - $scope.publicCS.push(value); - } else if(value.visibilityLevel === 'PR'){ - $scope.privateCS.push(value); - } - }); - }) - .catch(function(response){ - $scope.publicCS = []; - $scope.privateCS = []; + + + function solutionPrPB() { + var tempArr = 'PB', url = ''; + $scope.publicCS = []; + $scope.privateCS = []; + + const userId = $rootScope.userId; // Use $rootScope.userId + if (!userId) { + console.error("User ID is not set."); + return; + } + + url = build_url(options.getCompositeSolutions, { + userId: userId, + visibilityLevel: tempArr + }); + + ApiService.httpGet(url) + .then(function (data) { + angular.forEach(data.items, function (value, key) { + if (value.visibilityLevel === 'PB') { + $scope.publicCS.push(value); + } else if (value.visibilityLevel === 'PR') { + $scope.privateCS.push(value); + } }); - } */ - solutionPrPB(); + }) + .catch(function (response) { + $scope.publicCS = []; + $scope.privateCS = []; + }); +} + + +solutionPrPB(); $scope.setProbe = function(setProbeStatus){ if(_solutionId){ var args = { - userId: get_userId(), + userId: $rootScope.userId, solutionId: _solutionId, version: $scope.solutionVersion, probeIndicator: setProbeStatus }; } else if(_cid){ var args = { - userId: get_userId(), + userId: $rootScope.userId, cid: _cid, version: '1', probeIndicator: setProbeStatus @@ -4292,14 +4250,14 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } if(_solutionId){ url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, solutionid:_solutionId, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI }); } else { url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, cid:_cid, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI @@ -4592,14 +4550,14 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } if(_solutionId){ url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, solutionid:_solutionId, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI }); } else { url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, cid:_cid, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI @@ -4847,14 +4805,14 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } if(_solutionId){ url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, solutionid:_solutionId, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI }); } else { url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, cid:_cid, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI @@ -4906,14 +4864,14 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } if(_solutionId){ url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, solutionid:_solutionId, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI }); } else { url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, cid:_cid, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI @@ -5336,13 +5294,13 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } if(_solutionId){ url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, solutionid:_solutionId, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI }); } else { url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, cid:_cid, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI }); @@ -5407,13 +5365,13 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject } if(_solutionId){ url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, solutionid:_solutionId, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI }); } else { url = build_url(options.modifyNode, { - userid: get_userId(), + userid: $rootScope.userId, cid:_cid, nodeid: $scope.nodeIdDB, nodename: $scope.nodeNameUI }); @@ -5449,5 +5407,93 @@ function ACController($scope, $http, $q, $window, $rootScope, $mdDialog, $inject $scope.dsceVersion = response; }); */ + } + + function setSolutionDetails(nodes) { + if(nodes.length === 1) { + var selectedNodeId = _diagram.getNode(nodes[0]).key; + $scope.nodeIdDB = selectedNodeId; + + // Extracting node ID logic + var n = selectedNodeId.length; + var type = selectedNodeId.substring(0, n-1); + var comps = draggedNodes.get(selectedNodeId); + + // Setting solutionDetails + $scope.solutionDetails = draggedNodes.get(selectedNodeId); + console.log("Setting solutionDetails", $scope.solutionDetails); + + // Handle node name + if(Object.keys(changeNode).length !== 0 && changeNode[nodes[0]]){ + $scope.nodeNameUI = changeNode[nodes[0]]; + } else { + $scope.nodeNameUI = nodes[0]; + } + + // Handle toolkit-specific logic (as an example) + if ($scope.solutionDetails.toolKit === 'BR') { + $scope.showDataMapper = null; + $scope.solutionDetails = null; + $scope.showCollator = null; + $scope.showSplitter = null; + $scope.showDataBroker = true; + if($scope.readSolutionArray[$scope.nodeIdDB]) + $scope.readSolution = $scope.readSolutionArray[$scope.nodeIdDB]; + $scope.$apply(); + } + } + } + + +function initializeUserId() { + return browserStorageService.getUserDetail() + .then(function (userDetailsData) { + if (!userDetailsData) { + console.error("User details are not available."); + var modalService = $injector.get('$mdDialog'); + modalService.show({ + templateUrl: '../app/header/sign-in-promt-modal-box.html', + clickOutsideToClose: true, + controller: function DialogController($scope) { + $scope.closeDialog = function () { + modalService.hide(); + $rootScope.showAdvancedLogin(); + }; + } + }); + return Promise.reject("User details are not available"); + } + + console.log("initializeUserId userDetails", userDetailsData); + const userId = userDetailsData["userId"]; + if (!userId) { + console.error("User ID is missing in userDetails."); + return Promise.reject("User ID is missing in userDetails"); + } + + $rootScope.userId = userId; // Set globally in $rootScope + console.log("User ID initialized:", $rootScope.userId); + return userId; + }) + .catch(function (error) { + console.error("Error initializing user ID:", error); + throw error; + }); } + + + initializeUserId() + .then(function () { + console.log("User ID initialized:", $rootScope.userId); + + // Call functions that require userId + load_catalog().then(load_initial_solution); + solutionPrPB(); + $scope.newSolution('old'); + }) + .catch(function (error) { + console.error("Error during initialization:", error); + }); + + } diff --git a/src/legacy/design-studio.module.js b/src/legacy/design-studio.module.js index 8f40b05043161cbd818a083f12e0ece42ebcdde8..db8af501f6f38bbd8ac79f58816ae499e61008e3 100644 --- a/src/legacy/design-studio.module.js +++ b/src/legacy/design-studio.module.js @@ -18,8 +18,8 @@ limitations under the License. ===============LICENSE_END========================================================= */ -// 'use strict'; -// angular.module('designStudio',[]).config( -// function() { -// console.log("designStudio"); -// }); \ No newline at end of file + 'use strict'; + angular.module('designStudio',['ngRoute']).config( + function() { + console.log("designStudio"); + }); \ No newline at end of file diff --git a/src/legacy/design-studio.template.html b/src/legacy/design-studio.template.html index 5757ddc5b73c07dfb4329844fd786188a4e89dc9..683a9ad580b24840dbc777790368d14312c318b8 100644 --- a/src/legacy/design-studio.template.html +++ b/src/legacy/design-studio.template.html @@ -161,7 +161,7 @@ limitations under the License. <div ng-repeat="cat in palette.categories"> <div ng-if='cat.key== "DT"' class="ds-treelist-childtree"> - <div class="fa fa-share-alt ds-list-icon2 ds-inner-link" ng-repeat = "val in cat.values | filter:filterDT | orderBy:'solutionName'" ng-class="{'ds-selected-model': val.solutionName+val.version+val.solutionRevisionId.substring(0,4) === selectedIndex}" ng-attr-draggable="{{val.toolKit !== 'CP'}}" ng-click="getProperties(val.solutionName,val.version,val.solutionRevisionId)">{{val.solutionName}} ({{val.version}}) <div ng-if="val.duplicateSolution === true" style="display: inline-block">[{{val.solutionRevisionId.substring(0,4)}}...]</div></div> + <div class="fa fa-share-alt ds-list-icon2 ds-inner-link" ng-repeat = "val in cat.values | filter:filterDT | orderBy:'solutionName'" ng-class="{'ds-selected-model': val.solutionName+val.version+val.solutionRevisionId.substring(0,4) === selectedIndex}" ng-attr-draggable="{{val.toolKit !== 'CP'}}" ng-dragstart="handleDragStart($event, val)" role="button" tabindex="0" draggable="true" ng-click="getProperties(val,val.solutionName,val.version,val.solutionRevisionId)">{{val.solutionName}} ({{val.version}}) <div ng-if="val.duplicateSolution === true" style="display: inline-block">[{{val.solutionRevisionId.substring(0,4)}}...]</div></div> </div> </div> diff --git a/src/legacy/images/emotion_classifier.png b/src/legacy/images/emotion_classifier.png new file mode 100644 index 0000000000000000000000000000000000000000..758f14c5b0e50193a32cec464cbfb31320062336 Binary files /dev/null and b/src/legacy/images/emotion_classifier.png differ diff --git a/src/legacy/images/video_analytics.png b/src/legacy/images/video_analytics.png new file mode 100644 index 0000000000000000000000000000000000000000..e2ea2139bc75d6398a7d9c6a578d8023824eefef Binary files /dev/null and b/src/legacy/images/video_analytics.png differ