aboutsummaryrefslogtreecommitdiffstats
path: root/openo-portal/portal-extsys/src/main/webapp/extsys/sdn
diff options
context:
space:
mode:
authorsunqi310 <sun.qi310@zte.com.cn>2016-09-14 15:31:25 +0800
committersunqi310 <sun.qi310@zte.com.cn>2016-09-14 15:31:25 +0800
commit3d042d10258e3c6763bedb7da1071c7568788e73 (patch)
tree5b9ee3cafcf5d211b7205127807711703526502d /openo-portal/portal-extsys/src/main/webapp/extsys/sdn
parentd089cf2631c2d647b97977bff905a2bdbff93986 (diff)
Add extsys gui
Change-Id: Ifd4007f7f41b6efcc5abb120a1edf3e81f213d6d Signed-off-by: sunqi310 <sun.qi310@zte.com.cn>
Diffstat (limited to 'openo-portal/portal-extsys/src/main/webapp/extsys/sdn')
-rw-r--r--openo-portal/portal-extsys/src/main/webapp/extsys/sdn/css/sdn.css492
-rw-r--r--openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/loadi18nApp.js42
-rw-r--r--openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/roc-sdn-iui-i18n-en-US.properties49
-rw-r--r--openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/roc-sdn-iui-i18n-zh-CN.properties49
-rw-r--r--openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdn-validate.js67
-rw-r--r--openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdnController.js202
-rw-r--r--openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdnUtil.js89
-rw-r--r--openo-portal/portal-extsys/src/main/webapp/extsys/sdn/sdnView.html173
8 files changed, 1163 insertions, 0 deletions
diff --git a/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/css/sdn.css b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/css/sdn.css
new file mode 100644
index 00000000..558ac201
--- /dev/null
+++ b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/css/sdn.css
@@ -0,0 +1,492 @@
+/**
+ * Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE)
+ *
+ * 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.
+ */
+body {
+ font-family: microsoft yahei !important;
+}
+
+/* blue pill (inspired by iTunes)
+*******************************************************************************/
+
+.grey {
+ background-color: #e5e5e5;
+ color: #333;
+}
+
+.blue {
+
+ background-color: #5b9bd1;
+ border-radius: 20px;
+ color: #fff;
+ font-weight: bold;
+ padding: 8px 0;
+ text-align: center;
+ width: 100px;
+}
+
+.blue:hover {
+ background-color: #e8f3fd;
+ color: #5b9bd1;
+}
+
+.blue.selected {
+ border: 0;
+ background-color: #5b9bd1;
+ color: #fff;
+}
+
+.blue.selected:hover {
+ border: 0;
+ background-color: #5b9bd1;
+ color: #fff;
+}
+
+p {
+ color: #444;
+ font-size: 14px;
+ font-weight: normal;
+ line-height: 21px;
+ margin: 0 0 12px 0;
+}
+
+p.credit {
+ border-top: 1px solid #ccc;
+ font-size: 14px;
+ line-height: 140%;
+ margin: 36px 0 12px 0;
+ padding: 8px 0 0 0;
+ text-align: center;
+}
+
+ul.column {
+ float: left;
+ list-style: none;
+ width: 675px;
+}
+
+ul.column li {
+ background: #eee;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ -webkit-box-shadow: inset 0 1px 1px 0 #c7c7c7;
+ box-shadow: inset 0 1px 1px 0 #c7c7c7;
+ float: left;
+ margin: 10px 0 0 10px;
+ display: block;
+ height: 150px;
+ text-align: center;
+ width: 215px;
+}
+
+/* Clear Floated Elements
+------------------------------------------------------------------------------*/
+.column:after,.button-collection:after,.clearfix:after,div.project-info:after
+ {
+ clear: both;
+ content: ' ';
+ display: block;
+ font-size: 0;
+ line-height: 0;
+ visibility: hidden;
+ width: 0;
+ height: 0;
+}
+
+.container-fluid {
+ background-color:white !important;
+ min-height:500px;
+}
+
+.nav-tabs {
+ border: 0;
+}
+
+.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus
+ {
+ border: 0;
+ border-top: 3px solid #F3565D;
+}
+
+.nav-tabs>li>a {
+ border-radius: 0;
+}
+
+.nav-tabs>li>a:hover {
+ background-color: #f1f3fa;
+ border: 1Px solid #f1f3fa;
+}
+
+.c3 {
+ margin-top: 120px;
+}
+
+.skills-chart-breadcrumb {
+
+}
+
+.blue:selected {
+ border: 0;
+ background-color: #5b9bd1;
+}
+
+.btn {
+ /* border-width: 0; */
+ /* padding: 7px 14px; */
+ /* font-size: 14px; */
+ /* outline: none !important; */
+ /* background-image: none !important; */
+ /* filter: none; */
+ /* -webkit-box-shadow: none; */
+ -moz-box-shadow: none;
+ /* box-shadow: none; */
+ /* text-shadow: none; */
+}
+
+select {
+ border-width: 1px;
+ padding: 4px 1px;
+ border-radius: 4px;
+}
+
+.input-sm {
+ padding: 4px 10px;
+}
+
+.btn-block {
+ display: block;
+ width: 100%;
+ padding-left: 0;
+ padding-right: 0;
+}
+
+/* Bootstrap buttons */
+
+
+.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active
+ {
+ color: #333;
+ background-color: #ededed;
+ border-color: #b3b3b3;
+}
+
+.open .btn-default.dropdown-toggle {
+ color: #333;
+ background-color: #ededed;
+ border-color: #b3b3b3;
+}
+
+.btn-default:active,.btn-default.active {
+ background-image: none;
+ background-color: #e0e0e0;
+ font-weight: bold;
+}
+
+.btn-default:active:hover,.btn-default.active:hover {
+ background-color: #e6e6e6;
+}
+
+.open .btn-default.dropdown-toggle {
+ background-image: none;
+}
+
+.btn-default.disabled,.btn-default.disabled:hover,.btn-default.disabled:focus,.btn-default.disabled:active,.btn-default.disabled.active,.btn-default[disabled],.btn-default[disabled]:hover,.btn-default[disabled]:focus,.btn-default[disabled]:active,.btn-default[disabled].active,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default:hover,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default.active
+ {
+ background-color: #fff;
+ border-color: #ccc;
+}
+
+.btn-default .badge {
+ color: #fff;
+ background-color: #333;
+}
+
+
+.btn-default>i[class^="icon-"],.btn-default>i[class*="icon-"] {
+ color: #8c8c8c;
+}
+
+div[data-name="tab_zone"] div {
+ background-color: #f1f3fa;
+ padding: 0px;
+}
+
+div[data-name="cond_zone"] div {
+ background-color: #fff;
+ margin-top: 15px;
+ margin-bottom: 15px;
+}
+
+div[data-name="res-conds-zone"] {
+ display: inline;
+}
+
+div[data-name="res-conds-zone"] select,div[data-name="res-conds-zone"] span
+ {
+ /**height:33px;*/
+ margin-left: 15px;
+ color: #5b9bd1;
+ border-color: #ccc;
+ font-weight: bold;
+}
+
+.input{
+ width:250px;
+ height: 34px;
+ padding: 6px 12px;
+ font-size: 14px;
+ line-height: 1.42857143;
+ color: #555;
+ background-color: #fff;
+ background-image: none;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
+ -webkit-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
+ transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
+}
+
+div.separator {
+ margin: 20px;
+}
+
+div.separator div {
+ text-align: center;
+ line-height: 0;
+}
+
+div.separator-line {
+ height: 1px !important;
+ width: 100%;
+ background: #ddd;
+ overflow: hidden;
+}
+
+.dropdown-toggle {
+ color: #5b9bd1;
+}
+
+.calendar-date {
+ color: #5b9bd1;
+}
+
+.range_inputs {
+ color: #5b9bd1;
+}
+
+.btn.dropdown-toggle,.btn-group .btn.dropdown-toggle,.btn:hover,.btn:disabled,.btn[disabled],.btn:focus,.btn:active,.btn.active
+ {
+ outline: none !important;
+ background-image: none !important;
+ filter: none;
+ -webkit-box-shadow: none;
+ -moz-box-shadow: none;
+ box-shadow: none;
+ text-shadow: none;
+}
+
+#skills-chart-breadcrumb {
+ margin-bottom: 10px
+}
+
+/*增加daterangepicker的css*/
+input[name="daterange"] {
+ width: 220px;
+ line-height: 0;
+ height: 31px;
+ vertical-align: top;
+ margin-top: 2px;
+}
+
+.daterangepicker .ranges {
+ width: 205px;
+}
+
+.daterangepicker .ranges input {
+ width: 95px !important;
+}
+
+td.details-control {
+ background: url('../images/details_open.png') no-repeat center center;
+ cursor: pointer;
+}
+
+tr.shown td.details-control {
+ background: url('../images/details_close.png') no-repeat center center;
+}
+
+.details table td {
+ word-wrap: break-word;
+ word-break: normal;
+ border-top: 1px solid #dddddd;
+}
+
+.details table tr:first-child td {
+ border-top: none;
+}
+
+.details table {
+ table-layout: fixed;
+ width: 100%;
+}
+
+td.title {
+ width: 10%;
+}
+
+table.dataTable tbody th,table.dataTable tbody td {
+ padding: 8px 10px;
+}
+
+div.dataTables_length,div.dataTables_info {
+ display: inline;
+}
+
+div.dataTables_paginate {
+ display: inline;
+ float: right;
+}
+
+div.pagination-panel {
+ margin-right: 10px;
+}
+
+input.pagination-panel-input {
+ width: 50px;
+}
+
+#ict_res_table_div {
+ margin-top: 15px;
+}
+
+#ict_res_table_div label {
+ font-weight: 100;
+}
+
+.daterangepicker .daterangepicker_start_input label,.daterangepicker .daterangepicker_end_input label
+ {
+ color: #5b9bd1;
+}
+
+.daterangepicker .ranges .input-mini {
+ color: #5b9bd1;
+}
+
+.cancelBtn {
+ padding: 5px 10px 5px 10px;
+}
+
+.btn:focus,.btn:active:focus,.btn.active:focus {
+ outline: 0;
+}
+
+#ict_res_table_div table {
+ width: 100% !important;
+}
+
+.control-label .required {
+ color: #e02222;
+ font-size: 12px;
+ padding-left: 2px;
+}
+
+#ict_vim_table tbody tr{
+ cursor:pointer;
+}
+
+
+/*卡片面板样式*/
+.animated-panel {
+ -webkit-animation-duration: .5s;
+ animation-duration: .5s;
+ -webkit-animation-fill-mode: both;
+ animation-fill-mode: both;
+}
+
+.hpanel {
+ background-color: none;
+ border: none;
+ box-shadow: none;
+ margin-bottom: 25px;
+
+}
+
+.hpanel .panel-body {
+ border: 1px solid #e4e5e7;
+ border-radius: 2px;
+ padding: 20px;
+ position: relative;
+}
+.h-200 {
+ min-height: 220px;
+}
+
+.m-t-xl {
+ margin-top: 40px;
+}
+
+.m-t-xl div {
+ margin-bottom: 15px;
+}
+
+.text-success {
+ color: #0d638f;
+}
+.hpanel > .panel-footer {
+ color: inherit;
+ border: 1px solid #e4e5e7;
+ border-top: none;
+ font-size: 90%;
+ background: #f7f9fa;
+ height:40px;
+ padding: 5px 15px;
+}
+.color_cloud{
+ color:#ccc;
+}
+.stats-title{
+
+}
+
+h3{
+ margin-top: 10px;
+ margin-bottom: 40px;
+ font-weight: 200;
+}
+
+.blue-font{
+ color:#428bca;
+}
+
+.hpanel > .panel-footer .pull-right a{
+ margin-left: 5px;
+}
+
+.hpanel > .panel-footer .pull-right .btn{
+ min-width: 30px !important;
+}
+
+.font-bold {
+ font-weight: 600;
+ margin-bottom: 15px;
+}
+
+.hpanel_show{
+ background-color: #f7f9fa;
+}
+
+.sdn-padding {
+ padding-left: 0;
+} \ No newline at end of file
diff --git a/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/loadi18nApp.js b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/loadi18nApp.js
new file mode 100644
index 00000000..df993437
--- /dev/null
+++ b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/loadi18nApp.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE)
+ *
+ * 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.
+ */
+function loadPropertiesSideMenu(lang, propertiesFileNamePrefix, propertiesFilePath){
+ jQuery.i18n.properties({
+ language:lang,
+ name:propertiesFileNamePrefix,
+ path:propertiesFilePath,
+ mode:'map',
+ callback: function() {
+ var i18nItems = $('[name_i18n=org_openo_nfv_roc_ui_i18n]');
+ for(var i=0;i<i18nItems.length;i++){
+ var $item = $(i18nItems.eq(i));
+ var itemId = $item.attr('id');
+ var itemTitle = $item.attr('title');
+ if(typeof($item.attr("title")) == "string"){
+ $item.attr("title", ($.i18n.prop(itemTitle)));
+ }
+ if(undefined != itemId && typeof($item.attr("placeholder"))=="undefined"){
+ $item.text($.i18n.prop(itemId));
+ }else if(undefined != itemId && typeof($item.attr("placeholder"))!="undefined"){
+ $item.attr("placeholder", $.i18n.prop(itemId));
+ }
+ }
+ }
+ });
+}
+var lang = getLanguage();
+loadPropertiesSideMenu(lang, 'roc-sdn-iui-i18n', 'i18n/');
+
diff --git a/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/roc-sdn-iui-i18n-en-US.properties b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/roc-sdn-iui-i18n-en-US.properties
new file mode 100644
index 00000000..efdaea5c
--- /dev/null
+++ b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/roc-sdn-iui-i18n-en-US.properties
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE)
+#
+# 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.
+#
+
+roc-sdn-iui-common-tip=Tip:
+
+roc-sdn-iui-text-register=Register SDN controller info
+
+roc-sdn-iui-message-growl-msg-title=SDN controller info
+roc-sdn-iui-message-query-fail=Query SDN controller failed.
+roc-sdn-iui-message-save-success=Save successfully.
+roc-sdn-iui-message-save-fail=Save failed.
+roc-sdn-iui-message-update-success=Update successfully.
+roc-sdn-iui-message-update-fail=Update failed.
+roc-sdn-iui-message-delete-confirm=Do you want to delete the current SDN controller?
+roc-sdn-iui-message-delete-success=SDN controller deleted successfully.
+roc-sdn-iui-message-delete-fail=SDN controller deleted failed.
+
+roc-sdn-iui-text-update=Modify SDN controller info
+roc-sdn-iui-text-registerBtn=Register
+roc-sdn-iui-text-name=Name
+roc-sdn-iui-text-type=Type
+roc-sdn-iui-text-userName=Username
+roc-sdn-iui-text-password=Password
+roc-sdn-iui-text-cancelBtn=Cancel
+roc-sdn-iui-text-saveBtn=Save
+roc-sdn-iui-text-status-normal=Normal
+roc-sdn-iui-text-status-fail=Alarm
+roc-sdn-iui-text-total=Total
+roc-sdn-iui-text-total-sdn= of SDN Controller
+
+roc-sdn-iui-validate-name=Please enter a name
+roc-sdn-iui-validate-url-required=Please enter the right URL
+roc-sdn-iui-validate-url=Example: http://10.0.0.1:8181
+roc-sdn-iui-validate-username=Please enter a username
+roc-sdn-iui-validate-password=Please enter a password
+roc-sdn-iui-text-url-tip=Example: http://10.0.0.1:8181 \ No newline at end of file
diff --git a/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/roc-sdn-iui-i18n-zh-CN.properties b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/roc-sdn-iui-i18n-zh-CN.properties
new file mode 100644
index 00000000..a8e7dbcb
--- /dev/null
+++ b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/i18n/roc-sdn-iui-i18n-zh-CN.properties
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE)
+#
+# 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.
+#
+
+roc-sdn-iui-common-tip=提示:
+
+roc-sdn-iui-text-register=注册SDN控制器信息
+
+roc-sdn-iui-message-growl-msg-title=SDN控制器信息
+roc-sdn-iui-message-query-fail=查询SDN控制器失败。
+roc-sdn-iui-message-save-success=保存成功。
+roc-sdn-iui-message-save-fail=保存失败。
+roc-sdn-iui-message-update-success=修改成功。
+roc-sdn-iui-message-update-fail=修改失败。
+roc-sdn-iui-message-delete-confirm=确定删除所选SDN控制器信息?
+roc-sdn-iui-message-delete-success=删除成功。
+roc-sdn-iui-message-delete-fail=删除失败。
+
+roc-sdn-iui-text-update=修改SDN控制器信息
+roc-sdn-iui-text-registerBtn=注册
+roc-sdn-iui-text-name=名称
+roc-sdn-iui-text-type=类型
+roc-sdn-iui-text-userName=用户名
+roc-sdn-iui-text-password=密码
+roc-sdn-iui-text-cancelBtn=取消
+roc-sdn-iui-text-saveBtn=保存
+roc-sdn-iui-text-status-normal=正常
+roc-sdn-iui-text-status-fail=报警
+roc-sdn-iui-text-total=共
+roc-sdn-iui-text-total-sdn= SDN控制器
+
+roc-sdn-iui-validate-name=请输入名称
+roc-sdn-iui-validate-url-required=请输入正确的URL
+roc-sdn-iui-validate-url=例如:http://10.0.0.1:8181
+roc-sdn-iui-validate-username=请输入用户名
+roc-sdn-iui-validate-password=请输入密码
+roc-sdn-iui-text-url-tip=例如:http://10.0.0.1:8181 \ No newline at end of file
diff --git a/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdn-validate.js b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdn-validate.js
new file mode 100644
index 00000000..21b711af
--- /dev/null
+++ b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdn-validate.js
@@ -0,0 +1,67 @@
+$(function () {
+ var form = $('#sdn_form');
+ var error = $('.alert-danger', form);
+ var success = $('.alert-success', form);
+
+ form.validate({
+ doNotHideMessage : true, //this option enables to show the error/success messages on tab switch.
+ errorElement : 'span', //default input error message container
+ errorClass : 'help-block', // default input error message class
+ focusInvalid : false, // do not focus the last invalid input
+ rules : {
+ name : {
+ required : true,
+ maxlength : 20
+ },
+ url : {
+ required : true,
+ url : true
+ },
+ userName : {
+ required : true,
+ maxlength : 20
+ },
+ password : {
+ required : true,
+ maxlength : 20
+ }
+ },
+ messages : {
+ name : {
+ required : $.i18n.prop("roc-sdn-iui-validate-name")
+ },
+ url : {
+ required : $.i18n.prop("roc-sdn-iui-validate-url-required"),
+ url : $.i18n.prop("roc-sdn-iui-validate-url")
+ },
+ userName : {
+ required : $.i18n.prop('roc-sdn-iui-validate-username')
+ },
+ password : {
+ required : $.i18n.prop('roc-sdn-iui-validate-password')
+ }
+ },
+ errorPlacement : function (error, element) { // render error placement for each input type
+ error.insertAfter(element); // for other inputs, just perform default behavior
+ },
+ invalidHandler : function (event, validator) { //display error alert on form submit
+ success.hide();
+ error.show();
+ },
+ highlight : function (element) { // hightlight error inputs
+ $(element).closest('.form-group').removeClass('has-success').addClass('has-error'); // set error class to the control group
+ },
+ unhighlight : function (element) { // revert the change done by hightlight
+ $(element).closest('.form-group').removeClass('has-error'); // set error class to the control group
+ },
+ success : function (label) {
+ label.addClass('valid') // mark the current input as valid and display OK icon
+ .closest('.form-group').removeClass('has-error'); // set success class to the control group
+ },
+ submitHandler : function (form) {
+ success.show();
+ error.hide();
+ //add here some ajax code to submit your form or just call form.submit() if you want to submit the form without ajax
+ }
+ });
+});
diff --git a/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdnController.js b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdnController.js
new file mode 100644
index 00000000..0b6c5c2e
--- /dev/null
+++ b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdnController.js
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var vm = avalon
+ .define({
+ $id : "sdnController",
+ sdnInfo : [],
+ server_rtn : {
+ info_block : false,
+ warning_block : false,
+ rtn_info : "",
+ $RTN_SUCCESS : "RTN_SUCCESS",
+ $RTN_FAILED : "RTN_FAILED"
+ },
+ $Status : {
+ success : "active",
+ failed : "inactive"
+ },
+ $restUrl : {
+ querySdnControllerInfoUrl : '/openoapi/extsys/v1/sdncontrollers',
+ addSdnControllerInfoUrl : '/openoapi/extsys/v1/sdncontrollers',
+ updateSdnControllerInfoUrl : '/openoapi/extsys/v1/sdncontrollers',
+ delSdnControllerInfoUrl : '/openoapi/extsys/v1/sdncontrollers'
+ },
+ $htmlText : {
+ saveSuccess : $.i18n.prop("roc-sdn-iui-message-save-success"),
+ saveFail : $.i18n.prop("roc-sdn-iui-message-save-fail"),
+ updateSuccess : $.i18n.prop("roc-sdn-iui-message-update-success"),
+ updateFail : $.i18n.prop("roc-sdn-iui-message-update-fail")
+ },
+ $initTable : function () {
+ $.ajax({
+ "type" : 'GET',
+ "url" : vm.$restUrl.querySdnControllerInfoUrl,
+ "dataType" : "json",
+ "success" : function (resp) {
+ if (resp.operationResult == "SUCCESS") {
+ vm.sdnInfo = (resp == null) ? [] : resp.data;
+ } else {
+ vm.sdnInfo = [];
+ bootbox.alert($.i18n.prop("roc-sdn-iui-message-query-fail"));
+ return;
+ }
+ },
+ error : function (XMLHttpRequest, textStatus, errorThrown) {
+ bootbox.alert($.i18n.prop("roc-sdn-iui-message-query-fail") + ":" + textStatus + ":" + errorThrown);
+ return;
+ },
+ complete : function () {
+ sdnUtil.tooltipSdnStatus();
+ }
+ });
+ },
+ $sdnType : {
+ condName : $.i18n.prop("roc-sdn-iui-text-type"),
+ component_type : 'select',
+ selectItems : [{
+ cond_value : 'ODL',
+ name : "ODL",
+ value : true
+ }, {
+ cond_value : 'ONOS',
+ name : "ONOS",
+ value : true
+ }
+ ]
+ },
+ addSdn : {
+ title : $.i18n.prop("roc-sdn-iui-text-register"),
+ sdnId : "",
+ name : "",
+ type : "ODL",
+ typeDisabled : false,
+ url : "",
+ urlTip : $.i18n.prop("roc-sdn-iui-text-url-tip"),
+ userName : "",
+ password : "",
+ saveType : "add"
+ },
+ $showSdnTable : function () {
+ vm.addSdn.title = $.i18n.prop("roc-sdn-iui-text-register"),
+ vm.addSdn.sdnId = "";
+ vm.addSdn.name = "";
+ vm.addSdn.type = "ODL";
+ vm.addSdn.typeDisabled = false;
+ vm.addSdn.url = "";
+ vm.addSdn.userName = "";
+ vm.addSdn.password = "";
+ vm.addSdn.saveType = "add";
+ vm.server_rtn.warning_block = false;
+ vm.server_rtn.info_block = false;
+
+ $(".form-group").each(function () {
+ $(this).removeClass('has-success');
+ $(this).removeClass('has-error');
+ $(this).find(".help-block[id]").remove();
+ });
+ $("#addSdnDlg").modal("show");
+ },
+ $saveSdn : function () {
+ var form = $('#sdn_form');
+ if (form.valid() == false) {
+ return false;
+ }
+ vm.server_rtn.info_block = true;
+ vm.server_rtn.warning_block = false;
+ vm.addSdn.status = vm.$Status.success;
+
+ var param = {
+ name : vm.addSdn.name,
+ controllerType : $("#type").val(),
+ url : vm.addSdn.url,
+ userName : vm.addSdn.userName,
+ password : vm.addSdn.password
+ }
+ if (vm.addSdn.saveType == "add") {
+ for( var i = 0; i < vm.sdnInfo.length; i ++ ){
+ if(vm.addSdn.url == vm.sdnInfo[i].url){
+ sdnUtil.growl($.i18n.prop("roc-sdn-iui-message-growl-msg-title") + 'already exist',"info");
+ $('#addSdnDlg').modal('hide');
+ return;
+ }
+ }
+ $.ajax({
+ type : "POST",
+ url : vm.$restUrl.addSdnControllerInfoUrl,
+ data : JSON.stringify(param),
+ dataType : "json",
+ contentType : "application/json",
+ success : function (data) {
+ vm.server_rtn.info_block = false;
+ vm.server_rtn.warning_block = false;
+ if (data) {
+ vm.sdnInfo = [];
+ vm.$initTable();
+
+ $('#addSdnDlg').modal('hide');
+ sdnUtil.showMessage(vm.$htmlText.saveSuccess, "success");
+ } else {
+ vm.server_rtn.warning_block = true;
+ vm.server_rtn.rtn_info = vm.$htmlText.saveFail;
+ sdnUtil.showMessage(vm.$htmlText.saveFail, "failed");
+ }
+ },
+ error : function (XMLHttpRequest, textStatus, errorThrown) {
+ vm.server_rtn.warning_block = true;
+ vm.server_rtn.rtn_info = textStatus + ":" + errorThrown;
+ vm.server_rtn.info_block = false;
+ }
+ });
+ } else {
+ $.ajax({
+ type : "PUT",
+ url : vm.$restUrl.updateSdnControllerInfoUrl + vm.addSdn.sdnId,
+ data : JSON.stringify(param),
+ dataType : "json",
+ contentType : "application/json",
+ success : function (data) {
+ vm.server_rtn.info_block = false;
+ vm.server_rtn.warning_block = false;
+ if (data) {
+ for (var i = 0; i < vm.sdnInfo.length; i++) {
+ if (vm.sdnInfo[i].sdnControllerInstanceId == vm.addSdn.sdnId) {
+ vm.sdnInfo[i].name = vm.addSdn.name;
+ vm.sdnInfo[i].type = $("#type").val();
+ vm.sdnInfo[i].url = vm.addSdn.url;
+ vm.sdnInfo[i].userName = vm.addSdn.userName;
+ vm.sdnInfo[i].password = vm.addSdn.password;
+ }
+ }
+ $('#addSdnDlg').modal('hide');
+ sdnUtil.showMessage(vm.$htmlText.updateSuccess, "success");
+ } else {
+ vm.server_rtn.warning_block = true;
+ vm.server_rtn.rtn_info = vm.$htmlText.updateFail;
+ sdnUtil.showMessage(vm.$htmlText.updateFail, "failed");
+ }
+ },
+ error : function (XMLHttpRequest, textStatus, errorThrown) {
+ vm.server_rtn.warning_block = true;
+ vm.server_rtn.rtn_info = textStatus + ":" + errorThrown;
+ vm.server_rtn.info_block = false;
+ }
+ });
+ }
+ },
+ });
+avalon.scan();
+vm.$initTable();
diff --git a/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdnUtil.js b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdnUtil.js
new file mode 100644
index 00000000..59062fcd
--- /dev/null
+++ b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/js/sdnUtil.js
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var sdnUtil = {};
+
+sdnUtil.delSdn = function (el) {
+ bootbox.confirm($.i18n.prop("roc-sdn-iui-message-delete-confirm"), function (result) {
+ if (result) {
+ $.ajax({
+ type : "DELETE",
+ url : vm.$restUrl.delSdnControllerInfoUrl + el.sdnControllerInstanceId,
+ dataType : "json",
+ success : function (data) {
+ if (data) {
+ for (var i = 0; i < vm.sdnInfo.length; i++) {
+ if (el.sdnControllerInstanceId == vm.sdnInfo[i].sdnControllerInstanceId) {
+ vm.sdnInfo.splice(i, 1);
+ break;
+ }
+ }
+ sdnUtil.showMessage($.i18n.prop("roc-sdn-iui-message-delete-success"), "success");
+ } else {
+ sdnUtil.showMessage($.i18n.prop("roc-sdn-iui-message-delete-fail"), "warning");
+ }
+ },
+ error : function () {
+ sdnUtil.showMessage($.i18n.prop("roc-sdn-iui-message-delete-fail"), "warning");
+ }
+ });
+ }
+ });
+}
+
+sdnUtil.updateSdn = function (data) {
+ vm.addSdn.sdnId = data.sdnControllerInstanceId;
+ vm.addSdn.name = data.name;
+ vm.addSdn.type = data.controllerType;
+ vm.addSdn.typeDisabled = true;
+ vm.addSdn.url = data.url;
+ vm.addSdn.userName = data.userName;
+ vm.addSdn.password = data.password;
+ vm.addSdn.saveType = "update";
+ vm.addSdn.title = $.i18n.prop("roc-sdn-iui-text-update");
+ vm.server_rtn.info_block = false;
+ vm.server_rtn.warning_block = false;
+
+ $(".form-group").each(function () {
+ $(this).removeClass('has-success');
+ $(this).removeClass('has-error');
+ $(this).find(".help-block[id]").remove();
+ });
+ $("#addSdnDlg").modal("show");
+}
+
+sdnUtil.tooltipSdnStatus = function () {
+ $("[data-toggle='tooltip']").tooltip();
+}
+
+sdnUtil.growl = function (message, type) {
+ $.growl({
+ icon : "fa fa-envelope-o fa-lg",
+ title : "&nbsp;&nbsp;Notice: ",
+ message : message + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
+ }, {
+ type : type
+ });
+}
+
+sdnUtil.showMessage = function(message, type) {
+ $.growl({
+ icon: "fa fa-envelope-o fa-lg",
+ title: "&nbsp;&nbsp;" + $.i18n.prop("roc-sdn-iui-common-tip"),
+ message: message
+ },{
+ type: type
+ });
+};
diff --git a/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/sdnView.html b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/sdnView.html
new file mode 100644
index 00000000..16fc12ef
--- /dev/null
+++ b/openo-portal/portal-extsys/src/main/webapp/extsys/sdn/sdnView.html
@@ -0,0 +1,173 @@
+<!--
+
+ Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE)
+
+ 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.
+
+-->
+<!DOCTYPE html>
+<html>
+<head lang="en">
+<meta charset="UTF-8">
+<title></title>
+<link href="../component/thirdparty/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
+<link href="../component/thirdparty/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
+<link href="../component/thirdparty/uniform/css/uniform.default.min.css" rel="stylesheet" type="text/css"/>
+<link href="../component/css/ZteIctIcons/style.css" rel="stylesheet" type="text/css"/>
+<link href="../framework/css/ngict-component.css" rel="stylesheet" type="text/css"/>
+<link href="../vendor/animate/animate.min.css" rel="stylesheet" type="text/css"/>
+<link href="css/sdn.css" rel="stylesheet" type="text/css"/>
+<style>
+.ms-controller {
+ visibility: hidden
+}
+</style>
+
+</head>
+<body>
+ <div class="ms-controller container-fluid" ms-controller="sdnController" >
+ <div id="addSdnDlg" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
+ <div class="modal-dialog">
+ <div class="modal-content Changepasswd">
+ <div class="content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+ <h4 id="myModalLabel">{{addSdn.title}}</h4>
+ </div>
+ <div class="modal-body">
+ <form class="form-horizontal" id="sdn_form" role="form">
+ <input type="hidden" ms-duplex="addSdn.sdnId" name="sdnId" class="form-control" />
+ <div class="form-group">
+ <label class="control-label col-sm-3">
+ <span id="roc-sdn-iui-text-name" name_i18n="org_openo_nfv_roc_ui_i18n"></span>
+ <span class="required" aria-required="true">*</span>
+ </label>
+ <div class="col-sm-7">
+ <input type="text" ms-duplex="addSdn.name" name="name" class="form-control"/>
+ <span class="help-block"></span>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="control-label col-sm-3">
+ <span id="roc-sdn-iui-text-type" name_i18n="org_openo_nfv_roc_ui_i18n"></span>
+ <span class="required" aria-required="true">*</span>
+ </label>
+ <div class="col-sm-7">
+ <select class="form-control" id="type" ms-each="$sdnType.selectItems" ms-duplex="addSdn.type" ms-attr-disabled="addSdn.typeDisabled">
+ <option ms-attr-value='el.cond_value'>{{el.name}}</option>
+ </select>
+ <span class="help-block"></span>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="control-label col-sm-3">
+ <span>URL</span>
+ <span class="required" aria-required="true">*</span>
+ </label>
+ <div class="col-sm-7">
+ <input type="text" ms-duplex="addSdn.url" name="url" class="form-control"
+ ms-attr-placeholder="addSdn.urlTip"/>
+ <span class="help-block"></span>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="control-label col-sm-3">
+ <span id="roc-sdn-iui-text-userName" name_i18n="org_openo_nfv_roc_ui_i18n"></span>
+ <span class="required" aria-required="true">*</span>
+ </label>
+ <div class="col-sm-7">
+ <input type="text" ms-duplex="addSdn.userName" name="userName" class="form-control" />
+ <span class="help-block"></span>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="control-label col-sm-3">
+ <span id="roc-sdn-iui-text-password" name_i18n="org_openo_nfv_roc_ui_i18n"></span>
+ <span class="required" aria-required="true">*</span>
+ </label>
+ <div class="col-sm-7">
+ <input type="password" ms-duplex="addSdn.password" name="password" class="form-control" />
+ <span class="help-block"></span>
+ </div>
+ </div>
+ </form>
+ </div>
+ <div class="modal-footer">
+ <button class="btn" data-dismiss="modal" aria-hidden="true" id="roc-sdn-iui-text-cancelBtn" name_i18n="org_openo_nfv_roc_ui_i18n"></button>
+ <button class="btn btn-primary" type="submit" ms-click="$saveSdn" id="roc-sdn-iui-text-saveBtn" name_i18n="org_openo_nfv_roc_ui_i18n"></button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="row-fluid" data-name="cond_zone">
+ <div class="col-md-12">
+ <button class="btn white radius_l" id="app-new-btn" ms-click="$showSdnTable" >
+ <i class="ict-new"></i> <span id="roc-sdn-iui-text-registerBtn" name_i18n="org_openo_nfv_roc_ui_i18n"></span>
+ </button>
+ </div>
+ </div>
+
+ <div class="col-sm-12 sdn-padding" ms-each-el="sdnInfo">
+
+ <div class="col-sm-4 animated-panel zoomIn" style="-webkit-animation-delay: 0.1s;">
+ <div class="hpanel stats" >
+ <div class="panel-body h-200" ms-hover="hpanel_show" >
+ <div class="pull-left">
+ <span class="label label-success" id="roc-sdn-iui-text-status-normal" name_i18n="org_openo_nfv_roc_ui_i18n"></span>
+ </div>
+ <div class="stats-icon pull-right">
+ <i class="fa fa-server fa-5x color_cloud"></i>
+ </div>
+ <div class="m-t-xl">
+ <h3 ms-text="el.name"></h3>
+ <div><span id="roc-sdn-iui-text-type" name_i18n="org_openo_nfv_roc_ui_i18n"></span> : <span ms-text="el.controllerType"></span></div>
+ <div>URL : <span ms-text="el.url"></span></div>
+ </div>
+ </div>
+ <div class="panel-footer">
+ <div class="pull-right">
+ <a class="btn btn-default btn-sm" ms-click="sdnUtil.updateSdn(el.$model)"><i class="fa fa-pencil-square-o fa-lg"></i></a>
+ <a class="btn btn-default btn-sm" ms-click="sdnUtil.delSdn(el)"><i class="fa fa-trash-o fa-lg"> </i></a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="col-sm-12">
+ <div class="pull-left text-muted">
+ <small><span id="roc-sdn-iui-text-total" name_i18n="org_openo_nfv_roc_ui_i18n"></span> <span class="blue-font" ms-text="sdnInfo.size()"></span> <span id="roc-sdn-iui-text-total-sdn" name_i18n="org_openo_nfv_roc_ui_i18n"></span></small>
+ </div>
+ </div>
+ </div>
+ <script type="text/javascript" src="../component/thirdparty/jquery/jquery-1.10.2.min.js"></script>
+ <script type="text/javascript" src="../component/thirdparty/jquery.i18n/jquery.i18n.properties-1.0.9.js"></script>
+ <script type="text/javascript" src="../component/thirdparty/bootstrap/js/bootstrap.min.js"></script>
+ <script type="text/javascript" src="../component/thirdparty/bootbox/bootbox.min.js"></script>
+ <script type="text/javascript" src="../component/thirdparty/jquery-validation/js/jquery.validate.min.js"></script>
+ <script type="text/javascript" src="../component/thirdparty/jquery-validation/js/additional-methods.min.js"></script>
+
+ <script type="text/javascript" src="../vendor/bootstrap-growl/bootstrap-growl.min.js"></script>
+ <script type="text/javascript" src="../vendor/cometd/cometd.js"></script>
+ <script type="text/javascript" src="../vendor/cometd/jquery.cometd.js"></script>
+ <script type="text/javascript" src="../vendor/avalon/avalon.js"></script>
+
+ <script type="text/javascript" src="../framework/js/tools.js"></script>
+
+ <script type="text/javascript" src="i18n/loadi18nApp.js"></script>
+
+ <script type="text/javascript" src="js/sdn-validate.js"></script>
+ <script type="text/javascript" src="js/sdnUtil.js"></script>
+ <script type="text/javascript" src="js/sdnController.js"></script>
+</body>
+</html> \ No newline at end of file