http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/partials/users_form.hbs ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/users_form.hbs b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/users_form.hbs new file mode 100644 index 0000000..3c55119 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/users_form.hbs @@ -0,0 +1,182 @@ +{{#if isForm}} + <div id="centered"> + <div class="row title"> + <div class="title-main text-center"> + {{#if isForm}} + <h1>Add new {{formTitle}}</h1> + {{else}} + <h1>{{formTitle}}</h1> + {{/if}} + </div> + </div> + {{#if isForm}} + <div class='container' id='content'> + <div class='row'> + <div class='container text-center form-toolbar'> + <div class='col-md-5'></div> + <div class='col-md-7 '> + <button class='btn btn-info btn-lg pull-right' type='button' id='deploy' data-form=''> Add </button> + <button class='btn btn-default btn-lg pull-right button-gap' type='button' onclick='window.location.replace(document.referrer)'> Cancel + </button> + </div> + </div> + </div> + <div class='form' action='#' id='textform'></div> + <div id='jsonform'> + <div class='form-group'> + <div class='form' action='#'><textarea placeholder='JSON Editor' id='jsoneditor' + class='form-control'></textarea></div> + </div> + </div> + </div> + {{/if}} + </div> +{{else}} + <div class="row title"> + <div class="title-main text-center"> + <h1>{{formTitle}}</h1> + </div> + </div> + <div class="container content"> + <div class="row text-center"> + + {{#if content_body.sections}} + <div class="row form-toolbar "> + <div class="col-md-5 col-sm-3 text-left"> + <!--<input type="text" class="form-control" placeholder="Search">--> + <div class="btn-group"> + <a href="#" id="list" class="btn btn-default"> + <i class="fa fa-list-ul"></i> List + </a> + <a href="#" id="grid" class="btn btn-default"> + <i class="fa fa-th"></i> Grid + </a> + </div> + </div> + <div class="col-md-7 col-sm-3 text-right"> + <a type="button" class="btn btn-primary btn-lg" href="new/">Add New</a> + </div> + </div> + {{else}} + <div class="row no-item row-overide"> + <div class="row title"> + <h2>No {{formTitle}} found..</h2> + <a type="button" class="btn btn-primary btn-lg" href="new/">Add New {{formTitle}}</a> + </div> + </div> + {{/if}} + + <div class="row general-table row-overide"> + {{#each content_body.sections.userInfoBean}} + <div class="block col-md-4 grid-group-item border-right"> + <div class="toggle-menu-icon"> + <i class="fa fa-user"></i> + </div> + <h2>{{userName}} </h2> + + <div class="toggle-menu-description">Define partitions/partition groups to be used in + autoscaling and deployment policies. + </div> + <!--<div class="toggle-menu-button"> + <button type="button" class="btn btn-primary" >Remove</button> + </div>--> + </div> + {{/each}} + {{#each content_body.sections.tenantInfoBean}} + <div class="block col-md-4 grid-group-item border-right"> + <div class="toggle-menu-icon"> + <i class="fa fa-building"></i> + </div> + <h2>{{tenantDomain}} </h2> + + <div class="toggle-menu-description">{{email}} - {{createdDate}} </div> + <!--<div class="toggle-menu-button"> + <button type="button" class="btn btn-primary" >Remove</button> + </div>--> + </div> + {{/each}} + </div> + </div> + </div> +{{/if}} +<script> + + $(document).ready(function () { + {{#if isForm}} + // Set the default CSS theme and icon library globally + JSONEditor.defaults.theme = 'bootstrap3'; + JSONEditor.defaults.iconlib = 'fontawesome4'; + JSONEditor.defaults.show_errors = "always"; + + // This is the starting value for the editor + // We will use this to seed the initial editor + // and to provide a "Restore to Default" button. + var starting_value = {{{formDataRaw}}}; + + // Initialize the editor + var editor = new JSONEditor(document.getElementById('textform'), { + // Enable fetching schemas via ajax + ajax: false, + disable_edit_json: true, + // disable_properties:true, + // The schema for the editor + schema: {{{formData}}}, + format: "grid", + + // Seed the form with a starting value + startval: starting_value + }); + + + // status whenever the editor changes + editor.on('change', function () { + // Get an array of errors from the validator + var errors = editor.validate(); + console.log(errors); + // var indicator = document.getElementById('valid_indicator'); + +// // Not valid +// if(errors.length) { +// indicator.className = 'label alert'; +// indicator.textContent = 'not valid'; +// } +// // Valid +// else { +// indicator.className = 'label success'; +// indicator.textContent = 'valid'; +// } + }); + {{/if}} + + $('#deploy').click(function () { + + var payload = editor.getValue(); + var btn = $(this); + var formtype = '{{formContext}}'; + + btn.html("<i class='fa fa-spinner fa-spin'></i> Adding "+formtype); + $.ajax({ + type: "POST", + url: caramel.context + "/controllers/users/users_requests.jag", + dataType: 'json', + data: { "formPayload": JSON.stringify(payload), "formtype": formtype }, + success: function (data) { + console.log(data); + if (data.status == 'error') { + var n = noty({text: data.message, layout: 'bottomRight', type: 'error'}); + } else if (data.status == 'warning') { + var n = noty({text: data.message, layout: 'bottomRight', type: 'warning'}); + } else { + var n = noty({text: data.message, layout: 'bottomRight', type: 'success'}); + } + } + }) + .always(function () { + btn.html('Add '+formtype); + }); + console.log(payload); + });//end of deploy button trigger + + }); + +</script>
http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/partials/wizard.hbs ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/wizard.hbs b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/wizard.hbs new file mode 100644 index 0000000..f33dcff --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/wizard.hbs @@ -0,0 +1,247 @@ +<div id="centered"> + {{#if isSelection}} + <div class="row title"> + <div class="title-main text-center"> + <h1>{{content_title}}</h1> + </div> + </div> + <div class="container content"> + <div class="row text-center"> + <div class="row no-item row-overide"> + <div class="row title"> + <a type="button" class="btn btn-primary btn-lg" href="{{url ""}}/wizard/vm/">Virtual Machine</a> + <span>Or</span> + <a type="button" class="btn btn-primary btn-lg" href="{{url ""}}/wizard/docker/">Docker</a> + </div> + </div> + </div> + </div> + {{else}} + <div class="row title"> + <div class="title-main text-center"> + <h1>{{content_title}} - {{formTitle}}</h1> + </div> + </div> + + + <div class="container content"> + <div class="row text-center"> + <div class='container text-center form-toolbar'> + <div class="col-md-3"></div> + <div class='col-md-9'> + <div class="editor-button"> + <span class='pull-left'>Editor + <input type="checkbox" name="my-checkbox" id='editortoggle' checked> + </span> + <span class="auto-correct"><input type="checkbox" checked id="auto-correct-check">Auto correct with schema</span> + + <button class='btn btn-info btn-lg pull-right wizard-button' type='button' + id="{{#if steplast}}finished{{else}}next-step{{/if}}" + data-step="{{step}}" data-pstep="{{pstep}}"> {{#if steplast}}Finished{{else}} + Next{{/if}}</button> + {{#ifCond wizardstep "!=" 1}} + <button class='btn btn-default btn-lg pull-right wizard-button' type='button' + id="previous-step" data-pstep="{{pstep}}"> Previous</button> + {{/ifCond}} + </div> + + </div> + + </div> + <div class="col-md-3 stratos-tab-menu"> + <div class="list-group wizard "> + + <a href="#" class="list-group-item {{#ifCond wizardstep "==" 1}} active{{/ifCond}}"> + <i class="fa fa-th-large"></i> Partitions + </a> + <a href="#" class="list-group-item {{#ifCond wizardstep "==" 2}} active{{/ifCond}}"> + <i class="fa fa-expand"></i> Autoscaling Policies + </a> + <a href="#" class="list-group-item {{#ifCond wizardstep "==" 3}} active{{/ifCond}}"> + <i class="fa fa-road"></i> Deployment Policies + </a> + <a href="#" class="list-group-item {{#ifCond wizardstep "==" 4}} active{{/ifCond}}"> + <i class="fa fa-tasks"></i> Loadbalancers + </a> + <a href="#" class="list-group-item {{#ifCond wizardstep "==" 5}} active{{/ifCond}}"> + <i class="fa fa-inbox"></i> Cartridges + </a> + <a href="#" class="list-group-item {{#ifCond wizardstep "==" 6}} active{{/ifCond}}"> + <i class="fa fa-sitemap"></i> Multitenant Services + </a> + + </div> + </div> + <div class="col-md-9 stratos-tab"> + <div class="stratos-tab-content active"> + <div class='form' action='#' id='textform'></div> + <div id='jsonform'> + <div class='form-group'> + <div class='form' action='#'> + <textarea placeholder='JSON Editor' id='jsoneditor' class='form-control'></textarea> + </div> + </div> + </div> + </div> + </div> + </div> + </div> +</div> +<script> + + $(document).ready(function () { + // Set the default CSS theme and icon library globally + JSONEditor.defaults.theme = 'bootstrap3'; + JSONEditor.defaults.iconlib = 'fontawesome4'; + JSONEditor.defaults.show_errors = "always"; + + // This is the starting value for the editor + // We will use this to seed the initial editor + // and to provide a "Restore to Default" button. + var starting_value = {{{formDataRaw}}}; + + // Initialize the editor + var editor = new JSONEditor(document.getElementById('textform'), { + // Enable fetching schemas via ajax + ajax: false, + disable_edit_json: true, + // disable_properties:true, + // The schema for the editor + schema: {{{formData}}}, + format: "grid", + + // Seed the form with a starting value + startval: starting_value + }); + + JSONEditor.prototype.showErrors = function () { + this.setOption('show_errors', 'always'); + } + + // Hook up the validation indicator to update its + // status whenever the editor changes + editor.on('change', function () { + // Get an array of errors from the validator + var errors = editor.validate(); + if (errors.length) { + for (var i = 0; i < errors.length; i++) { + var n = noty({text: errors[i].message + ' in ' + errors[i].path, layout: 'bottomRight', + type: 'error', timeout: 2000}); + } + + } + + }); + + /** + * Function to handle hiding and showing the JSON form + */ + $('input[name="my-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) { + if (isForm) { + + changeDisplayMode('#textform', '#jsonform'); + $('#editortoggle').text('Form View'); + isForm = false; + $('textarea#jsoneditor').val(JSON.stringify(editor.getValue(), null, '\t')); + console.log('click once') + } else { + + changeDisplayMode('#jsonform', '#textform'); + $('#editortoggle').text('JSON Editor'); + editor.validate(); + editor.setValue(JSON.parse($('textarea#jsoneditor').val())); + isForm = true; + // Fire a change event to force revalidation + editor.onChange(); + } + + if(state){ + $('.auto-correct').css({"display":"block"}); + }else{ + $('.auto-correct').css({"display":"none"}); + } + }); + + //handle changes happens on json editor + $('textarea#jsoneditor').on('keyup', function (event) { + //valiadate raw json and do validation + try { + var rawEditValidate = JSON.parse($('textarea#jsoneditor').val()); + $(this).addClass("has-success").removeClass('has-error'); + $('#deploy').prop('disabled', false); + } catch (e) { + $(this).addClass("has-error").removeClass('has-success'); + $('#deploy').prop('disabled', true); + return false; + } + + var autoCorrect = $('#auto-correct-check:checked').val(); + + if (rawEditValidate && autoCorrect ) { + + editor.setValue(rawEditValidate); + editor.onChange(); + if (event.keyCode == '13' || event.keyCode == '32') { + }else{ + $('textarea#jsoneditor').val(JSON.stringify(editor.getValue(), null, '\t')); + } + + } + + }); + + // Finding the height of the rendered form, and setting the JSON + // editor to the same height + var formHeight = $('#textform').height(); + $('#jsoneditor').css('height', formHeight); + + $.fn.bootstrapSwitch.defaults.onText = 'JSON'; + $.fn.bootstrapSwitch.defaults.offText = 'UI'; + $("[name='my-checkbox']").bootstrapSwitch('state', false, true); + + + $('#previous-step').click(function() { + window.location = '{{url ""}}/wizard/vm/{{pstep}}/' + }); + + $('#finished').click(function() { + window.location = '{{url ""}}/' + }); + + + $('#next-step').click(function () { + console.log('get hit') + var payload = editor.getValue(); + var btn = $(this); + var formtype = '{{step}}'; + btn.html("<i class='fa fa-spinner fa-spin'></i> Deploying..."); + $.ajax({ + type: "POST", + url: caramel.context + "/controllers/wizard/wizard_requests.jag", + dataType: 'json', + data: { "formPayload": JSON.stringify(payload), "formtype": formtype }, + success: function (data) { + console.log(data); + if (data.status == 'error') { + var n = noty({text: data.message, layout: 'bottomRight', type: 'error'}); + + } else if (data.status == 'warning') { + var n = noty({text: data.message, layout: 'bottomRight', type: 'warning'}); + } else { + var n = noty({text: data.message, layout: 'bottomRight', type: 'success'}); + setTimeout(function () { + window.location = '{{url ""}}/wizard/vm/{{nsettype}}/' + }, 5000); + } + } + }) + .always(function () { + btn.html('Deploy'); + }); + + });//end of deploy button trigger + + }); + +</script> + {{/if}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications.js new file mode 100644 index 0000000..931688d --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications.js @@ -0,0 +1,116 @@ +/* + * + * 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 render = function (theme, data, meta, require) { + + if(data.error.length == 0 ){ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos - Application Managment', + page_description:'Apache Stratos - Application Managment' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + user_name:'[email protected]' + } + } + ], + sub_header:[ + { + partial:'index_sub_header', + context:{ + breadcrumbPathLevelOne:'applications', + breadcrumbPathLevelTwo:'' + } + } + ], + left_menu:[ + { + partial:'index_left_menu', + context:{ + left_menu:data.left_menu + } + } + ], + right_menu_help:[ + { + partial:'index_right_menu_help', + context:{ + + } + } + ], + content: [ + + { + partial: 'metro_menu', + context:{ + content_menu:'links', + content_title:'Application Management', + content_body:{sections:data.metro_menu} + + } + } + ] + }); + + }else{ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home - Error', + page_description:'Apache Stratos Home - Error' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + content: [ + + { + partial: 'error_page', + context:{ + error:data.error, + content_title:'Sorry Something went Wrong...! ', + content_body:{ + + } + + } + } + ] + }); + + } +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications_form.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications_form.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications_form.js new file mode 100644 index 0000000..dd47960 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/applications_form.js @@ -0,0 +1,124 @@ +/* + * + * 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 render = function (theme, data, meta, require) { + + if(data.error.length === 0 ){ + theme('index', { + page_meta: [ + { + partial: 'index_title', + context: { + page_title: 'Apache Stratos - Cartridges', + page_description: 'Apache Stratos - Cartridges' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + user_name: '[email protected]' + } + } + ], + sub_header:[ + { + partial:'index_sub_header', + context:{ + breadcrumbPathLevelOne:data.breadcrumbPathLevelOne, + breadcrumbPathLevelTwo:data.breadcrumbPathLevelTwo + } + } + ], + left_menu:[ + { + partial:'index_left_menu', + context:{ + left_menu:data.left_menu + } + } + ], + right_menu_help:[ + { + partial:'index_right_menu_help', + context:{ + + } + } + ], + content: [ + { + partial:'applications_form', + context:{ + formContext: data.breadcrumbPathLevelTwo, + form_action: data.form_action, + formHtml: data.formHtml, + formData: data.formData, + formDataRaw: data.formDataRaw, + isForm: data.isForm, + isEdit:data.isEdit, + formTitle: data.formTitle, + isForm: data.isForm, + content_body: {sections: + data.list_data + } + } + } + + ] + }); + + }else{ + + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home - Error', + page_description:'Apache Stratos Home - Error' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + content: [ + + { + partial: 'error_page', + context:{ + error:data.error, + content_title:'Sorry Something went Wrong...! ', + content_body:{ + + } + + } + } + ] + }); + } +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure.js new file mode 100644 index 0000000..7ce2a7f --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure.js @@ -0,0 +1,116 @@ +/* + * + * 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 render = function (theme, data, meta, require) { + + if(data.error.length == 0 ){ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos - Configure', + page_description:'Apache Stratos - Configure' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + user_name:'[email protected]' + } + } + ], + sub_header:[ + { + partial:'index_sub_header', + context:{ + breadcrumbPathLevelOne:data.breadcrumbPathLevelOne, + breadcrumbPathLevelTwo:data.breadcrumbPathLevelTwo + } + } + ], + left_menu:[ + { + partial:'index_left_menu', + context:{ + left_menu:data.left_menu + } + } + ], + right_menu_help:[ + { + partial:'index_right_menu_help', + context:{ + + } + } + ], + content: [ + + { + partial: 'metro_menu', + context:{ + content_menu:'links', + content_title:'Configure Apache Stratos', + content_body:{sections:data.metro_menu} + + } + } + ] + }); + + }else{ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home - Error', + page_description:'Apache Stratos Home - Error' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + content: [ + + { + partial: 'error_page', + context:{ + error:data.error, + content_title:'Sorry Something went Wrong...! ', + content_body:{ + + } + + } + } + ] + }); + + } +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure_form.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure_form.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure_form.js new file mode 100644 index 0000000..f9da073 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/configure_form.js @@ -0,0 +1,124 @@ +/* + * + * 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 render = function (theme, data, meta, require) { + + if(data.error.length === 0 ){ + theme('index', { + page_meta: [ + { + partial: 'index_title', + context: { + page_title: 'Apache Stratos - Configure', + page_description: 'Apache Stratos - Configure' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + user_name: '[email protected]' + } + } + ], + sub_header:[ + { + partial:'index_sub_header', + context:{ + breadcrumbPathLevelOne:data.breadcrumbPathLevelOne, + breadcrumbPathLevelTwo:data.breadcrumbPathLevelTwo + } + } + ], + left_menu:[ + { + partial:'index_left_menu', + context:{ + left_menu:data.left_menu + } + } + ], + right_menu_help:[ + { + partial:'index_right_menu_help', + context:{ + + } + } + ], + content: [ + { + partial:'configure_form', + context:{ + formContext: data.breadcrumbPathLevelTwo, + form_action: data.form_action, + formData: data.formData, + formDataRaw: data.formDataRaw, + formTitle: data.formTitle, + buttonText: data.buttonText, + isForm: data.isForm, + isEdit:data.isEdit, + formDataEdit:data.formDataEdit, + content_body: {sections: + data.list_data + } + } + } + + ] + }); + + }else{ + + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home - Error', + page_description:'Apache Stratos Home - Error' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + content: [ + + { + partial: 'error_page', + context:{ + error:data.error, + content_title:'Sorry Something went Wrong...! ', + content_body:{ + + } + + } + } + ] + }); + } +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/index.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/index.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/index.js new file mode 100644 index 0000000..d13a11c --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/index.js @@ -0,0 +1,106 @@ +/* + * + * 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 render = function (theme, data, meta, require) { + + if(data.error.length == 0 ){ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home', + page_description:'Apache Stratos Home' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + left_menu:[ + { + partial:'index_left_menu', + context:{ + left_menu:data.left_menu + } + } + ], + right_menu_help:[ + { + partial:'index_right_menu_help', + context:{ + } + } + ], + content: [ + + { + partial: 'metro_menu', + context:{ + content_menu:'links', + content_title:'Welcome to Apache Stratos', + content_body:{sections: data.metro_menu} + + } + } + ] + }); + + }else{ + + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home - Error', + page_description:'Apache Stratos Home - Error' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + content: [ + + { + partial: 'error_page', + context:{ + error:data.error, + content_title:'Sorry Something went Wrong...! ', + content_body:{ + + } + + } + } + ] + }); + + } +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/login.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/login.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/login.js new file mode 100644 index 0000000..380840a --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/login.js @@ -0,0 +1,89 @@ +/* + * + * 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 render = function (theme, data, meta, require) { + + if(data.error.length == 0 ){ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Login', + page_description:'Apache Stratos Login' + } + } + ], + header:[ + { + partial: 'login_header', + context:{ + } + } + ], + content: [ + + { + partial: 'login_body', + context:{ + content_title:'The most comprehensive enterprise grade PaaS Framework' + + } + } + ] + }); + + }else{ + + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home - Error', + page_description:'Apache Stratos Home - Error' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + content: [ + + { + partial: 'error_page', + context:{ + error:data.error, + content_title:'Sorry Something went Wrong...! ', + content_body:{ + + } + + } + } + ] + }); + + } +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/my_cartridges.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/my_cartridges.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/my_cartridges.js new file mode 100644 index 0000000..50381f6 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/my_cartridges.js @@ -0,0 +1,119 @@ +/* + * + * 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 render = function (theme, data, meta, require) { + + if(data.error.length == 0 ){ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos - My Cartrides', + page_description:'Apache Stratos - My Cartrides' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + user_name:'[email protected]' + } + } + ], + sub_header:[ + { + partial:'index_sub_header', + context:{ + breadcrumbPathLevelOne:data.breadcrumbPathLevelOne, + breadcrumbPathLevelTwo:data.breadcrumbPathLevelTwo + } + } + ], + left_menu:[ + { + partial:'index_left_menu', + context:{ + left_menu:data.left_menu + } + } + ], + right_menu_help:[ + { + partial:'index_right_menu_help', + context:{ + + } + } + ], + content: [ + + { + partial: 'my_cartridges', + context:{ + content_title:'My Cartridges', + content_body:{ + sections:data.myCartridges, + myCartridgeInfoStatus: data.myCartridgeInfoStatus, + myCartridgeInfo: data.myCartridgeInfo + } + + } + } + ] + }); + + }else{ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home - Error', + page_description:'Apache Stratos Home - Error' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + content: [ + + { + partial: 'error_page', + context:{ + error:data.error, + content_title:'Sorry Something went Wrong...! ', + content_body:{ + + } + + } + } + ] + }); + + } +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/my_cartridges_info.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/my_cartridges_info.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/my_cartridges_info.js new file mode 100644 index 0000000..9377fdf --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/my_cartridges_info.js @@ -0,0 +1,117 @@ +/* + * + * 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 render = function (theme, data, meta, require) { + + if(data.error.length == 0 ){ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos My Cartrides', + page_description:'Apache Stratos My Cartrides' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + user_name:'[email protected]' + } + } + ], + sub_header:[ + { + partial:'index_sub_header', + context:{ + breadcrumbPathLevelOne:data.breadcrumbPathLevelOne, + breadcrumbPathLevelTwo:data.breadcrumbPathLevelTwo + } + } + ], + left_menu:[ + { + partial:'index_left_menu', + context:{ + left_menu:data.left_menu + } + } + ], + right_menu_help:[ + { + partial:'index_right_menu_help', + context:{ + + } + } + ], + content: [ + + { + partial: 'my_cartridges_info', + context:{ + content_title:'My Cartridge: ', + content_body:{ + myCartridgeInfo: data.myCartridgeInfo + } + + } + } + ] + }); + + }else{ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home - Error', + page_description:'Apache Stratos Home - Error' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + content: [ + + { + partial: 'error_page', + context:{ + error:data.error, + content_title:'Sorry Something went Wrong...! ', + content_body:{ + + } + + } + } + ] + }); + + } +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/users.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/users.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/users.js new file mode 100644 index 0000000..98fdd6b --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/users.js @@ -0,0 +1,116 @@ +/* + * + * 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 render = function (theme, data, meta, require) { + + if(data.error.length == 0 ){ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos - User Managment', + page_description:'Apache Stratos - User Managment' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + user_name:'[email protected]' + } + } + ], + sub_header:[ + { + partial:'index_sub_header', + context:{ + breadcrumbPathLevelOne:'users', + breadcrumbPathLevelTwo:'' + } + } + ], + left_menu:[ + { + partial:'index_left_menu', + context:{ + left_menu:data.left_menu + } + } + ], + right_menu_help:[ + { + partial:'index_right_menu_help', + context:{ + + } + } + ], + content: [ + + { + partial: 'metro_menu', + context:{ + content_menu:'links', + content_title:'User Management', + content_body:{sections:data.metro_menu} + + } + } + ] + }); + + }else{ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home - Error', + page_description:'Apache Stratos Home - Error' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + content: [ + + { + partial: 'error_page', + context:{ + error:data.error, + content_title:'Sorry Something went Wrong...! ', + content_body:{ + + } + + } + } + ] + }); + + } +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/users_form.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/users_form.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/users_form.js new file mode 100644 index 0000000..f3eb4a9 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/users_form.js @@ -0,0 +1,121 @@ +/* + * + * 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 render = function (theme, data, meta, require) { + + if(data.error.length === 0 ){ + theme('index', { + page_meta: [ + { + partial: 'index_title', + context: { + page_title: 'Apache Stratos - User Managment', + page_description: 'Apache Stratos - User Managment' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + user_name: '[email protected]' + } + } + ], + sub_header:[ + { + partial:'index_sub_header', + context:{ + breadcrumbPathLevelOne:data.breadcrumbPathLevelOne, + breadcrumbPathLevelTwo:data.breadcrumbPathLevelTwo + } + } + ], + left_menu:[ + { + partial:'index_left_menu', + context:{ + left_menu:data.left_menu + } + } + ], + right_menu_help:[ + { + partial:'index_right_menu_help', + context:{ + + } + } + ], + content: [ + { + partial:'users_form', + context:{ + formContext: data.breadcrumbPathLevelTwo, + formHtml: data.formHtml, + formData: data.formData, + formDataRaw: data.formDataRaw, + formTitle: data.formTitle, + isForm: data.isForm, + content_body: {sections: + data.list_data + } + } + } + + ] + }); + + }else{ + + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home - Error', + page_description:'Apache Stratos Home - Error' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + content: [ + + { + partial: 'error_page', + context:{ + error:data.error, + content_title:'Sorry Something went Wrong...! ', + content_body:{ + + } + + } + } + ] + }); + } +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/wizard.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/wizard.js b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/wizard.js new file mode 100644 index 0000000..e292c60 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/renderers/wizard.js @@ -0,0 +1,123 @@ +/* + * + * 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 render = function (theme, data, meta, require) { + + if(data.error.length == 0 ){ + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Wizard', + page_description:'Apache Stratos Wizard' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + sub_header:[ + { + partial:'index_sub_header', + context:{ + breadcrumbPathLevelOne:'wizard', + breadcrumbPathLevelTwo:data.breadcrumbPathLevelTwo + } + } + ], + left_menu:[ + { + partial:'index_left_menu', + context:{ + left_menu:data.left_menu + } + } + ], + right_menu_help:[ + { + partial:'index_right_menu_help', + context:{ + } + } + ], + content: [ + + { + partial: 'wizard', + context:{ + content_menu:'links', + content_title:'Configuration Wizard', + formData: data.formData, + formDataRaw: data.formDataRaw, + formTitle: data.formTitle, + isSelection: data.isSelection, + wizardstep:data.wizardstep, + nsettype:data.nsettype, + step:data.step, + pstep:data.pstep, + steplast:data.steplast + + } + } + ] + }); + + }else{ + + theme('index', { + page_meta: [ + { + partial:'index_title', + context:{ + page_title:'Apache Stratos Home - Error', + page_description:'Apache Stratos Home - Error' + } + } + ], + header:[ + { + partial: 'index_header', + context:{ + } + } + ], + content: [ + + { + partial: 'error_page', + context:{ + error:data.error, + content_title:'Sorry Something went Wrong...! ', + content_body:{ + + } + + } + } + ] + }); + + } +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/themes/theme0/theme.js ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/theme.js b/components/org.apache.stratos.manager.console/console/themes/theme0/theme.js new file mode 100644 index 0000000..69b7c05 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/themes/theme0/theme.js @@ -0,0 +1,104 @@ +/* + * + * 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 engine = require('caramel').engine('handlebars', (function () { + return { + partials: function (Handlebars) { + var theme = caramel.theme(); + var partials = function (file) { + (function register(prefix, file) { + var i, length, name, files; + if (file.isDirectory()) { + files = file.listFiles(); + length = files.length; + for (i = 0; i < length; i++) { + file = files[i]; + register(prefix ? prefix + '.' + file.getName() : file.getName(), file); + } + } else { + name = file.getName(); + if (name.substring(name.length - 4) !== '.hbs') { + return; + } + file.open('r'); + Handlebars.registerPartial(prefix.substring(0, prefix.length - 4), file.readAll()); + file.close(); + } + })('', file); + }; + //TODO : we don't need to register all partials in the themes dir. + //Rather register only not overridden partials + partials(new File(theme.__proto__.resolve.call(theme, 'partials'))); + partials(new File(theme.resolve('partials'))); + + Handlebars.registerHelper('isAllowed', function(action, options) { + if(caramel.meta().request.permissions != undefined && caramel.meta().request.permissions[action]) { + return options.fn(this); + } + return options.inverse(this); + }); + + + Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) { + + switch (operator) { + case '!=': + return (v1 != v2) ? options.fn(this) : options.inverse(this); + case '==': + return (v1 == v2) ? options.fn(this) : options.inverse(this); + case '===': + return (v1 === v2) ? options.fn(this) : options.inverse(this); + case '<': + return (v1 < v2) ? options.fn(this) : options.inverse(this); + case '<=': + return (v1 <= v2) ? options.fn(this) : options.inverse(this); + case '>': + return (v1 > v2) ? options.fn(this) : options.inverse(this); + case '>=': + return (v1 >= v2) ? options.fn(this) : options.inverse(this); + default: + return options.inverse(this); + } + }); + + Handlebars.registerHelper('user', function(action, options) { + if(caramel.meta().session.get("USER_NAME") != undefined ) { + return caramel.meta().session.get("USER_NAME"); + } + return ""; + }); + + Handlebars.registerHelper('domain', function(action, options) { + if(caramel.meta().session.get("TENANT_DOMAIN") != undefined ) { + return caramel.meta().session.get("TENANT_DOMAIN"); + } + return ""; + }); + Handlebars.registerHelper('tenantID', function(action, options) { + if(caramel.meta().session.get("TENANT_ID") != undefined ) { + return caramel.meta().session.get("TENANT_ID"); + } + return ""; + }); + + } + } +}())); http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/users.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/users.jag b/components/org.apache.stratos.manager.console/console/users.jag new file mode 100644 index 0000000..9d1e40a --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/users.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.users"), + 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('/users', 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/users_form.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/users_form.jag b/components/org.apache.stratos.manager.console/console/users_form.jag new file mode 100644 index 0000000..0bce660 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/users_form.jag @@ -0,0 +1,72 @@ +<% +/* + * + * 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'); + +var log = new Log("apacheStratos.users"); +var error=[]; +var caramel = require('caramel'), + util = require('/controllers/rest/rest_calls.jag'), + uriMatcher = new URIMatcher(request.getRequestURI()), + elements = uriMatcher.match('/{context}/users/{formtype}/'), + list_data, + isForm = false; + +if(!elements){ + elements = uriMatcher.match('/{context}/users/{formtype}/{action}/'); + isForm = true; +} + +var formData = require('controllers/forms/schema/users/' + elements.formtype + '.json'), + formDataRaw = require('controllers/forms/default/users/' + elements.formtype + '.json'), + formTitle = formData.title; + +if(elements.formtype == 'users'){ + list_data = util.RESTCalls.getUserList(); + if(list_data.userInfoBean && list_data.userInfoBean.length === 0){ + list_data = null; + } + +}else if(elements.formtype == 'tenants'){ + list_data = util.RESTCalls.getTenants(); + if(list_data.tenantInfoBean && list_data.tenantInfoBean.length === 0){ + list_data = null; + } +} + +//check user has permission to access endpoints +if( list_data != null && list_data.hasOwnProperty('Error')){ + error.push(list_data.Error); +} + +caramel.render({ + breadcrumbPathLevelOne: 'users', + breadcrumbPathLevelTwo: elements.formtype, + isForm: isForm, + formTitle: formTitle, + formDataRaw: JSON.stringify(formDataRaw), + formData: JSON.stringify(formData), + list_data: list_data, + 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/wizard.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/wizard.jag b/components/org.apache.stratos.manager.console/console/wizard.jag new file mode 100644 index 0000000..232b939 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/wizard.jag @@ -0,0 +1,115 @@ +<% +/* + * + * 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.wizard"); +var error = []; +var caramel = require('caramel'), + setptype,psetptype,nsettype,steplast = false, + context = caramel.configs().context, + util = require('/controllers/rest/rest_calls.jag'), + menuJson = require('/controllers/menu/menu.json'), + uriMatcher = new URIMatcher(request.getRequestURI()), + elements = uriMatcher.match('/{context}/wizard/{wtype}/{wstep}'), + wizardstep = '', + wizardtype = 'vm', + isSelection = false, + userPermissions = session.get('PERMISSIONS'); + +if(elements==null){ + wizardstep = 1; +}else{ + wizardstep = elements.wstep; +} + +var vm = { + '1':'partitions', + '2':'autoscalingpolicies', + '3':'deployments', + '4':'loadbalancer', + '5':'cartridges' , + '6':'multitenant' + }; +var docker = [ + 'autoscalingpolicies', + 'deployments', + 'loadbalancer', + 'cartridges' , + 'multitenant' + ]; + +var count = 0; +for (var k in vm) { + if (vm.hasOwnProperty(k)) { + ++count; + } +} + +if(wizardtype == 'vm' && vm.hasOwnProperty(wizardstep)){ + + nsettype = parseInt(wizardstep)+1; + setptype = vm[wizardstep]; + psetptype = parseInt(wizardstep)-1; + var formData = require('/controllers/forms/schema/configure/' + vm[wizardstep] + '.json'), + formDataRaw = require('/controllers/forms/default/configure/' + vm[wizardstep] + '.json'), + formTitle = formData.title; +}else{ + error.push({"errorMessage": "Sorry incorrect wizard value set"}); +} + +if(count >= nsettype){ +}else{ + nsettype=count; + steplast=true; +} + + +//create left menu +var leftMenu = menuGenerator(context, menuJson.menu, userPermissions); +//create metro block +var metroMenu = metroGenerator('/', menuJson.menu, userPermissions); + +var config_status = util.RESTCalls.getConfigStatus(); + + + + + + +log.info(config_status) +caramel.render({ + metro_menu: metroMenu, + left_menu: leftMenu, + formTitle: formTitle, + formDataRaw: JSON.stringify(formDataRaw), + formData: JSON.stringify(formData), + isSelection: isSelection, + wizardstep:wizardstep, + nsettype:nsettype, + step:setptype, + pstep:psetptype, + steplast:steplast, + error: error +}); + +%> \ No newline at end of file
