From: Ioakeim Samaras Date: Fri, 20 Sep 2019 14:26:55 +0000 (+0300) Subject: [UI] Support data registration X-Git-Tag: 2.0.0~36^2 X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=validation.git;a=commitdiff_plain;h=3ff5d7028b19a649f6b80c476ff45ced1fdd67dc [UI] Support data registration Data regarding available labs, blueprints, versions, layers is created/deleted/updated by the UI users using user-friendly views. JIRA: VAL-44 Signed-off-by: Ioakeim Samaras Change-Id: Ic69e5bf9c150e51cc6d83b7ed5124632075943eb --- diff --git a/.coafile b/.coafile index 739b21f..39d09fa 100644 --- a/.coafile +++ b/.coafile @@ -55,12 +55,13 @@ ignore = ui/target/**, ui/src/main/java/org/akraino/validation/ui/filter/SecurityXssFilter.java, ui/src/main/java/org/akraino/validation/ui/client/jenkins/resources/**.java, ui/src/main/java/org/akraino/validation/ui/client/nexus/resources/**.java, - ui/src/main/java/org/akraino/validation/ui/service/DbResultAdapter.java, + ui/src/main/java/org/akraino/validation/ui/service/DbAdapter.java, ui/src/main/java/org/akraino/validation/ui/client/nexus/NexusExecutorClient.java, ui/src/main/java/org/akraino/validation/ui/daoimpl/ValidationTestResultDAOImpl.java, ui/src/main/java/org/akraino/validation/ui/entity/ValidationDbTestResult.java, ui/src/main/java/org/akraino/validation/ui/entity/WRobotDbTestResult.java, - ui/src/main/java/org/akraino/validation/ui/entity/Submission.java + ui/src/main/java/org/akraino/validation/ui/entity/Submission.java, + ui/src/main/java/org/akraino/validation/ui/controller/ModelsViewsController.java [all.JS] bears = ESLintBear,JSComplexityBear @@ -74,9 +75,24 @@ ignore = ui/src/main/webapp/app/fusion/**, ui/target/**, ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmission.js, ui/src/main/webapp/app/BluvalUI/CommittedSubmissions/CommittedSubmissions.js, - ui/src/main/webapp/app/BluvalUI/GetBySubmissionId/GetBySubmissionId.js, ui/src/main/webapp/app/BluvalUI/GetMostRecent/GetMostRecent.js, ui/src/main/webapp/app/BluvalUI/GetLastRun/GetLastRun.js, ui/src/main/webapp/app/BluvalUI/GetByTimestamp/GetByTimestamp.js, ui/src/main/webapp/app/BluvalUI/GetBasedOnDate/GetBasedOnDate.js, - ui/src/main/webapp/app/BluvalUI/ValidationResults/ValidationResults.js + ui/src/main/webapp/app/BluvalUI/ValidationResults/ValidationResults.js, + ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstance.js, + ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLab.js, + ui/src/main/webapp/app/BluvalUI/RegisterBlueprint/RegisterBlueprint.js, + ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstance.js, + ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLab.js, + ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayer.js, + ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslot.js, + ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprint.js, + ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstance.js, + ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLab.js, + ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayer.js, + ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprints.js, + ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstances.js, + ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabs.js, + ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayers.js, + ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslots.js diff --git a/ui/CHANGELOG.md b/ui/CHANGELOG.md index 16e6352..75cde42 100644 --- a/ui/CHANGELOG.md +++ b/ui/CHANGELOG.md @@ -164,3 +164,12 @@ All notable changes to this project will be documented in this file. ### Removed +## [0.3.1-SNAPSHOT] - 20 September 2019 +### Added +- Tabs for CRUD operations regarding labs, blueprints, layers, timeslots and blueprint instances have been added. + +### Changed +- Timeslot is now referenced by a blueprint instance +- The UI searches for results only under the 'bluval_results' directory in Nexus + +### Removed diff --git a/ui/README.rst b/ui/README.rst index 100624e..6b32a34 100644 --- a/ui/README.rst +++ b/ui/README.rst @@ -41,16 +41,16 @@ In order for the blueprint validation UI to be functional, the following items a - An appropriate mariadb instance is up and running (look at the Database subsection). This prerequisite concerns both of the UI modes. -- The available labs and their silos (i.e. which silo is used by a lab in order to store results in Nexus) for blueprint validation execution are defined by the corresponding lab owners (look at the Database subsection). It is their responsibility to publish them. Currently, this data is statically stored in the blueprint validation UI mariadb database. In order for a lab owner to update them, he/her must update the corresponding table entries. This inconvenience will be handled in the future. - This prerequisite concerns only the full control loop mode. +- The available labs and their silos (i.e. which silo is used by a lab in order to store results in Nexus) for blueprint validation execution are stored in mariadb (look at the Database subsection). It is the lab owner's responsibility to update them using the UI. + This prerequisite concerns both the partial and the full control loop modes. -- The available timeslots for blueprint validation execution of every lab are defined by the corresponding lab owners (look at the Database subsection). It is their responsibility to publish them. Currently, this data is statically stored in the blueprint validation UI mariadb database. In order for a lab owner to update them, he/her must update the corresponding table entries. This inconvenience will be handled in the future. +- The available timeslots for blueprint validation execution of every lab are stored in the mariadb (look at the Database subsection). It is the lab owner's responsibility to update them using the UI. This prerequisite concerns only the full control loop mode. -- The data of available blueprints (i.e. blueprint name) is stored in the mariadb database (look at the Database subsection). This data is automatically updated using info from Nexus. If a blueprint owner's is not satisfied with this info, he/her must update the corresponding table entries. +- The data of available blueprints (i.e. blueprint name) is stored in the mariadb database (look at the Database subsection). This data is automatically updated by the UI using info from Nexus. If a blueprint owner's is not satisfied with this info, he/her must update it using the UI. This prerequisite concerns only the full control loop mode. -- The data of an available blueprint instance for validation (i.e. version and layer) is stored in the mariadb database (look at the Database subsection). This data is automatically updated using info from Nexus. If a blueprint owner's is not satisfied with this info, he/her must update the corresponding table entries. +- The data of an available blueprint instance for validation (i.e. version and layer) is stored in the mariadb database (look at the Database subsection). This data is automatically updated by the UI using info from Nexus. If a blueprint owner's is not satisfied with this info, he/her must update it using the UI. This prerequisite concerns only the full control loop mode. - A Jenkins instance exists capable of executing blueprint validation tests on the specified lab and storing the results to Nexus server (look at the Jenkins configuration subsection). @@ -231,21 +231,25 @@ To this end, after the image build process, the following commands should be exe ./deploy.sh TAG_PRE=dev-mariadb MARIADB_ROOT_PASSWORD= MARIADB_AKRAINO_PASSWORD= UI_ADMIN_PASSWORD= UI_AKRAINO_PASSWORD= mysql -p -uakraino -h < ../../ui/db-scripts/examples/initialize_db_example.sql -In the context of the full control loop mode, the following tables must be initialized with appropriate data: +In the context of the UI application, the following tables exist in the database: -- lab (here every lab owner should store the name of the lab and the silo used for storing results in Nexus) -- timeslot (here every lab owner should register the available timeslots that can be used for blueprint validation test execution) -- blueprint_layer (here all the blueprint layers should be registered. These layers will be referenced by the blueprint instances) -- blueprint (here every blueprint owner should register the name of the blueprint) -- blueprint_instance_for_validation (here every blueprint owner should register the blueprint instances for validation, i.e. version and layer) -- blueprint_instance_blueprint_layer (here the many-to-many relationship between blueprint instances and layers is formulated) +- lab (here, every lab owner should store the name of the lab and the silo used for storing results in Nexus) +- timeslot (here, every lab owner should register the available timeslots that can be used for blueprint validation test execution) +- blueprint_layer (here, all the blueprint layers should be registered. These layers will be referenced by the blueprint instances) +- blueprint (here, every blueprint owner should register the name of the blueprint) +- blueprint_instance_for_validation (here, every blueprint owner should register the blueprint instances for validation, i.e. version and layer) +- blueprint_instance_blueprint_layer (here, the many-to-many relationship between blueprint instances and layers is formulated) +- blueprint_instance_timeslot (here, the many-to-many relationship between blueprint instances and timeslots is formulated) -As it has been already mentioned, these tables are initialized automatically by the UI by fetching data from Nexus. +As it has been already mentioned, a user can perform CRUD operations on these tables using the UI. Also, all these tables except from lab and timeslot are initialized and updated automatically +by the UI by fetching data from Nexus. It is the lab owners responsibility to update them if a modifications is needed (especially the data related to lab and timeslot tables). -However, a user may wish to extend or change this data (for example a new blueprint has been created and no results have been pushed to Nexus yet). To this end, the following file can be used (that's why the command 'mysql -p -uakraino -h < ../../ui/db-scripts/examples/initialize_db_example.sql' has been used previously): +An example of data initialization is stored in the following file: db-scripts/examples/initialize_db_example.sql +That is the reason why the command 'mysql -p -uakraino -h < ../../ui/db-scripts/examples/initialize_db_example.sql' has been used previously. + Some of this data is illustrated below: .. code-block:: console @@ -264,17 +268,22 @@ Some of this data is illustrated below: Blueprint Instances: id: 2, blueprint_id: 2 (i.e. rec), version: "master" - + blueprint_instances_blueprint_layers blueprint_id: 2 (i.e. rec), layer_id: 1 (i.e. hardware) + blueprint_instances_timeslots + blueprint_instance_id: 2 (i.e. rec), timeslot_id: 1 (i.e. now in att lab) + It should be noted that currently the start date and time and the duration of the timeslot are not taken into account by the UI (see limitation section). Therefore, a user should define 'now' and null respectively for their content. Based on this data, the UI enables the user to select an appropriate blueprint instance for validation. +In the following lines it is explained how a user can update database using the mysql tool. However, it is advised that UI should be used for this purpose as it supports a more user-friendly way. + For example, if a user wants to define a new lab with the following data: - lab: community, silo : 'community' + lab: community, silo : 'community' the following file should be created: @@ -310,11 +319,7 @@ Then, the following command should be executed: mysql -p -uakraino -h < ./dbscript.sql -Furthermore, if a user wants to define a new blueprint, namely "newBlueprint" and a new instance of this blueprint with the following data: - - version: "master", layer: k8s - -the following file should be created: +Furthermore, if a user wants to define a new blueprint, namely "newBlueprint", and an instance of this blueprint with version "master" and layer "k8s" and assign a timeslot to it, the following file should be created: name: dbscript content: @@ -324,6 +329,7 @@ content: insert into blueprint_instance (id, blueprint_id, version) values(3, 3, 'master'); insert into blueprint_layer (id, layer) values(4, 'k8s'); insert into blueprint_instance_blueprint_layer (blueprint_instance_id, blueprint_layer_id) values(3, 4); + insert into blueprint_instance_timeslot (blueprint_instance_id, timeslot_id) values(3, 2); Then, the following command should be executed: @@ -357,17 +363,15 @@ It should be noted that it is not the UI responsibility to deploy a Nexus server These results must be available in the following url: - https://nexus.akraino.org/content/sites/logs/////results// + https://nexus.akraino.org/content/sites/logs//bluval_results////results// where is the silo used by a lab for storing results in Nexus (for example 'att-blu-val'), is the name of the blueprint, the the blueprint version, is the timestamp used for producinf the results, is the blueprint layer and is the name of the corresponding test suite. Below, an example URL is illustrated - https://nexus.akraino.org/content/sites/logs/att-blu-val/rec/master/20190611-132818/results/hardware/bios_version/ + https://nexus.akraino.org/content/sites/logs/att-blu-val/bluval_results/rec/master/20190611-132818/results/hardware/bios_version/ -Moreover, the results should be stored in the 'output.xml' file and placed in the aforementioned URL using the following format: - -TBD +Moreover, the results should be stored in the 'output.xml' file and placed in the aforementioned URL. Compiling ~~~~~~~~~ @@ -435,4 +439,3 @@ Limitations ----------- - The UI has been tested using Chrome and Firefox browsers. - The back-end part of the UI does not take into account the start date and time and duration of the configured timeslot. It immediately triggers the corresponding Jenkins Job. -- Results data manipulation (filtering, graphical representation, indexing in time order, etc) is not supported. diff --git a/ui/db-scripts/EcompSdkDMLMySql_2_4_OS.sql b/ui/db-scripts/EcompSdkDMLMySql_2_4_OS.sql index 1dc1742..a1b3767 100644 --- a/ui/db-scripts/EcompSdkDMLMySql_2_4_OS.sql +++ b/ui/db-scripts/EcompSdkDMLMySql_2_4_OS.sql @@ -26,13 +26,33 @@ INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (930, 'Search', 9, 15, 'userProfile', 'menu_admin', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/search_profile.png'); INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (150022, 'Menus', 10, 60, 'admin#/admin_menu_edit', 'menu_admin', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', NULL); INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (150038,'Notebook',5000,135,'samplePage#/notebook','menu_sample','Y',NULL,NULL,NULL,NULL,'APP','N',NULL); -Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (21, 'New Submission', 1, 10, 'newsubmission', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-building-home'); -Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (22, 'Committed Submissions', 1, 10, 'committedsubmissions', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-building-home'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (21, 'New Submission', 1, 10, 'newsubmission', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-building-home'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (22, 'Committed Submissions', 1, 10, 'committedsubmissions', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-building-home'); Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (23, 'Validation Results', 1, 10, 'report.htm', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-misc-piechart'); Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (24, 'Get most recent', 23, 10, 'getmostrecent', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (25, 'Get by timestamp', 23, 10, 'getbytimestamp', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (26, 'Get last run', 23, 10, 'getlastrun', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (27, 'Get based on dates', 23, 10, 'getbasedondate', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (28, 'Register data', 1, 10, 'report.htm', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-misc-piechart'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (29, 'Lab', 28, 10, 'registerlab', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (30, 'Blueprint', 28, 10, 'registerblueprint', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (31, 'Layer', 28, 10, 'registerlayer', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (32, 'Timeslot', 28, 10, 'registertimeslot', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (33, 'Blueprint Instance', 28, 10, 'registerblueprintinstance', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (34, 'Unregister data', 1, 10, 'report.htm', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-misc-piechart'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (35, 'Lab', 34, 10, 'unregisterlab', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (36, 'Blueprint', 34, 10, 'unregisterblueprint', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (37, 'Layer', 34, 10, 'unregisterlayer', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (38, 'Blueprint Instance', 34, 10, 'unregisterblueprintinstance', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (39, 'Modify data', 1, 10, 'report.htm', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-misc-piechart'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (40, 'Lab', 39, 10, 'modifylab', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (41, 'Blueprint Instance', 39, 10, 'modifyblueprintinstance', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (42, 'Get data', 1, 10, 'report.htm', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-misc-piechart'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (43, 'Lab', 42, 10, 'getlabs', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (44, 'Blueprints', 42, 10, 'getblueprints', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (45, 'Layers', 42, 10, 'getlayers', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (46, 'Timeslots', 42, 10, 'gettimeslots', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); +Insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (47, 'Blueprint Instances', 42, 10, 'getblueprintinstances', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png'); -- fn_user Insert into fn_user (USER_ID,ORG_ID,MANAGER_ID,FIRST_NAME,MIDDLE_NAME,LAST_NAME,PHONE,FAX,CELLULAR,EMAIL,ADDRESS_ID,ALERT_METHOD_CD,HRID,ORG_USER_ID,ORG_CODE,LOGIN_ID,LOGIN_PWD,LAST_LOGIN_DATE,ACTIVE_YN,CREATED_ID,CREATED_DATE,MODIFIED_ID,MODIFIED_DATE,IS_INTERNAL_YN,ADDRESS_LINE_1,ADDRESS_LINE_2,CITY,STATE_CD,ZIP_CODE,COUNTRY_CD,LOCATION_CLLI,ORG_MANAGER_USERID,COMPANY,DEPARTMENT_NAME,JOB_TITLE,TIMEZONE,DEPARTMENT,BUSINESS_UNIT,BUSINESS_UNIT_NAME,COST_CENTER,FIN_LOC_CODE,SILO_STATUS) values (1,null,null,'admin',null,'User',null,null,null,'admin@email.com',null,null,null,'admin',null,'admin','admin_password',str_to_date('24-OCT-16','%d-%M-%Y'),'Y',null,str_to_date('17-OCT-16','%d-%M-%Y'),1,str_to_date('24-OCT-16','%d-%M-%Y'),'N',null,null,null,'NJ',null,'US',null,null,null,null,null,10,null,null,null,null,null,null); diff --git a/ui/db-scripts/akraino_blueprint_validation_db.sql b/ui/db-scripts/akraino_blueprint_validation_db.sql index a9ccae3..31f9ad5 100644 --- a/ui/db-scripts/akraino_blueprint_validation_db.sql +++ b/ui/db-scripts/akraino_blueprint_validation_db.sql @@ -26,6 +26,7 @@ DROP TABLE IF EXISTS blueprint_instance; DROP TABLE IF EXISTS blueprint_layer; DROP TABLE IF EXISTS blueprint; DROP TABLE IF EXISTS timeslot; +DROP TABLE IF EXISTS blueprint_instance_timeslot; DROP TABLE IF EXISTS lab; create table lab ( @@ -43,8 +44,7 @@ create table timeslot ( CONSTRAINT id_pk PRIMARY KEY (id), CONSTRAINT lab_id_fk FOREIGN KEY (lab_id) REFERENCES lab (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION, - unique (start_date_time, lab_id) + ON UPDATE NO ACTION ON DELETE NO ACTION ); CREATE TABLE blueprint @@ -86,13 +86,26 @@ CREATE TABLE blueprint_instance_blueprint_layer unique (blueprint_instance_id, blueprint_layer_id) ); +CREATE TABLE blueprint_instance_timeslot +( + blueprint_instance_id bigint not NULL, + timeslot_id bigint not NULL, + CONSTRAINT blueprint_instance_id_fk3 FOREIGN KEY (blueprint_instance_id) + REFERENCES blueprint_instance (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT timeslot_id_fk FOREIGN KEY (timeslot_id) + REFERENCES timeslot (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + unique (blueprint_instance_id, timeslot_id) +); + CREATE TABLE submission ( id bigint not NULL AUTO_INCREMENT, status text not NULL, timeslot_id bigint not NULL, CONSTRAINT id_pk PRIMARY KEY (id), - CONSTRAINT timeslot_id_fk FOREIGN KEY (timeslot_id) + CONSTRAINT timeslot_id_fk2 FOREIGN KEY (timeslot_id) REFERENCES timeslot (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ); @@ -109,7 +122,7 @@ CREATE TABLE validation_test_result submission_id bigint, date_of_storage text, CONSTRAINT id_pk PRIMARY KEY (id), - CONSTRAINT lab_id_fk3 FOREIGN KEY (lab_id) + CONSTRAINT lab_id_fk2 FOREIGN KEY (lab_id) REFERENCES lab (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT submission_id_fk FOREIGN KEY (submission_id) diff --git a/ui/db-scripts/examples/initialize_db_example.sql b/ui/db-scripts/examples/initialize_db_example.sql index 694c3cb..6f8419e 100644 --- a/ui/db-scripts/examples/initialize_db_example.sql +++ b/ui/db-scripts/examples/initialize_db_example.sql @@ -40,4 +40,7 @@ insert into blueprint_instance_blueprint_layer (blueprint_instance_id, blueprint insert into blueprint_instance_blueprint_layer (blueprint_instance_id, blueprint_layer_id) values(2, 2); /* os layer is assigned to rec*/ insert into blueprint_instance_blueprint_layer (blueprint_instance_id, blueprint_layer_id) values(2, 4); /* k8s layer is assigned to rec*/ +insert into blueprint_instance_timeslot (blueprint_instance_id, timeslot_id) values(1, 1); /* dummy blueprint instance validation tests can run on ATT lab*/ +insert into blueprint_instance_timeslot (blueprint_instance_id, timeslot_id) values(2, 1); /* rec blueprint instance validation tests can run on ATT lab*/ + commit; diff --git a/ui/pom.xml b/ui/pom.xml index 6baa507..2a6973c 100644 --- a/ui/pom.xml +++ b/ui/pom.xml @@ -14,7 +14,7 @@ org.akraino.validation ui - 0.2.1-SNAPSHOT + 0.3.1-SNAPSHOT Bluval UI Maven Webapp war diff --git a/ui/src/main/java/org/akraino/validation/ui/client/nexus/NexusExecutorClient.java b/ui/src/main/java/org/akraino/validation/ui/client/nexus/NexusExecutorClient.java index 33e53db..263d7de 100644 --- a/ui/src/main/java/org/akraino/validation/ui/client/nexus/NexusExecutorClient.java +++ b/ui/src/main/java/org/akraino/validation/ui/client/nexus/NexusExecutorClient.java @@ -45,7 +45,7 @@ import org.akraino.validation.ui.entity.BlueprintInstance; import org.akraino.validation.ui.entity.LabInfo; import org.akraino.validation.ui.entity.ValidationDbTestResult; import org.akraino.validation.ui.entity.WRobotDbTestResult; -import org.akraino.validation.ui.service.DbResultAdapter; +import org.akraino.validation.ui.service.DbAdapter; import org.apache.commons.httpclient.HttpException; import org.json.JSONObject; import org.json.XML; @@ -79,7 +79,7 @@ import com.sun.jersey.client.urlconnection.URLConnectionClientHandler; public final class NexusExecutorClient { @Autowired - DbResultAdapter dbAdapter; + DbAdapter dbAdapter; private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(NexusExecutorClient.class); @@ -158,7 +158,7 @@ public final class NexusExecutorClient { @Nonnull String timestamp) throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { - String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version; + String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version; LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get validation nexus test result"); WebResource webResource = this.client.resource(nexusUrl + "/"); LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString()); @@ -217,7 +217,7 @@ public final class NexusExecutorClient { @Nonnull String siloText, int noOfLastElements) throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, IOException, KeyManagementException, NoSuchAlgorithmException, ParseException { - String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version; + String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version; LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get validation Nexus test results"); WebResource webResource = this.client.resource(nexusUrl + "/"); LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString()); @@ -267,7 +267,7 @@ public final class NexusExecutorClient { @Nonnull String siloText, @Nonnull Date date) throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { - String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version; + String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version; LOGGER.debug(EELFLoggerDelegate.applicationLogger, "Trying to get validation Nexus results based on date"); WebResource webResource = this.client.resource(nexusUrl + "/"); LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString()); @@ -300,7 +300,7 @@ public final class NexusExecutorClient { @Nonnull String siloText, List layers, Boolean optional, boolean outcome) throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { - String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version; + String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version; LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get last result based on outcome"); WebResource webResource = this.client.resource(nexusUrl + "/"); LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString()); @@ -364,7 +364,7 @@ public final class NexusExecutorClient { @Nonnull String siloText, Boolean allLayers, Boolean optional, boolean outcome) throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { - String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version; + String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version; LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get last result based on outcome"); WebResource webResource = this.client.resource(nexusUrl + "/"); LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString()); @@ -422,7 +422,8 @@ public final class NexusExecutorClient { @Nonnull String siloText, @Nonnull String timestamp) throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, IOException, KeyManagementException, NoSuchAlgorithmException { - String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version + "/" + timestamp + "/results"; + String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version + "/" + + timestamp + "/results"; List listOfwrappers = new ArrayList(); LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get the blueprint layers"); WebResource webResource = this.client.resource(nexusUrl + "/"); diff --git a/ui/src/main/java/org/akraino/validation/ui/conf/ValidationTestResultsGetter.java b/ui/src/main/java/org/akraino/validation/ui/conf/ValidationTestResultsGetter.java index 981191b..6ad8a37 100644 --- a/ui/src/main/java/org/akraino/validation/ui/conf/ValidationTestResultsGetter.java +++ b/ui/src/main/java/org/akraino/validation/ui/conf/ValidationTestResultsGetter.java @@ -20,7 +20,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import org.akraino.validation.ui.entity.ValidationDbTestResult; -import org.akraino.validation.ui.service.DbResultAdapter; +import org.akraino.validation.ui.service.DbAdapter; import org.akraino.validation.ui.service.IntegratedResultService; import org.akraino.validation.ui.service.utils.PrioritySupplier; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; @@ -42,7 +42,7 @@ public class ValidationTestResultsGetter implements ApplicationListener> getBlueprints() { try { return new ResponseEntity<>(service.getBlueprints(), HttpStatus.OK); @@ -53,4 +54,26 @@ public class BlueprintController extends RestrictedBaseController { } return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); } + + @RequestMapping(value = { "/" }, method = RequestMethod.POST) + public ResponseEntity createBlueprint(@RequestBody Blueprint blueprint) { + try { + service.saveBlueprint(blueprint); + return new ResponseEntity<>(blueprint, HttpStatus.OK); + } catch (Exception e) { + LOGGER.error(EELFLoggerDelegate.errorLogger, "Creation of blueprint failed. " + UserUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + } + + @RequestMapping(value = { "/" }, method = RequestMethod.DELETE) + public ResponseEntity deleteBlueprint(@RequestBody Blueprint blueprint) { + try { + service.deleteBlueprint(blueprint); + return new ResponseEntity<>(true, HttpStatus.OK); + } catch (Exception e) { + LOGGER.error(EELFLoggerDelegate.errorLogger, "Deletion of blueprint failed. " + UserUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + } } diff --git a/ui/src/main/java/org/akraino/validation/ui/controller/BlueprintInstanceController.java b/ui/src/main/java/org/akraino/validation/ui/controller/BlueprintInstanceController.java index 84e0636..71a4d92 100644 --- a/ui/src/main/java/org/akraino/validation/ui/controller/BlueprintInstanceController.java +++ b/ui/src/main/java/org/akraino/validation/ui/controller/BlueprintInstanceController.java @@ -19,7 +19,7 @@ package org.akraino.validation.ui.controller; import java.util.List; import org.akraino.validation.ui.entity.BlueprintInstance; -import org.akraino.validation.ui.service.BlueprintInstanceService; +import org.akraino.validation.ui.service.DbAdapter; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.web.support.UserUtils; @@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -37,7 +38,7 @@ public class BlueprintInstanceController extends RestrictedBaseController { private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(BlueprintInstanceController.class); @Autowired - BlueprintInstanceService service; + DbAdapter service; public BlueprintInstanceController() { super(); @@ -54,4 +55,28 @@ public class BlueprintInstanceController extends RestrictedBaseController { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); } + @RequestMapping(value = { "/" }, method = RequestMethod.POST) + public ResponseEntity createBlueprintInstance(@RequestBody BlueprintInstance blueprintInstance) { + try { + service.saveBlueprintInstance(blueprintInstance); + return new ResponseEntity<>(blueprintInstance, HttpStatus.OK); + } catch (Exception e) { + LOGGER.error(EELFLoggerDelegate.errorLogger, + "Creation of blueprintInstance failed. " + UserUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + } + + @RequestMapping(value = { "/" }, method = RequestMethod.DELETE) + public ResponseEntity deleteBlueprintInstance(@RequestBody BlueprintInstance inst) { + try { + service.deleteBlueprintInstance(inst); + return new ResponseEntity<>(true, HttpStatus.OK); + } catch (Exception e) { + LOGGER.error(EELFLoggerDelegate.errorLogger, + "Deletion of blueprint instance failed. " + UserUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + } + } diff --git a/ui/src/main/java/org/akraino/validation/ui/controller/BlueprintLayerController.java b/ui/src/main/java/org/akraino/validation/ui/controller/BlueprintLayerController.java new file mode 100644 index 0000000..7dd2ba2 --- /dev/null +++ b/ui/src/main/java/org/akraino/validation/ui/controller/BlueprintLayerController.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package org.akraino.validation.ui.controller; + +import java.util.List; + +import org.akraino.validation.ui.entity.BlueprintLayer; +import org.akraino.validation.ui.service.DbAdapter; +import org.onap.portalsdk.core.controller.RestrictedBaseController; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +@Controller +@RequestMapping("/api/v1/layer") +public class BlueprintLayerController extends RestrictedBaseController { + + private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(BlueprintLayerController.class); + + @Autowired + DbAdapter service; + + public BlueprintLayerController() { + super(); + } + + @RequestMapping(value = { "/" }, method = RequestMethod.GET) + public ResponseEntity> getBlueprintLayers() { + try { + return new ResponseEntity<>(service.getBlueprintLayers(), HttpStatus.OK); + } catch (Exception e) { + LOGGER.error(EELFLoggerDelegate.errorLogger, + "Error when trying to get blueprint layers. " + UserUtils.getStackTrace(e)); + } + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + + @RequestMapping(value = { "/" }, method = RequestMethod.POST) + public ResponseEntity createBlueprintLayer(@RequestBody BlueprintLayer blueprintLayer) { + try { + service.saveBlueprintLayer(blueprintLayer); + return new ResponseEntity<>(blueprintLayer, HttpStatus.OK); + } catch (Exception e) { + LOGGER.error(EELFLoggerDelegate.errorLogger, + "Creation of blueprint layer failed. " + UserUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + } + + @RequestMapping(value = { "/" }, method = RequestMethod.DELETE) + public ResponseEntity deleteBlueprintLayer(@RequestBody BlueprintLayer blueprintLayer) { + try { + service.deleteBlueprintLayer(blueprintLayer); + return new ResponseEntity<>(true, HttpStatus.OK); + } catch (Exception e) { + LOGGER.error(EELFLoggerDelegate.errorLogger, + "Deletion of blueprint layer failed. " + UserUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + } +} diff --git a/ui/src/main/java/org/akraino/validation/ui/controller/LabController.java b/ui/src/main/java/org/akraino/validation/ui/controller/LabController.java index 1e214f8..f32de4a 100644 --- a/ui/src/main/java/org/akraino/validation/ui/controller/LabController.java +++ b/ui/src/main/java/org/akraino/validation/ui/controller/LabController.java @@ -19,7 +19,7 @@ package org.akraino.validation.ui.controller; import java.util.List; import org.akraino.validation.ui.entity.LabInfo; -import org.akraino.validation.ui.service.LabService; +import org.akraino.validation.ui.service.DbAdapter; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.web.support.UserUtils; @@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -37,7 +38,7 @@ public class LabController extends RestrictedBaseController { private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(LabController.class); @Autowired - LabService service; + DbAdapter service; public LabController() { super(); @@ -53,4 +54,26 @@ public class LabController extends RestrictedBaseController { } return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); } + + @RequestMapping(value = { "/" }, method = RequestMethod.POST) + public ResponseEntity saveLab(@RequestBody LabInfo labInfo) { + try { + service.saveLab(labInfo); + return new ResponseEntity<>(labInfo, HttpStatus.OK); + } catch (Exception e) { + LOGGER.error(EELFLoggerDelegate.errorLogger, "Save of lab failed. " + UserUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + } + + @RequestMapping(value = { "/" }, method = RequestMethod.DELETE) + public ResponseEntity deleteLab(@RequestBody LabInfo labInfo) { + try { + service.deleteLab(labInfo); + return new ResponseEntity<>(true, HttpStatus.OK); + } catch (Exception e) { + LOGGER.error(EELFLoggerDelegate.errorLogger, "Deletion of lab failed. " + UserUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + } } diff --git a/ui/src/main/java/org/akraino/validation/ui/controller/ModelsViewsController.java b/ui/src/main/java/org/akraino/validation/ui/controller/ModelsViewsController.java index cc9cec2..3d75a4a 100644 --- a/ui/src/main/java/org/akraino/validation/ui/controller/ModelsViewsController.java +++ b/ui/src/main/java/org/akraino/validation/ui/controller/ModelsViewsController.java @@ -77,6 +77,102 @@ public class ModelsViewsController extends RestrictedBaseController { return new ModelAndView(defaultViewName); } + @RequestMapping(value = { "/registerlab" }, method = RequestMethod.GET) + public ModelAndView registerLab(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/unregisterlab" }, method = RequestMethod.GET) + public ModelAndView unRegisterLab(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/modifylab" }, method = RequestMethod.GET) + public ModelAndView modifyLab(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/getlabs" }, method = RequestMethod.GET) + public ModelAndView getLabs(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/registerblueprint" }, method = RequestMethod.GET) + public ModelAndView registerBlueprint(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/unregisterblueprint" }, method = RequestMethod.GET) + public ModelAndView unRegisterBlueprint(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/getblueprints" }, method = RequestMethod.GET) + public ModelAndView getBlueprints(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/registerlayer" }, method = RequestMethod.GET) + public ModelAndView registerLayer(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/unregisterlayer" }, method = RequestMethod.GET) + public ModelAndView unRegisterLayer(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/getlayers" }, method = RequestMethod.GET) + public ModelAndView getLayers(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/registertimeslot" }, method = RequestMethod.GET) + public ModelAndView registerTimeslot(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/gettimeslots" }, method = RequestMethod.GET) + public ModelAndView getTimeslots(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/registerblueprintinstance" }, method = RequestMethod.GET) + public ModelAndView registerBlueprintInstance(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/unregisterblueprintinstance" }, method = RequestMethod.GET) + public ModelAndView unRegisterBlueprintInstance(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/getblueprintinstances" }, method = RequestMethod.GET) + public ModelAndView getBlueprintInstances(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + + @RequestMapping(value = { "/modifyblueprintinstance" }, method = RequestMethod.GET) + public ModelAndView modifyBlueprintInstance(HttpServletRequest request) { + final String defaultViewName = null; + return new ModelAndView(defaultViewName); + } + @RequestMapping(value = { "/logout.htm" }, method = RequestMethod.GET) public ModelAndView login() { Map model = new HashMap<>(); diff --git a/ui/src/main/java/org/akraino/validation/ui/controller/ResultController.java b/ui/src/main/java/org/akraino/validation/ui/controller/ResultController.java index b923d61..83ad0fa 100644 --- a/ui/src/main/java/org/akraino/validation/ui/controller/ResultController.java +++ b/ui/src/main/java/org/akraino/validation/ui/controller/ResultController.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.Set; import org.akraino.validation.ui.entity.ValidationDbTestResult; -import org.akraino.validation.ui.service.DbResultAdapter; +import org.akraino.validation.ui.service.DbAdapter; import org.akraino.validation.ui.service.IntegratedResultService; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; @@ -44,7 +44,7 @@ public class ResultController extends RestrictedBaseController { IntegratedResultService resultService; @Autowired - DbResultAdapter dbAdapter; + DbAdapter dbAdapter; public ResultController() { super(); diff --git a/ui/src/main/java/org/akraino/validation/ui/controller/TimeslotsController.java b/ui/src/main/java/org/akraino/validation/ui/controller/TimeslotController.java similarity index 56% rename from ui/src/main/java/org/akraino/validation/ui/controller/TimeslotsController.java rename to ui/src/main/java/org/akraino/validation/ui/controller/TimeslotController.java index f82c273..2e86406 100644 --- a/ui/src/main/java/org/akraino/validation/ui/controller/TimeslotsController.java +++ b/ui/src/main/java/org/akraino/validation/ui/controller/TimeslotController.java @@ -19,7 +19,7 @@ package org.akraino.validation.ui.controller; import java.util.List; import org.akraino.validation.ui.entity.Timeslot; -import org.akraino.validation.ui.service.TimeslotService; +import org.akraino.validation.ui.service.DbAdapter; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.web.support.UserUtils; @@ -27,19 +27,20 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller -@RequestMapping("/api/v1/timeslots") -public class TimeslotsController extends RestrictedBaseController { +@RequestMapping("/api/v1/timeslot") +public class TimeslotController extends RestrictedBaseController { - private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(TimeslotsController.class); + private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(TimeslotController.class); @Autowired - TimeslotService service; + DbAdapter service; - public TimeslotsController() { + public TimeslotController() { super(); } @@ -49,8 +50,30 @@ public class TimeslotsController extends RestrictedBaseController { return new ResponseEntity<>(service.getTimeslots(), HttpStatus.OK); } catch (Exception e) { LOGGER.error(EELFLoggerDelegate.errorLogger, - "Error occured when trying to retrieve timeslots. " + UserUtils.getStackTrace(e)); + "Error occured when trying to retrieve timeslots." + UserUtils.getStackTrace(e)); } return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); } + + @RequestMapping(value = { "/" }, method = RequestMethod.POST) + public ResponseEntity createTimeslot(@RequestBody Timeslot timeslot) { + try { + service.saveTimeslot(timeslot); + return new ResponseEntity<>(timeslot, HttpStatus.OK); + } catch (Exception e) { + LOGGER.error(EELFLoggerDelegate.errorLogger, "Creation of timeslot failed. " + UserUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + } + + @RequestMapping(value = { "/" }, method = RequestMethod.DELETE) + public ResponseEntity deleteTimeslot(@RequestBody Timeslot timeslot) { + try { + service.deleteTimeslot(timeslot); + return new ResponseEntity<>(true, HttpStatus.OK); + } catch (Exception e) { + LOGGER.error(EELFLoggerDelegate.errorLogger, "Deletion of timeslot failed. " + UserUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + } } diff --git a/ui/src/main/java/org/akraino/validation/ui/entity/BlueprintInstance.java b/ui/src/main/java/org/akraino/validation/ui/entity/BlueprintInstance.java index 30722e2..9024b38 100644 --- a/ui/src/main/java/org/akraino/validation/ui/entity/BlueprintInstance.java +++ b/ui/src/main/java/org/akraino/validation/ui/entity/BlueprintInstance.java @@ -15,6 +15,7 @@ */ package org.akraino.validation.ui.entity; +import java.io.IOException; import java.io.Serializable; import java.util.HashSet; import java.util.Set; @@ -32,10 +33,19 @@ import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.Table; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.web.support.UserUtils; + +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + @Entity @Table(name = "blueprint_instance") public class BlueprintInstance implements Serializable { + private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(BlueprintInstance.class); + /** * */ @@ -59,6 +69,12 @@ public class BlueprintInstance implements Serializable { @JoinColumn(name = "blueprint_layer_id") }) private Set blueprintLayers = new HashSet<>(); + @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @JoinTable(name = "blueprint_instance_timeslot", joinColumns = { + @JoinColumn(name = "blueprint_instance_id") }, inverseJoinColumns = { @JoinColumn(name = "timeslot_id") }) + @JsonSerialize(using = TimeslotsSerializer.class) + private Set timeslots = new HashSet<>(); + public int getBlueprintInstanceId() { return blueprintInstId; } @@ -91,4 +107,43 @@ public class BlueprintInstance implements Serializable { this.blueprintLayers = blueprintLayers; } + public Set getTimeslots() { + return timeslots; + } + + public void setTimeslots(Set timeslots) { + this.timeslots = timeslots; + } + + static class TimeslotsSerializer extends StdSerializer> { + + public TimeslotsSerializer() { + this(null); + } + + public TimeslotsSerializer(Class> tclass) { + super(tclass); + } + + @Override + public void serialize(Set timeslots, com.fasterxml.jackson.core.JsonGenerator gen, + SerializerProvider provider) throws IOException { + Set results = new HashSet<>(); + for (Timeslot timeslot : timeslots) { + try { + Timeslot result = new Timeslot(); + result.setDuration(timeslot.getDuration()); + result.setLabInfo(timeslot.getLabInfo()); + result.setStartDateTime(timeslot.getStartDateTime()); + result.setTimeslotId(timeslot.getTimeslotId()); + results.add(result); + } catch (Exception ex) { + LOGGER.error(EELFLoggerDelegate.errorLogger, + "Error when serializing." + UserUtils.getStackTrace(ex)); + } + } + gen.writeObject(results); + } + } + } diff --git a/ui/src/main/java/org/akraino/validation/ui/entity/Timeslot.java b/ui/src/main/java/org/akraino/validation/ui/entity/Timeslot.java index be2f250..1e2459b 100644 --- a/ui/src/main/java/org/akraino/validation/ui/entity/Timeslot.java +++ b/ui/src/main/java/org/akraino/validation/ui/entity/Timeslot.java @@ -81,4 +81,5 @@ public class Timeslot implements Serializable { public LabInfo getLabInfo() { return labInfo; } + } diff --git a/ui/src/main/java/org/akraino/validation/ui/service/BlueprintInstanceService.java b/ui/src/main/java/org/akraino/validation/ui/service/BlueprintInstanceService.java deleted file mode 100644 index 748085e..0000000 --- a/ui/src/main/java/org/akraino/validation/ui/service/BlueprintInstanceService.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. You may obtain - * a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -package org.akraino.validation.ui.service; - -import java.util.List; - -import org.akraino.validation.ui.dao.BlueprintInstanceDAO; -import org.akraino.validation.ui.entity.Blueprint; -import org.akraino.validation.ui.entity.BlueprintInstance; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class BlueprintInstanceService { - - @Autowired - private BlueprintInstanceDAO dao; - - public void saveBlueprintInstance(BlueprintInstance blueprintIns) { - dao.saveOrUpdate(blueprintIns); - } - - public List getBlueprintInstances() { - return dao.getBlueprintInstances(); - } - - public BlueprintInstance getBlueprintInstance(int instId) { - return dao.getBlueprintInstance(instId); - } - - public BlueprintInstance getBlueprintInstance(Blueprint blueprint, String version) { - return dao.getBlueprintInstance(blueprint, version); - } - - public void deleteAll() { - dao.deleteAll(); - } - -} diff --git a/ui/src/main/java/org/akraino/validation/ui/service/BlueprintLayerService.java b/ui/src/main/java/org/akraino/validation/ui/service/BlueprintLayerService.java deleted file mode 100644 index d814575..0000000 --- a/ui/src/main/java/org/akraino/validation/ui/service/BlueprintLayerService.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. You may obtain - * a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -package org.akraino.validation.ui.service; - -import java.util.List; - -import org.akraino.validation.ui.dao.BlueprintLayerDAO; -import org.akraino.validation.ui.entity.BlueprintLayer; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class BlueprintLayerService { - - @Autowired - private BlueprintLayerDAO layerDAO; - - public void saveBlueprintLayer(BlueprintLayer layer) { - layerDAO.saveOrUpdate(layer); - } - - public BlueprintLayer getBlueprintLayer(Integer layerId) { - return layerDAO.getBlueprintLayer(layerId); - } - - public BlueprintLayer getBlueprintLayer(String layerData) { - return layerDAO.getBlueprintLayer(layerData); - } - - public List getBlueprintLayers() { - return layerDAO.getBlueprintLayers(); - } - - public void deleteAll() { - layerDAO.deleteAll(); - } - -} diff --git a/ui/src/main/java/org/akraino/validation/ui/service/BlueprintService.java b/ui/src/main/java/org/akraino/validation/ui/service/BlueprintService.java deleted file mode 100644 index ed5aa75..0000000 --- a/ui/src/main/java/org/akraino/validation/ui/service/BlueprintService.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. You may obtain - * a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -package org.akraino.validation.ui.service; - -import java.util.List; - -import org.akraino.validation.ui.dao.BlueprintDAO; -import org.akraino.validation.ui.entity.Blueprint; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class BlueprintService { - - @Autowired - private BlueprintDAO blueprintDAO; - - public void saveBlueprint(Blueprint blueprint) { - blueprintDAO.saveOrUpdate(blueprint); - } - - public Blueprint getBlueprint(String name) { - return blueprintDAO.getBlueprint(name); - } - - public List getBlueprints() { - return blueprintDAO.getBlueprints(); - } - - public void deleteAll() { - blueprintDAO.deleteAll(); - } - -} diff --git a/ui/src/main/java/org/akraino/validation/ui/service/DbResultAdapter.java b/ui/src/main/java/org/akraino/validation/ui/service/DbAdapter.java similarity index 71% rename from ui/src/main/java/org/akraino/validation/ui/service/DbResultAdapter.java rename to ui/src/main/java/org/akraino/validation/ui/service/DbAdapter.java index dcb3bac..56eada6 100644 --- a/ui/src/main/java/org/akraino/validation/ui/service/DbResultAdapter.java +++ b/ui/src/main/java/org/akraino/validation/ui/service/DbAdapter.java @@ -8,6 +8,11 @@ import java.util.Set; import javax.annotation.Nonnull; +import org.akraino.validation.ui.dao.BlueprintDAO; +import org.akraino.validation.ui.dao.BlueprintInstanceDAO; +import org.akraino.validation.ui.dao.BlueprintLayerDAO; +import org.akraino.validation.ui.dao.LabDAO; +import org.akraino.validation.ui.dao.TimeslotDAO; import org.akraino.validation.ui.dao.ValidationTestResultDAO; import org.akraino.validation.ui.dao.WRobotTestResultDAO; import org.akraino.validation.ui.data.JnksJobNotify; @@ -16,6 +21,7 @@ import org.akraino.validation.ui.entity.BlueprintInstance; import org.akraino.validation.ui.entity.BlueprintLayer; import org.akraino.validation.ui.entity.LabInfo; import org.akraino.validation.ui.entity.Submission; +import org.akraino.validation.ui.entity.Timeslot; import org.akraino.validation.ui.entity.ValidationDbTestResult; import org.akraino.validation.ui.entity.WRobotDbTestResult; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; @@ -28,14 +34,11 @@ import com.fasterxml.jackson.databind.JsonMappingException; @Service @Transactional -public class DbResultAdapter { +public class DbAdapter { - private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(DbResultAdapter.class); + private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(DbAdapter.class); private static final Object LOCK = new Object(); - @Autowired - LabService labService; - @Autowired private ValidationTestResultDAO vTestResultDAO; @@ -43,25 +46,49 @@ public class DbResultAdapter { private WRobotTestResultDAO wRobotDAO; @Autowired - DbSubmissionAdapter subService; + private LabDAO labDAO; + + @Autowired + private BlueprintLayerDAO layerDAO; @Autowired - BlueprintService blueprintService; + private BlueprintInstanceDAO bluInstDao; @Autowired - BlueprintInstanceService blueprintInstService; + private BlueprintDAO blueprintDAO; @Autowired - BlueprintLayerService layerService; + private TimeslotDAO timeslotDAO; + + @Autowired + DbSubmissionAdapter subService; public void associateSubmissionWithValidationResult(Submission submission) throws JsonParseException, JsonMappingException, IOException { synchronized (LOCK) { if (!compareBluInstances(submission.getValidationDbTestResult().getBlueprintInstance(), - blueprintInstService.getBlueprintInstance( + bluInstDao.getBlueprintInstance( submission.getValidationDbTestResult().getBlueprintInstance().getBlueprintInstanceId()))) { throw new RuntimeException("Blueprint instance data changed."); } + if (!compareTimeslots(submission.getTimeslot(), + timeslotDAO.getTimeslot(submission.getTimeslot().getTimeslotId()))) { + throw new RuntimeException("Timeslot data changed."); + } + + boolean canContinue = false; + for (Timeslot timeslot : bluInstDao + .getBlueprintInstance( + submission.getValidationDbTestResult().getBlueprintInstance().getBlueprintInstanceId()) + .getTimeslots()) { + if (compareTimeslots(timeslot, submission.getTimeslot())) { + canContinue = true; + break; + } + } + if (!canContinue) { + throw new RuntimeException("Configured timeslot is no longer assigned to the blueprint instance."); + } submission.getValidationDbTestResult().setSubmission(submission); vTestResultDAO.saveOrUpdate(submission.getValidationDbTestResult()); if (submission.getValidationDbTestResult().getWRobotDbTestResults() != null) { @@ -86,24 +113,24 @@ public class DbResultAdapter { if (!checkValidityOfNexusResult(vNexusResult)) { continue; } - LabInfo labInfo = labService.getLabBasedOnSilo(vNexusResult.getLab().getSilo()); + LabInfo labInfo = labDAO.getLabBasedOnSilo(vNexusResult.getLab().getSilo()); ValidationDbTestResult vDbResult = vTestResultDAO.getValidationTestResult(labInfo, vNexusResult.getTimestamp()); if (vDbResult == null) { vDbResult = vNexusResult; vDbResult.setLab(labInfo); - Blueprint blueprint = blueprintService + Blueprint blueprint = blueprintDAO .getBlueprint(vNexusResult.getBlueprintInstance().getBlueprint().getBlueprintName()); if (blueprint == null) { blueprint = vNexusResult.getBlueprintInstance().getBlueprint(); - blueprintService.saveBlueprint(blueprint); + blueprintDAO.saveOrUpdate(blueprint); } - BlueprintInstance blueprintInst = blueprintInstService.getBlueprintInstance(blueprint, + BlueprintInstance blueprintInst = bluInstDao.getBlueprintInstance(blueprint, (vNexusResult.getBlueprintInstance().getVersion())); if (blueprintInst == null) { blueprintInst = vNexusResult.getBlueprintInstance(); blueprintInst.setBlueprint(blueprint); - blueprintInstService.saveBlueprintInstance(blueprintInst); + bluInstDao.saveOrUpdate(blueprintInst); } vDbResult.setBlueprintInstance(blueprintInst); } @@ -181,19 +208,19 @@ public class DbResultAdapter { synchronized (LOCK) { LabInfo actualLabInfo = null; if (lab != null) { - actualLabInfo = labService.getLab(lab); + actualLabInfo = labDAO.getLab(lab); if (actualLabInfo == null) { return null; } } Blueprint blueprint = null; if (blueprintName != null) { - blueprint = blueprintService.getBlueprint(blueprintName); + blueprint = blueprintDAO.getBlueprint(blueprintName); if (blueprint == null) { return null; } } - BlueprintInstance blueprintInst = blueprintInstService.getBlueprintInstance(blueprint, version); + BlueprintInstance blueprintInst = bluInstDao.getBlueprintInstance(blueprint, version); if (blueprintInst == null) { return null; } @@ -226,7 +253,7 @@ public class DbResultAdapter { public ValidationDbTestResult readResultFromDb(@Nonnull String lab, @Nonnull String timestamp) throws JsonParseException, JsonMappingException, IOException { synchronized (LOCK) { - LabInfo actualLabInfo = labService.getLab(lab); + LabInfo actualLabInfo = labDAO.getLab(lab); ValidationDbTestResult vDbResult = vTestResultDAO.getValidationTestResult(actualLabInfo, timestamp); if (vDbResult == null) { return null; @@ -247,16 +274,16 @@ public class DbResultAdapter { if (vNexusResults == null || vNexusResults.size() < 1) { return; } - LabInfo labInfo = labService.getLabBasedOnSilo(vNexusResults.get(0).getLab().getSilo()); + LabInfo labInfo = labDAO.getLabBasedOnSilo(vNexusResults.get(0).getLab().getSilo()); if (labInfo == null) { return; } - Blueprint blueprint = blueprintService + Blueprint blueprint = blueprintDAO .getBlueprint(vNexusResults.get(0).getBlueprintInstance().getBlueprint().getBlueprintName()); if (blueprint == null) { return; } - BlueprintInstance blueInst = blueprintInstService.getBlueprintInstance(blueprint, + BlueprintInstance blueInst = bluInstDao.getBlueprintInstance(blueprint, vNexusResults.get(0).getBlueprintInstance().getVersion()); if (blueInst == null) { return; @@ -274,7 +301,7 @@ public class DbResultAdapter { String dbTimestamp = vDbResult.getTimestamp(); LabInfo dbLabInfo = vDbResult.getLab(); for (ValidationDbTestResult vNexusResult : vNexusResults) { - LabInfo nexusLabInfo = labService.getLabBasedOnSilo(vNexusResult.getLab().getSilo()); + LabInfo nexusLabInfo = labDAO.getLabBasedOnSilo(vNexusResult.getLab().getSilo()); if (nexusLabInfo == null) { continue; } @@ -313,12 +340,12 @@ public class DbResultAdapter { synchronized (LOCK) { Blueprint blueprint = null; if (blueprintName != null) { - blueprint = blueprintService.getBlueprint(blueprintName); + blueprint = blueprintDAO.getBlueprint(blueprintName); if (blueprint == null) { return null; } } - BlueprintInstance bluInst = blueprintInstService.getBlueprintInstance(blueprint, version); + BlueprintInstance bluInst = bluInstDao.getBlueprintInstance(blueprint, version); if (bluInst == null) { return null; } @@ -334,7 +361,7 @@ public class DbResultAdapter { public ValidationDbTestResult getValidationTestResult(String labSilo, String timestamp) { synchronized (LOCK) { - return vTestResultDAO.getValidationTestResult(labService.getLabBasedOnSilo(labSilo), timestamp); + return vTestResultDAO.getValidationTestResult(labDAO.getLabBasedOnSilo(labSilo), timestamp); } } @@ -362,16 +389,194 @@ public class DbResultAdapter { } } + public void saveLab(LabInfo lab) { + synchronized (LOCK) { + labDAO.saveOrUpdate(lab); + } + } + + public void deleteLab(LabInfo lab) { + synchronized (LOCK) { + labDAO.deleteLab(lab); + } + } + + public LabInfo getLab(String lab) { + synchronized (LOCK) { + return labDAO.getLab(lab); + } + } + + public LabInfo getLabBasedOnSilo(String silo) { + synchronized (LOCK) { + return labDAO.getLabBasedOnSilo(silo); + } + } + + public List getLabs() { + synchronized (LOCK) { + return labDAO.getLabs(); + } + } + + public void deleteLabAll() { + synchronized (LOCK) { + labDAO.deleteAll(); + } + } + + public void saveBlueprintInstance(BlueprintInstance blueprintIns) { + synchronized (LOCK) { + Set timeslots = blueprintIns.getTimeslots(); + if (timeslots != null && timeslots.size() > 1) { + for (Timeslot timeslot : timeslots) { + if (!compareTimeslots(timeslot, timeslotDAO.getTimeslot(timeslot.getTimeslotId()))) { + throw new RuntimeException("Timeslot instance data changed."); + } + } + bluInstDao.merge(blueprintIns); + return; + } + bluInstDao.saveOrUpdate(blueprintIns); + } + } + + public List getBlueprintInstances() { + synchronized (LOCK) { + return bluInstDao.getBlueprintInstances(); + } + } + + public BlueprintInstance getBlueprintInstance(int instId) { + synchronized (LOCK) { + return bluInstDao.getBlueprintInstance(instId); + } + } + + public BlueprintInstance getBlueprintInstance(Blueprint blueprint, String version) { + synchronized (LOCK) { + return bluInstDao.getBlueprintInstance(blueprint, version); + } + } + + public void deleteBlueprintInstance(BlueprintInstance blueprintIns) { + synchronized (LOCK) { + bluInstDao.deleteBlueprintInstance(blueprintIns); + } + } + + public void deleteBluInstAll() { + synchronized (LOCK) { + bluInstDao.deleteAll(); + } + } + + public void saveBlueprintLayer(BlueprintLayer layer) { + synchronized (LOCK) { + layerDAO.saveOrUpdate(layer); + } + } + + public BlueprintLayer getBlueprintLayer(Integer layerId) { + synchronized (LOCK) { + return layerDAO.getBlueprintLayer(layerId); + } + } + + public BlueprintLayer getBlueprintLayer(String layerData) { + synchronized (LOCK) { + return layerDAO.getBlueprintLayer(layerData); + } + } + + public List getBlueprintLayers() { + synchronized (LOCK) { + return layerDAO.getBlueprintLayers(); + } + } + + public void deleteBlueprintLayer(BlueprintLayer layer) { + synchronized (LOCK) { + layerDAO.deleteBlueprintLayer(layer); + } + } + + public void deleteBluLayersAll() { + synchronized (LOCK) { + layerDAO.deleteAll(); + } + } + + public void saveBlueprint(Blueprint blueprint) { + synchronized (LOCK) { + blueprintDAO.saveOrUpdate(blueprint); + } + } + + public Blueprint getBlueprint(String name) { + synchronized (LOCK) { + return blueprintDAO.getBlueprint(name); + } + } + + public List getBlueprints() { + synchronized (LOCK) { + return blueprintDAO.getBlueprints(); + } + } + + public void deleteBlueprint(Blueprint blueprint) { + synchronized (LOCK) { + blueprintDAO.deleteBlueprint(blueprint); + } + } + + public void deleteBluAll() { + synchronized (LOCK) { + blueprintDAO.deleteAll(); + } + } + + public void saveTimeslot(Timeslot timeslot) { + synchronized (LOCK) { + LabInfo labInfo = timeslot.getLabInfo(); + if (labInfo != null) { + if (!compareLabInfos(labInfo, labDAO.getLab(labInfo.getLabId()))) { + throw new RuntimeException("Lab data changed."); + } + } + timeslotDAO.saveOrUpdate(timeslot); + } + } + + public List getTimeslots() { + synchronized (LOCK) { + return timeslotDAO.getTimeslots(); + } + } + + public void deleteTimeslot(Timeslot timeslot) { + synchronized (LOCK) { + timeslotDAO.deleteTimeslot(timeslot); + } + } + + public void deleteTimeslotAll() { + synchronized (LOCK) { + timeslotDAO.deleteAll(); + } + } + public boolean checkValidityOfNexusResult(ValidationDbTestResult vNexusResult) { if (vNexusResult == null) { return true; } - LabInfo labInfo = labService.getLabBasedOnSilo(vNexusResult.getLab().getSilo()); + LabInfo labInfo = labDAO.getLabBasedOnSilo(vNexusResult.getLab().getSilo()); if (labInfo == null) { throw new RuntimeException("Lab silo : " + vNexusResult.getLab().getSilo() + " not found"); } ValidationDbTestResult vDbResult = vTestResultDAO.getValidationTestResult( - labService.getLabBasedOnSilo(vNexusResult.getLab().getSilo()), vNexusResult.getTimestamp()); + labDAO.getLabBasedOnSilo(vNexusResult.getLab().getSilo()), vNexusResult.getTimestamp()); Blueprint blueprint = null; BlueprintInstance bluInst = null; List wRobotDbResults = null; @@ -380,15 +585,14 @@ public class DbResultAdapter { labInfo = vDbResult.getLab(); wRobotDbResults = wRobotDAO.getWRobotTestResult(vDbResult); } else { - blueprint = blueprintService + blueprint = blueprintDAO .getBlueprint(vNexusResult.getBlueprintInstance().getBlueprint().getBlueprintName()); } if (blueprint != null) { if (vDbResult != null) { bluInst = vDbResult.getBlueprintInstance(); } else { - bluInst = blueprintInstService.getBlueprintInstance(blueprint, - vNexusResult.getBlueprintInstance().getVersion()); + bluInst = bluInstDao.getBlueprintInstance(blueprint, vNexusResult.getBlueprintInstance().getVersion()); } } // Start comparison, be elastic with allLayers and optional @@ -488,7 +692,7 @@ public class DbResultAdapter { .equals(vDbTimestamp.getBlueprintInstance().getBlueprint().getBlueprintName()) || !vDbSubmission.getBlueprintInstance().getVersion() .equals(vDbTimestamp.getBlueprintInstance().getVersion()) - || !vDbSubmission.getLab().equals(vDbTimestamp.getLab())) { + || !compareLabInfos(vDbSubmission.getLab(), vDbTimestamp.getLab())) { LOGGER.error(EELFLoggerDelegate.errorLogger, "No consistency exists in database records."); return false; } @@ -496,7 +700,7 @@ public class DbResultAdapter { } private void updateBlueInstLayers(ValidationDbTestResult vNexusResult) { - for (BlueprintInstance blueprintInst : blueprintInstService.getBlueprintInstances()) { + for (BlueprintInstance blueprintInst : bluInstDao.getBlueprintInstances()) { if (!blueprintInst.getBlueprint().getBlueprintName() .equals(vNexusResult.getBlueprintInstance().getBlueprint().getBlueprintName())) { continue; @@ -506,18 +710,18 @@ public class DbResultAdapter { blueprintLayers = new HashSet(); } for (WRobotDbTestResult nexusResult : vNexusResult.getWRobotDbTestResults()) { - BlueprintLayer layer = layerService.getBlueprintLayer(nexusResult.getLayer()); + BlueprintLayer layer = layerDAO.getBlueprintLayer(nexusResult.getLayer()); if (layer == null) { layer = new BlueprintLayer(); layer.setLayer(nexusResult.getLayer()); - layerService.saveBlueprintLayer(layer); + layerDAO.saveOrUpdate(layer); } if (!blueprintLayers.contains(layer)) { blueprintLayers.add(layer); } } blueprintInst.setBlueprintLayers(blueprintLayers); - blueprintInstService.saveBlueprintInstance(blueprintInst); + bluInstDao.saveOrUpdate(blueprintInst); } } @@ -557,15 +761,60 @@ public class DbResultAdapter { return false; } } - Blueprint blueprint1 = inst1.getBlueprint(); - Blueprint blueprint2 = inst2.getBlueprint(); - if (blueprint1.getBlueprintId() != blueprint2.getBlueprintId()) { + if (!compareBlueprints(inst1.getBlueprint(), inst2.getBlueprint())) { + return false; + } + return true; + } + + private boolean compareTimeslots(Timeslot timeslot1, Timeslot timeslot2) { + if (!timeslot1.getStartDateTime().equals(timeslot2.getStartDateTime()) + || timeslot1.getTimeslotId() != timeslot2.getTimeslotId()) { return false; } - if (!blueprint1.getBlueprintName().equals(blueprint2.getBlueprintName())) { + if (!compareLabInfos(timeslot1.getLabInfo(), timeslot2.getLabInfo())) { return false; } return true; } + private boolean compareBlueprints(Blueprint blueprint1, Blueprint blueprint2) { + if (blueprint1 != null || blueprint2 != null) { + if (blueprint1 != null && blueprint2 == null) { + return false; + } + if (blueprint1 == null && blueprint2 != null) { + return false; + } + if (blueprint1.getBlueprintId() != blueprint2.getBlueprintId()) { + return false; + } + if (!blueprint1.getBlueprintName().equals(blueprint2.getBlueprintName())) { + return false; + } + } + return true; + } + + private boolean compareLabInfos(LabInfo labInfo1, LabInfo labInfo2) { + if (labInfo1 != null || labInfo2 != null) { + if (labInfo1 != null && labInfo2 == null) { + return false; + } + if (labInfo1 == null && labInfo2 != null) { + return false; + } + if (labInfo1.getLabId() != labInfo2.getLabId()) { + return false; + } + if (!labInfo1.getSilo().equals(labInfo2.getSilo())) { + return false; + } + if (!labInfo1.getLab().equals(labInfo2.getLab())) { + return false; + } + } + return true; + } + } diff --git a/ui/src/main/java/org/akraino/validation/ui/service/DbSubmissionAdapter.java b/ui/src/main/java/org/akraino/validation/ui/service/DbSubmissionAdapter.java index 70955c0..648b89f 100644 --- a/ui/src/main/java/org/akraino/validation/ui/service/DbSubmissionAdapter.java +++ b/ui/src/main/java/org/akraino/validation/ui/service/DbSubmissionAdapter.java @@ -61,10 +61,7 @@ public class DbSubmissionAdapter { private JenkinsExecutorClient jenkinsService; @Autowired - private DbResultAdapter dbAdapter; - - @Autowired - BlueprintInstanceService bluInstService; + private DbAdapter dbAdapter; public Submission saveSubmission(Submission submission) throws JsonParseException, JsonMappingException, IOException { diff --git a/ui/src/main/java/org/akraino/validation/ui/service/IntegratedResultService.java b/ui/src/main/java/org/akraino/validation/ui/service/IntegratedResultService.java index e97b5d1..965a78c 100644 --- a/ui/src/main/java/org/akraino/validation/ui/service/IntegratedResultService.java +++ b/ui/src/main/java/org/akraino/validation/ui/service/IntegratedResultService.java @@ -36,6 +36,7 @@ import org.akraino.validation.ui.client.nexus.NexusExecutorClient; import org.akraino.validation.ui.entity.LabInfo; import org.akraino.validation.ui.entity.Submission; import org.akraino.validation.ui.entity.ValidationDbTestResult; +import org.apache.commons.httpclient.HttpException; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.web.support.UserUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -60,17 +61,14 @@ public class IntegratedResultService { NexusExecutorClient nexusService; @Autowired - LabService labService; - - @Autowired - DbResultAdapter dbAdapter; + DbAdapter dbAdapter; public List getLabsFromNexus() throws JsonParseException, JsonMappingException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, IOException, IllegalArgumentException, ParseException { List labs = new ArrayList(); for (String cLabSilo : nexusService.getResource(null)) { - for (LabInfo labInfo : labService.getLabs()) { + for (LabInfo labInfo : dbAdapter.getLabs()) { if (labInfo.getSilo().equals(cLabSilo)) { labs.add(labInfo.getLab()); } @@ -82,17 +80,22 @@ public class IntegratedResultService { public List getBlueprintNamesOfLabFromNexus(@Nonnull String lab) throws JsonParseException, JsonMappingException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, IOException, IllegalArgumentException, ParseException { - LabInfo labInfo = labService.getLab(lab); + LabInfo labInfo = dbAdapter.getLab(lab); if (labInfo == null) { throw new IllegalArgumentException("Could not retrieve lab : " + lab.toString()); } - List cNames = nexusService.getResource(labService.getLab(lab).getSilo()); List rNames = new ArrayList(); - for (String cName : cNames) { - if (cName.equals("family") || cName.equals("ta") || cName.equals("job")) { - continue; + try { + List cNames = nexusService.getResource(dbAdapter.getLab(lab).getSilo() + "/bluval_results"); + for (String cName : cNames) { + if (cName.equals("family") || cName.equals("ta") || cName.equals("job")) { + continue; + } + rNames.add(cName); } - rNames.add(cName); + } catch (HttpException ex) { + LOGGER.warn(EELFLoggerDelegate.auditLogger, + "Error when retrieving blueprint names from nexus" + UserUtils.getStackTrace(ex)); } return rNames; } @@ -100,28 +103,35 @@ public class IntegratedResultService { public List getBlueprintVersionsFromNexus(@Nonnull String name, @Nonnull String lab) throws JsonParseException, JsonMappingException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, IOException, IllegalArgumentException, ParseException { - LabInfo labInfo = labService.getLab(lab); + LabInfo labInfo = dbAdapter.getLab(lab); if (labInfo == null) { throw new IllegalArgumentException("Could not retrieve lab : " + lab.toString()); } - return nexusService.getResource(labInfo.getSilo(), name); + return nexusService.getResource(labInfo.getSilo() + "/bluval_results", name); } public List getBlueprintTimeStampsFromNexus(@Nonnull String name, @Nonnull String version, @Nonnull String lab) throws JsonParseException, JsonMappingException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, IOException, ParseException { - LabInfo labInfo = labService.getLab(lab); + LabInfo labInfo = dbAdapter.getLab(lab); if (labInfo == null) { throw new IllegalArgumentException("Could not retrieve lab : " + lab.toString()); } - return nexusService.getResource(labInfo.getSilo(), name, version); + List timestamps = new ArrayList(); + try { + timestamps = nexusService.getResource(labInfo.getSilo() + "/bluval_results", name, version); + } catch (HttpException ex) { + LOGGER.warn(EELFLoggerDelegate.auditLogger, + "Error when retrieving blueprint names from nexus" + UserUtils.getStackTrace(ex)); + } + return timestamps; } public List getResultsFromNexus(@Nonnull String name, @Nonnull String version, @Nonnull String lab, int noTimestamps) throws JsonParseException, JsonMappingException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, IOException, IllegalArgumentException, ParseException { - LabInfo labInfo = labService.getLab(lab); + LabInfo labInfo = dbAdapter.getLab(lab); if (labInfo == null) { throw new IllegalArgumentException("Could not retrieve lab : " + lab.toString()); } @@ -132,7 +142,7 @@ public class IntegratedResultService { @Nonnull String timestamp) throws JsonParseException, JsonMappingException, IOException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, NullPointerException, ParseException { - LabInfo labInfo = labService.getLab(lab); + LabInfo labInfo = dbAdapter.getLab(lab); if (labInfo == null) { throw new IllegalArgumentException("Could not retrieve lab : " + lab.toString()); } @@ -148,7 +158,7 @@ public class IntegratedResultService { @Nonnull String lab, Boolean allLayers, Boolean optional, boolean outcome) throws JsonParseException, JsonMappingException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, NullPointerException, IOException, ParseException { - LabInfo labInfo = labService.getLab(lab); + LabInfo labInfo = dbAdapter.getLab(lab); if (labInfo == null) { throw new IllegalArgumentException("Could not retrieve lab : " + lab.toString()); } @@ -165,7 +175,7 @@ public class IntegratedResultService { @Nonnull String lab, @Nonnull List layers, Boolean optional, boolean outcome) throws JsonParseException, JsonMappingException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, NullPointerException, IOException, ParseException { - LabInfo labInfo = labService.getLab(lab); + LabInfo labInfo = dbAdapter.getLab(lab); if (labInfo == null) { throw new IllegalArgumentException("Could not retrieve lab : " + lab.toString()); } @@ -182,7 +192,7 @@ public class IntegratedResultService { @Nonnull String lab, @Nonnull Date date) throws JsonParseException, JsonMappingException, IOException, ParseException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, NullPointerException { - LabInfo labInfo = labService.getLab(lab); + LabInfo labInfo = dbAdapter.getLab(lab); if (labInfo == null) { throw new IllegalArgumentException("Could not retrieve lab : " + lab.toString()); } @@ -236,7 +246,7 @@ public class IntegratedResultService { @Nonnull String timestamp) throws JsonParseException, JsonMappingException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, NullPointerException, IOException, ParseException { - LabInfo actualLabInfo = labService.getLab(lab); + LabInfo actualLabInfo = dbAdapter.getLab(lab); if (actualLabInfo == null) { return null; } @@ -248,7 +258,7 @@ public class IntegratedResultService { @Nonnull String lab, Boolean allLayers, Boolean optional, boolean outcome) throws JsonParseException, JsonMappingException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, IOException, NullPointerException, ParseException { - LabInfo actualLabInfo = labService.getLab(lab); + LabInfo actualLabInfo = dbAdapter.getLab(lab); if (actualLabInfo == null) { return null; } @@ -279,7 +289,7 @@ public class IntegratedResultService { @Nonnull String lab, List layers, Boolean optional, boolean outcome) throws JsonParseException, JsonMappingException, KeyManagementException, ClientHandlerException, UniformInterfaceException, NoSuchAlgorithmException, IOException, NullPointerException, ParseException { - LabInfo actualLabInfo = labService.getLab(lab); + LabInfo actualLabInfo = dbAdapter.getLab(lab); if (actualLabInfo == null) { return null; } diff --git a/ui/src/main/java/org/akraino/validation/ui/service/JenkinsJobNotificationService.java b/ui/src/main/java/org/akraino/validation/ui/service/JenkinsJobNotificationService.java index c292b79..95cb1c1 100644 --- a/ui/src/main/java/org/akraino/validation/ui/service/JenkinsJobNotificationService.java +++ b/ui/src/main/java/org/akraino/validation/ui/service/JenkinsJobNotificationService.java @@ -45,14 +45,11 @@ public class JenkinsJobNotificationService { private DbSubmissionAdapter submissionService; @Autowired - private DbResultAdapter dbAdapter; + private DbAdapter dbAdapter; @Autowired private IntegratedResultService iService; - @Autowired - private LabService labService; - @Autowired private ValidationTestResultDAO vTestResultDAO; @@ -66,7 +63,7 @@ public class JenkinsJobNotificationService { LOGGER.debug(EELFLoggerDelegate.debugLogger, "No related submission was found"); return; } - LabInfo labInfo = labService.getLab(submission.getTimeslot().getLabInfo().getLab()); + LabInfo labInfo = dbAdapter.getLab(submission.getTimeslot().getLabInfo().getLab()); if (labInfo == null) { throw new IllegalArgumentException( "Could not retrieve lab : " + submission.getTimeslot().getLabInfo().getLab().toString()); diff --git a/ui/src/main/java/org/akraino/validation/ui/service/LabService.java b/ui/src/main/java/org/akraino/validation/ui/service/LabService.java deleted file mode 100644 index 81fe7b1..0000000 --- a/ui/src/main/java/org/akraino/validation/ui/service/LabService.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. You may obtain - * a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -package org.akraino.validation.ui.service; - -import java.util.List; - -import org.akraino.validation.ui.dao.LabDAO; -import org.akraino.validation.ui.entity.LabInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class LabService { - - @Autowired - private LabDAO labDAO; - - public void saveLab(LabInfo lab) { - labDAO.saveOrUpdate(lab); - } - - public LabInfo getLab(String lab) { - return labDAO.getLab(lab); - } - - public LabInfo getLabBasedOnSilo(String silo) { - return labDAO.getLabBasedOnSilo(silo); - } - - public List getLabs() { - return labDAO.getLabs(); - } - - public void deleteAll() { - labDAO.deleteAll(); - } - -} diff --git a/ui/src/main/java/org/akraino/validation/ui/service/TimeslotService.java b/ui/src/main/java/org/akraino/validation/ui/service/TimeslotService.java deleted file mode 100644 index 6445d7f..0000000 --- a/ui/src/main/java/org/akraino/validation/ui/service/TimeslotService.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. You may obtain - * a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -package org.akraino.validation.ui.service; - -import java.util.List; - -import org.akraino.validation.ui.dao.TimeslotDAO; -import org.akraino.validation.ui.entity.Timeslot; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class TimeslotService { - - @Autowired - private TimeslotDAO timeslotDAO; - - public void saveTimeslot(Timeslot timeslot) { - timeslotDAO.saveOrUpdate(timeslot); - } - - public List getTimeslots() { - return timeslotDAO.getTimeslots(); - } - - public void deleteAll() { - timeslotDAO.deleteAll(); - } - -} diff --git a/ui/src/main/webapp/WEB-INF/defs/definitions.xml b/ui/src/main/webapp/WEB-INF/defs/definitions.xml index f64ea8f..c8cca69 100644 --- a/ui/src/main/webapp/WEB-INF/defs/definitions.xml +++ b/ui/src/main/webapp/WEB-INF/defs/definitions.xml @@ -38,4 +38,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui/src/main/webapp/app/BluvalUI/App.Services.js b/ui/src/main/webapp/app/BluvalUI/App.Services.js index b5123e1..635286a 100644 --- a/ui/src/main/webapp/app/BluvalUI/App.Services.js +++ b/ui/src/main/webapp/app/BluvalUI/App.Services.js @@ -14,123 +14,123 @@ * limitations under the License. */ -var services = angular.module('App.Services', ['App.Config']); +var services = angular.module('App.Services', [ 'App.Config' ]); services.factory('restAPISvc', [ - '$http', - 'appContext', - function ($http, appContext) { - var svc = []; - svc.getRestAPI = function (path, cb) { - return $http({ - method: 'GET', - url: appContext + path, - headers: { - 'Content-Type': "application/json", - 'Accept': "application/json" - } - }).then( - function (response) { - if (response.status == 200) { - cb(response.data); - } else { - /* eslint-disable no-console */ - console.log("Get REST API error: " - + response.statusText); - /* eslint-enable no-console */ - cb(null); + '$http', + 'appContext', + function($http, appContext) { + var svc = []; + svc.getRestAPI = function(path, cb) { + return $http({ + method : 'GET', + url : appContext + path, + headers : { + 'Content-Type' : "application/json", + 'Accept' : "application/json" } - }, - function (error) { - /* eslint-disable no-console */ - console.log("Get REST API error: " - + error.statusText); - /* eslint-enable no-console */ - cb(null); - }); - }; - svc.postRestAPI = function (path, json, cb) { - return $http({ - method: 'POST', - url: appContext + path, - headers: { - 'Content-Type': "application/json", - 'Accept': "application/json" - }, - data: json - }).then( - function (response) { - if (response.status == 200 - || response.status == 201) { - cb(response.data); - } else { - /* eslint-disable no-console */ - console.log("Post REST API error: " - + response.statusText); - /* eslint-enable no-console */ - cb(null); - } - }, - function (error) { - /* eslint-disable no-console */ - console.log("Post REST API error: " - + error.statusText); - /* eslint-enable no-console */ - cb(null); - }); - }; - svc.deleteRestAPI = function (path, json) { - return $http({ - method: 'DELETE', - url: appContext + path, - headers: { - 'Content-Type': "application/json", - 'Accept': "application/json" - }, - data: json - }).then( - function (response) { - if (response.status !== 200) { - /* eslint-disable no-console */ - console.log("Delete REST API error: " - + response.statusText); - /* eslint-enable no-console */ - } - }, - function (error) { - /* eslint-disable no-console */ - console.log("Delete REST API error: " - + error.statusText); - /* eslint-enable no-console */ - }); - }; - return svc; - }]); + }).then( + function(response) { + if (response.status == 200) { + cb(response.data); + } else { + /* eslint-disable no-console */ + console.log("Get REST API error: " + + response.statusText); + /* eslint-enable no-console */ + cb(null); + } + }, + function(error) { + /* eslint-disable no-console */ + console.log("Get REST API error: " + + error.statusText); + /* eslint-enable no-console */ + cb(null); + }); + }; + svc.postRestAPI = function(path, json, cb) { + return $http({ + method : 'POST', + url : appContext + path, + headers : { + 'Content-Type' : "application/json", + 'Accept' : "application/json" + }, + data : json + }).then( + function(response) { + if (response.status == 200 + || response.status == 201) { + cb(response.data); + } else { + /* eslint-disable no-console */ + console.log("Post REST API error: " + + response.statusText); + /* eslint-enable no-console */ + cb(null); + } + }, + function(error) { + /* eslint-disable no-console */ + console.log("Post REST API error: " + + error.statusText); + /* eslint-enable no-console */ + cb(null); + }); + }; + svc.deleteRestAPI = function(path, json, cb) { + return $http({ + method : 'DELETE', + url : appContext + path, + headers : { + 'Content-Type' : "application/json", + 'Accept' : "application/json" + }, + data : json + }).then( + function(response) { + if (response.status !== 200) { + /* eslint-disable no-console */ + console.log("Delete REST API error: " + + response.statusText); + /* eslint-enable no-console */ + cb(null); + } + cb(response.data); + }, + function(error) { + /* eslint-disable no-console */ + console.log("Delete REST API error: " + + error.statusText); + /* eslint-enable no-console */ + cb(null); + }); + }; + return svc; + } ]); -services.factory("sharedContext", function () { +services.factory("sharedContext", function() { var context = []; - var addData = function (key, value) { + var addData = function(key, value) { var data = { - key: key, - value: value + key : key, + value : value }; context.push(data); } - var getData = function (key) { + var getData = function(key) { var data = []; - angular - .forEach( - context, - function (pair) { - if (pair.key === key) { - data = pair.value; - } - }); + angular.forEach(context, function(pair) { + if (pair.key === key) { + data = pair.value; + } + }); return data; } return { - addData: addData, - getData: getData + addData : addData, + getData : getData } }); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstances.html b/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstances.html new file mode 100644 index 0000000..e112535 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstances.html @@ -0,0 +1,181 @@ + + + + + + + + + + +Get Blueprint Instances + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstances.js b/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstances.js new file mode 100644 index 0000000..f56d1d5 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstances.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("GetBlueprintInstances", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstancesController.js b/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstancesController.js new file mode 100644 index 0000000..7ce4249 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstancesController.js @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('GetBlueprintInstances'); +app.controller('GetBlueprintInstancesController', function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingBlueprintInstances = true; + $scope.blueprintInstanceInfos = []; + restAPISvc.getRestAPI("/api/v1/blueprintinstance/", function(data) { + if (data) { + $scope.blueprintInstanceInfos = data; + } else { + confirm("No blueprint instances found"); + } + $scope.loadingBlueprintInstances = false; + }); + } +}); diff --git a/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstancesTemplate.html b/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstancesTemplate.html new file mode 100644 index 0000000..a6a8fdc --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/GetBlueprintInstancesTemplate.html @@ -0,0 +1,89 @@ + + +
+ +
+

Get Blueprint Instances

+ +
+ +
+ +

+ + + + + + + + + + + + + + + + + + + +
Id Version Blueprint Layer(s) Timeslot(s) 
+ {{ blueprintInstanceInfo.blueprintInstanceId }} + {{ blueprintInstanceInfo.version }} + {{ blueprintInstanceInfo.blueprint.blueprintName + }} +
    +
  • {{layer.layer}}
  • +
+
+
    +
  • Lab: + {{timeslot.labInfo.lab}}, Start Date and + Time: {{timeslot.startDateTime}}
  • +
+
+ + +
+
diff --git a/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/Route.js b/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/Route.js new file mode 100644 index 0000000..f8ba348 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetBlueprintInstances/Route.js @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2 + .config(function($routeProvider) { + $routeProvider + .otherwise({ + templateUrl : 'app/BluvalUI/GetBlueprintInstances/GetBlueprintInstancesTemplate.html', + controller : "GetBlueprintInstancesController" + }); + }); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprints.html b/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprints.html new file mode 100644 index 0000000..69c64c7 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprints.html @@ -0,0 +1,179 @@ + + + + + + + + + + +Get Blueprints + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprints.js b/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprints.js new file mode 100644 index 0000000..a631bf7 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprints.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("GetBlueprints", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprintsController.js b/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprintsController.js new file mode 100644 index 0000000..0c3b289 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprintsController.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('GetBlueprints'); +app.controller('GetBlueprintsController', function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingBlueprints = true; + $scope.blueprintInfos = []; + restAPISvc.getRestAPI("/api/v1/blueprint/", function(data) { + if (data) { + $scope.blueprintInfos = data; + } else { + confirm("No blueprints found"); + } + $scope.loadingBlueprints = false; + }); + } + +}); diff --git a/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprintsTemplate.html b/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprintsTemplate.html new file mode 100644 index 0000000..45c16b5 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetBlueprints/GetBlueprintsTemplate.html @@ -0,0 +1,46 @@ + + +
+
+

Get Blueprints

+ +
+ +
+ +

+ + + + + + + + + + + + + +
Id Name 
+ {{ blueprintInfo.blueprintId }} + {{ blueprintInfo.blueprintName }}
+
+
diff --git a/ui/src/main/webapp/app/BluvalUI/GetBlueprints/Route.js b/ui/src/main/webapp/app/BluvalUI/GetBlueprints/Route.js new file mode 100644 index 0000000..df08610 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetBlueprints/Route.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2.config(function($routeProvider) { + $routeProvider.otherwise({ + templateUrl : 'app/BluvalUI/GetBlueprints/GetBlueprintsTemplate.html', + controller : "GetBlueprintsController" + }); +}); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabs.html b/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabs.html new file mode 100644 index 0000000..a8a927d --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabs.html @@ -0,0 +1,179 @@ + + + + + + + + + + +Get Lab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabs.js b/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabs.js new file mode 100644 index 0000000..f0bebf4 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabs.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("GetLabs", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabsController.js b/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabsController.js new file mode 100644 index 0000000..fbcfb4f --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabsController.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('GetLabs'); +app.controller('GetLabsController', function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingLabs = true; + $scope.labInfos = []; + restAPISvc.getRestAPI("/api/v1/lab/", function(data) { + if (data) { + $scope.labInfos = data; + } else { + confirm("No labs found"); + } + $scope.loadingLabs = false; + }); + } + +}); diff --git a/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabsTemplate.html b/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabsTemplate.html new file mode 100644 index 0000000..effaf88 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetLabs/GetLabsTemplate.html @@ -0,0 +1,50 @@ + + +
+
+

Get Labs

+ +
+ +
+ +

+ + + + + + + + + + + + + + + +
Id Lab Silo 
+ {{ labInfo.labId }} + {{ labInfo.lab }}{{ + labInfo.silo }}
+
+
diff --git a/ui/src/main/webapp/app/BluvalUI/GetLabs/Route.js b/ui/src/main/webapp/app/BluvalUI/GetLabs/Route.js new file mode 100644 index 0000000..8cbc93b --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetLabs/Route.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2.config(function($routeProvider) { + $routeProvider.otherwise({ + templateUrl : 'app/BluvalUI/GetLabs/GetLabsTemplate.html', + controller : "GetLabsController" + }); +}); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayers.html b/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayers.html new file mode 100644 index 0000000..a67ad15 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayers.html @@ -0,0 +1,179 @@ + + + + + + + + + + +Get Layers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayers.js b/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayers.js new file mode 100644 index 0000000..8905670 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayers.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("GetLayers", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayersController.js b/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayersController.js new file mode 100644 index 0000000..8dcf267 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayersController.js @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('GetLayers'); +app.controller('GetLayersController', function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingLayers = true; + $scope.layerInfos = []; + restAPISvc.getRestAPI("/api/v1/layer/", function(data) { + if (data) { + $scope.layerInfos = data; + } else { + confirm("No blueprint layers found"); + } + $scope.loadingLayers = false; + }); + } +}); diff --git a/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayersTemplate.html b/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayersTemplate.html new file mode 100644 index 0000000..48defa7 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetLayers/GetLayersTemplate.html @@ -0,0 +1,47 @@ + + +
+
+

Get Layers

+ +
+ +
+ +

+ + + + + + + + + + + + + +
Id Layer 
+ {{ layerInfo.blueprintLayerId }} + {{ layerInfo.layer }}
+ +
+
diff --git a/ui/src/main/webapp/app/BluvalUI/GetLayers/Route.js b/ui/src/main/webapp/app/BluvalUI/GetLayers/Route.js new file mode 100644 index 0000000..dd1dd20 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetLayers/Route.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2.config(function($routeProvider) { + $routeProvider.otherwise({ + templateUrl : 'app/BluvalUI/GetLayers/GetLayersTemplate.html', + controller : "GetLayersController" + }); +}); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslots.html b/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslots.html new file mode 100644 index 0000000..0025a7a --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslots.html @@ -0,0 +1,179 @@ + + + + + + + + + + +Get Timeslots + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslots.js b/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslots.js new file mode 100644 index 0000000..ef5eb4e --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslots.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("GetTimeslots", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslotsController.js b/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslotsController.js new file mode 100644 index 0000000..eb94721 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslotsController.js @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('GetTimeslots'); +app.controller('GetTimeslotsController', function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingTimeslots = true; + $scope.timeslotInfos = []; + restAPISvc.getRestAPI("/api/v1/timeslot/", function(data) { + if (data) { + $scope.timeslotInfos = data; + } else { + confirm("No timeslots found"); + } + $scope.loadingTimeslots = false; + }); + } +}); diff --git a/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslotsTemplate.html b/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslotsTemplate.html new file mode 100644 index 0000000..320dcbe --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetTimeslots/GetTimeslotsTemplate.html @@ -0,0 +1,51 @@ + + +
+
+

Get Timeslots

+ +
+ +
+ +

+ + + + + + + + + + + + + + + +
Id Start date and time Lab 
+ {{ timeslotInfo.timeslotId }} + {{ timeslotInfo.startDateTime }} + {{ timeslotInfo.labInfo.lab }}
+ +
+
diff --git a/ui/src/main/webapp/app/BluvalUI/GetTimeslots/Route.js b/ui/src/main/webapp/app/BluvalUI/GetTimeslots/Route.js new file mode 100644 index 0000000..845739b --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/GetTimeslots/Route.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2.config(function($routeProvider) { + $routeProvider.otherwise({ + templateUrl : 'app/BluvalUI/GetTimeslots/GetTimeslotsTemplate.html', + controller : "GetTimeslotsController" + }); +}); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstance.html b/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstance.html new file mode 100644 index 0000000..a4e3dc4 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstance.html @@ -0,0 +1,184 @@ + + + + + + + + + + +Modify Blueprint Instance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstance.js b/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstance.js new file mode 100644 index 0000000..0a2af3c --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstance.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("ModifyBlueprintInstance", [ 'ngRoute', + 'ngMessages', 'modalServices', 'ngCookies', 'b2b.att', 'gridster', + 'ui.bootstrap', 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstanceController.js b/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstanceController.js new file mode 100644 index 0000000..fb6b5ca --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstanceController.js @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('ModifyBlueprintInstance'); +app + .controller( + 'ModifyBlueprintInstanceController', + function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingBlueprintInstances = true; + $scope.loadingLayers = true; + $scope.blueprintInstanceInfos = []; + $scope.declerativeInsts = []; + $scope.selectedBlueprintInstance = ''; + $scope.layers = []; + $scope.layerInfos = []; + $scope.selectedLayer = ''; + $scope.configuredLayers = []; + $scope.oldLayers = []; + $scope.newLayers = []; + restAPISvc + .getRestAPI( + "/api/v1/blueprintinstance/", + function(data) { + if (data) { + $scope.blueprintInstanceInfos = data; + angular + .forEach( + data, + function( + blueprintInstance) { + var temp = "id: " + + blueprintInstance.blueprintInstanceId + + " name: " + + blueprintInstance["blueprint"]["blueprintName"] + + " version: " + + blueprintInstance["version"]; + $scope.declerativeInsts + .push(temp); + restAPISvc + .getRestAPI( + "/api/v1/layer/", + function( + data2) { + if (data2) { + $scope.layerInfos = data2; + angular + .forEach( + data2, + function( + layer) { + if ($scope.layers + .indexOf(layer.layer) === -1) { + $scope.layers + .push(layer.layer); + } + }); + } else { + confirm("No layers found"); + } + }); + }); + } else { + confirm("No blueprint instances found"); + } + $scope.loadingBlueprintInstances = false; + $scope.loadingLayers = false; + }); + } + + $scope.selectedBlueprintInstanceChange = function() { + $scope.oldLayers = []; + $scope.newLayers = []; + var finalBlueprintInstanceInfo = ''; + var id = $scope.selectedBlueprintInstance + .substring($scope.selectedBlueprintInstance + .indexOf("id:") + 4, + $scope.selectedBlueprintInstance + .indexOf("name") - 1); + angular + .forEach( + $scope.blueprintInstanceInfos, + function(blueprintInstanceInfo) { + if (blueprintInstanceInfo.blueprintInstanceId + .toString().trim() === id + .toString().trim()) { + finalBlueprintInstanceInfo = blueprintInstanceInfo; + } + }); + if (!finalBlueprintInstanceInfo) { + confirm("Error in blueprint instance data"); + return; + } + angular.forEach( + finalBlueprintInstanceInfo.blueprintLayers, + function(layer) { + $scope.oldLayers.push(layer.layer); + }); + } + + $scope.addConfiguredLayer = function(configuredLayer) { + if ($scope.configuredLayers.indexOf(configuredLayer + .trim()) === -1) { + $scope.configuredLayers.push(configuredLayer); + } + } + + $scope.deleteConfiguredLayer = function(index) { + $scope.configuredLayers.splice(index, 1); + } + + $scope.modify = function() { + if (!$scope.selectedBlueprintInstance + || !$scope.configuredLayers + || $scope.configuredLayers.length === 0) { + confirm("You must specify all the data"); + return; + } + var finalBlueprintInstanceInfo = ''; + var id = $scope.selectedBlueprintInstance + .substring($scope.selectedBlueprintInstance + .indexOf("id:") + 4, + $scope.selectedBlueprintInstance + .indexOf("name") - 1); + angular + .forEach( + $scope.blueprintInstanceInfos, + function(blueprintInstanceInfo) { + if (blueprintInstanceInfo.blueprintInstanceId + .toString().trim() === id + .toString().trim()) { + finalBlueprintInstanceInfo = blueprintInstanceInfo; + } + }); + if (!finalBlueprintInstanceInfo) { + confirm("Error in blueprint instance data"); + return; + } + + var blueprintLayers = []; + angular.forEach($scope.layerInfos, function(layerInfo) { + if ($scope.configuredLayers + .indexOf(layerInfo.layer) !== -1) { + blueprintLayers.push(layerInfo); + } + }); + if (!blueprintLayers || blueprintLayers.length === 0) { + confirm("Error in blueprint layers data"); + return; + } + finalBlueprintInstanceInfo.blueprintLayers = blueprintLayers; + restAPISvc + .postRestAPI( + "/api/v1/blueprintinstance/", + finalBlueprintInstanceInfo, + function(data) { + if (data) { + var confirmText = "The blueprint instance has been modified successfully."; + confirm(confirmText); + } else { + confirm("Error when modifying the blueprint instance"); + } + initialize(); + }); + } + }); diff --git a/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstanceTemplate.html b/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstanceTemplate.html new file mode 100644 index 0000000..c24d821 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstanceTemplate.html @@ -0,0 +1,132 @@ + + +
+ +
+

Modify Blueprint Instance

+ +
+
+ +
+
+
+
    +
  • + {{oldLayer}}
  • +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+
+ +
    +
  • {{configuredLayer}}
  • +
+ +
+ +
+
+
+
diff --git a/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/Route.js b/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/Route.js new file mode 100644 index 0000000..9ffcad4 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/ModifyBlueprintInstance/Route.js @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2 + .config(function($routeProvider) { + $routeProvider + .otherwise({ + templateUrl : 'app/BluvalUI/ModifyBlueprintInstance/ModifyBlueprintInstanceTemplate.html', + controller : "ModifyBlueprintInstanceController" + }); + }); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLab.html b/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLab.html new file mode 100644 index 0000000..add858f --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLab.html @@ -0,0 +1,179 @@ + + + + + + + + + + +Modify Lab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLab.js b/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLab.js new file mode 100644 index 0000000..b5e498a --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLab.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("ModifyLab", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLabController.js b/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLabController.js new file mode 100644 index 0000000..f832bf6 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLabController.js @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('ModifyLab'); +app + .controller( + 'ModifyLabController', + function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingLabs = true; + $scope.labInfos = []; + $scope.labs = []; + $scope.selectedLab = ''; + $scope.oldName = ''; + $scope.oldSilo = ''; + $scope.newData = {}; + restAPISvc.getRestAPI("/api/v1/lab/", function(data) { + if (data) { + $scope.labInfos = data; + angular.forEach(data, function(lab) { + $scope.labs.push(lab.lab); + }); + } else { + confirm("No labs found"); + } + $scope.loadingLabs = false; + }); + } + + $scope.selectedLabChange = function() { + $scope.oldName = ''; + $scope.oldSilo = ''; + $scope.newData = {}; + var finalLabInfo = ''; + angular.forEach($scope.labInfos, function(labInfo) { + if ($scope.selectedLab.trim() === labInfo.lab + .trim()) { + finalLabInfo = labInfo; + } + }); + if (!finalLabInfo) { + confirm("Error in lab info"); + return; + } + $scope.oldName = finalLabInfo.lab; + $scope.oldSilo = finalLabInfo.silo; + } + + $scope.modify = function() { + if (!$scope.selectedLab || !$scope.newData.name + || !$scope.newData.silo) { + confirm("You must specify all the values"); + return; + } + var finalLabInfo = ''; + angular.forEach($scope.labInfos, function(labInfo) { + if ($scope.selectedLab.trim() === labInfo.lab + .trim()) { + finalLabInfo = labInfo; + } + }); + if (!finalLabInfo) { + confirm("Error in lab info"); + return; + } + finalLabInfo.lab = $scope.newData.name; + finalLabInfo.silo = $scope.newData.silo; + restAPISvc + .postRestAPI( + "/api/v1/lab/", + finalLabInfo, + function(data) { + if (data) { + var confirmText = "The lab has been modified successfully." + confirm(confirmText); + } else { + confirm("Error when modifying the lab"); + } + initialize(); + }); + } + }); diff --git a/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLabTemplate.html b/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLabTemplate.html new file mode 100644 index 0000000..99b133f --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/ModifyLab/ModifyLabTemplate.html @@ -0,0 +1,76 @@ + + +
+
+

Modify Lab

+ +
+
+ +
+
+
+ +
+ +
+ +
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+ +
+
+
diff --git a/ui/src/main/webapp/app/BluvalUI/ModifyLab/Route.js b/ui/src/main/webapp/app/BluvalUI/ModifyLab/Route.js new file mode 100644 index 0000000..7a0700f --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/ModifyLab/Route.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2.config(function($routeProvider) { + $routeProvider.otherwise({ + templateUrl : 'app/BluvalUI/ModifyLab/ModifyLabTemplate.html', + controller : "ModifyLabController" + }); +}); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmissionController.js b/ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmissionController.js index f0ac27c..3468b25 100644 --- a/ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmissionController.js +++ b/ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmissionController.js @@ -24,14 +24,17 @@ app function initialize() { $scope.blueprintInstances = []; + $scope.blueprintInstance = ''; $scope.blueprintNames = []; $scope.blueprintVersions = []; + $scope.declerativeTimeslots = []; $scope.blueprintLayers = []; $scope.optionals = []; - $scope.selectedBlueprintName = {}; - $scope.selectedBlueprintVersion = {}; - $scope.selectedBlueprintLayer = {}; - $scope.selectedOptional = ""; + $scope.selectedBlueprintName = ''; + $scope.selectedBlueprintVersion = ''; + $scope.selectedDeclerativeTimeslot = ''; + $scope.selectedBlueprintLayer = ''; + $scope.selectedOptional = ''; restAPISvc .getRestAPI( "/api/v1/blueprintinstance/", @@ -51,33 +54,17 @@ app } }); }); - restAPISvc.getRestAPI("/api/v1/timeslots/", function( - data) { - $scope.timeslots = data; - $scope.declerativeTimeslots = []; - angular.forEach($scope.timeslots, - function(timeslot) { - var temp = "id: " + timeslot.timeslotId - + " Start date and time: " - + timeslot.startDateTime - /* - * + " duration(in sec) :" + - * blueprintInstance["timeslot"].duration - */ - + " lab :" - + timeslot.labInfo.lab; - $scope.declerativeTimeslots.push(temp); - }); - }); } - $scope.selectedBlueprintNameChange = function() { + $scope.blueprintInstance = ''; $scope.blueprintVersions = []; + $scope.declerativeTimeslots = []; $scope.blueprintLayers = []; $scope.optionals = []; - $scope.selectedBlueprintVersion = {}; - $scope.selectedBlueprintLayer = {}; - $scope.selectedOptional = ""; + $scope.selectedBlueprintVersion = ''; + $scope.selectedDeclerativeTimeslot = ''; + $scope.selectedBlueprintLayer = ''; + $scope.selectedOptional = ''; angular .forEach( $scope.blueprintInstances, @@ -99,10 +86,13 @@ app if (!$scope.selectedBlueprintName) { return; } + $scope.blueprintInstance = ''; + $scope.declerativeTimeslots = []; $scope.blueprintLayers = []; $scope.optionals = []; - $scope.selectedBlueprintLayer = {}; - $scope.selectedOptional = ""; + $scope.selectedDeclerativeTimeslot = ''; + $scope.selectedBlueprintLayer = ''; + $scope.selectedOptional = ''; angular .forEach( $scope.blueprintInstances, @@ -113,27 +103,53 @@ app if ($scope.selectedBlueprintVersion .trim() === blueprintInstance["version"] .trim()) { - angular - .forEach( - blueprintInstance.blueprintLayers, - function( - layer) { - $scope.blueprintLayers - .push(layer.layer); - }); + $scope.blueprintInstance = blueprintInstance; } } }); + if (!$scope.blueprintInstance + || !$scope.blueprintInstance.timeslots + || $scope.blueprintInstance.timeslots.length === 0) { + confirm("No available timeslots for this blueprint instance in this lab"); + return; + } + angular.forEach($scope.blueprintInstance.timeslots, + function(timeslot) { + var temp = "id: " + timeslot.timeslotId + + " Start date and time: " + + timeslot.startDateTime + /* + * + " duration(in sec) :" + + * blueprintInstance["timeslot"].duration + */ + + " lab :" + timeslot.labInfo.lab; + $scope.declerativeTimeslots.push(temp); + }); + } + + $scope.selectedDeclerativeTimeslotChange = function() { + $scope.blueprintLayers = []; + $scope.optionals = []; + $scope.selectedBlueprintLayer = {}; + $scope.selectedOptional = ""; + angular.forEach( + $scope.blueprintInstance.blueprintLayers, + function(layer) { + $scope.blueprintLayers.push(layer.layer); + }); $scope.blueprintLayers.push("all"); } $scope.selectedBlueprintLayerChange = function() { + $scope.optionals = []; + $scope.selectedOptional = ""; $scope.optionals = [ 'true', 'false' ]; } $scope.submit = function() { if (!$scope.selectedBlueprintName || !$scope.selectedBlueprintVersion + || !$scope.blueprintInstance || !$scope.selectedBlueprintLayer || !$scope.selectedOptional || !$scope.selectedDeclerativeTimeslot) { @@ -149,7 +165,7 @@ app .indexOf("Start date and time:") - 1); angular .forEach( - $scope.timeslots, + $scope.blueprintInstance.timeslots, function(timeslot) { if (selectedDeclerativeTimeslotId .toString().trim() === timeslot.timeslotId @@ -168,23 +184,8 @@ app } ]; } - var blueprintInstanceData = ""; - angular - .forEach( - $scope.blueprintInstances, - function(blueprintInstance) { - if ($scope.selectedBlueprintName - .trim() === blueprintInstance["blueprint"]["blueprintName"] - .trim()) { - if ($scope.selectedBlueprintVersion - .trim() === blueprintInstance["version"] - .trim()) { - blueprintInstanceData = blueprintInstance; - } - } - }); var validationDbTestResult = { - "blueprintInstance" : blueprintInstanceData, + "blueprintInstance" : $scope.blueprintInstance, "allLayers" : allLayers, "wrobotDbTestResults" : wrobotTestResults, "optional" : $scope.selectedOptional, @@ -207,11 +208,12 @@ app confirm("Error when committing the submission"); } }); - $scope.selectedBlueprintName = {}; - $scope.selectedBlueprintVersion = {}; - $scope.selectedBlueprintLayer = {}; + $scope.selectedBlueprintName = ''; + $scope.selectedBlueprintVersion = ''; + $scope.selectedBlueprintLayer = ''; $scope.selectedOptional = ""; - $scope.selectedDeclerativeTimeslot = {}; + $scope.selectedDeclerativeTimeslot = ''; + $scope.blueprintInstance = ''; } }); diff --git a/ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmissionTemplate.html b/ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmissionTemplate.html index 82dda0f..b90581a 100644 --- a/ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmissionTemplate.html +++ b/ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmissionTemplate.html @@ -42,6 +42,17 @@ limitations under the License.
+
+
+ +
+
+
+

- -
-
- -
-
-
-
+
+
+ diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterBlueprint/Route.js b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprint/Route.js new file mode 100644 index 0000000..0ce4f49 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprint/Route.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2.config(function($routeProvider) { + $routeProvider.otherwise({ + templateUrl : 'app/BluvalUI/RegisterBlueprint/RegisterBlueprintTemplate.html', + controller : "RegisterBlueprintController" + }); +}); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstance.html b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstance.html new file mode 100644 index 0000000..72d7cf1 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstance.html @@ -0,0 +1,184 @@ + + + + + + + + + + +Register Blueprint Instance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstance.js b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstance.js new file mode 100644 index 0000000..0899816 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstance.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("RegisterBlueprintInstance", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstanceController.js b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstanceController.js new file mode 100644 index 0000000..e65f4db --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstanceController.js @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('RegisterBlueprintInstance'); +app + .controller( + 'RegisterBlueprintInstanceController', + function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingBlueprints = true; + $scope.loadingLayers = true; + $scope.blueprints = []; + $scope.blueprintInfos = []; + $scope.layers = []; + $scope.layerInfos = []; + $scope.selectedLayer = ''; + $scope.configuredLayers = []; + restAPISvc + .getRestAPI( + "/api/v1/blueprint/", + function(data) { + if (data) { + $scope.blueprintInfos = data; + angular + .forEach( + data, + function( + blueprint) { + $scope.blueprints + .push(blueprint.blueprintName); + restAPISvc + .getRestAPI( + "/api/v1/layer/", + function( + data2) { + if (data2) { + $scope.layerInfos = data2; + angular + .forEach( + data2, + function( + layer) { + if ($scope.layers + .indexOf(layer.layer) === -1) { + $scope.layers + .push(layer.layer); + } + }); + } else { + confirm("No layers found"); + } + }); + }); + } else { + confirm("No blueprints found"); + } + $scope.loadingBlueprints = false; + $scope.loadingLayers = false; + }); + } + + $scope.addConfiguredLayer = function(configuredLayer) { + if ($scope.configuredLayers.indexOf(configuredLayer + .trim()) === -1) { + $scope.configuredLayers.push(configuredLayer); + } + } + + $scope.deleteConfiguredLayer = function(index) { + $scope.configuredLayers.splice(index, 1); + } + + $scope.register = function() { + if (!$scope.selectedBlueprint || !$scope.definedVersion + || !$scope.configuredLayers + || $scope.configuredLayers.length === 0) { + confirm("You must specify all the fields"); + return; + } + var blueprint = ''; + angular + .forEach( + $scope.blueprintInfos, + function(blueprintInfo) { + if (blueprintInfo.blueprintName + .toString().trim() === $scope.selectedBlueprint + .toString().trim()) { + blueprint = blueprintInfo; + } + }); + if (!blueprint) { + confirm("Error in blueprint data"); + return; + } + var blueprintLayers = []; + angular.forEach($scope.layerInfos, function(layerInfo) { + if ($scope.configuredLayers + .indexOf(layerInfo.layer) !== -1) { + blueprintLayers.push(layerInfo); + } + }); + if (!blueprintLayers || blueprintLayers.length === 0) { + confirm("Error in blueprint layers data"); + return; + } + var blueprintInstance = { + "blueprint" : blueprint, + "version" : $scope.definedVersion, + "blueprintLayers" : blueprintLayers + }; + restAPISvc + .postRestAPI( + "/api/v1/blueprintinstance/", + blueprintInstance, + function(data) { + if (data) { + var confirmText = "The blueprint instance has been registered successfully. Blueprint instance id:" + + data.blueprintInstanceId; + confirm(confirmText); + } else { + confirm("Error when registering the blueprint instance"); + } + initialize(); + }); + } + }); diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstanceTemplate.html b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstanceTemplate.html new file mode 100644 index 0000000..db78ca4 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstanceTemplate.html @@ -0,0 +1,129 @@ + + +
+ +
+

Register Blueprint Instance

+ +
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+ + +
+
+
+ +
    +
  • {{configuredLayer}}
  • +
+ +
+ +
+ +
+ +
+
+
diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/Route.js b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/Route.js new file mode 100644 index 0000000..d7b210c --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterBlueprintInstance/Route.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2.config(function($routeProvider) { + $routeProvider.otherwise({ + templateUrl : 'app/BluvalUI/RegisterBlueprintInstance/RegisterBlueprintInstanceTemplate.html', + controller : "RegisterBlueprintInstanceController" + }); +}); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLab.html b/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLab.html new file mode 100644 index 0000000..8a67a26 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLab.html @@ -0,0 +1,179 @@ + + + + + + + + + + +Register Lab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLab.js b/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLab.js new file mode 100644 index 0000000..e8d9e23 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLab.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("RegisterLab", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLabController.js b/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLabController.js new file mode 100644 index 0000000..5a97da2 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLabController.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('RegisterLab'); +app + .controller( + 'RegisterLabController', + function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.definedName = ''; + $scope.definedSilo = ''; + } + + $scope.register = function() { + if (!$scope.definedName || !$scope.definedSilo) { + confirm("You must specify all data fields"); + return; + } + var labInfo = { + "lab" : $scope.definedName, + "silo" : $scope.definedSilo + }; + restAPISvc + .postRestAPI( + "/api/v1/lab/", + labInfo, + function(data) { + if (data) { + var confirmText = "The lab has been registered successfully. Lab id:" + + data.labId; + confirm(confirmText); + } else { + confirm("Error when registering the lab"); + } + initialize(); + }); + } + }); diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLabTemplate.html b/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLabTemplate.html new file mode 100644 index 0000000..51c58c9 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterLab/RegisterLabTemplate.html @@ -0,0 +1,45 @@ + + +
+
+

Register Lab

+ +
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+ +
+
+
diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterLab/Route.js b/ui/src/main/webapp/app/BluvalUI/RegisterLab/Route.js new file mode 100644 index 0000000..758ed9d --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterLab/Route.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2.config(function($routeProvider) { + $routeProvider.otherwise({ + templateUrl : 'app/BluvalUI/RegisterLab/RegisterLabTemplate.html', + controller : "RegisterLabController" + }); +}); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayer.html b/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayer.html new file mode 100644 index 0000000..3326c17 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayer.html @@ -0,0 +1,179 @@ + + + + + + + + + + +Register Layer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayer.js b/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayer.js new file mode 100644 index 0000000..b5cbe33 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayer.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("RegisterLayer", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayerController.js b/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayerController.js new file mode 100644 index 0000000..ec82a4a --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayerController.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('RegisterLayer'); +app + .controller( + 'RegisterLayerController', + function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.definedLayer = ''; + } + + $scope.register = function() { + if (!$scope.definedLayer) { + confirm("You must specify the blueprint layer"); + return; + } + var blueprintLayer = { + "layer" : $scope.definedLayer + }; + restAPISvc + .postRestAPI( + "/api/v1/layer/", + blueprintLayer, + function(data) { + if (data) { + var confirmText = "The blueprint layer has been registered successfully. Blueprint layer id:" + + data.blueprintLayerId; + confirm(confirmText); + } else { + confirm("Error when registering the blueprint layer"); + } + initialize(); + }); + } + }); diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayerTemplate.html b/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayerTemplate.html new file mode 100644 index 0000000..cbf6a1c --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterLayer/RegisterLayerTemplate.html @@ -0,0 +1,37 @@ + + +
+
+

Register Blueprint Layer

+ +
+
+ +
+
+
+ +
+ +
+
+
diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterLayer/Route.js b/ui/src/main/webapp/app/BluvalUI/RegisterLayer/Route.js new file mode 100644 index 0000000..af31e62 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterLayer/Route.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2.config(function($routeProvider) { + $routeProvider.otherwise({ + templateUrl : 'app/BluvalUI/RegisterLayer/RegisterLayerTemplate.html', + controller : "RegisterLayerController" + }); +}); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslot.html b/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslot.html new file mode 100644 index 0000000..1462866 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslot.html @@ -0,0 +1,183 @@ + + + + + + + + + + +Register Timeslot + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslot.js b/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslot.js new file mode 100644 index 0000000..6a6facb --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslot.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("RegisterTimeslot", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslotController.js b/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslotController.js new file mode 100644 index 0000000..952d478 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslotController.js @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('RegisterTimeslot'); +app + .controller( + 'RegisterTimeslotController', + function($scope, restAPISvc, $q) { + + initialize(); + + function initialize() { + $scope.loadingLabs = true; + $scope.loadingBlueprintInstances = true; + $scope.definedStart = "now"; + $scope.labInfos = []; + $scope.labs = []; + $scope.selectedLab = ''; + $scope.blueprintInstances = []; + $scope.declerativeInsts = []; + $scope.selectedDeclerativeInst = ''; + $scope.insts = []; + restAPISvc + .getRestAPI( + "/api/v1/lab/", + function(data) { + if (data) { + $scope.labInfos = data; + angular.forEach(data, function( + lab) { + $scope.labs.push(lab.lab); + }); + restAPISvc + .getRestAPI( + "/api/v1/blueprintinstance/", + function(data2) { + if (data2) { + $scope.blueprintInstances = data2; + angular + .forEach( + $scope.blueprintInstances, + function( + blueprintInstance) { + var temp = "id: " + + blueprintInstance.blueprintInstanceId + + " name: " + + blueprintInstance["blueprint"]["blueprintName"] + + " version: " + + blueprintInstance["version"]; + $scope.declerativeInsts + .push(temp); + }); + } else { + confirm("No blueprint instances found"); + } + }); + } else { + confirm("No labs found"); + } + $scope.loadingLabs = false; + $scope.loadingBlueprintInstances = false; + }); + } + + $scope.addInst = function(selectedDeclerativeInst) { + if ($scope.insts + .indexOf(selectedDeclerativeInst.trim()) === -1) { + $scope.insts.push(selectedDeclerativeInst); + } + } + + $scope.deleteInst = function(index) { + $scope.insts.splice(index, 1); + } + + $scope.register = function() { + if (!$scope.selectedLab || !$scope.insts + || $scope.insts.length === 0) { + confirm("You must specify all the fields"); + return; + } + var lab = ''; + angular.forEach($scope.labInfos, function(labInfo) { + if (labInfo.lab.trim() === $scope.selectedLab) { + lab = labInfo; + } + }); + if (!lab) { + confirm("Error in lab data"); + return; + } + var timeslot = { + "startDateTime" : $scope.definedStart, + "labInfo" : lab + }; + restAPISvc + .postRestAPI( + "/api/v1/timeslot/", + timeslot, + function(data) { + if (data) { + var confirmText = "The timeslot has been registered successfully. Timeslot id:" + + data.timeslotId; + confirm(confirmText); + updateBlusInsts(data); + } else { + confirm("Error when registering the timeslot"); + } + }); + } + + function updateBlusInsts(timeslot) { + var blueprintInstances = []; + angular + .forEach( + $scope.insts, + function(inst) { + var id = inst.substring(inst + .indexOf("id:") + 4, inst + .indexOf("name") - 1); + angular + .forEach( + $scope.blueprintInstances, + function( + blueprintInstance) { + if (blueprintInstance.blueprintInstanceId + .toString() + .trim() === id + .toString() + .trim()) { + blueprintInstances + .push(blueprintInstance); + } + }); + }); + if (!blueprintInstances) { + confirm("Error in blueprint instances data"); + return; + } + var promises = []; + angular + .forEach( + blueprintInstances, + function(blueprintInstance) { + if (blueprintInstance.timeslots) { + blueprintInstance.timeslots + .push(timeslot); + } else { + blueprintInstance.timeslots = [ timeslot ]; + } + promises + .push(restAPISvc + .postRestAPI( + "/api/v1/blueprintinstance/", + blueprintInstance, + function( + data) { + if (data) { + var text = "Blueprint instance: " + + blueprintInstance.blueprint.blueprintName + + " version: " + + blueprintInstance.version + + " updated successfully"; + confirm(text); + } else { + var text2 = "Failed to update blueprint instance: " + + blueprintInstance.blueprint.blueprintName + + " version: " + + blueprintInstance.version; + confirm(text2); + } + })); + }); + $q + .all(promises) + .then( + function() { + confirm("All blueprint instances have been updated"); + $scope.selectedLab = ''; + $scope.selectedDeclerativeInst = ''; + $scope.insts = []; + initialize(); + }); + } + }); diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslotTemplate.html b/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslotTemplate.html new file mode 100644 index 0000000..113cd21 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/RegisterTimeslotTemplate.html @@ -0,0 +1,137 @@ + + +
+ +
+

Register Timeslot

+ +
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+ + +
+
+
+ +
    +
  • {{inst}}
  • +
+ +
+ +
+ +
+ +
+
+
diff --git a/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/Route.js b/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/Route.js new file mode 100644 index 0000000..576b4e2 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/RegisterTimeslot/Route.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2.config(function($routeProvider) { + $routeProvider.otherwise({ + templateUrl : 'app/BluvalUI/RegisterTimeslot/RegisterTimeslotTemplate.html', + controller : "RegisterTimeslotController" + }); +}); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/Route.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/Route.js new file mode 100644 index 0000000..53929d2 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/Route.js @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2 + .config(function($routeProvider) { + $routeProvider + .otherwise({ + templateUrl : 'app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprintTemplate.html', + controller : "UnRegisterBlueprintController" + }); + }); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprint.html b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprint.html new file mode 100644 index 0000000..ae81f56 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprint.html @@ -0,0 +1,180 @@ + + + + + + + + + + +Unregister Blueprint + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprint.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprint.js new file mode 100644 index 0000000..4df1a25 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprint.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("UnRegisterBlueprint", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprintController.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprintController.js new file mode 100644 index 0000000..eefd9a5 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprintController.js @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('UnRegisterBlueprint'); +app + .controller( + 'UnRegisterBlueprintController', + function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingBlueprints = true; + $scope.blueprintInfos = []; + $scope.blueprints = []; + $scope.selectedBlueprint = ''; + restAPISvc.getRestAPI("/api/v1/blueprint/", function( + data) { + if (data) { + $scope.blueprintInfos = data; + angular.forEach(data, function(blueprint) { + $scope.blueprints + .push(blueprint.blueprintName); + }); + } else { + confirm("No blueprints found"); + } + $scope.loadingBlueprints = false; + }); + } + + $scope.unRegister = function() { + if (!$scope.selectedBlueprint) { + confirm("You must select a blueprint"); + return; + } + var finalBlueprintInfo = ''; + angular + .forEach( + $scope.blueprintInfos, + function(blueprintInfo) { + if ($scope.selectedBlueprint.trim() === blueprintInfo.blueprintName + .trim()) { + finalBlueprintInfo = blueprintInfo; + } + }); + if (!finalBlueprintInfo) { + return; + } + restAPISvc + .deleteRestAPI( + "/api/v1/blueprint/", + finalBlueprintInfo, + function(data) { + if (data) { + var confirmText = "The blueprint has been unregistered successfully." + confirm(confirmText); + } else { + confirm("Error when unregistering the blueprint"); + } + initialize(); + }); + } + }); diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprintTemplate.html b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprintTemplate.html new file mode 100644 index 0000000..9d746fb --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprint/UnRegisterBlueprintTemplate.html @@ -0,0 +1,44 @@ + + +
+
+

Unregister Blueprint

+ +
+
+ +
+
+
+ +
+ +
+ +
+ +
+
+
diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/Route.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/Route.js new file mode 100644 index 0000000..db38d90 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/Route.js @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2 + .config(function($routeProvider) { + $routeProvider + .otherwise({ + templateUrl : 'app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstanceTemplate.html', + controller : "UnRegisterBlueprintInstanceController" + }); + }); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstance.html b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstance.html new file mode 100644 index 0000000..03e7e49 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstance.html @@ -0,0 +1,180 @@ + + + + + + + + + + +Unregister Blueprint Instance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstance.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstance.js new file mode 100644 index 0000000..8ab00e8 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstance.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("UnRegisterBlueprintInstance", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstanceController.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstanceController.js new file mode 100644 index 0000000..277f676 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstanceController.js @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('UnRegisterBlueprintInstance'); +app + .controller( + 'UnRegisterBlueprintInstanceController', + function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingBlueprintInstances = true; + $scope.blueprintInstanceInfos = []; + $scope.declerativeInsts = []; + $scope.selectedBlueprintInstance = ''; + restAPISvc + .getRestAPI( + "/api/v1/blueprintinstance/", + function(data) { + if (data) { + $scope.blueprintInstanceInfos = data; + angular + .forEach( + data, + function( + blueprintInstance) { + var temp = "id: " + + blueprintInstance.blueprintInstanceId + + " name: " + + blueprintInstance["blueprint"]["blueprintName"] + + " version: " + + blueprintInstance["version"]; + $scope.declerativeInsts + .push(temp); + }); + } else { + confirm("No blueprint instances found"); + } + $scope.loadingBlueprintInstances = false; + }); + } + + $scope.unRegister = function() { + if (!$scope.selectedBlueprintInstance) { + confirm("You must select a blueprint instance"); + return; + } + var finalBlueprintInstanceInfo = ''; + var id = $scope.selectedBlueprintInstance + .substring($scope.selectedBlueprintInstance + .indexOf("id:") + 4, + $scope.selectedBlueprintInstance + .indexOf("name") - 1); + angular + .forEach( + $scope.blueprintInstanceInfos, + function(blueprintInstanceInfo) { + if (blueprintInstanceInfo.blueprintInstanceId + .toString().trim() === id + .toString().trim()) { + finalBlueprintInstanceInfo = blueprintInstanceInfo; + } + }); + if (!finalBlueprintInstanceInfo) { + confirm("Error in blueprint instance data"); + return; + } + restAPISvc + .deleteRestAPI( + "/api/v1/blueprintinstance/", + finalBlueprintInstanceInfo, + function(data) { + if (data) { + var confirmText = "The blueprint instance has been unregistered successfully." + confirm(confirmText); + } else { + confirm("Error when unregistering the blueprint instance"); + } + initialize(); + }); + } + }); diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstanceTemplate.html b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstanceTemplate.html new file mode 100644 index 0000000..76d968e --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterBlueprintInstance/UnRegisterBlueprintInstanceTemplate.html @@ -0,0 +1,45 @@ + + +
+
+

Unregister Blueprint Instance

+ +
+
+ +
+
+
+ +
+ +
+ +
+ +
+
+
diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/Route.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/Route.js new file mode 100644 index 0000000..59ad1da --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/Route.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2.config(function($routeProvider) { + $routeProvider.otherwise({ + templateUrl : 'app/BluvalUI/UnRegisterLab/UnRegisterLabTemplate.html', + controller : "UnRegisterLabController" + }); +}); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLab.html b/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLab.html new file mode 100644 index 0000000..f9d04ff --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLab.html @@ -0,0 +1,179 @@ + + + + + + + + + + +Unregister Lab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLab.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLab.js new file mode 100644 index 0000000..f3dac5c --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLab.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("UnRegisterLab", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLabController.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLabController.js new file mode 100644 index 0000000..1fede9c --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLabController.js @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('UnRegisterLab'); +app.controller('UnRegisterLabController', function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingLabs = true; + $scope.labInfos = []; + $scope.labs = []; + $scope.selectedLab = ''; + restAPISvc.getRestAPI("/api/v1/lab/", function(data) { + if (data) { + $scope.labInfos = data; + angular.forEach(data, function(lab) { + $scope.labs.push(lab.lab); + }); + } else { + confirm("No labs found"); + } + $scope.loadingLabs = false; + }); + } + + $scope.unRegister = function() { + if (!$scope.selectedLab) { + confirm("You must select a lab"); + return; + } + var finalLabInfo = ''; + angular.forEach($scope.labInfos, function(labInfo) { + if ($scope.selectedLab.trim() === labInfo.lab.trim()) { + finalLabInfo = labInfo; + } + }); + if (!finalLabInfo) { + return; + } + restAPISvc.deleteRestAPI("/api/v1/lab/", finalLabInfo, function(data) { + if (data) { + var confirmText = "The lab has been unregistered successfully." + confirm(confirmText); + } else { + confirm("Error when unregistering the lab"); + } + initialize(); + }); + } +}); diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLabTemplate.html b/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLabTemplate.html new file mode 100644 index 0000000..ee55605 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterLab/UnRegisterLabTemplate.html @@ -0,0 +1,44 @@ + + +
+
+

Unregister Lab

+ +
+
+ +
+
+
+ +
+ +
+ +
+ +
+
+
diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/Route.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/Route.js new file mode 100644 index 0000000..68b158d --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/Route.js @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +appDS2 + .config(function($routeProvider) { + $routeProvider + .otherwise({ + templateUrl : 'app/BluvalUI/UnRegisterLayer/UnRegisterLayerTemplate.html', + controller : "UnRegisterLayerController" + }); + }); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayer.html b/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayer.html new file mode 100644 index 0000000..2c96131 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayer.html @@ -0,0 +1,179 @@ + + + + + + + + + + +Unregister Layer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayer.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayer.js new file mode 100644 index 0000000..a92b508 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayer.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var appDS2 = angular.module("UnRegisterLayer", [ 'ngRoute', 'ngMessages', + 'modalServices', 'ngCookies', 'b2b.att', 'gridster', 'ui.bootstrap', + 'ui.bootstrap.modal', 'App.Services' ]); \ No newline at end of file diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayerController.js b/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayerController.js new file mode 100644 index 0000000..39ea854 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayerController.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('UnRegisterLayer'); +app + .controller( + 'UnRegisterLayerController', + function($scope, restAPISvc) { + + initialize(); + + function initialize() { + $scope.loadingLayers = true; + $scope.layerInfos = []; + $scope.layers = []; + $scope.selectedLayer = ''; + restAPISvc.getRestAPI("/api/v1/layer/", function(data) { + if (data) { + $scope.layerInfos = data; + angular.forEach(data, function(layer) { + $scope.layers.push(layer.layer); + }); + } else { + confirm("No blueprint layers found"); + } + $scope.loadingLayers = false; + }); + } + + $scope.unRegister = function() { + if (!$scope.selectedLayer) { + confirm("You must select a blueprint layer"); + return; + } + var finalLayerInfo = ''; + angular.forEach($scope.layerInfos, function(layerInfo) { + if ($scope.selectedLayer.trim() === layerInfo.layer + .trim()) { + finalLayerInfo = layerInfo; + } + }); + if (!finalLayerInfo) { + return; + } + restAPISvc + .deleteRestAPI( + "/api/v1/layer/", + finalLayerInfo, + function(data) { + if (data) { + var confirmText = "The blueprint layer has been unregistered successfully." + confirm(confirmText); + } else { + confirm("Error when unregistering the blueprint layer"); + } + initialize(); + }); + } + }); diff --git a/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayerTemplate.html b/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayerTemplate.html new file mode 100644 index 0000000..2d6cc9b --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/UnRegisterLayer/UnRegisterLayerTemplate.html @@ -0,0 +1,44 @@ + + +
+
+

Unregister Layer

+ +
+
+ +
+
+
+ +
+ +
+ +
+ +
+
+
diff --git a/ui/src/main/webapp/app/fusion/scripts/DS2-view-models/welcome-content.html b/ui/src/main/webapp/app/fusion/scripts/DS2-view-models/welcome-content.html index 05ee699..0dfd377 100644 --- a/ui/src/main/webapp/app/fusion/scripts/DS2-view-models/welcome-content.html +++ b/ui/src/main/webapp/app/fusion/scripts/DS2-view-models/welcome-content.html @@ -19,9 +19,9 @@ limitations under the License. - + Page Redirection