initial commit with new stratos console app
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/c6a485f9 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/c6a485f9 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/c6a485f9 Branch: refs/heads/master Commit: c6a485f9cc638c1e6f0fea62f2bf3732b2da2c52 Parents: 6aabe7d Author: Dakshika Jayathilaka <[email protected]> Authored: Mon Nov 10 17:28:14 2014 +0530 Committer: Dakshika Jayathilaka <[email protected]> Committed: Mon Nov 10 17:28:14 2014 +0530 ---------------------------------------------------------------------- .../console/.gitignore | 29 + .../console/LICENSE | 201 + .../console/README.md | 13 + .../console/app.js | 31 + .../console/applications.jag | 45 + .../console/applications_form.jag | 93 + .../console/config/acl.json | 6 + .../console/config/console.js | 40 + .../console/config/console.json | 5 + .../console/configure.jag | 45 + .../console/configure_form.jag | 160 + .../applications/application_requests.jag | 49 + .../cartridges/subscription_requests.jag | 43 + .../cartridges/unsubscription_requests.jag | 39 + .../configure/configure_requests.jag | 64 + .../default/applications/applications.json | 23 + .../forms/default/applications/groups.json | 9 + .../forms/default/configure/application.json | 1 + .../default/configure/autoscalingpolicies.json | 19 + .../forms/default/configure/cartridges.json | 67 + .../forms/default/configure/deployments.json | 17 + .../forms/default/configure/docker.json | 65 + .../forms/default/configure/loadbalancer.json | 46 + .../forms/default/configure/multitenant.json | 10 + .../forms/default/configure/partitions.json | 16 + .../forms/default/users/tenants.json | 9 + .../controllers/forms/default/users/users.json | 9 + .../controllers/forms/form_generator.jag | 134 + .../forms/schema/applications/applications.json | 112 + .../forms/schema/applications/groups.json | 46 + .../forms/schema/configure/application.json | 1 + .../schema/configure/autoscalingpolicies.json | 143 + .../forms/schema/configure/cartridges.json | 383 + .../forms/schema/configure/deployments.json | 103 + .../forms/schema/configure/docker.json | 302 + .../forms/schema/configure/loadbalancer.json | 263 + .../forms/schema/configure/multitenant.json | 71 + .../forms/schema/configure/partitions.json | 89 + .../controllers/forms/schema/users/tenants.json | 52 + .../controllers/forms/schema/users/users.json | 68 + .../console/controllers/log/console.jag | 30 + .../console/controllers/login/login.jag | 89 + .../console/controllers/login/logout.jag | 24 + .../console/controllers/login/validator.jag | 33 + .../console/controllers/menu/menu.json | 165 + .../console/controllers/menu/menu_generator.jag | 125 + .../console/controllers/rest/rest_calls.jag | 374 + .../controllers/users/users_requests.jag | 45 + .../controllers/wizard/wizard_requests.jag | 53 + .../console/errorhtml/error-404.html | 1 + .../console/errorhtml/error.html | 1 + .../console/index.jag | 43 + .../console/jaggery.conf | 60 + .../console/login.jag | 36 + .../console/modules/pinch.min.js | 25 + .../console/my_cartridges.jag | 71 + .../console/my_cartridges_info.jag | 65 + .../css/bootstrap-3.2.0/bootstrap.min.css | 5 + .../fonts/glyphicons-halflings-regular.eot | Bin 0 -> 20335 bytes .../fonts/glyphicons-halflings-regular.svg | 229 + .../fonts/glyphicons-halflings-regular.ttf | Bin 0 -> 41280 bytes .../fonts/glyphicons-halflings-regular.woff | Bin 0 -> 23320 bytes .../bootstrap-switch.min.css | 22 + .../console/themes/theme0/css/custom.css | 197 + .../console/themes/theme0/css/custom/style.css | 214 + .../css/font-awesome-4.2.0/font-awesome.min.css | 4 + .../font-awesome-4.2.0/fonts/FontAwesome.otf | Bin 0 -> 85908 bytes .../fonts/fontawesome-webfont.eot | Bin 0 -> 56006 bytes .../fonts/fontawesome-webfont.svg | 520 + .../fonts/fontawesome-webfont.ttf | Bin 0 -> 112160 bytes .../fonts/fontawesome-webfont.woff | Bin 0 -> 65452 bytes .../theme0/css/font-mfizz-1.2/LICENSE.txt | 21 + .../theme0/css/font-mfizz-1.2/font-mfizz.css | 318 + .../theme0/css/font-mfizz-1.2/font-mfizz.eot | Bin 0 -> 43154 bytes .../theme0/css/font-mfizz-1.2/font-mfizz.svg | 1344 +++ .../theme0/css/font-mfizz-1.2/font-mfizz.ttf | Bin 0 -> 45324 bytes .../theme0/css/font-mfizz-1.2/font-mfizz.woff | Bin 0 -> 29056 bytes ...ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff | Bin 0 -> 21744 bytes ...ySUJH_bn48VBG8sNSnhCUOGz7vYGh680lGh-uXM.woff | Bin 0 -> 21704 bytes ...eOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff | Bin 0 -> 20544 bytes ...02ZOKiLJc3WVjuplzHhCUOGz7vYGh680lGh-uXM.woff | Bin 0 -> 21272 bytes .../themes/theme0/css/web-fonts/open_sans.css | 24 + .../console/themes/theme0/css/wizard/custom.css | 87 + .../themes/theme0/helpers/applications.js | 7 + .../themes/theme0/helpers/applications_form.js | 6 + .../themes/theme0/helpers/configure_form.js | 6 + .../console/themes/theme0/helpers/login_body.js | 6 + .../themes/theme0/helpers/my_cartridges.js | 7 + .../console/themes/theme0/helpers/users_form.js | 6 + .../console/themes/theme0/helpers/wizard.js | 6 + .../themes/theme0/images/avatar/6497326.png | Bin 0 -> 142145 bytes .../themes/theme0/images/stratos-logo.png | Bin 0 -> 14423 bytes .../themes/theme0/images/stratos_background.png | Bin 0 -> 131283 bytes .../js/JSONEditor-0.7.12/jsoneditor-0.7.12.js | 7001 +++++++++++ .../theme0/js/bootstrap-3.2.0/bootstrap.min.js | 6 + .../bootstrap-switch.min.js | 22 + .../console/themes/theme0/js/custom.js | 144 + .../console/themes/theme0/js/custom/form.js | 72 + .../console/themes/theme0/js/custom/script.js | 5 + .../theme0/js/jquery-1.11.1/jquery-1.11.1.js | 10308 +++++++++++++++++ .../js/jquery-1.11.1/jquery-1.11.1.min.js | 4 + .../console/themes/theme0/js/login/login.js | 92 + .../themes/theme0/js/noty-2.2.9/noty-2.2.9.js | 10 + .../console/themes/theme0/js/wizard/custom.js | 10 + .../console/themes/theme0/pages/index.hbs | 48 + .../themes/theme0/partials/applications.hbs | 86 + .../theme0/partials/applications_form.hbs | 258 + .../themes/theme0/partials/configure_form.hbs | 314 + .../themes/theme0/partials/error_page.hbs | 17 + .../themes/theme0/partials/index_header.hbs | 28 + .../themes/theme0/partials/index_left_menu.hbs | 10 + .../theme0/partials/index_right_menu_help.hbs | 28 + .../theme0/partials/index_right_menu_log.hbs | 11 + .../themes/theme0/partials/index_sub_header.hbs | 13 + .../themes/theme0/partials/index_title.hbs | 22 + .../themes/theme0/partials/login_body.hbs | 38 + .../themes/theme0/partials/login_header.hbs | 12 + .../themes/theme0/partials/metro_menu.hbs | 28 + .../themes/theme0/partials/my_cartridges.hbs | 123 + .../theme0/partials/my_cartridges_info.hbs | 22 + .../themes/theme0/partials/users_form.hbs | 182 + .../console/themes/theme0/partials/wizard.hbs | 247 + .../themes/theme0/renderers/applications.js | 116 + .../theme0/renderers/applications_form.js | 124 + .../themes/theme0/renderers/configure.js | 116 + .../themes/theme0/renderers/configure_form.js | 124 + .../console/themes/theme0/renderers/index.js | 106 + .../console/themes/theme0/renderers/login.js | 89 + .../themes/theme0/renderers/my_cartridges.js | 119 + .../theme0/renderers/my_cartridges_info.js | 117 + .../console/themes/theme0/renderers/users.js | 116 + .../themes/theme0/renderers/users_form.js | 121 + .../console/themes/theme0/renderers/wizard.js | 123 + .../console/themes/theme0/theme.js | 104 + .../console/users.jag | 45 + .../console/users_form.jag | 72 + .../console/wizard.jag | 115 + 137 files changed, 27958 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/.gitignore ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/.gitignore b/components/org.apache.stratos.manager.console/console/.gitignore new file mode 100644 index 0000000..587b380 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/.gitignore @@ -0,0 +1,29 @@ +# Ignoring system files +.DS_Store + + + + +# Ignoring node modules +node_modules + +*.class +*.iml +.idea +*.~ + +# Package Files # +*.jar +*.war +*.ear +*.zip + +target +.classpath +.settings +.project +*.iml +*.iws +*.ipr +.idea +atlassian-ide-plugin.xml http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/LICENSE ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/LICENSE b/components/org.apache.stratos.manager.console/console/LICENSE new file mode 100644 index 0000000..5c304d1 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + 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. http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/README.md ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/README.md b/components/org.apache.stratos.manager.console/console/README.md new file mode 100644 index 0000000..d904d92 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/README.md @@ -0,0 +1,13 @@ +##Stratos 4.1.0 New UXD Implemantation## +==================================== + +Initial version with improved UXDesigns. + +### New Features ### + +1. json-schema support for all form definitions (www.json-schema.org) [STRATOS-944] +2. JSON Hyper-Schema based UI form implementation +3. JSON auto-correct feature +4. Carbon based user Management +5. Mobile friendly design +6. Improved UXD [STRATOS-810] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/app.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/app.js b/components/org.apache.stratos.manager.console/console/app.js new file mode 100644 index 0000000..b2a33e3 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/app.js @@ -0,0 +1,31 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +var caramel = require('caramel'); + +caramel.configs({ + context: '/stratos-4.1.0-ui', + cache: true, + negotiation: true, + themer: function () { + return 'theme0'; + } +}); http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/applications.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/applications.jag b/components/org.apache.stratos.manager.console/console/applications.jag new file mode 100644 index 0000000..d5c22f3 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/applications.jag @@ -0,0 +1,45 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +//add login validator for pages +include('/controllers/login/validator.jag'); +include('/controllers/menu/menu_generator.jag'); + +var log = new Log("apacheStratos.appconfig"), + error = [], + caramel = require('caramel'), + context = caramel.configs().context, + menuJson = require('/controllers/menu/menu.json'), + userPermissions = session.get('PERMISSIONS'); + +//create left menu +var leftMenu = menuGenerator(context, menuJson.menu, userPermissions); +//create metro block +var metro_menu = metroGenerator('/applications', menuJson.menu, userPermissions); + +caramel.render({ + error: error, + breadcrumbPathLevelOne: 'users', + left_menu: leftMenu, + metro_menu: metro_menu +}); + +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/applications_form.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/applications_form.jag b/components/org.apache.stratos.manager.console/console/applications_form.jag new file mode 100644 index 0000000..199bcc3 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/applications_form.jag @@ -0,0 +1,93 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +include('/controllers/login/validator.jag'); +include('/controllers/menu/menu_generator.jag'); + +var log = new Log("apachestratos.applications_form"), + error = [], + list_data, + caramel = require('caramel'), + context = caramel.configs().context, + menuJson = require('/controllers/menu/menu.json'), + util = require('/controllers/rest/rest_calls.jag'), + uriMatcher = new URIMatcher(request.getRequestURI()), + elements = uriMatcher.match('/{context}/applications/{formtype}/'), + breadcrumbPathLevelOne = 'applications', + isEdit = false, + isForm = false; + userPermissions = session.get('PERMISSIONS'); + +//create left menu +var leftMenu = menuGenerator(context, menuJson.menu, userPermissions); + +if (!elements) { + elements = uriMatcher.match('/{context}/applications/{formtype}/{action}/'); + isForm = true; + + if (elements.action != 'new') { + isEdit = true; + } +} + +try { + var formData = require('controllers/forms/schema/applications/' + elements.formtype + '.json'), + formDataRaw = require('controllers/forms/default/applications/' + elements.formtype + '.json'), + formTitle = formData.title, + buttonText = formData.name; +} catch (e) { + log.error(e.message); + error.push({"errorMessage": e.message}); +} + +var formtype = elements.formtype; + +switch (formtype) { + case "groups": + //TODO need to get group list endpoint + break; + case "applications": + list_data = util.RESTCalls.getApplications(); + if (list_data.applications && list_data.applications.length === 0) { + list_data = null; + } + break; + default: + error.push({"errorMessage":"Incorrect resource path found"}); +} + +var caramelData = { + breadcrumbPathLevelOne: breadcrumbPathLevelOne, + breadcrumbPathLevelTwo: elements.formtype, + left_menu: leftMenu, + isForm: isForm, + formTitle: formTitle, + formDataRaw: JSON.stringify(formDataRaw), + //formDataRaw: JSON.stringify(partition_data.partition[0]), + formData: JSON.stringify(formData), + list_data: list_data, + error: error +} + + +caramel.render(caramelData); + +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/config/acl.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/config/acl.json b/components/org.apache.stratos.manager.console/console/config/acl.json new file mode 100644 index 0000000..3101a67 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/config/acl.json @@ -0,0 +1,6 @@ +{ + "resourcePaths":{ + "/permission/admin/restlogin":"/", + "":"" + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/config/console.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/config/console.js b/components/org.apache.stratos.manager.console/console/config/console.js new file mode 100644 index 0000000..062df56 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/config/console.js @@ -0,0 +1,40 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +var config = function () { + var log = new Log(), + pinch = require('/modules/pinch.min.js').pinch, + config = require('/config/console.json'), + process = require('process'), + localIP = process.getProperty('server.host'), + httpPort = process.getProperty('http.port'), + httpsPort = process.getProperty('https.port'); + + pinch(config, /^/, function (path, key, value) { + if ((typeof value === 'string') && value.indexOf('%https.host%') > -1) { + return value.replace('%https.host%', 'https://' + localIP + ':' + httpsPort); + } else if ((typeof value === 'string') && value.indexOf('%http.host%') > -1) { + return value.replace('%http.host%', 'http://' + localIP + ':' + httpPort); + } + return value; + }); + return config; +}; http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/config/console.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/config/console.json b/components/org.apache.stratos.manager.console/console/config/console.json new file mode 100644 index 0000000..45cd1c1 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/config/console.json @@ -0,0 +1,5 @@ +{ + "backendServerConfiguration": { + "url": "%https.host%/api/v4.1" + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/configure.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/configure.jag b/components/org.apache.stratos.manager.console/console/configure.jag new file mode 100644 index 0000000..86d4689 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/configure.jag @@ -0,0 +1,45 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +//add login validator for pages +include('/controllers/login/validator.jag'); +include('/controllers/menu/menu_generator.jag'); + +var log = new Log("apacheStratos.configure"); +var error = []; +var caramel = require('caramel'), + context = caramel.configs().context, + menuJson = require('/controllers/menu/menu.json'), + userPermissions = session.get('PERMISSIONS'); + +//create left menu +var left_menu = menuGenerator(context, menuJson.menu, userPermissions); +//create metro block +var metro_menu = metroGenerator('/configure', menuJson.menu, userPermissions); + +caramel.render({ + breadcrumbPathLevelOne: 'configure', + metro_menu: metro_menu, + left_menu: left_menu, + error: error +}); + +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/configure_form.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/configure_form.jag b/components/org.apache.stratos.manager.console/console/configure_form.jag new file mode 100644 index 0000000..6106a36 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/configure_form.jag @@ -0,0 +1,160 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +include('/controllers/login/validator.jag'); +include('/controllers/menu/menu_generator.jag'); + +var log = new Log("apachestratos.configure_form"), + error = [], + list_data, + caramel = require('caramel'), + context = caramel.configs().context, + menuJson = require('/controllers/menu/menu.json'), + userPermissions = session.get('PERMISSIONS'), + util = require('/controllers/rest/rest_calls.jag'), + uriMatcher = new URIMatcher(request.getRequestURI()), + elements = uriMatcher.match('/{context}/configure/{formtype}/'), + breadcrumbPathLevelOne = 'configure', + formDataEdit = '', + isEdit = false, + isForm = false; + +//create left menu +var leftMenu = menuGenerator(context, menuJson.menu, userPermissions); + + +if (!elements) { + elements = uriMatcher.match('/{context}/configure/{formtype}/{action}/'); + isForm = true; + + if (elements.action != 'new') { + isEdit = true; + } +} + +try { + var formData = require('controllers/forms/schema/configure/' + elements.formtype + '.json'), + formDataRaw = require('controllers/forms/default/configure/' + elements.formtype + '.json'), + formTitle = formData.title, + buttonText = formData.name; +} catch (e) { + log.error(e.message); + error.push({"errorMessage": e.message}); +} + + +if (elements.action != 'new' && isEdit) { + formTitle = 'Partition Details - ' + elements.action; +} + +var formtype = elements.formtype; + +switch (formtype) { + case "partitions": + list_data = util.RESTCalls.getPartitions(); + if (list_data.partition && list_data.partition.length === 0) { + list_data = null; + } else { + formDataEdit = list_data.partition; + for (specNumber in list_data.partition) { + if (list_data.partition[specNumber].id == elements.action) { + formDataEdit = list_data.partition[specNumber]; + } + + } + + } + break; + + case "autoscalingpolicies": + list_data = util.RESTCalls.getPolicyAutoScale(); + if (list_data.autoscalePolicy && list_data.autoscalePolicy.length === 0) { + list_data = null; + } + break; + + case "deployments": + list_data = util.RESTCalls.getPolicyDeployment(); + break; + + case "loadbalancer": + list_data = util.RESTCalls.getLbCartridges(); + if (list_data.cartridge && list_data.cartridge.length === 0) { + list_data = null; + } + break; + + case "cartridges": + list_data = util.RESTCalls.getCartridges(); + + if (list_data.cartridge && list_data.cartridge.length === 0) { + list_data = null; + } else if (list_data.hasOwnProperty('cartridge')) { + //remove LB from current object + for (var i = 0; i < list_data.cartridge.length; i++) { + if (list_data.cartridge[i].loadBalancer === true) { + list_data.cartridge.splice(i, 1); + i = i - 1; + } + } + } + break; + + case "multitenant": + list_data = util.RESTCalls.getServices(); + if (list_data.serviceDefinitionBean && list_data.serviceDefinitionBean.length === 0) { + list_data = null; + } + break; + + case "docker": + list_data = util.RESTCalls.getKubernetesGroups(); + break; + + default: + error.push({"errorMessage":"Incorrect resource path found"}); + +} + +//check user has permission to access endpoints +if (list_data != null && list_data.hasOwnProperty('Error')) { + error.push(list_data.Error); +} + +var caramelData = { + breadcrumbPathLevelOne: breadcrumbPathLevelOne, + breadcrumbPathLevelTwo: elements.formtype, + left_menu: leftMenu, + isForm: isForm, + isEdit: isEdit, + formDataEdit: JSON.stringify(formDataEdit), + formTitle: formTitle, + formDataRaw: JSON.stringify(formDataRaw), + formData: JSON.stringify(formData), + buttonText: buttonText, + list_data: list_data, + error: error +} + + +caramel.render(caramelData); + +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/applications/application_requests.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/applications/application_requests.jag b/components/org.apache.stratos.manager.console/console/controllers/applications/application_requests.jag new file mode 100644 index 0000000..bde0b9e --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/applications/application_requests.jag @@ -0,0 +1,49 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +var log = new Log("apachestratos.configure_request"), + util = require('/controllers/rest/rest_calls.jag'), + formPayload = request.getParameter('formPayload'), + formtype = request.getParameter('formtype'), + formSubmit; + +//add login validator for pages +include('/controllers/login/validator.jag'); + +try { + switch (formtype) { + case "groups": + formSubmit = util.RESTCalls.deployGroupDefinition(formPayload); + break; + case "applications": + formSubmit = util.RESTCalls.deployApplicationDefinition(formPayload); + break; + default: + session.put("deploy-status", { "message": "Sorry Endpoint Error", "status": "error" }); + + } +} catch (e) { + log.warn(e); +} + + +print(session.get("deploy-status")); +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/cartridges/subscription_requests.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/cartridges/subscription_requests.jag b/components/org.apache.stratos.manager.console/console/controllers/cartridges/subscription_requests.jag new file mode 100644 index 0000000..1ede803 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/cartridges/subscription_requests.jag @@ -0,0 +1,43 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +var log = new Log("apachestratos.subscription_request"), + util = require('/controllers/rest/rest_calls.jag'), + formPayload = request.getParameter('formPayload'), + formtype = request.getParameter('formtype'), + formSubmit; + +//add login validator for pages +include('/controllers/login/validator.jag'); + +try { + if(formtype == 'subscribe'){ + formSubmit = util.RESTCalls.subscribeToCartridge(JSON.parse(formPayload)); + + } + +}catch(e){ + log.info(e); +} + + +print(session.get("get-status")); +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/cartridges/unsubscription_requests.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/cartridges/unsubscription_requests.jag b/components/org.apache.stratos.manager.console/console/controllers/cartridges/unsubscription_requests.jag new file mode 100644 index 0000000..fed63fc --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/cartridges/unsubscription_requests.jag @@ -0,0 +1,39 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +var log = new Log("apachestratos.subscription_request"), + util = require('/controllers/rest/rest_calls.jag'), + cartridge_name = request.getParameter('cartridge_name'), + formSubmit; + +//add login validator for pages +include('/controllers/login/validator.jag'); + +try { + formSubmit = util.RESTCalls.unsubscribeCartridge(cartridge_name); +}catch(e){ + log.info(e); +} + +log.info(formSubmit) + +print(session.get("deploy-status")); +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag b/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag new file mode 100644 index 0000000..593a734 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/configure/configure_requests.jag @@ -0,0 +1,64 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +var log = new Log("apachestratos.configure_request"), + util = require('/controllers/rest/rest_calls.jag'), + formPayload = request.getParameter('formPayload'), + formtype = request.getParameter('formtype'), + formSubmit; + +//add login validator for pages +include('/controllers/login/validator.jag'); + +try { + switch (formtype) { + case "partitions": + formSubmit = util.RESTCalls.deployPartitionDefinition(formPayload); + break; + case "autoscalingpolicies": + formSubmit = util.RESTCalls.deployAutoscalePolicyDefinition(formPayload); + break; + case "deployments": + formSubmit = util.RESTCalls.deployDeploymentPolicyDefinition(formPayload); + break; + case "loadbalancer": + formSubmit = util.RESTCalls.deployLbDefinition(formPayload); + break; + case "cartridges": + formSubmit = util.RESTCalls.deployCartridgeDefinition(formPayload); + break; + case "multitenant": + formSubmit = util.RESTCalls.deployServiceDefinition(formPayload); + break; + case "docker": + formSubmit = util.RESTCalls.deployKubernetesGroupDefinition(formPayload); + break; + default: + session.put("deploy-status", { "message": "Sorry Endpoint Error", "status": "error" }); + + } +} catch (e) { + log.warn(e); +} + + +print(session.get("deploy-status")); +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/applications.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/applications.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/applications.json new file mode 100644 index 0000000..4e6d332 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/applications.json @@ -0,0 +1,23 @@ +{ + "applicationId": "mysql-only", + "alias": "mytestapp2", + "components": { + "subscribables": [ + { + "type": "mysql", + "alias": "mymysql" + } + ] + }, + "subscribableInfo": [ + { + "alias": "mymysql", + "deploymentPolicy": "dep", + "autoscalingPolicy": "auto", + "repoURL": "www.mygit.com/tomcat.git", + "privateRepo": "false", + "repoUsername": "admin", + "repoPassword": "yyyy" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/groups.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/groups.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/groups.json new file mode 100644 index 0000000..75df0cb --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/applications/groups.json @@ -0,0 +1,9 @@ +{ + "name": "group1", + "cartridges": [ + "tomcat" + ], + "dependencies": { + "terminationBehaviour": "terminate-none" + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/application.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/application.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/application.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/application.json @@ -0,0 +1 @@ +{} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/autoscalingpolicies.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/autoscalingpolicies.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/autoscalingpolicies.json new file mode 100644 index 0000000..d5aa54a --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/autoscalingpolicies.json @@ -0,0 +1,19 @@ +{ + "id": "economy", + "description":"autoscale policy description", + "isPublic":false, + "loadThresholds": { + "requestsInFlight": { + "upperLimit": 30, + "lowerLimit": 5 + }, + "memoryConsumption": { + "upperLimit": 80, + "lowerLimit": 50 + }, + "loadAverage": { + "upperLimit": 100, + "lowerLimit": 20 + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/cartridges.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/cartridges.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/cartridges.json new file mode 100644 index 0000000..fbe9df4 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/cartridges.json @@ -0,0 +1,67 @@ +{ + "type":"php", + "isPublic":false, + "provider":"apache", + "host":"stratos.org", + "displayName":"PHP", + "description":"PHP Cartridge", + "version":"7", + "defaultAutoscalingPolicy":"economyPolicy", + "multiTenant":"false", + "portMapping":[ + { + "protocol":"http", + "port":"80", + "proxyPort":"8280" + }, + { + "protocol":"https", + "port":"443", + "proxyPort":"8243" + } + ], + "iaasProvider":[ + { + "type":"ec2", + "imageId":"ap-southeast-1/ami-2e0d5a7c", + "maxInstanceLimit":"4", + "property":[ + { + "name":"instanceType", + "value":"m1.medium" + }, + { + "name":"keyPair", + "value":"xxxxxxxx" + } + ], + "networkInterfaces": [ + { + "networkUuid": "fb9c21f4-0672-48b2-8279-77334bb63a53" + }, + { + "networkUuid": "1e43f86f-4165-4f2e-8017-dd4cfb5548b0" + } + ] + } + ], + "loadBalancer":{ + "type":"lb", + "property":{ + "name":"default.load.balancer", + "value":"true" + } + }, + "persistence": { + "isRequired": "true", + "volume" : [ + { + "device": "/dev/sdc", + "mappingPath": "/home/ubuntu/sdc", + "size": "11", + "removeOnTermination": "false" + } + + ] + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/deployments.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/deployments.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/deployments.json new file mode 100644 index 0000000..feb94cb --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/deployments.json @@ -0,0 +1,17 @@ +{ + "id":"dakshika-ec2", + "description":"Deployment policy description", + "isPublic":false, + "partitionGroup":{ + "id":"ec2", + "partitionAlgo":"one-after-another", + "partition":[ + { + "id":"P1", + "description":"description", + "partitionMax":"3", + "partitionMin":"1" + } + ] + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/docker.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/docker.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/docker.json new file mode 100644 index 0000000..0f5b02b --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/docker.json @@ -0,0 +1,65 @@ +{ + "groupId": "KubGrp1", + "description": "Kubernetes CoreOS cluster on EC2 ", + "kubernetesMaster": { + "hostId": "KubHostMaster1", + "hostname": "master.dev.kubernetes.example.org", + "hostIpAddress": "172.17.8.100", + "property": [ + { + "name": "prop1", + "value": "val1" + }, + { + "name": "prop2", + "value": "val2" + } + ] + }, + "portRange": { + "upper": "5000", + "lower": "4500" + }, + "kubernetesHosts": [ + { + "hostId": "KubHostSlave1", + "hostname": "slave1.dev.kubernetes.example.org", + "hostIpAddress": "172.17.8.101", + "property": [ + { + "name": "prop1", + "value": "val1" + }, + { + "name": "prop2", + "value": "val2" + } + ] + }, + { + "hostId": "KubHostSlave2", + "hostname": "slave2.dev.kubernetes.example.org", + "hostIpAddress": "172.17.8.102", + "property": [ + { + "name": "prop1", + "value": "val1" + }, + { + "name": "prop2", + "value": "val2" + } + ] + } + ], + "property": [ + { + "name": "prop1", + "value": "val1" + }, + { + "name": "prop2", + "value": "val2" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/loadbalancer.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/loadbalancer.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/loadbalancer.json new file mode 100644 index 0000000..5379db2 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/loadbalancer.json @@ -0,0 +1,46 @@ +{ + "type":"lb", + "isPublic":false, + "provider":"lb", + "host":"stratos.org", + "displayName":"load balancer", + "description":"LB Cartridge", + "version":"4", + "defaultAutoscalingPolicy":"economyPolicy", + "portMapping":[ + { + "protocol":"http", + "port":"8280", + "proxyPort":"8280" + }, + { + "protocol":"https", + "port":"8243", + "proxyPort":"8243" + } + ], + "iaasProvider":[ + { + "type":"ec2", + "imageId":"ap-southeast-1/amiÂ-70326522", + "maxInstanceLimit":"5", + "property":[ + { + "name":"instanceType", + "value":"m1.medium" + }, + { + "name":"keyPair", + "value":"xxxxxx" + } + ] + } + ], + + "property":[ + { + "name":"load.balancer", + "value":"true" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/multitenant.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/multitenant.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/multitenant.json new file mode 100644 index 0000000..4d5d423 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/multitenant.json @@ -0,0 +1,10 @@ +{ + "serviceName": "appserver", + "isPublic":"true", + "cartridgeType": "appserver", + "deploymentPolicyName": "D1", + "autoscalingPolicyName": "AS1", + "clusterDomain": "appserverdev.dev.domain", + "clusterSubDomain": "subdomain2", + "tenantRange": "*" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/partitions.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/partitions.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/partitions.json new file mode 100644 index 0000000..a970f29 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/configure/partitions.json @@ -0,0 +1,16 @@ +{ + "id": "P1", + "description":"partition description", + "isPublic":false, + "provider": "ec2", + "property": [ + { + "name": "region", + "value": "ap-southeast-1" + }, + { + "name": "zone", + "value": "ap-southeast-1a" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/users/tenants.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/users/tenants.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/users/tenants.json new file mode 100644 index 0000000..7fb7080 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/users/tenants.json @@ -0,0 +1,9 @@ +{ + "admin":"admin", + "firstname":"Frank", + "lastname":"Myers", + "adminPassword":"admin123", + "tenantDomain":"frank.com", + "email":"[email protected]", + "active":"true" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/default/users/users.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/default/users/users.json b/components/org.apache.stratos.manager.console/console/controllers/forms/default/users/users.json new file mode 100644 index 0000000..92a607b --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/default/users/users.json @@ -0,0 +1,9 @@ +{ + "userName":"lasindu", + "credential":"lasindu", + "role":"Internal/user", + "firstName":"Lasindu", + "lastName":"Charith", + "email":"[email protected]", + "profileName":"null" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/form_generator.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/form_generator.jag b/components/org.apache.stratos.manager.console/console/controllers/forms/form_generator.jag new file mode 100644 index 0000000..6e2acfd --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/form_generator.jag @@ -0,0 +1,134 @@ +<% +var outputHtml,path,i= ""; +/** + * UI generation logic + */ + +/** + * Function to generate HTML for the form + * @param {JSON} jsonSpec JSON description of the form + * @return {String} Formatted HTML ready to be inserted into the template + */ +function traverse(jsonSpec, path) { + + for (specNumber in jsonSpec) { + var spec = jsonSpec[specNumber]; + + if (typeof(spec.value)==="object") { + if (spec.type === 'name_object') { + path += spec.name + '.'; + outputHtml += generateSectionHtml(spec.label,spec.name, spec.value); + }else if(spec.type === 'name_array'){ + i=-1; + path += spec.name ; + outputHtml += generateSectionHtml(spec.label,spec.name, spec.value); + }else if(spec.type === 'object'){ + ++i; + path += '.'+ i + '.'; + } + + traverse(spec.value, path); + + if (spec.type === 'name_object') { + path = path.replace(spec.name+'.', ''); + outputHtml += "</div></div></div>"; + }else if(spec.type === 'name_array'){ + path = path.replace(spec.name, ''); + i=0; + outputHtml += "</div></div></div>"; + }else if(spec.type === 'object'){ + path = path.replace('.'+ i + '.', ''); + outputHtml += "<hr>"; + } + + }else{ + if (spec.type === 'field') { + path += spec.name+'.'; + + outputHtml += generateFieldHtml(spec.label,spec.placeholder, spec.name, spec.value, path); + path = path.replace(spec.name+'.', ''); + } + } + } + + return outputHtml; + +} + + + +/** + * Function to generate the html for a text field in the form + * @param {String} label Label to be put in the form + * @param {String} placeholder Placeholder for the field + * @param {String} fieldName Name of the field + * @return {String} Formatted HTML ready to be inserted in the template + */ +function generateFieldHtml (label, placeholder, fieldName, value, path) { + log.info(path); + var labelHtml = "<label class='formlabel'>" + label + "</label>"; + var inputHtml = "<input type='text' placeholder='" + placeholder + "' id='" + + fieldName + "' class='form-control' value='"+value+"' data-path='"+ + path+"'>"; + return labelHtml + inputHtml; +} + +/** + * @param myParam1 + * @param myParam2 + */ +function generateSectionHtml(label, name, content){ + var outputHtml = ""; + outputHtml += "<div class='panel-group subform' id='" + name + "'>"; + outputHtml += "<div class='panel panel-default'>"; + outputHtml += "<div class='panel-heading'>"; + outputHtml += "<h4 class='panel-title'><a class='togglelink' data-toggle='collapse' data-parent='" + name + "' href='#" + name + "panel'>" + label + "</a></h4>"; + outputHtml += "</div>"; + outputHtml += "<div class='panel-collapse collapse' id='" + name + "panel'>"; + return outputHtml; +} + + +var outputJSON = ""; +/** + * Function to generate JSON for the form + * @param {JSON} jsonSpec JSON description of the form + * @return {String} Formatted JSON ready to be inserted into the editor box + */ +function generateJSON(jsonSpec){ + + for (specNumber in jsonSpec) { + var spec = jsonSpec[specNumber]; + if (typeof(spec.value)==="object") { + + if(spec.type === 'name_object'){ + outputJSON += '"'+ spec.name + '":'; + outputJSON += "{"; + }else if(spec.type === 'name_array'){ + outputJSON += '"'+ spec.name + '":'; + outputJSON += "["; + }else if(spec.type == 'object'){ + outputJSON += "{"; + } + + generateJSON(spec.value); + + if(spec.type === 'name_object'){ + outputJSON += "},"; + }else if(spec.type === 'name_array'){ + outputJSON += "],"; + }else if(spec.type == 'object'){ + outputJSON += "},"; + } + }else{ + if (spec.type === 'field') { + outputJSON += '"'+spec.name + '":"'+ spec.value + '",'; + } + } + + } + + return outputJSON; +} + +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/applications.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/applications.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/applications.json new file mode 100644 index 0000000..3085809 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/applications.json @@ -0,0 +1,112 @@ +{ + "type":"object", + "$schema": "http://json-schema.org/draft-04/schema", + "id": "http://jsonschema.net", + "title": "Application Definition", + "name": "Application", + "properties":{ + "alias": { + "type":"string", + "id": "root/alias", + "default": "mytestapp2", + "required":false + }, + "applicationId": { + "type":"string", + "id": "root/applicationId", + "default": "mysql-only-app2", + "required":false + }, + "components": { + "type":"object", + "id": "root/components", + "required":false, + "properties":{ + "subscribables": { + "type":"array", + "id": "root/components/subscribables", + "required":false, + "items": + { + "type":"object", + "id": "root/components/subscribables/0", + "required":false, + "properties":{ + "alias": { + "type":"string", + "id": "root/components/subscribables/0/alias", + "default": "mymysql", + "required":false + }, + "type": { + "type":"string", + "id": "root/components/subscribables/0/type", + "default": "mysql", + "required":false + } + } + } + + + } + } + }, + "subscribableInfo": { + "type":"array", + "id": "root/subscribableInfo", + "required":false, + "items": + { + "type":"object", + "id": "root/subscribableInfo/0", + "required":false, + "properties":{ + "alias": { + "type":"string", + "id": "root/subscribableInfo/0/alias", + "default": "mymysql", + "required":false + }, + "autoscalingPolicy": { + "type":"string", + "id": "root/subscribableInfo/0/autoscalingPolicy", + "default": "auto", + "required":false + }, + "deploymentPolicy": { + "type":"string", + "id": "root/subscribableInfo/0/deploymentPolicy", + "default": "dep", + "required":false + }, + "privateRepo": { + "type":"string", + "id": "root/subscribableInfo/0/privateRepo", + "default": "false", + "required":false + }, + "repoPassword": { + "type":"string", + "id": "root/subscribableInfo/0/repoPassword", + "default": "yyyy", + "required":false + }, + "repoURL": { + "type":"string", + "id": "root/subscribableInfo/0/repoURL", + "default": "www.mygit.com/tomcat.git", + "required":false + }, + "repoUsername": { + "type":"string", + "id": "root/subscribableInfo/0/repoUsername", + "default": "admin", + "required":false + } + } + } + + + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/groups.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/groups.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/groups.json new file mode 100644 index 0000000..4b8cfb0 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/applications/groups.json @@ -0,0 +1,46 @@ +{ + "type":"object", + "$schema": "http://json-schema.org/draft-04/schema", + "id": "root", + "title": "Group Definition", + "name": "Group", + "options": { + "disable_properties": true, + "disable_collapse": true + }, + "properties":{ + "cartridges": { + "type":"array", + "id": "root/cartridges", + "required":false, + "items": + { + "type":"string", + "id": "root/cartridges/0", + "default": "tomcat", + "required":false + } + + + }, + "dependencies": { + "type":"object", + "id": "root/dependencies", + "required":false, + "properties":{ + "terminationBehaviour": { + "type":"string", + "id": "root/dependencies/terminationBehaviour", + "default": "terminate-none", + "required":false + } + } + }, + "name": { + "type":"string", + "id": "root/name", + "default": "group1", + "required":false + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/application.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/application.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/application.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/application.json @@ -0,0 +1 @@ +{} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/autoscalingpolicies.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/autoscalingpolicies.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/autoscalingpolicies.json new file mode 100644 index 0000000..5ae876c --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/autoscalingpolicies.json @@ -0,0 +1,143 @@ +{ + "type":"object", + "$schema": "http://json-schema.org/draft-04/schema", + "id": "root", + "title":"Auto Scaling Policy Definition", + "name": "Auto Scaling Policy", + "options": { + "disable_properties": true, + "disable_collapse": true + }, + "required" : ["id", "loadThresholds"], + "properties":{ + "id": { + "type":"string", + "id": "root/id", + "title":"Auto Scale policy ID", + "minLength":4, + "default":"Policy name", + "maxItems":1 + }, + "description": { + "type":"string", + "id": "root/description", + "title": "Description", + "name": "Description", + "maxItems":1 + }, + "isPublic": { + "type":"boolean", + "id": "root/isPublic", + "title": "Is Public", + "name": "Is Public", + "default": false, + "maxItems":1 + }, + "loadThresholds": { + "type":"object", + "title":"Load Thresholds", + "id": "root/loadThresholds", + "required":["loadAverage","memoryConsumption","requestsInFlight"], + "options": { + "disable_properties": true + }, + "properties":{ + "requestsInFlight": { + "type":"object", + "id": "root/loadThresholds/requestsInFlight", + "title": "Requests In Flight", + "name": "Requests In Flight", + "format": "grid", + "options": { + "disable_properties": true, + "collapsed": false + }, + "properties":{ + "lowerLimit": { + "type":"number", + "id": "root/loadThresholds/requestsInFlight/lowerLimit", + "title": "Lower Limit", + "name": "Lower Limit", + "default":5, + "format": "number", + "required":false + }, + "upperLimit": { + "type":"number", + "id": "root/loadThresholds/requestsInFlight/upperLimit", + "title": "Upper Limit", + "name": "Upper Limit", + "default":30, + "format": "number", + "required":false + } + } + }, + "memoryConsumption": { + "type":"object", + "id": "root/loadThresholds/memoryConsumption", + "title": "Memory Consumption", + "name": "Memory Consumption", + "format": "grid", + "options": { + "disable_properties": true, + "collapsed": false + }, + "properties":{ + "lowerLimit": { + "type":"number", + "id": "root/loadThresholds/memoryConsumption/lowerLimit", + "title": "Lower Limit", + "name": "Lower Limit", + "default":50, + "format": "number", + "required":false + }, + "upperLimit": { + "type":"number", + "id": "root/loadThresholds/memoryConsumption/upperLimit", + "title": "Upper Limit", + "name": "Upper Limit", + "default":80, + "format": "number", + "required":false + } + } + }, + "loadAverage": { + "type":"object", + "id": "root/loadThresholds/loadAverage", + "title": "Load Average", + "name": "Load Average", + "format": "grid", + "options": { + "disable_properties": true, + "collapsed": false + }, + "properties":{ + "lowerLimit": { + "type":"number", + "id": "root/loadThresholds/loadAverage/lowerLimit", + "title": "Lower Limit", + "name": "Lower Limit", + "default":20, + "format": "number", + "required":false + }, + "upperLimit": { + "type":"number", + "id": "root/loadThresholds/loadAverage/upperLimit", + "title": "Upper Limit", + "name": "Upper Limit", + "default":100, + "format": "number", + "required":false + } + } + } + + + } + } + } +}
