summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoren Lev <korenlev@gmail.com>2017-08-06 11:41:38 +0300
committerKoren Lev <korenlev@gmail.com>2017-08-06 11:41:38 +0300
commit98ccf39560e0f643ddf9a766e33b420b96dffac6 (patch)
treeb52e3e8c205ffce5cde86f182a230908eb6873e9
parentb429b22ad4000e1f3ed37e30d3a36697c6e8c2da (diff)
latest ui code fixes merged in opnfv repo
Change-Id: Ib6d7f81e4a85286b7b30d332c757f7eb1bb519f3 Signed-off-by: Koren Lev <korenlev@gmail.com>
-rw-r--r--ui/.eslintrc.js50
-rw-r--r--ui/.gitignore3
-rw-r--r--ui/.meteor/.finished-upgraders16
-rw-r--r--ui/.meteor/.gitignore1
-rw-r--r--ui/.meteor/.id7
-rw-r--r--ui/.meteor/packages48
-rw-r--r--ui/.meteor/platforms2
-rw-r--r--ui/.meteor/release1
-rw-r--r--ui/.meteor/versions138
-rw-r--r--ui/client/lib/jquery.multilevelpushmenu.css120
-rw-r--r--ui/client/lib/jquery.multilevelpushmenu.js1148
-rw-r--r--ui/imports/api/environments/configuration-groups/amqp-configuration.js2
-rw-r--r--ui/imports/api/environments/configuration-groups/mysql-configuration.js2
-rw-r--r--ui/imports/api/scheduled-scans/methods.js8
-rw-r--r--ui/imports/api/scheduled-scans/scheduled-scans.js8
-rw-r--r--ui/imports/api/scheduled-scans/server/methods.js8
-rw-r--r--ui/imports/api/scheduled-scans/server/publications.js8
-rw-r--r--ui/imports/lib/images-for-node-type.js8
-rw-r--r--ui/imports/ui/actions/environment-panel.actions.js8
-rw-r--r--ui/imports/ui/actions/graph-tooltip-window.actions.js8
-rw-r--r--ui/imports/ui/actions/main-app.actions.js8
-rw-r--r--ui/imports/ui/actions/navigation.js8
-rw-r--r--ui/imports/ui/actions/search-interested-parties.js8
-rw-r--r--ui/imports/ui/actions/tree-node.actions.js8
-rw-r--r--ui/imports/ui/actions/vedge-info-window.actions.js8
-rw-r--r--ui/imports/ui/components/env-amqp-credentials-info/env-amqp-credentials-info.html4
-rw-r--r--ui/imports/ui/components/env-open-stack-db-credentials-info/env-open-stack-db-credentials-info.html4
-rw-r--r--ui/imports/ui/components/mt-input/mt-input.js8
-rw-r--r--ui/imports/ui/components/mt-radios/mt-radios.js8
-rw-r--r--ui/imports/ui/components/mt-select/mt-select.js8
-rw-r--r--ui/imports/ui/components/network-graph-manager/network-graph-manager.js29
-rw-r--r--ui/imports/ui/components/network-graph/network-graph.js89
-rw-r--r--ui/imports/ui/components/network-graph/network-graph.styl17
-rw-r--r--ui/imports/ui/components/new-scanning/new-scanning.js8
-rw-r--r--ui/imports/ui/components/scheduled-scan/scheduled-scan.js8
-rw-r--r--ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.js8
-rw-r--r--ui/imports/ui/components/selectable-ordered-input/selectable-ordered-input.js8
-rw-r--r--ui/imports/ui/lib/environment-tree-node-behavior.js8
-rw-r--r--ui/imports/ui/lib/input-model.js8
-rw-r--r--ui/imports/ui/lib/inventory-tree-node-behavior.js8
-rw-r--r--ui/imports/ui/lib/select-model.js8
-rw-r--r--ui/imports/ui/reducers/environment-panel.reducer.js8
-rw-r--r--ui/imports/ui/reducers/graph-tooltip-window.reducer.js8
-rw-r--r--ui/imports/ui/reducers/i18n.reducer.js8
-rw-r--r--ui/imports/ui/reducers/index.js8
-rw-r--r--ui/imports/ui/reducers/main-app.reducer.js8
-rw-r--r--ui/imports/ui/reducers/navigation.js8
-rw-r--r--ui/imports/ui/reducers/search-interested-parties.js8
-rw-r--r--ui/imports/ui/reducers/tree-node.reducer.js8
-rw-r--r--ui/imports/ui/reducers/vedge-info-window.reducer.js8
-rw-r--r--ui/imports/ui/store/index.js8
-rw-r--r--ui/imports/ui/store/store.js8
-rwxr-xr-xui/run2
-rwxr-xr-xui/run-dev.sh10
54 files changed, 370 insertions, 1595 deletions
diff --git a/ui/.eslintrc.js b/ui/.eslintrc.js
new file mode 100644
index 0000000..913c6f3
--- /dev/null
+++ b/ui/.eslintrc.js
@@ -0,0 +1,50 @@
+module.exports = {
+ "env": {
+ "browser": true,
+ "commonjs": true,
+ "es6": true,
+ "node": true,
+ "meteor": true
+ },
+ "extends": "eslint:recommended",
+ "parserOptions": {
+ "sourceType": "module"
+ },
+ "rules": {
+ "indent": [
+ "error",
+ 2
+ ],
+ "linebreak-style": [
+ "error",
+ "unix"
+ ],
+ "quotes": [
+ "error",
+ "single",
+ {
+ "allowTemplateLiterals": true
+ }
+ ],
+ "semi": [
+ "error",
+ "always"
+ ],
+ "no-console": 0,
+ "no-unused-vars": [
+ "error",
+ { "argsIgnorePattern": "^_" }
+ ]
+ },
+ "globals": {
+ "Iron": true,
+ "jQuery": true,
+ "d3Graph": true,
+ "d3": true,
+ "$": true,
+ "toastr": true,
+ "google": true,
+ "moment": true,
+ "WOW": true,
+ }
+};
diff --git a/ui/.gitignore b/ui/.gitignore
new file mode 100644
index 0000000..619933a
--- /dev/null
+++ b/ui/.gitignore
@@ -0,0 +1,3 @@
+**/*.swp
+**/*.directory
+node_modules/
diff --git a/ui/.meteor/.finished-upgraders b/ui/.meteor/.finished-upgraders
new file mode 100644
index 0000000..ce276f3
--- /dev/null
+++ b/ui/.meteor/.finished-upgraders
@@ -0,0 +1,16 @@
+# This file contains information which helps Meteor properly upgrade your
+# app when you run 'meteor update'. You should check it into version control
+# with your project.
+
+notices-for-0.9.0
+notices-for-0.9.1
+0.9.4-platform-file
+notices-for-facebook-graph-api-2
+1.2.0-standard-minifiers-package
+1.2.0-meteor-platform-split
+1.2.0-cordova-changes
+1.2.0-breaking-changes
+1.3.0-split-minifiers-package
+1.4.0-remove-old-dev-bundle-link
+1.4.1-add-shell-server-package
+1.4.3-split-account-service-packages
diff --git a/ui/.meteor/.gitignore b/ui/.meteor/.gitignore
new file mode 100644
index 0000000..4083037
--- /dev/null
+++ b/ui/.meteor/.gitignore
@@ -0,0 +1 @@
+local
diff --git a/ui/.meteor/.id b/ui/.meteor/.id
new file mode 100644
index 0000000..6041321
--- /dev/null
+++ b/ui/.meteor/.id
@@ -0,0 +1,7 @@
+# This file contains a token that is unique to your project.
+# Check it into your repository along with the rest of this directory.
+# It can be used for purposes such as:
+# - ensuring you don't accidentally deploy one app on top of another
+# - providing package authors with aggregated statistics
+
+ryedun1uy1llg1szr22d
diff --git a/ui/.meteor/packages b/ui/.meteor/packages
new file mode 100644
index 0000000..a63ed10
--- /dev/null
+++ b/ui/.meteor/packages
@@ -0,0 +1,48 @@
+# Meteor packages used by this project, one per line.
+# Check this file (and the other files in this directory) into your repository.
+#
+# 'meteor add' and 'meteor remove' will edit this file for you,
+# but you can also edit it by hand.
+
+meteor-base@1.0.4 # Packages every Meteor app needs to have
+mobile-experience@1.0.4 # Packages for a great mobile UX
+mongo@1.1.16 # The database Meteor supports right now
+blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
+session@1.1.7 # Client-side reactive dictionary for your app
+jquery@1.11.10 # Helpful client-side library
+tracker@1.1.2 # Meteor's client-side reactive programming library
+
+es5-shim@4.6.15 # ECMAScript 5 compatibility for older browsers.
+ecmascript@0.7.2 # Enable ECMAScript2015+ syntax in app code
+
+http@1.2.12
+iron:router
+twbs:bootstrap
+standard-minifier-css@1.3.4
+standard-minifier-js@2.0.0
+limemakers:three
+pcel:loading
+spectrum:material-design-lite
+timmyg:wow
+accounts-ui@1.1.9
+accounts-password@1.3.5
+zimme:active-route
+gwendall:auth-client-callbacks
+meteortoys:allthings
+fortawesome:fontawesome
+chrismbeckett:toastr
+stolinski:stylus-multi
+shell-server@0.2.3
+reactive-dict@1.1.8
+tmeasday:publish-counts
+modules@0.8.1
+aldeed:simple-schema
+mdg:validated-method
+aldeed:collection2
+meteorhacks:aggregate
+momentjs:moment
+tsega:bootstrap3-datetimepicker
+alanning:roles
+percolate:migrations
+npm-bcrypt
+natestrauser:publish-performant-counts
diff --git a/ui/.meteor/platforms b/ui/.meteor/platforms
new file mode 100644
index 0000000..efeba1b
--- /dev/null
+++ b/ui/.meteor/platforms
@@ -0,0 +1,2 @@
+server
+browser
diff --git a/ui/.meteor/release b/ui/.meteor/release
new file mode 100644
index 0000000..605b4e1
--- /dev/null
+++ b/ui/.meteor/release
@@ -0,0 +1 @@
+METEOR@1.4.4.1
diff --git a/ui/.meteor/versions b/ui/.meteor/versions
new file mode 100644
index 0000000..4f3b155
--- /dev/null
+++ b/ui/.meteor/versions
@@ -0,0 +1,138 @@
+accounts-base@1.2.16
+accounts-password@1.3.5
+accounts-ui@1.1.9
+accounts-ui-unstyled@1.2.1
+alanning:roles@1.2.16
+aldeed:collection2@2.10.0
+aldeed:collection2-core@1.2.0
+aldeed:schema-deny@1.1.0
+aldeed:schema-index@1.1.1
+aldeed:simple-schema@1.5.3
+allow-deny@1.0.5
+autoupdate@1.3.12
+babel-compiler@6.18.2
+babel-runtime@1.0.1
+base64@1.0.10
+binary-heap@1.0.10
+blaze@2.3.2
+blaze-html-templates@1.1.2
+blaze-tools@1.0.10
+boilerplate-generator@1.0.11
+caching-compiler@1.1.9
+caching-html-compiler@1.1.2
+callback-hook@1.0.10
+check@1.2.5
+chrismbeckett:toastr@2.1.2_1
+coffeescript@1.12.3_1
+ddp@1.2.5
+ddp-client@1.3.4
+ddp-common@1.2.8
+ddp-rate-limiter@1.0.7
+ddp-server@1.3.14
+deps@1.0.12
+diff-sequence@1.0.7
+ecmascript@0.7.3
+ecmascript-runtime@0.3.15
+ejson@1.0.13
+email@1.2.1
+es5-shim@4.6.15
+fastclick@1.0.13
+fortawesome:fontawesome@4.7.0
+geojson-utils@1.0.10
+gwendall:auth-client-callbacks@0.1.0
+hot-code-push@1.0.4
+html-tools@1.0.11
+htmljs@1.0.11
+http@1.2.12
+id-map@1.0.9
+iron:controller@1.0.12
+iron:core@1.0.11
+iron:dynamic-template@1.0.12
+iron:layout@1.0.12
+iron:location@1.0.11
+iron:middleware-stack@1.1.0
+iron:router@1.1.2
+iron:url@1.1.0
+jquery@1.11.10
+launch-screen@1.1.1
+less@2.7.9
+limemakers:three@0.75.0
+livedata@1.0.18
+localstorage@1.0.12
+logging@1.1.17
+mdg:validated-method@1.1.0
+mdg:validation-error@0.5.1
+meteor@1.6.1
+meteor-base@1.0.4
+meteorhacks:aggregate@1.3.0
+meteorhacks:collection-utils@1.2.0
+meteortoys:allthings@3.0.0
+meteortoys:authenticate@3.0.0
+meteortoys:autopub@3.0.0
+meteortoys:blueprint@3.0.0
+meteortoys:email@3.0.0
+meteortoys:hotreload@3.0.0
+meteortoys:listen@3.0.0
+meteortoys:method@3.0.4
+meteortoys:pub@3.0.4
+meteortoys:result@3.0.0
+meteortoys:shell@3.0.0
+meteortoys:status@3.0.0
+meteortoys:sub@3.0.0
+meteortoys:throttle@3.0.0
+meteortoys:toykit@3.0.4
+minifier-css@1.2.16
+minifier-js@2.0.0
+minimongo@1.0.21
+mobile-experience@1.0.4
+mobile-status-bar@1.0.14
+modules@0.8.2
+modules-runtime@0.7.10
+momentjs:moment@2.18.1
+mongo@1.1.16
+mongo-id@1.0.6
+mongo-livedata@1.0.12
+msavin:jetsetter@2.0.0
+msavin:mongol@2.0.1
+natestrauser:publish-performant-counts@0.1.2
+npm-bcrypt@0.9.2
+npm-mongo@2.2.24
+observe-sequence@1.0.16
+ordered-dict@1.0.9
+pcel:loading@1.0.3
+percolate:migrations@0.9.8
+promise@0.8.8
+raix:eventemitter@0.1.3
+random@1.0.10
+rate-limit@1.0.8
+reactive-dict@1.1.8
+reactive-var@1.0.11
+reload@1.1.11
+retry@1.0.9
+routepolicy@1.0.12
+service-configuration@1.0.11
+session@1.1.7
+sha@1.0.9
+shell-server@0.2.3
+spacebars@1.0.15
+spacebars-compiler@1.1.2
+spectrum:material-design-lite@0.0.4
+srp@1.0.10
+standard-minifier-css@1.3.4
+standard-minifier-js@2.0.0
+stolinski:stylus-multi@1.4.3
+templating@1.3.2
+templating-compiler@1.3.2
+templating-runtime@1.3.2
+templating-tools@1.1.2
+timmyg:wow@1.0.1
+tmeasday:publish-counts@0.8.0
+tracker@1.1.2
+tsega:bootstrap3-datetimepicker@4.17.37_1
+twbs:bootstrap@3.3.6
+ui@1.0.13
+underscore@1.0.10
+url@1.1.0
+webapp@1.3.15
+webapp-hashing@1.0.9
+zimme:active-route@2.3.2
diff --git a/ui/client/lib/jquery.multilevelpushmenu.css b/ui/client/lib/jquery.multilevelpushmenu.css
deleted file mode 100644
index 407cda9..0000000
--- a/ui/client/lib/jquery.multilevelpushmenu.css
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************************/
-/* Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others */
-/* */
-/* All rights reserved. This program and the accompanying materials */
-/* are made available under the terms of the Apache License, Version 2.0 */
-/* which accompanies this distribution, and is available at */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/****************************************************************************************/
-.multilevelpushmenu_wrapper {
- position: absolute;
- overflow: hidden;
- min-width: 100%;
- min-height: 100%;
- margin: 0;
- padding: 0;
-}
-
-.multilevelpushmenu_wrapper .levelHolderClass {
- position: absolute;
- overflow: hidden;
- top: 0;
- background: #336ca6;
- width: auto;
- min-height: 100%;
- font-family: 'Open Sans Condensed', sans-serif;
- font-size: 1em;
- zoom: 1;
-}
-
-.multilevelpushmenu_wrapper .ltr {
- margin-left: -100%;
- left: 0;
- -moz-box-shadow: 5px 0 5px -5px #1f4164;
- -webkit-box-shadow: 5px 0 5px -5px #1f4164;
- box-shadow: 5px 0 5px -5px #1f4164;
- filter: progid:DXImageTransform.Microsoft.Shadow(color=#1f4164,direction=90,strength=2);
-}
-
-.multilevelpushmenu_wrapper .rtl {
- margin-right: -100%;
- right: 0;
- -moz-box-shadow: 5px 0 5px 5px #1f4164;
- -webkit-box-shadow: 5px 0 5px 5px #1f4164;
- box-shadow: 5px 0 5px 5px #1f4164;
- filter: progid:DXImageTransform.Microsoft.Shadow(color=#1f4164,direction=270,strength=2);
-}
-
-.multilevelpushmenu_wrapper .multilevelpushmenu_inactive {
- background: #2e6196;
-}
-
-.multilevelpushmenu_wrapper h2 {
- font-size: 1.5em;
- line-height: 1em;
- font-weight: bold;
- color: #1f4164;
- padding: 0 .4em 0 .4em;
-}
-
-.multilevelpushmenu_wrapper ul {
- list-style: none;
- padding: 0;
- margin: 0;
-}
-
-.multilevelpushmenu_wrapper li {
- cursor: pointer;
- border-top: 1px solid #295685;
- padding: .4em .4em .4em .4em;
-}
-
-.multilevelpushmenu_wrapper li:last-child {
- border-bottom: 1px solid #295685;
-}
-
-.multilevelpushmenu_wrapper li:hover {
- background-color: #295685;
-}
-
-.multilevelpushmenu_wrapper a {
- display: block;
- outline: none;
- overflow: hidden;
- font-size: 1.5em;
- line-height: 1em;
- padding: .2em .2em;
- text-decoration: none;
- color: #fff;
-}
-
-.multilevelpushmenu_wrapper a:hover {
- color: #ffe;
-}
-
-.multilevelpushmenu_wrapper .backItemClass {
- display: block;
- padding: .4em .4em .4em .4em;
- background: #2e6196;
- border-top: 1px solid #295685;
-}
-
-.multilevelpushmenu_wrapper .floatRight {
- float: right;
-}
-
-.multilevelpushmenu_wrapper .floatLeft {
- float: left;
-}
-
-.multilevelpushmenu_wrapper .cursorPointer {
- cursor: pointer;
-}
-
-.multilevelpushmenu_wrapper .iconSpacing_ltr {
- padding: 0 .4em 0 0;
-}
-
-.multilevelpushmenu_wrapper .iconSpacing_rtl {
- padding: 0 0 0 .4em;
-} \ No newline at end of file
diff --git a/ui/client/lib/jquery.multilevelpushmenu.js b/ui/client/lib/jquery.multilevelpushmenu.js
deleted file mode 100644
index 0b2a24d..0000000
--- a/ui/client/lib/jquery.multilevelpushmenu.js
+++ /dev/null
@@ -1,1148 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
-/**
- * jquery.multilevelpushmenu.js v2.1.4
- *
- * Licensed under the MIT license.
- * http://www.opensource.org/licenses/mit-license.php
- *
- * Copyright 2013-2014, Make IT d.o.o.
- * http://multi-level-push-menu.make.rs
- * https://github.com/adgsm/multi-level-push-menu
- */
-(function ( $ ) {
- $.fn.multilevelpushmenu = function( options ) {
- "use strict";
- var args = arguments,
- returnValue = null;
-
- this.each(function(){
- var instance = this,
- $this = $( this ),
- $container = ( $this.context != undefined ) ? $this : $( 'body' ),
- menu = ( options && options.menu != undefined ) ? options.menu : $this.find( 'nav' ),
- clickEventType, dragEventType;
-
- // Settings
- var settings = $.extend({
- container: $container,
- containersToPush: null,
- menuID: ( ( $container.prop( 'id' ) != undefined && $container.prop( 'id' ) != '' ) ? $container.prop( 'id' ) : this.nodeName.toLowerCase() ) + "_multilevelpushmenu",
- wrapperClass: 'multilevelpushmenu_wrapper',
- menuInactiveClass: 'multilevelpushmenu_inactive',
- menu: menu,
- menuWidth: 0,
- menuHeight: 0,
- collapsed: false,
- fullCollapse: false,
- direction: 'ltr',
- backText: 'Back',
- backItemClass: 'backItemClass',
- backItemIcon: 'fa fa-angle-right',
- groupIcon: 'fa fa-angle-left',
- mode: 'overlap',
- overlapWidth: 40,
- preventItemClick: true,
- preventGroupItemClick: true,
- swipe: 'both',
- durationSlideOut: 400,
- durationSlideDown: 500,
- durationTransition: 400,
- onCollapseMenuStart: function() {},
- onCollapseMenuEnd: function() {},
- onExpandMenuStart: function() {},
- onExpandMenuEnd: function() {},
- onGroupItemClick: function() {},
- onItemClick: function() {},
- onTitleItemClick: function() {},
- onBackItemClick: function() {},
- onMenuReady: function() {},
- onMenuSwipe: function() {}
- }, options );
-
- // Store a settings reference withint the element's data
- if (!$.data(instance, 'plugin_multilevelpushmenu')) {
- $.data(instance, 'plugin_multilevelpushmenu', settings);
- instance.settings = $.data(instance, 'plugin_multilevelpushmenu');
- }
-
- // Exposed methods
- var methods = {
- // Initialize menu
- init: function () {
- return initialize.apply(this, Array.prototype.slice.call(arguments));
- },
- // Collapse menu
- collapse: function () {
- return collapseMenu.apply(this, Array.prototype.slice.call(arguments));
- },
- // Expand menu
- expand: function () {
- return expandMenu.apply(this, Array.prototype.slice.call(arguments));
- },
- // Menu expanded
- menuexpanded: function () {
- return menuExpanded.apply(this, Array.prototype.slice.call(arguments));
- },
- // Active menu
- activemenu: function () {
- return activeMenu.apply(this, Array.prototype.slice.call(arguments));
- },
- // Find menu(s) by title
- findmenusbytitle: function () {
- return findMenusByTitle.apply(this, Array.prototype.slice.call(arguments));
- },
- // Find item(s) by name
- finditemsbyname: function () {
- return findItemsByName.apply(this, Array.prototype.slice.call(arguments));
- },
- // Find path to root menu collection
- pathtoroot: function () {
- return pathToRoot.apply(this, Array.prototype.slice.call(arguments));
- },
- // Find shared path to root of two menus
- comparepaths: function () {
- return comparePaths.apply(this, Array.prototype.slice.call(arguments));
- },
- // Get/Set settings options
- option: function () {
- return manageOptions.apply(this, Array.prototype.slice.call(arguments));
- },
- // Add item(s)
- additems: function () {
- return addItems.apply(this, Array.prototype.slice.call(arguments));
- },
- // Remove item(s)
- removeitems: function () {
- return removeItems.apply(this, Array.prototype.slice.call(arguments));
- },
- // Size DOM elements
- redraw: function () {
- return sizeDOMelements.apply(this, Array.prototype.slice.call(arguments));
- },
- // Returns visible level holders
- visiblemenus: function () {
- return visibleLevelHolders.apply(this, Array.prototype.slice.call(arguments));
- },
- // Returns visible level holders
- hiddenmenus: function () {
- return hiddenLevelHolders.apply(this, Array.prototype.slice.call(arguments));
- },
- // Propagate event to underneath layer
- propagateevent: function () {
- return propagateEvent.apply(this, Array.prototype.slice.call(arguments));
- }
- };
-
- // IE 8 and modern browsers, prevent event propagation
- function stopEventPropagation( e ){
- if ( e.stopPropagation && e.preventDefault ) {
- e.stopPropagation();
- e.preventDefault();
- }
- else {
- e.cancelBubble = true;
- e.returnValue = false;
- }
- }
-
- // propagate event to underneath layer
- // http://jsfiddle.net/E9zTs/2/
- function propagateEvent( $element , event ) {
- if( $element == undefined || event == undefined ) return false;
- $element.on( event , function ( e , ee ) {
- $element.hide();
- try {
- if(!e.pageX || !e.pageY) return false;
- ee = ee || {
- pageX: e.pageX,
- pageY: e.pageY
- };
- var next = document.elementFromPoint( ee.pageX , ee.pageY );
- next = ( next.nodeType == 3 ) ? next.parentNode : next //Opera
- $( next ).trigger( event , ee );
- }
- catch ( err ) {
- $.error( 'Error while propagating event: ' + err.message );
- }
- finally {
- $element.show();
- }
- });
- }
-
- // Create DOM structure if it does not already exist within the container (input: array)
- function createDOMStructure() {
- var $mainWrapper = $( "<nav />" )
- .prop( { "id" : instance.settings.menuID, "className" : instance.settings.wrapperClass } )
- .appendTo( instance.settings.container );
- createNestedDOMStructure( instance.settings.menu, $mainWrapper );
- }
- function createNestedDOMStructure( menus, $wrapper ){
- if( menus.level == undefined ) menus.level = 0;
- $.each( menus, function(){
- var $levelHolder = $( "<div />" )
- .attr( { "class" : "levelHolderClass" + ( ( instance.settings.direction == 'rtl' ) ? " rtl" : " ltr" ), "data-level" : menus.level, "style" : ( ( instance.settings.direction == 'rtl' ) ? "margin-right: " : "margin-left: " ) + ( ( menus.level == 0 && !instance.settings.collapsed ) ? 0 : "-200%" ) } )
- .appendTo( $wrapper ),
- extWidth = ( isValidDim( instance.settings.menuWidth ) || ( isInt( instance.settings.menuWidth ) && instance.settings.menuWidth > 0 ) );
- $levelHolder.bind( dragEventType , function(e){
- holderSwipe( e, $levelHolder );
- });
- if( this.id != undefined ) $levelHolder.attr( { "id" : this.id } );
- var $title = $( "<h2 />" )
- .attr( { "style" : "text-align: " + ( ( instance.settings.direction == 'rtl' ) ? "right" : "left" ) } )
- .text( this.title )
- .appendTo( $levelHolder ),
- $titleIcon = $( "<i />" )
- .prop( { "class" : ( ( instance.settings.direction == 'rtl' ) ? "floatLeft" : "floatRight" ) + " cursorPointer " + this.icon } )
- .prependTo( $title );
- $titleIcon.bind( clickEventType , function(e){
- titleIconClick(e, $levelHolder, menus);
- });
- if( menus.level > 0 ) createBackItem( $levelHolder );
- var $itemGroup = $( "<ul />" )
- .appendTo( $levelHolder );
- $.each(this.items, function(){
- createItem( this, $levelHolder , -1 );
- })
- });
- }
-
- // Update DOM structure if it already exists in container (input: HTML markup)
- function updateDOMStructure() {
- var $mainWrapper = ( instance.settings.container.find( 'nav' ).length > 0 ) ? instance.settings.container.find( 'nav' ) : instance.settings.menu;
- if( $mainWrapper.length == 0 ) return false;
- $mainWrapper.prop( { "id" : instance.settings.menuID, "className" : instance.settings.wrapperClass } );
- updateNestedDOMStructure( $mainWrapper );
- }
- function updateNestedDOMStructure( $wrapper ){
- if( $wrapper.level == undefined ) $wrapper.level = 0;
- $.each( $wrapper, function(){
- var $levelHolder = $( "<div />" )
- .attr( { "class" : "levelHolderClass" + ( ( instance.settings.direction == 'rtl' ) ? " rtl" : " ltr" ), "data-level" : $wrapper.level, "style" : ( ( instance.settings.direction == 'rtl' ) ? "margin-right: " : "margin-left: " ) + ( ( $wrapper.level == 0 && !instance.settings.collapsed ) ? 0 : "-200%" ) } )
- .appendTo( $wrapper ),
- extWidth = ( isValidDim( instance.settings.menuWidth ) || ( isInt( instance.settings.menuWidth ) && instance.settings.menuWidth > 0 ) );
- $levelHolder.bind( dragEventType , function(e){
- holderSwipe( e, $levelHolder );
- });
- var $title = $wrapper.children( 'h2' );
- $title.attr( { "style" : "text-align: " + ( ( instance.settings.direction == 'rtl' ) ? "right" : "left" ) } );
- $title.appendTo( $levelHolder );
- var $titleIcon = $title.children( 'i' );
- $titleIcon.addClass( ( ( instance.settings.direction == 'rtl' ) ? "floatLeft" : "floatRight" ) + " cursorPointer" );
- $titleIcon.bind( clickEventType , function(e){
- titleIconClick(e, $levelHolder, $wrapper);
- });
- if( $wrapper.level > 0 ) createBackItem( $levelHolder );
- var $itemGroup = $wrapper.children( 'ul' );
- $itemGroup.appendTo( $levelHolder );
- $.each($itemGroup.children( 'li' ), function(){
- var $item = $( this );
- $item.attr( { "style" : "text-align: " + ( ( instance.settings.direction == 'rtl' ) ? "right" : "left" ) } );
- var $itemAnchor = $item.children( 'a' );
- var $itemIcon = $itemAnchor.children( 'i' );
- $itemIcon.addClass( ( ( instance.settings.direction == 'rtl' ) ? "floatLeft" : "floatRight" ) );
- if($item.children( 'ul' ).length > 0) {
- $itemAnchor.bind( clickEventType , function(e){
- itemGroupAnchorClick( e, $levelHolder, $item );
- });
- createItemGroupIcon( $itemAnchor );
- $item.level = $wrapper.level + 1;
- updateNestedDOMStructure($item);
- } else {
- $itemAnchor.bind( clickEventType , function(e){
- itemAnchorClick( e, $levelHolder, $item );
- });
- }
- })
- });
- }
-
- // Click event for title icon
- function titleIconClick( e, $levelHolder, menus ) {
- if( $(instance).find( 'div.levelHolderClass' ).is(':animated') ) return false;
- instance.settings.onTitleItemClick.apply(this, Array.prototype.slice.call([e, $levelHolder, instance.settings]));
- stopEventPropagation(e);
- var instanceFC = ( instance.settings.direction == 'rtl' ) ?
- parseInt( $levelHolder.css( 'margin-right' ) ) < 0
- :
- parseInt( $levelHolder.css( 'margin-left' ) ) < 0;
- if( menus.level == 0 && instanceFC ) {
- expandMenu();
- }
- else {
- var $nextLevelHolders = instance.settings.container
- .find( '#' + instance.settings.menuID + ' div.levelHolderClass' )
- .filter(function(){
- var retObjs = ( instance.settings.direction == 'rtl' ) ?
- (($( this ).attr( 'data-level' ) > $levelHolder.attr( 'data-level' )) && ( parseInt( $( this ).css( 'margin-right' ) ) >= 0 ) )
- :
- (($( this ).attr( 'data-level' ) > $levelHolder.attr( 'data-level' )) && ( parseInt( $( this ).css( 'margin-left' ) ) >= 0 ) );
- return retObjs;
- }),
- $prevLevelHolders = instance.settings.container
- .find( '#' + instance.settings.menuID + ' div.levelHolderClass' )
- .filter(function(){
- var retObjs = ( instance.settings.direction == 'rtl' ) ?
- (($( this ).attr( 'data-level' ) <= $levelHolder.attr( 'data-level' )) && ( parseInt( $( this ).css( 'margin-right' ) ) >= 0 ) )
- :
- (($( this ).attr( 'data-level' ) <= $levelHolder.attr( 'data-level' )) && ( parseInt( $( this ).css( 'margin-left' ) ) >= 0 ) );
- return retObjs;
- }),
- collapseAll = ( $nextLevelHolders.length == 0 && $prevLevelHolders.length == 1 ) ? collapseMenu() : collapseMenu( parseInt( $levelHolder.attr( 'data-level' ) ) );
- }
- $levelHolder.css( 'visibility' , 'visible' );
- $levelHolder.find( '.' + instance.settings.backItemClass ).css( 'visibility' , 'visible' );
- $levelHolder.find( 'ul' ).css( 'visibility' , 'visible' );
- $levelHolder.removeClass( instance.settings.menuInactiveClass );
- }
-
- // Create Back item DOM elements
- function createBackItem( $levelHolder ) {
- var $backItem = $( "<div />" )
- .attr( { "class" : instance.settings.backItemClass } )
- .appendTo( $levelHolder ),
- $backItemAnchor = $( "<a />" )
- .prop( { "href" : "#" } )
- .text( instance.settings.backText )
- .appendTo( $backItem ),
- $backItemIcon = $( "<i />" )
- .prop( { "class" : ( ( instance.settings.direction == 'rtl' ) ? "floatLeft " : "floatRight " ) + instance.settings.backItemIcon } )
- .prependTo( $backItemAnchor );
- $backItemAnchor.bind( clickEventType , function(e){
- backItemAnchorClick(e, $levelHolder);
- });
- }
-
- // Click event for back item
- function backItemAnchorClick( e, $levelHolder ) {
- if( $(instance).find( 'div.levelHolderClass' ).is(':animated') ) return false;
- instance.settings.onBackItemClick.apply(this, Array.prototype.slice.call([e, $levelHolder, instance.settings]));
- stopEventPropagation(e);
- collapseMenu( parseInt( $levelHolder.attr( 'data-level' ) - 1 ) );
- }
-
- // Click event for group items
- function itemGroupAnchorClick( e, $levelHolder, $item ) {
- if( $(instance).find( 'div.levelHolderClass' ).is(':animated') ) return false;
- instance.settings.onGroupItemClick.apply(this, Array.prototype.slice.call([e, $levelHolder, $item, instance.settings]));
- expandMenu( $item.find( 'div:first' ) );
- if( instance.settings.preventGroupItemClick ) stopEventPropagation(e);
- }
-
- // Create item group DOM element
- function createItemGroupIcon( $itemAnchor ) {
- var $itemGroupIcon = $( "<i />" )
- .attr( { "class" : ( ( instance.settings.direction == 'rtl' ) ? " floatRight iconSpacing_rtl " : " floatLeft iconSpacing_ltr " ) + instance.settings.groupIcon } )
- .prependTo( $itemAnchor );
- }
-
- // Create item DOM element
- function createItem() {
- var item = arguments[0],
- $levelHolder = arguments[1],
- position = arguments[2],
- $itemGroup = $levelHolder.find( 'ul:first' ),
- $item = $( "<li />" );
- ( position < ( $itemGroup.children( 'li' ).length ) && position >= 0 ) ?
- $item.insertBefore( $itemGroup.children( 'li' ).eq( position ) ) : $item.appendTo( $itemGroup );
- $item.attr( { "style" : "text-align: " + ( ( instance.settings.direction == 'rtl' ) ? "right" : "left" ) } );
- if( item.id != undefined ) $item.attr( { "id" : item.id } );
- var $itemAnchor = $( "<a />" )
- .prop( { "href" : item.link } )
- .text( item.name )
- .appendTo( $item ),
- $itemIcon = $( "<i />" )
- .prop( { "class" : ( ( instance.settings.direction == 'rtl' ) ? "floatLeft " : "floatRight " ) + item.icon } )
- .prependTo( $itemAnchor );
- if(item.items) {
- $itemAnchor.bind( clickEventType , function(e){
- itemGroupAnchorClick( e, $levelHolder, $item );
- });
- createItemGroupIcon( $itemAnchor );
- item.items.level = parseInt( $levelHolder.attr( 'data-level' ), 10 ) + 1;
- createNestedDOMStructure(item.items, $item);
- } else {
- $itemAnchor.bind( clickEventType , function(e){
- itemAnchorClick( e, $levelHolder, $item );
- });
- }
- }
-
- // Click event for items
- function itemAnchorClick( e, $levelHolder, $item ) {
- instance.settings.onItemClick.apply(this, Array.prototype.slice.call([e, $levelHolder, $item, instance.settings]));
- if( instance.settings.preventItemClick ) stopEventPropagation(e);
- }
-
- // Swipe/Drag event for holders
- function holderSwipe( emd, $levelHolder ) {
- var extRes = instance.settings.onMenuSwipe.apply(this, Array.prototype.slice.call([emd, $levelHolder, instance.settings]));
- if( extRes == false ) return false;
- if( $(instance).find( 'div.levelHolderClass' ).is(':animated') ) return false;
- var level = ( $levelHolder.attr( 'data-level' ) > 0 ) ? $levelHolder.attr( 'data-level' ) - 1 : undefined;
- if( emd.type == 'touchmove' && instance.settings.swipe != 'desktop' ) {
- stopEventPropagation( emd );
- emd = ( emd.touches ) ? emd : emd.originalEvent;
- if( !emd.touches || emd.touches.length <= 0 ) return false;
- var touch = emd.touches[0];
- instance.settings.container.unbind( 'touchend' );
- instance.settings.container.bind( 'touchend' , function( emm ) {
- stopEventPropagation( emm );
- $levelHolder.significance = 0;
- $levelHolder.swipeStart = 0;
- instance.settings.container.unbind( 'touchend' );
- });
- if ( $levelHolder.swipeStart != undefined && $levelHolder.swipeStart != 0 ) {
- $levelHolder.significance = touch.pageX - $levelHolder.swipeStart;
- }
- else {
- $levelHolder.significance = 0;
- $levelHolder.swipeStart = touch.pageX;
- return true;
- }
- if( Math.abs( $levelHolder.significance ) > instance.settings.overlapWidth*.3 ) {
- if( instance.settings.direction == 'rtl' ) $levelHolder.significance *= ( -1 );
- ( $levelHolder.significance > 0 ) ? expandMenu( ( level == undefined ) ? level : $levelHolder ) : collapseMenu( level );
- $levelHolder.significance = 0;
- $levelHolder.swipeStart = 0;
- }
- }
- else if( instance.settings.swipe != 'touchscreen' ) {
- stopEventPropagation( emd );
- var significance = 0;
- $levelHolder.unbind( 'mousemove' );
- $levelHolder.bind( 'mousemove' , function( emm ){
- significance = emm.clientX - emd.clientX;
- if( Math.abs( significance ) > instance.settings.overlapWidth*.3 ) {
- $levelHolder.unbind( 'mousemove' );
- if( instance.settings.direction == 'rtl' ) significance *= ( -1 );
- ( significance > 0 ) ? expandMenu( ( level == undefined ) ? level : $levelHolder ) : collapseMenu( level );
- return true;
- }
- });
- instance.settings.container.unbind( 'mouseup' );
- instance.settings.container.bind( 'mouseup' , function(e){
- stopEventPropagation( e );
- $levelHolder.unbind( 'mousemove' );
- instance.settings.container.unbind( 'mouseup' );
- });
- }
- }
-
- // Returns visible level holders
- function visibleLevelHolders() {
- var $visibleLevelHolders = instance.settings.container
- .find( '#' + instance.settings.menuID + ' div.levelHolderClass' )
- .filter(function(){
- var retObjs = ( instance.settings.direction == 'rtl' ) ?
- ( parseInt( $( this ).css( 'margin-right' ) ) >= 0 && $( this ).position().left < instance.settings.container.width() - instance.settings.overlapWidth )
- :
- ( parseInt( $( this ).css( 'margin-left' ) ) >= 0 && $( this ).position().left >= 0 );
- return retObjs;
- });
- if( $visibleLevelHolders.length < 1 ) $visibleLevelHolders = false;
- return $visibleLevelHolders;
- }
-
- // Returns hidden level holders
- function hiddenLevelHolders() {
- var $hiddenLevelHolders = instance.settings.container
- .find( '#' + instance.settings.menuID + ' div.levelHolderClass' )
- .filter(function(){
- var retObjs = ( instance.settings.direction == 'rtl' ) ?
- ( ( $( this ).position().left > instance.settings.container.width() || parseInt( $( this ).css( 'margin-right' ) ) < 0 ) )
- :
- ( ( $( this ).position().left < 0 || parseInt( $( this ).css( 'margin-left' ) ) < 0 ) );
- return retObjs;
- });
- if( $hiddenLevelHolders.length < 1 ) $hiddenLevelHolders = false;
- return $hiddenLevelHolders;
- }
-
- // Sizing DOM elements per creation/update
- function sizeDOMelements() {
- if( !instance.redraw ) {
- instance.redraw = true;
- var forceWidth = arguments[0],
- forceHeight = arguments[1],
- filter = arguments[2],
- ieShadowFilterDistortion = ($('#' + instance.settings.menuID + ' div.levelHolderClass').first().css('filter').match(/DXImageTransform\.Microsoft\.Shadow/)) ? $('#' + instance.settings.menuID + ' div.levelHolderClass').first().get(0).filters.item("DXImageTransform.Microsoft.Shadow").strength : 0,
- maxWidth = ( forceWidth == undefined ) ? Math.max.apply( null,
- $('#' + instance.settings.menuID + ' div.levelHolderClass').map(function(){ return $(this).width(); }).get() ) - ieShadowFilterDistortion : forceWidth - ieShadowFilterDistortion,
- maxLevel = Math.max.apply( null,
- $('#' + instance.settings.menuID + ' div.levelHolderClass').map(function(){ return $(this).attr( 'data-level' ); }).get() ),
- extWidth = ( isValidDim( instance.settings.menuWidth ) || ( isInt( instance.settings.menuWidth ) && instance.settings.menuWidth > 0 ) ),
- extHeight = ( isValidDim( instance.settings.menuHeight ) || ( isInt( instance.settings.menuHeight ) && instance.settings.menuHeight > 0 ) ),
- $objects = ( filter == undefined ) ? $('#' + instance.settings.menuID + ' div.levelHolderClass' ) : filter,
- currWidth;
- if ( !extWidth && instance.menuWidth != undefined ) maxWidth = instance.menuWidth;
- ( extWidth && forceWidth == undefined ) ? $objects.width(instance.settings.menuWidth) : $objects.width( maxWidth );
- if( extWidth ){
- if( ( $objects.width() == 0 || ( isValidDim( instance.settings.menuWidth ) && instance.settings.menuWidth.indexOf( '%' ) != -1 ) ) && forceWidth == undefined ) {
- $objects.css( 'min-width' , '' );
- $objects.width( parseInt( instance.settings.container.parent().width() * parseInt( instance.settings.menuWidth )/100 ) )
- };
- maxWidth = $objects.width() - ieShadowFilterDistortion;
- $objects.css( 'min-width' , $objects.width() - ieShadowFilterDistortion + 'px' );
- }
- var maxExtWidth = ( extWidth && forceWidth == undefined ) ? ( $objects.width() - ieShadowFilterDistortion + maxLevel * ( instance.settings.overlapWidth + ieShadowFilterDistortion ) ) : ( maxWidth + maxLevel * ( instance.settings.overlapWidth + ieShadowFilterDistortion ) ),
- maxHeight = ( forceHeight == undefined ) ? Math.max.apply( null,
- $('#' + instance.settings.menuID + ' div.levelHolderClass').map(function(){ return $(this).height(); }).get() ) : forceHeight;
-
- instance.settings.container.css( 'min-height' , '' );
- instance.settings.container.children( 'nav:first' ).css( 'min-height' , '' );
- if( extHeight ) {
- instance.settings.container.height( instance.settings.menuHeight );
- instance.settings.container.css( 'min-height' , instance.settings.menuHeight );
- instance.settings.container.children( 'nav:first' ).css( 'min-height' , instance.settings.menuHeight );
- $('#' + instance.settings.menuID).height(instance.settings.menuHeight);
- maxHeight = instance.settings.container.height();
- }
- else {
- $('#' + instance.settings.menuID).height( maxHeight );
- }
- instance.settings.container.css( 'min-height' , maxHeight + 'px' );
- instance.settings.container.children( 'nav:first' ).css( 'min-height' , maxHeight + 'px' );
- instance.settings.container.width( maxExtWidth );
- instance.settings.container.height( maxHeight );
- var $baseLevelHolder = $('#' + instance.settings.menuID + ' div.levelHolderClass:first'),
- $visibleLevelHolders = visibleLevelHolders(),
- $hiddenLevelHolders = hiddenLevelHolders(),
- $activeLevelHolder = activeMenu(),
- activeLevel = ( $activeLevelHolder.length == 1 ) ? $activeLevelHolder.attr( 'data-level' ) : 0;
- if( $visibleLevelHolders )
- $visibleLevelHolders.each(function(){
- if ( instance.settings.mode == 'overlap' )
- $( this ).width( $( this ).width() + ( parseInt( activeLevel , 10) - parseInt( $( this ).attr( 'data-level' ) , 10) ) * ( instance.settings.overlapWidth + ieShadowFilterDistortion ) );
- });
- if( $hiddenLevelHolders )
- $hiddenLevelHolders.each(function(){
- ( instance.settings.direction == 'rtl' ) ?
- $( this ).css( 'margin-right' , ( $( this ).attr( 'data-level' ) == $baseLevelHolder.attr( 'data-level' ) && !instance.settings.fullCollapse ) ? $( this ).width() * (-1) + instance.settings.overlapWidth : $( this ).width() * (-2) )
- :
- $( this ).css( 'margin-left' , ( $( this ).attr( 'data-level' ) == $baseLevelHolder.attr( 'data-level' ) && !instance.settings.fullCollapse ) ? $( this ).width() * (-1) + instance.settings.overlapWidth : $( this ).width() * (-2) );
- });
- currWidth = $baseLevelHolder.width() + parseInt( $baseLevelHolder.css( ( instance.settings.direction == 'rtl' ) ? 'margin-right' : 'margin-left' ) , 10 );
- sizeElementWidth( instance.settings.container , currWidth );
- instance.menuWidth = maxWidth;
- instance.menuHeight = maxHeight;
- instance.redraw = false;
- }
- }
-
- // Simple/singe DOM element width sizing
- function sizeElementWidth( $element , size ) {
- if( $element == undefined || size == undefined ) return false;
- $element.css( 'min-width' , '' );
- $element.css( 'min-width' , size + 'px' );
- $element.children( 'nav:first' ).css( 'min-width' , '' );
- $element.children( 'nav:first' ).css( 'min-width' , size + 'px' );
- $element.width( size );
- }
-
- // Hide wrappers in browsers that
- // does not understand negative margin in %
- // before DOM element got its dimensions
- function fixLazyBrowsers() {
- var $baseLevelHolder = $('#' + instance.settings.menuID + ' div.levelHolderClass:first'),
- $hiddenLevelHolders = instance.settings.container
- .find( '#' + instance.settings.menuID + ' div.levelHolderClass' )
- .filter(function(){
- var retObjs = ( instance.settings.direction == 'rtl' ) ?
- ( ( $( this ).position().left > instance.settings.container.width() || parseInt( $( this ).css( 'margin-right' ) ) < 0 ) && $( this ).attr( 'data-level' ) > $baseLevelHolder.attr( 'data-level' ) )
- :
- ( ( $( this ).position().left < 0 || parseInt( $( this ).css( 'margin-left' ) ) < 0 ) && $( this ).attr( 'data-level' ) > $baseLevelHolder.attr( 'data-level' ) );
- return retObjs;
- });
- $hiddenLevelHolders.each(function(){
- if( instance.settings.direction == 'rtl' ){
- $( this ).css( 'margin-right' , ( ( $( this ).attr( 'data-level' ) == $baseLevelHolder.attr( 'data-level' ) && !instance.settings.collapsed ) ? 0 : (-2) * $( this ).width() ) )
- }
- else {
- $( this ).css( 'margin-left' , ( ( $( this ).attr( 'data-level' ) == $baseLevelHolder.attr( 'data-level' ) && !instance.settings.collapsed ) ? 0 : (-2) * $( this ).width() ) );
- }
- });
- if( instance.settings.direction == 'rtl' ){
- $baseLevelHolder.css( 'margin-right' , ( !instance.settings.collapsed ) ? 0 : (-2) * $baseLevelHolder.width() )
- }
- else {
- $baseLevelHolder.css( 'margin-left' , ( !instance.settings.collapsed ) ? 0 : (-2) * $baseLevelHolder.width() );
- }
- }
-
- // Is integer
- function isInt( n ) {
- return typeof n === 'number' && parseFloat( n ) == parseInt( n, 10 ) && !isNaN( n );
- }
-
- // Is Valid CSS dimension
- function isValidDim( s ) {
- return typeof s === 'string' && ( s.indexOf( '%' ) != -1 || s.indexOf( 'px' ) != -1 || s.indexOf( 'em' ) != -1 );
- }
-
- // Initialize menu level push menu
- function initialize(){
- var execute = ( options && options.menu != undefined ) ? createDOMStructure() : updateDOMStructure();
- propagateEvent( instance.settings.container , clickEventType );
- sizeDOMelements();
- fixLazyBrowsers();
- startMode( instance.settings.collapsed );
- instance.settings.onMenuReady.apply(this, Array.prototype.slice.call([instance.settings]));
- return $this;
- }
-
- // Initialize menu in collapsed/expanded mode
- function startMode( mode ) {
- if( mode ) {
- var $baseLevelHolder = $('#' + instance.settings.menuID + ' div.levelHolderClass:first');
- $baseLevelHolder.find( 'ul' ).hide();
- $baseLevelHolder.addClass( instance.settings.menuInactiveClass );
- if( instance.settings.direction == 'rtl' ) {
- $baseLevelHolder.stop().animate({
- marginRight: ( ( -1 ) * $baseLevelHolder.width() + ( ( instance.settings.fullCollapse ) ? 0 : instance.settings.overlapWidth ) )
- }, instance.settings.durationSlideOut)
- }
- else {
- $baseLevelHolder.stop().animate({
- marginLeft: ( ( -1 ) * $baseLevelHolder.width() + ( ( instance.settings.fullCollapse ) ? 0 : instance.settings.overlapWidth ) )
- }, instance.settings.durationSlideOut);
- }
- }
- }
-
- // Push container(s) of choice
- function pushContainers( absMove ) {
- if( instance.settings.containersToPush == null ) return false;
- $.each( instance.settings.containersToPush, function() {
- var lMr = parseInt( $( this ).css( 'margin-left' ) ),
- lM = isInt( lMr ) ? lMr : 0,
- rMr = parseInt( $( this ).css( 'margin-right' ) ),
- rM = isInt( rMr ) ? rMr : 0;
- $( this ).stop().animate({
- marginLeft: lM + ( ( instance.settings.direction == 'rtl' ) ? (-1) : 1 ) * absMove,
- marginRight: rM + ( ( instance.settings.direction == 'rtl' ) ? 1 : (-1) ) * absMove
- }, instance.settings.durationSlideOut);
- });
- }
-
- // Collapse menu
- function collapseMenu() {
- if( $(instance).find( 'div.levelHolderClass' ).is(':animated') ) return false;
- instance.settings.onCollapseMenuStart.apply(this, Array.prototype.slice.call([instance.settings]));
- var level = arguments[0],
- callbacks = arguments[1],
- collapingObjects = {},
- ieShadowFilterDistortion,lwidth, lpush, lMarginLeft, lMarginLeftFC,
- $baseLevelHolder = $('#' + instance.settings.menuID + ' div.levelHolderClass:first'),
- collapseAll = ( level == undefined ) ? true : false,
- currWidth;
- collapingObjects[ 'collapsingEnded' ] = false;
- if( typeof level == 'object' ) {
- level = level.attr( 'data-level' );
- }
- else if( typeof level == 'string' ){
- var $selectedLevelHolder = findMenusByTitle( level );
- if( $selectedLevelHolder && $selectedLevelHolder.length == 1 ) {
- level = $selectedLevelHolder.attr( 'data-level' );
- }
- else {
- level = $baseLevelHolder.attr( 'data-level' );
- }
- }
- else if( level == undefined || !isInt( level ) || level < 0 ) {
- level = $baseLevelHolder.attr( 'data-level' );
- }
- if( callbacks == undefined && typeof callbacks != 'object' ) {
- callbacks = [ { 'method' : instance.settings.onCollapseMenuEnd, 'args' : [instance.settings] } ];
- } else {
- $.merge(callbacks, [ { 'method' : instance.settings.onCollapseMenuEnd, 'args' : [instance.settings] } ]);
- }
- var $nextLevelHolders = instance.settings.container
- .find( '#' + instance.settings.menuID + ' div.levelHolderClass' )
- .filter(function(){
- var retObjs = ( instance.settings.direction == 'rtl' ) ?
- ($( this ).attr( 'data-level' ) > level) && (parseInt( $( this ).css( 'margin-right' ) ) >= 0 && $( this ).position().left < instance.settings.container.width() - instance.settings.overlapWidth )
- :
- ($( this ).attr( 'data-level' ) > level) && (parseInt( $( this ).css( 'margin-left' ) ) >= 0 && $( this ).position().left >= 0 );
- return retObjs;
- }),
- $prevLevelHolders = instance.settings.container
- .find( '#' + instance.settings.menuID + ' div.levelHolderClass' )
- .filter(function(){
- var retObjs = ( instance.settings.direction == 'rtl' ) ?
- ($( this ).attr( 'data-level' ) <= level) && (parseInt( $( this ).css( 'margin-right' ) ) >= 0 && $( this ).position().left < instance.settings.container.width() - instance.settings.overlapWidth )
- :
- ($( this ).attr( 'data-level' ) <= level) && (parseInt( $( this ).css( 'margin-left' ) ) >= 0 && $( this ).position().left >= 0 );
- return retObjs;
- });
- if( $prevLevelHolders.length > 0 ) {
- collapingObjects[ 'prevAnimEnded' ] = false;
- $nextLevelHolders.each(function( key, val ){
- ieShadowFilterDistortion = ($( val ).css('filter').match(/DXImageTransform\.Microsoft\.Shadow/)) ? $( val ).get(0).filters.item("DXImageTransform.Microsoft.Shadow").strength : 0;
- lwidth = ( instance.settings.mode == 'overlap' ) ? $( val ).width() - ( $nextLevelHolders.length + $prevLevelHolders.length - $( val ).attr( 'data-level' ) - 1) * ( instance.settings.overlapWidth + ieShadowFilterDistortion ) - ieShadowFilterDistortion : $( val ).width() - ieShadowFilterDistortion
- if( instance.settings.direction == 'rtl' ) {
- $( val ).stop().animate({
- marginRight : ( (-1) * lwidth ),
- width: lwidth
- }, instance.settings.durationTransition);
- }
- else {
- $( val ).stop().animate({
- marginLeft : ( (-1) * lwidth ),
- width: lwidth
- }, instance.settings.durationTransition);
- }
- });
- collapingObjects[ 'nextAnimEnded' ] = ( $nextLevelHolders.length > 0 ) ? false : true ;
- $nextLevelHolders.last().queue(function(){
- collapingObjects[ 'nextAnimEnded' ] = true;
- animatedEventCallback( collapingObjects , callbacks );
- });
- $prevLevelHolders.each(function( key, val ){
- ieShadowFilterDistortion = ($( val ).css('filter').match(/DXImageTransform\.Microsoft\.Shadow/)) ? $( val ).get(0).filters.item("DXImageTransform.Microsoft.Shadow").strength : 0;
- var $makeLevelHolderVisible = $prevLevelHolders.filter(function(){
- return $( this ).attr( 'data-level' ) == level;
- });
- $makeLevelHolderVisible.css( 'visibility' , 'visible' );
- $makeLevelHolderVisible.find( '.' + instance.settings.backItemClass ).css( 'visibility' , 'visible' );
- $makeLevelHolderVisible.find( 'ul' ).css( 'visibility' , 'visible' );
- $makeLevelHolderVisible.removeClass( instance.settings.menuInactiveClass );
- lwidth = ( instance.settings.mode == 'overlap' ) ? $( val ).width() - $nextLevelHolders.length * ( instance.settings.overlapWidth + ieShadowFilterDistortion ) - ieShadowFilterDistortion : $( val ).width() - ieShadowFilterDistortion;
- if( instance.settings.direction == 'rtl' ) {
- $( val ).stop().animate({
- width: lwidth,
- marginRight : ( $( val ).attr( 'data-level' ) == $baseLevelHolder.attr( 'data-level' ) && collapseAll ) ?
- ( instance.settings.fullCollapse ) ?
- ( -1 ) * $( val ).width()
- :
- ( ( -1 ) * $( val ).width() + ( ( instance.settings.mode == 'overlap' ) ? $nextLevelHolders.length + 1 : 1 ) * instance.settings.overlapWidth )
- :
- 0
- }, instance.settings.durationSlideOut, function(){
- if( $( val ).attr( 'data-level' ) == $baseLevelHolder.attr( 'data-level' ) && collapseAll ){
- $baseLevelHolder.children( 'ul' ).first().hide(instance.settings.durationSlideDown, function(){
- $baseLevelHolder.addClass( instance.settings.menuInactiveClass );
- });
- }
- currWidth = $baseLevelHolder.width() + parseInt( $baseLevelHolder.css( 'margin-right' ) , 10 );
- sizeElementWidth( instance.settings.container , currWidth );
- });
- }
- else {
- $( val ).stop().animate({
- width: lwidth,
- marginLeft : ( $( val ).attr( 'data-level' ) == $baseLevelHolder.attr( 'data-level' ) && collapseAll ) ?
- ( instance.settings.fullCollapse ) ?
- ( -1 ) * $( val ).width()
- :
- ( ( -1 ) * $( val ).width() + ( ( instance.settings.mode == 'overlap' ) ? $nextLevelHolders.length + 1 : 1 ) * instance.settings.overlapWidth )
- :
- 0
- }, instance.settings.durationSlideOut, function(){
- if( $( val ).attr( 'data-level' ) == $baseLevelHolder.attr( 'data-level' ) && collapseAll ){
- $baseLevelHolder.children( 'ul' ).first().hide(instance.settings.durationSlideDown, function(){
- $baseLevelHolder.addClass( instance.settings.menuInactiveClass );
- });
- }
- currWidth = $baseLevelHolder.width() + parseInt( $baseLevelHolder.css( 'margin-left' ) , 10 );
- sizeElementWidth( instance.settings.container , currWidth );
- });
- }
- lpush = ( instance.settings.mode == 'overlap' ) ? ( (-1) * ( $nextLevelHolders.length * ( instance.settings.overlapWidth + ieShadowFilterDistortion ) ) ) : 0 ;
- if( $( val ).attr( 'data-level' ) == $baseLevelHolder.attr( 'data-level' ) && collapseAll ){
- var blpush = ( instance.settings.fullCollapse ) ? ( -1 ) * ( $baseLevelHolder.width() - ieShadowFilterDistortion ) : ( -1 ) * ( $baseLevelHolder.width() - ieShadowFilterDistortion ) + instance.settings.overlapWidth;
- pushContainers( blpush );
- }
- else {
- pushContainers( lpush );
- }
- });
- $prevLevelHolders.last().queue(function(){
- collapingObjects[ 'prevAnimEnded' ] = true;
- animatedEventCallback( collapingObjects , callbacks );
- });
- }
- collapingObjects[ 'collapsingEnded' ] = true;
- animatedEventCallback( collapingObjects , callbacks );
- return $this;
- }
-
- // Expand Menu helper
- function expandMenuActions() {
- if( $(instance).find( 'div.levelHolderClass' ).is(':animated') ) return false;
- instance.settings.onExpandMenuStart.apply(this, Array.prototype.slice.call([instance.settings]));
- var menuTitle = arguments[0],
- callbacks = arguments[1],
- ieShadowFilterDistortion, lwidth, lpush, blpush, currWidth,
- expandingObjects = {},
- $baseLevelHolder = $('#' + instance.settings.menuID + ' div.levelHolderClass:first'),
- baseExpand = ( menuTitle == undefined ) ? true : false,
- baseLevelHolderCollapsed = ( instance.settings.direction == 'rtl' ) ?
- parseInt( $baseLevelHolder.css( 'margin-right' ), 10 ) < 0 || $baseLevelHolder.position().left >= instance.settings.container.width() - instance.settings.overlapWidth
- :
- parseInt( $baseLevelHolder.css( 'margin-left' ), 10 ) < 0 || $baseLevelHolder.position().left < 0;
- expandingObjects[ 'expandingEnded' ] = false;
- if( callbacks == undefined && typeof callbacks != 'object' ) {
- callbacks = [ { 'method' : instance.settings.onExpandMenuEnd, 'args' : [instance.settings] } ];
- } else {
- $.merge(callbacks, [ { 'method' : instance.settings.onExpandMenuEnd, 'args' : [instance.settings] } ]);
- }
- if( baseExpand ) {
- expandingObjects[ 'baseAnimEnded' ] = false;
- $baseLevelHolder.removeClass( instance.settings.menuInactiveClass );
- currWidth = $baseLevelHolder.width();
- sizeElementWidth( instance.settings.container , currWidth );
- if( instance.settings.direction == 'rtl' ) {
- $baseLevelHolder.stop().animate({
- marginRight: 0
- }, instance.settings.durationSlideOut, function(){
- $baseLevelHolder.children( 'ul' ).first().show(instance.settings.durationSlideDown , function(){
- expandingObjects[ 'baseAnimEnded' ] = true;
- animatedEventCallback( expandingObjects , callbacks );
- });
- });
- }
- else {
- $baseLevelHolder.stop().animate({
- marginLeft: 0
- }, instance.settings.durationSlideOut, function(){
- $baseLevelHolder.children( 'ul' ).first().show(instance.settings.durationSlideDown , function(){
- expandingObjects[ 'baseAnimEnded' ] = true;
- animatedEventCallback( expandingObjects , callbacks );
- });
- });
- }
- blpush = ( instance.settings.fullCollapse ) ? $baseLevelHolder.width() : $baseLevelHolder.width() - instance.settings.overlapWidth;
- var pushbm = ( !menuExpanded( $baseLevelHolder ) ) ? pushContainers( blpush ) : null;
- } else {
- var $selectedLevelHolder;
- if( typeof menuTitle == 'object' ) {
- $selectedLevelHolder = menuTitle;
- }
- else if( typeof menuTitle == 'string' ){
- $selectedLevelHolder = findMenusByTitle( menuTitle );
- }
- else {
- $selectedLevelHolder = null;
- $.error( 'Provided menu selector is not valid' );
- }
- if( $selectedLevelHolder && $selectedLevelHolder.length == 1 ) {
- var $activeLevelHolder = activeMenu(),
- activeLevel = ( $activeLevelHolder.length == 1 ) ? $activeLevelHolder.attr( 'data-level' ) : 0,
- baseWidth = $selectedLevelHolder.width(),
- setToOpenHolders = pathToRoot( $selectedLevelHolder );
- expandingObjects[ 'setToOpenAnimEnded' ] = false;
- if( setToOpenHolders ) {
- var parentLevelHoldersLen = $( setToOpenHolders ).length - 1;
- $baseLevelHolder.find( 'ul' ).each(function(){
- $( this ).show(0);
- });
- $( setToOpenHolders ).find( 'ul' ).css( 'visibility' , 'hidden' );
- $( setToOpenHolders ).find( 'div' ).css( 'visibility' , 'visible' );
- $( setToOpenHolders ).find( '.' + instance.settings.backItemClass ).css( 'visibility' , 'hidden' );
- $( setToOpenHolders ).each( function( key, val ) {
- ieShadowFilterDistortion = ($( val ).css('filter').match(/DXImageTransform\.Microsoft\.Shadow/)) ? $( val ).get(0).filters.item("DXImageTransform.Microsoft.Shadow").strength : 0;
- lwidth = baseWidth - ieShadowFilterDistortion + ( parentLevelHoldersLen - $( val ).attr( 'data-level' ) ) * ( instance.settings.overlapWidth + ieShadowFilterDistortion );
- if(instance.settings.container.width() < lwidth && instance.settings.mode == 'overlap' )
- sizeElementWidth( instance.settings.container , lwidth );
- if( instance.settings.direction == 'rtl' ) {
- $( val ).stop().animate({
- marginRight: 0,
- width: ( instance.settings.mode == 'overlap' ) ? lwidth : baseWidth - ieShadowFilterDistortion
- }, instance.settings.durationTransition, function(){
- $( val ).addClass( instance.settings.menuInactiveClass );
- });
- }
- else {
- $( val ).stop().animate({
- marginLeft: 0,
- width: ( instance.settings.mode == 'overlap' ) ? lwidth : baseWidth - ieShadowFilterDistortion
- }, instance.settings.durationTransition, function(){
- $( val ).addClass( instance.settings.menuInactiveClass );
- });
- }
- });
- $( setToOpenHolders ).last().queue(function(){
- $( this ).removeClass( instance.settings.menuInactiveClass );
- expandingObjects[ 'setToOpenAnimEnded' ] = true;
- animatedEventCallback( expandingObjects , callbacks );
- });
- if( baseLevelHolderCollapsed ) {
- blpush = ( instance.settings.fullCollapse ) ? $baseLevelHolder.width() : ( $baseLevelHolder.width() - instance.settings.overlapWidth );
- pushContainers( blpush );
- }
- if( instance.settings.mode == 'overlap' ){
- lpush = ( ( baseLevelHolderCollapsed ) ? ( baseWidth + ( parentLevelHoldersLen - ( ( instance.settings.fullCollapse ) ? 0 : 1 ) ) * ( instance.settings.overlapWidth + ieShadowFilterDistortion ) ) : ( ( parentLevelHoldersLen - activeLevel ) * ( instance.settings.overlapWidth + ieShadowFilterDistortion ) ) );
- pushContainers( lpush );
- }
- $selectedLevelHolder.css( 'visibility' , 'visible' );
- $selectedLevelHolder.find( '.' + instance.settings.backItemClass ).css( 'visibility' , 'visible' );
- $selectedLevelHolder.find( 'ul' ).css( 'visibility' , 'visible' );
- $selectedLevelHolder.removeClass( instance.settings.menuInactiveClass );
- }
- else {
- $.error( 'Invalid menu object provided' );
- }
- }
- else {
- $.error( 'No or too many menus named ' + menuTitle );
- }
- }
- expandingObjects[ 'expandingEnded' ] = true;
- animatedEventCallback( expandingObjects , callbacks );
- }
-
- // Expand menu
- function expandMenu() {
- var menu = arguments[0],
- $expandLevelHolder,
- $activeLevelHolder = activeMenu(),
- $sharedLevelHolders, collapseLevel, $searchRes;
- if( typeof menu == 'object' ) {
- $expandLevelHolder = menu;
- }
- else if( typeof menu == 'string' ){
- $searchRes = findMenusByTitle( menu );
- if($searchRes) {
- $expandLevelHolder = $searchRes.eq( 0 );
- }
- else {
- $.error( menu + ' menu level does not exist!' );
- }
- }
- else {
- $expandLevelHolder = $('#' + instance.settings.menuID + ' div.levelHolderClass:first');
- }
- $sharedLevelHolders = comparePaths( $expandLevelHolder , $activeLevelHolder, true );
- collapseLevel = ( $sharedLevelHolders.length > 0 ) ? Math.max.apply( null,
- $sharedLevelHolders.map(function(){ return $(this).attr( 'data-level' ); }).get() ) : 0;
- if( collapseLevel < $activeLevelHolder.attr( 'data-level' ) ) {
- collapseMenu( collapseLevel , [ { 'method' : expandMenuActions, 'args' : arguments } ] );
- }
- else {
- expandMenuActions.apply( this, Array.prototype.slice.call( arguments ) );
- }
- return $this;
- }
-
- // Find menu(s) by Title text
- function findMenusByTitle() {
- var menuTitle = arguments[0],
- response,
- $selectedLevelHolders = instance.settings.container
- .find( '#' + instance.settings.menuID + ' div.levelHolderClass' )
- .filter(function(){
- return ( ($( this ).children( 'h2' ).text() == menuTitle ) );
- });
- if( $selectedLevelHolders.length > 0 ) {
- returnValue = $selectedLevelHolders;
- response = returnValue;
- }
- else {
- returnValue = false;
- response = returnValue;
- }
- return response;
- }
-
- // Find item(s) by Name
- function findItemsByName() {
- var itemName = arguments[0],
- response,
- $selectedItems = instance.settings.container
- .find( '#' + instance.settings.menuID + ' div.levelHolderClass li' )
- .filter(function(){
- return ( ($( this ).children( 'a' ).text() == itemName ) );
- });
- if( $selectedItems.length > 0 ) {
- returnValue = $selectedItems;
- response = returnValue;
- }
- else {
- returnValue = false;
- response = returnValue;
- }
- return response;
- }
-
- // Find pathToRoot for provided menu
- function pathToRoot() {
- var $selectedLevelHolder = arguments[0],
- $parentLevelHolders, setToOpenHolders, response;
- if( $selectedLevelHolder == undefined || $selectedLevelHolder.length != 1 ) {
- returnValue = false;
- return returnValue;
- };
- $parentLevelHolders = $selectedLevelHolder.parents( 'div.levelHolderClass' );
- setToOpenHolders = $.merge( $parentLevelHolders.get().reverse(), $selectedLevelHolder.get() );
- returnValue = setToOpenHolders;
- return returnValue;
- }
-
- // Finds the same part of the path to root of two provided menus
- function comparePaths() {
- var $levelHolder0 = arguments[0],
- $levelHolder1 = arguments[1],
- mode = ( arguments[2] != undefined ) ? arguments[2] : false,
- $parentLevelHolders0, $parentLevelHolders1, setParents0, setParents1, lPath, sPath, comparePath, response;
- if( $levelHolder0 == undefined || $levelHolder1 == undefined ) {
- returnValue = false;
- return returnValue;
- };
- $parentLevelHolders0 = ( $levelHolder0.length == 1 ) ? $levelHolder0.parents( 'div.levelHolderClass' ) : null;
- $parentLevelHolders1 = ( $levelHolder1.length == 1 ) ? $levelHolder1.parents( 'div.levelHolderClass' ) : null;
- setParents0 = ( $parentLevelHolders0 != null ) ? $.merge( $parentLevelHolders0.get().reverse(), $levelHolder0.get() ) : [];
- setParents1 = ( $parentLevelHolders1 != null ) ? $.merge( $parentLevelHolders1.get().reverse(), $levelHolder1.get() ) : [];
- lPath = ( setParents0.length >= setParents1.length ) ? setParents0 : setParents1;
- sPath = ( lPath === setParents0 ) ? setParents1 : setParents0;
- comparePath = $( lPath ).filter(function() {
- return ( mode ) ? ( $.inArray( this, sPath ) != -1 ) : ( $.inArray( this, sPath ) == -1 );
- });
- returnValue = comparePath;
- return returnValue;
- }
-
- // Active menu
- function activeMenu() {
- var $activeLevelHolders = instance.settings.container
- .find( '#' + instance.settings.menuID + ' div.levelHolderClass' )
- .filter(function(){
- var retObjs = ( instance.settings.direction == 'rtl' ) ?
- ((parseInt( $( this ).css( 'margin-right' ) ) >= 0 && $( this ).position().left < instance.settings.container.width() - instance.settings.overlapWidth ) )
- :
- ((parseInt( $( this ).css( 'margin-left' ) ) >= 0 && $( this ).position().left >= 0 ) );
- return retObjs;
- }),
- maxLevel = Math.max.apply( null,
- $activeLevelHolders.map(function(){ return $(this).attr( 'data-level' ); }).get() ),
- $activeLevelHolder = $activeLevelHolders.filter(function(){
- return $( this ).attr( 'data-level' ) == maxLevel;
- });
- returnValue = $activeLevelHolder;
- return returnValue;
- }
-
- // Menu expanded
- function menuExpanded() {
- var $levelHolder = arguments[0],
- returnValue = false;
- if( $levelHolder == undefined ) return returnValue;
-
- var check = ( instance.settings.direction == 'rtl' ) ?
- ( parseInt( $levelHolder.css( 'margin-right' ) ) >= 0 && $levelHolder.position().left < instance.settings.container.width() - instance.settings.overlapWidth )
- :
- ( parseInt( $levelHolder.css( 'margin-left' ) ) >= 0 && $levelHolder.position().left >= 0 );
- return check;
- }
-
- // Add item(s)
- function addItems() {
- var items = arguments[0],
- $levelHolder = arguments[1],
- position = arguments[2];
- if( $levelHolder == undefined || typeof items != 'object' || !$levelHolder ) return false;
- if( items.level == undefined ) items.level = parseInt( $levelHolder.attr( 'data-level' ) , 10 );
- if( position == undefined ) position = 0;
- var $itemGroup = $levelHolder.find( 'ul:first' );
- $.each(items, function() {
- if( this.name != undefined )
- createItem( this, $levelHolder, position );
- });
- sizeDOMelements( instance.menuWidth );
- return $this;
- }
-
- // Remove item(s)
- function removeItems() {
- var $items = arguments[0];
- if( $items == undefined || typeof $items != 'object' || $items.length == 0 ) return false;
- $items.remove();
- var $activeMenu = activeMenu();
- if( $activeMenu.length == 1 ) {
- $activeMenu.css( 'visibility' , 'visible' );
- $activeMenu.find( '.' + instance.settings.backItemClass ).css( 'visibility' , 'visible' );
- $activeMenu.find( 'ul' ).css( 'visibility' , 'visible' );
- $activeMenu.removeClass( instance.settings.menuInactiveClass );
- var widthDiff = $activeMenu.width() - instance.menuWidth;
- if( widthDiff != 0 ) {
- var $visibleLevelHolders = visibleLevelHolders();
- if( $visibleLevelHolders )
- $visibleLevelHolders.each(function(){
- $( this ).width( $( this ).width() - widthDiff );
- });
- }
- }
- sizeDOMelements( instance.menuWidth );
- return $this;
- }
-
- // Manage multiple animated events and associated callbacks
- function animatedEventCallback( animatedObjects, callbacks ) {
- var doCallBack = true;
- $.each( animatedObjects, function( key, val ){
- doCallBack = doCallBack && val;
- });
- if( doCallBack )
- window.setTimeout(function(){
- $.each( callbacks, function( key, val ){
- val['method'].apply( this, Array.prototype.slice.call( val['args'] ) );
- });
- }, 1);
- }
-
- // Get/set settings options
- function manageOptions() {
- var response = false;
- if( instance.settings[arguments[0]] != undefined ) {
- if( arguments[1] != undefined )
- instance.settings[arguments[0]] = arguments[1];
- response = instance.settings[arguments[0]];
- } else {
- $.error('No option ' + arguments[0] + ' found in jQuery.multilevelpushmenu');
- }
- return response;
- }
-
- // Mobile check
- // http://coveroverflow.com/a/11381730/989439
- function mobileCheck() {
- var check = false;
- (function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);
- return check;
- }
-
- if( mobileCheck() ) {
- clickEventType = 'touchend';
- dragEventType = 'touchmove';
- }
- else {
- clickEventType = 'click';
- dragEventType = 'mousedown';
- }
-
- // Invoke called method or init
- if ( methods[options] ) {
- returnValue = methods[options].apply(this, Array.prototype.slice.call(args, 1));
- return returnValue;
- } else if (typeof options === 'object' || !options) {
- returnValue = methods.init.apply(this, arguments);
- return returnValue;
- } else {
- $.error('No ' + options + ' method found in jQuery.multilevelpushmenu');
- }
-
- // Return object instance or option value
- if (!returnValue) {
- returnValue = this;
- }
- });
- return returnValue;
- }
-}( jQuery ));
diff --git a/ui/imports/api/environments/configuration-groups/amqp-configuration.js b/ui/imports/api/environments/configuration-groups/amqp-configuration.js
index 83a15cf..7b7ddaf 100644
--- a/ui/imports/api/environments/configuration-groups/amqp-configuration.js
+++ b/ui/imports/api/environments/configuration-groups/amqp-configuration.js
@@ -25,5 +25,5 @@ export const AMQPSchema = new SimpleSchema({
type: String,
defaultValue: 'rabbitmquser'
},
- password: { type: String },
+ pwd: { type: String },
});
diff --git a/ui/imports/api/environments/configuration-groups/mysql-configuration.js b/ui/imports/api/environments/configuration-groups/mysql-configuration.js
index 1921432..97eab29 100644
--- a/ui/imports/api/environments/configuration-groups/mysql-configuration.js
+++ b/ui/imports/api/environments/configuration-groups/mysql-configuration.js
@@ -19,7 +19,7 @@ export const MysqlSchema = new SimpleSchema({
regEx: SimpleSchema.RegEx.IP,
defaultValue: '10.0.0.1'
},
- password: { type: String },
+ pwd: { type: String },
port: {
type: String,
regEx: portRegEx,
diff --git a/ui/imports/api/scheduled-scans/methods.js b/ui/imports/api/scheduled-scans/methods.js
index 22f8110..06cdea7 100644
--- a/ui/imports/api/scheduled-scans/methods.js
+++ b/ui/imports/api/scheduled-scans/methods.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import * as R from 'ramda';
diff --git a/ui/imports/api/scheduled-scans/scheduled-scans.js b/ui/imports/api/scheduled-scans/scheduled-scans.js
index 66ae5d1..54d4565 100644
--- a/ui/imports/api/scheduled-scans/scheduled-scans.js
+++ b/ui/imports/api/scheduled-scans/scheduled-scans.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Constants } from '/imports/api/constants/constants';
diff --git a/ui/imports/api/scheduled-scans/server/methods.js b/ui/imports/api/scheduled-scans/server/methods.js
index 17ed990..4a6c508 100644
--- a/ui/imports/api/scheduled-scans/server/methods.js
+++ b/ui/imports/api/scheduled-scans/server/methods.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import { check } from 'meteor/check';
import * as R from 'ramda';
import { ScheduledScans } from '../scheduled-scans';
diff --git a/ui/imports/api/scheduled-scans/server/publications.js b/ui/imports/api/scheduled-scans/server/publications.js
index 97acc21..9359c20 100644
--- a/ui/imports/api/scheduled-scans/server/publications.js
+++ b/ui/imports/api/scheduled-scans/server/publications.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import { Meteor } from 'meteor/meteor';
import * as R from 'ramda';
import { Counts } from 'meteor/tmeasday:publish-counts';
diff --git a/ui/imports/lib/images-for-node-type.js b/ui/imports/lib/images-for-node-type.js
index 5846f46..fb8e582 100644
--- a/ui/imports/lib/images-for-node-type.js
+++ b/ui/imports/lib/images-for-node-type.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
export let imagesForNodeType = {
'instance': 'ic_computer_black_48dp_2x.png',
'pnic': 'ic_dns_black_48dp_2x.png',
diff --git a/ui/imports/ui/actions/environment-panel.actions.js b/ui/imports/ui/actions/environment-panel.actions.js
index fb7350c..ca8489c 100644
--- a/ui/imports/ui/actions/environment-panel.actions.js
+++ b/ui/imports/ui/actions/environment-panel.actions.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
//import * as R from 'ramda';
export const SET_ENV_NAME = 'SET_ENV_NAME';
diff --git a/ui/imports/ui/actions/graph-tooltip-window.actions.js b/ui/imports/ui/actions/graph-tooltip-window.actions.js
index 08c48b6..297cb7c 100644
--- a/ui/imports/ui/actions/graph-tooltip-window.actions.js
+++ b/ui/imports/ui/actions/graph-tooltip-window.actions.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
//import * as R from 'ramda';
export const ACTIVATE_GRAPH_TOOLTIP_WINDOW = 'ACTIVATE_GRAPH_TOOLTIP_WINDOW';
diff --git a/ui/imports/ui/actions/main-app.actions.js b/ui/imports/ui/actions/main-app.actions.js
index 1daafa1..7d1a730 100644
--- a/ui/imports/ui/actions/main-app.actions.js
+++ b/ui/imports/ui/actions/main-app.actions.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
//import * as R from 'ramda';
export const SET_MAIN_APP_SELECTED_ENVIRONMENT = 'SET_MAIN_APP_SELECTED_ENVIRONMENT';
diff --git a/ui/imports/ui/actions/navigation.js b/ui/imports/ui/actions/navigation.js
index 06b1501..f9c86b5 100644
--- a/ui/imports/ui/actions/navigation.js
+++ b/ui/imports/ui/actions/navigation.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import * as R from 'ramda';
const SET_CURRENT_NODE = 'SET_CURRENT_NODE';
diff --git a/ui/imports/ui/actions/search-interested-parties.js b/ui/imports/ui/actions/search-interested-parties.js
index 1eb9b78..98b413b 100644
--- a/ui/imports/ui/actions/search-interested-parties.js
+++ b/ui/imports/ui/actions/search-interested-parties.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
//import * as R from 'ramda';
const ADD_SEARCH_INTERESTED_PARTY = 'ADD_SEARCH_INTERESTED_PARTY';
diff --git a/ui/imports/ui/actions/tree-node.actions.js b/ui/imports/ui/actions/tree-node.actions.js
index 0fad8c9..f463321 100644
--- a/ui/imports/ui/actions/tree-node.actions.js
+++ b/ui/imports/ui/actions/tree-node.actions.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
//import * as R from 'ramda';
export const UPDATE_TREE_NODE_INFO = 'UPDATE_TREE_NODE_INFO';
diff --git a/ui/imports/ui/actions/vedge-info-window.actions.js b/ui/imports/ui/actions/vedge-info-window.actions.js
index 0431648..2ff3031 100644
--- a/ui/imports/ui/actions/vedge-info-window.actions.js
+++ b/ui/imports/ui/actions/vedge-info-window.actions.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
//import * as R from 'ramda';
export const ACTIVATE_VEDGE_INFO_WINDOW = 'ACTIVATE_VEDGE_INFO_WINDOW';
diff --git a/ui/imports/ui/components/env-amqp-credentials-info/env-amqp-credentials-info.html b/ui/imports/ui/components/env-amqp-credentials-info/env-amqp-credentials-info.html
index b6187e6..02b923d 100644
--- a/ui/imports/ui/components/env-amqp-credentials-info/env-amqp-credentials-info.html
+++ b/ui/imports/ui/components/env-amqp-credentials-info/env-amqp-credentials-info.html
@@ -79,8 +79,8 @@
<div class="col-sm-3">
{{> InputModel(createInputArgs
- value=model.password
- key="password"
+ value=model.pwd
+ key="pwd"
type="password"
disabled=disabled
placeholder="Password")
diff --git a/ui/imports/ui/components/env-open-stack-db-credentials-info/env-open-stack-db-credentials-info.html b/ui/imports/ui/components/env-open-stack-db-credentials-info/env-open-stack-db-credentials-info.html
index 11421a0..13967d5 100644
--- a/ui/imports/ui/components/env-open-stack-db-credentials-info/env-open-stack-db-credentials-info.html
+++ b/ui/imports/ui/components/env-open-stack-db-credentials-info/env-open-stack-db-credentials-info.html
@@ -79,8 +79,8 @@
<div class="col-sm-3">
{{> InputModel(createInputArgs
- value=model.password
- key="password"
+ value=model.pwd
+ key="pwd"
type="password"
disabled=disabled
placeholder="Password")
diff --git a/ui/imports/ui/components/mt-input/mt-input.js b/ui/imports/ui/components/mt-input/mt-input.js
index f8192ef..729adb9 100644
--- a/ui/imports/ui/components/mt-input/mt-input.js
+++ b/ui/imports/ui/components/mt-input/mt-input.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
/*
* Template Component: MtInput
*/
diff --git a/ui/imports/ui/components/mt-radios/mt-radios.js b/ui/imports/ui/components/mt-radios/mt-radios.js
index e2c3169..a8f7f7c 100644
--- a/ui/imports/ui/components/mt-radios/mt-radios.js
+++ b/ui/imports/ui/components/mt-radios/mt-radios.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
/*
* Template Component: MtRadios
*/
diff --git a/ui/imports/ui/components/mt-select/mt-select.js b/ui/imports/ui/components/mt-select/mt-select.js
index 48a2141..95190e2 100644
--- a/ui/imports/ui/components/mt-select/mt-select.js
+++ b/ui/imports/ui/components/mt-select/mt-select.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
/*
* Template Component: MtSelect
*/
diff --git a/ui/imports/ui/components/network-graph-manager/network-graph-manager.js b/ui/imports/ui/components/network-graph-manager/network-graph-manager.js
index 7022bcc..16637ea 100644
--- a/ui/imports/ui/components/network-graph-manager/network-graph-manager.js
+++ b/ui/imports/ui/components/network-graph-manager/network-graph-manager.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
/*
* Template Component: NetworkGraphManager
*/
@@ -229,10 +221,14 @@ function addNodeToGraph(node, graphData) {
name: node._id._str,
};
- newNode = R.ifElse(R.isNil,
- R.always(newNode),
- R.assocPath(['_osmeta', 'host'], R.__, newNode)
- )(node.host);
+ let groupMarkers = ['host', 'switch'];
+ let groupKey = R.find((key) => {
+ if (R.isNil(R.path([key], node))) { return false; }
+ return true;
+ })(groupMarkers);
+ if (groupKey) {
+ newNode = R.assocPath(['_osmeta', 'groupId'], node[groupKey], newNode);
+ }
let nodes = R.unionWith(R.eqBy(R.prop('_osid')), graphData.nodes, [newNode]);
let links = expandLinks(graphData.links, nodes);
@@ -253,18 +249,19 @@ function calcIsReady(graphData) {
function calcGroups(nodes) {
return R.reduce((accGroups, node) => {
- let host = R.path(['_osmeta', 'host'], node);
- if (R.isNil(host)) {
+ let groupId = R.path(['_osmeta', 'groupId'], node);
+ if (R.isNil(groupId)) {
return accGroups;
}
- let groupIndex = R.findIndex(R.propEq('_osid', host), accGroups);
+ let groupIndex = R.findIndex(R.propEq('_osid', groupId), accGroups);
let group = null;
if (groupIndex < 0) {
let group = {
- _osid: host,
+ _osid: groupId,
leaves: [node],
isExpanded: true,
+ name: groupId,
};
accGroups = R.append(group, accGroups);
diff --git a/ui/imports/ui/components/network-graph/network-graph.js b/ui/imports/ui/components/network-graph/network-graph.js
index 49e41a8..04a33b0 100644
--- a/ui/imports/ui/components/network-graph/network-graph.js
+++ b/ui/imports/ui/components/network-graph/network-graph.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
/*
* Template Component: NetworkGraph
*/
@@ -389,12 +381,22 @@ function renderView(force,
function tickFn() {
let svgGroups = mainEl.selectAll('.group');
svgGroups
+ .attr('transform', function (d) {
+ let x = R.path(['bounds', 'x'], d);
+ let y = R.path(['bounds', 'y'], d);
+ return `translate(${x},${y})`;
+ })
+ ;
+ /*
.attr('x', function (d) {
return R.path(['bounds', 'x'], d);
})
.attr('y', function (d) {
return R.path(['bounds', 'y'], d);
})
+ */
+
+ svgGroups.selectAll('.group-shape')
.attr('width', function (d) {
if (d.bounds) { return d.bounds.width(); }
})
@@ -402,6 +404,15 @@ function renderView(force,
if (d.bounds) { return d.bounds.height(); }
});
+ svgGroups.selectAll('.group-name')
+ .attr('x', function(d) {
+ return (d.bounds.width() / 2);
+ })
+ .attr('y', function(_d) {
+ return 30;
+ })
+ ;
+
let svgNodes = mainEl.selectAll('.node');
svgNodes.attr('transform', function(d) {
return 'translate(' + d.x + ',' + d.y + ')';
@@ -470,20 +481,44 @@ function genSvgGroups(g, groups, drag, onRenderViewReq) {
let svgGroups = g.selectAll('.group')
.data(groups, (d) => d._osid);
- //let rects =
- svgGroups.enter()
+ let enterGroups = svgGroups.enter();
+
+ let groupsContainers =
+ enterGroups
+ .append('g')
+ .attr('class', 'group')
+ .attr('data-group-id', (d) => d._osid)
+ .call(drag)
+ .on('click', function (d) {
+ console.log('click', d);
+ d.isExpanded = !d.isExpanded;
+ onRenderViewReq();
+ });
+
+ groupsContainers
.append('rect')
+ .attr('class', 'group-shape')
.attr('rx', 8)
.attr('ry', 8)
- .attr('class', 'group')
- .attr('data-group-id', (d) => d._osid)
.style('fill', function (_d, _i) { return 'lightblue'; })
- .call(drag)
- .on('click', function (d) {
- console.log('click', d);
- d.isExpanded = !d.isExpanded;
- onRenderViewReq();
- });
+ ;
+
+ groupsContainers
+ .append('text')
+ .text(function(d) {
+ return d.name;
+ })
+ .attr('class', 'group-name')
+ .attr('x', function(d) {
+ return (d.bounds.width() / 2);
+ })
+ .attr('y', function(_d) {
+ return 30;
+ })
+ .attr('dy', '.25em')
+ .attr('text-anchor', 'middle')
+ .attr('font-size', 20)
+ ;
svgGroups.exit()
.remove();
@@ -552,10 +587,10 @@ function calcClosedGroupsNodes(rejectedGroups, prevViewNodes) {
function calcNodesAndRejectedNodes(originalNodes, originalGroups) {
let rejectedNodes = [];
let nodes = R.reject((node) => {
- let host = R.path(['_osmeta', 'host'], node);
- if (R.isNil(host)) { return false; }
+ let groupId = R.path(['_osmeta', 'groupId'], node);
+ if (R.isNil(groupId)) { return false; }
- let group = R.find(R.propEq('_osid', host), originalGroups);
+ let group = R.find(R.propEq('_osid', groupId), originalGroups);
if (R.isNil(group)) { return false; }
if (group.isExpanded) { return false; }
@@ -596,8 +631,8 @@ function calcLinksAndRejectedLinks(originalLinks, rejectedNodes) {
function calcNewLinksForRejectedSource(rejectedSourceLinks, nodes, prevLinks) {
let newLinksForRejectedSource = R.reduce((acc, link) => {
- let host = R.path(['_osmeta', 'host'], link.source);
- let groupNodeId = `${host}-group-node`;
+ let groupId = R.path(['_osmeta', 'groupId'], link.source);
+ let groupNodeId = `${groupId}-group-node`;
let newSource = R.find(R.propEq('_osid', groupNodeId), nodes);
if (R.isNil(newSource)) {
throw 'error in new links for rejected source function';
@@ -628,8 +663,8 @@ function calcNewLinksForRejectedSource(rejectedSourceLinks, nodes, prevLinks) {
function calcNewLinksForRejectedTarget(rejectedLinks, nodes, prevLinks) {
let newLinks = R.reduce((acc, link) => {
- let host = R.path(['_osmeta', 'host'], link.target);
- let groupNodeId = `${host}-group-node`;
+ let groupId = R.path(['_osmeta', 'groupId'], link.target);
+ let groupNodeId = `${groupId}-group-node`;
let newTarget = R.find(R.propEq('_osid', groupNodeId), nodes);
if (R.isNil(newTarget)) {
throw 'error in new links for rejected target function';
@@ -660,8 +695,8 @@ function calcNewLinksForRejectedTarget(rejectedLinks, nodes, prevLinks) {
function calcNewLinksForRejectedBoth(rejectedLinks, nodes, prevLinks) {
let newLinks = R.reduce((acc, link) => {
- let targetHost = R.path(['_osmeta', 'host'], link.target);
- let sourceHost = R.path(['_osmeta', 'host'], link.source);
+ let targetHost = R.path(['_osmeta', 'groupId'], link.target);
+ let sourceHost = R.path(['_osmeta', 'groupId'], link.source);
let groupSourceNodeId = `${sourceHost}-group-node`;
let groupTargetNodeId = `${targetHost}-group-node`;
diff --git a/ui/imports/ui/components/network-graph/network-graph.styl b/ui/imports/ui/components/network-graph/network-graph.styl
index 114cc96..d5f7ce2 100644
--- a/ui/imports/ui/components/network-graph/network-graph.styl
+++ b/ui/imports/ui/components/network-graph/network-graph.styl
@@ -6,13 +6,18 @@
width: 100%;
height: 100%;
- .group {
- stroke: #fff;
- stroke-width: 1.5px;
- cursor: move;
- opacity: 0.7;
- }
+ .group
+ .group-shape
+ stroke: #fff;
+ stroke-width: 1.5px;
+ cursor: move;
+ opacity: 0.7;
+ .group-name
+ fill: rgba(133, 133, 133, 0.52);
+ font-weight: 400;
+ line-height: 20px;
+ font-family: 'Helvetica', 'Arial', sans-serif;
.link-group
text
diff --git a/ui/imports/ui/components/new-scanning/new-scanning.js b/ui/imports/ui/components/new-scanning/new-scanning.js
index 1995ded..891d2b3 100644
--- a/ui/imports/ui/components/new-scanning/new-scanning.js
+++ b/ui/imports/ui/components/new-scanning/new-scanning.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
/*
* Template Component: NewScanning
*/
diff --git a/ui/imports/ui/components/scheduled-scan/scheduled-scan.js b/ui/imports/ui/components/scheduled-scan/scheduled-scan.js
index 3bcc591..4092d00 100644
--- a/ui/imports/ui/components/scheduled-scan/scheduled-scan.js
+++ b/ui/imports/ui/components/scheduled-scan/scheduled-scan.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
/*
* Template Component: ScheduledScan
*/
diff --git a/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.js b/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.js
index 7aa76e9..bd85afd 100644
--- a/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.js
+++ b/ui/imports/ui/components/scheduled-scans-list/scheduled-scans-list.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
/*
* Template Component: ScheduledScansList
*/
diff --git a/ui/imports/ui/components/selectable-ordered-input/selectable-ordered-input.js b/ui/imports/ui/components/selectable-ordered-input/selectable-ordered-input.js
index 30b740f..15c46fe 100644
--- a/ui/imports/ui/components/selectable-ordered-input/selectable-ordered-input.js
+++ b/ui/imports/ui/components/selectable-ordered-input/selectable-ordered-input.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
/*
* Template Component: SelectableOrderedInput
*/
diff --git a/ui/imports/ui/lib/environment-tree-node-behavior.js b/ui/imports/ui/lib/environment-tree-node-behavior.js
index 86286a4..12f0407 100644
--- a/ui/imports/ui/lib/environment-tree-node-behavior.js
+++ b/ui/imports/ui/lib/environment-tree-node-behavior.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import { Inventory } from '/imports/api/inventories/inventories';
export let EnvironmentTreeNodeBehavior = {
diff --git a/ui/imports/ui/lib/input-model.js b/ui/imports/ui/lib/input-model.js
index 5a5be84..a60f842 100644
--- a/ui/imports/ui/lib/input-model.js
+++ b/ui/imports/ui/lib/input-model.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
/*
* file: input-model.js
*/
diff --git a/ui/imports/ui/lib/inventory-tree-node-behavior.js b/ui/imports/ui/lib/inventory-tree-node-behavior.js
index ecf9c60..c8bf4fd 100644
--- a/ui/imports/ui/lib/inventory-tree-node-behavior.js
+++ b/ui/imports/ui/lib/inventory-tree-node-behavior.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import { Inventory } from '/imports/api/inventories/inventories';
//import * as R from 'ramda';
diff --git a/ui/imports/ui/lib/select-model.js b/ui/imports/ui/lib/select-model.js
index da553b5..c902f93 100644
--- a/ui/imports/ui/lib/select-model.js
+++ b/ui/imports/ui/lib/select-model.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import * as R from 'ramda';
export const createSelectArgs = function (params) {
diff --git a/ui/imports/ui/reducers/environment-panel.reducer.js b/ui/imports/ui/reducers/environment-panel.reducer.js
index bac0e72..d06052f 100644
--- a/ui/imports/ui/reducers/environment-panel.reducer.js
+++ b/ui/imports/ui/reducers/environment-panel.reducer.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import * as R from 'ramda';
import * as actions from '/imports/ui/actions/environment-panel.actions';
diff --git a/ui/imports/ui/reducers/graph-tooltip-window.reducer.js b/ui/imports/ui/reducers/graph-tooltip-window.reducer.js
index 67f96f1..4489fb6 100644
--- a/ui/imports/ui/reducers/graph-tooltip-window.reducer.js
+++ b/ui/imports/ui/reducers/graph-tooltip-window.reducer.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import * as R from 'ramda';
import * as actions from '/imports/ui/actions/graph-tooltip-window.actions';
diff --git a/ui/imports/ui/reducers/i18n.reducer.js b/ui/imports/ui/reducers/i18n.reducer.js
index 8771aad..28815f7 100644
--- a/ui/imports/ui/reducers/i18n.reducer.js
+++ b/ui/imports/ui/reducers/i18n.reducer.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
//import * as R from 'ramda';
const defaultState = {
diff --git a/ui/imports/ui/reducers/index.js b/ui/imports/ui/reducers/index.js
index 6ee909d..936f68a 100644
--- a/ui/imports/ui/reducers/index.js
+++ b/ui/imports/ui/reducers/index.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import { combineReducers } from 'redux';
import { navigation } from './navigation';
diff --git a/ui/imports/ui/reducers/main-app.reducer.js b/ui/imports/ui/reducers/main-app.reducer.js
index abc4574..e5e1489 100644
--- a/ui/imports/ui/reducers/main-app.reducer.js
+++ b/ui/imports/ui/reducers/main-app.reducer.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import * as R from 'ramda';
import * as actions from '/imports/ui/actions/main-app.actions';
diff --git a/ui/imports/ui/reducers/navigation.js b/ui/imports/ui/reducers/navigation.js
index de78ee5..d7ab503 100644
--- a/ui/imports/ui/reducers/navigation.js
+++ b/ui/imports/ui/reducers/navigation.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import * as R from 'ramda';
import * as actions from '/imports/ui/actions/navigation';
diff --git a/ui/imports/ui/reducers/search-interested-parties.js b/ui/imports/ui/reducers/search-interested-parties.js
index 26220c2..f4963d2 100644
--- a/ui/imports/ui/reducers/search-interested-parties.js
+++ b/ui/imports/ui/reducers/search-interested-parties.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import * as R from 'ramda';
import * as actions from '/imports/ui/actions/search-interested-parties';
diff --git a/ui/imports/ui/reducers/tree-node.reducer.js b/ui/imports/ui/reducers/tree-node.reducer.js
index 0a6ec73..5e9420d 100644
--- a/ui/imports/ui/reducers/tree-node.reducer.js
+++ b/ui/imports/ui/reducers/tree-node.reducer.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
//import { Mongo } from 'meteor/mongo';
import * as R from 'ramda';
diff --git a/ui/imports/ui/reducers/vedge-info-window.reducer.js b/ui/imports/ui/reducers/vedge-info-window.reducer.js
index d1be629..0cedc6a 100644
--- a/ui/imports/ui/reducers/vedge-info-window.reducer.js
+++ b/ui/imports/ui/reducers/vedge-info-window.reducer.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import * as R from 'ramda';
import * as actions from '/imports/ui/actions/vedge-info-window.actions';
diff --git a/ui/imports/ui/store/index.js b/ui/imports/ui/store/index.js
index fc5e2f5..af0813b 100644
--- a/ui/imports/ui/store/index.js
+++ b/ui/imports/ui/store/index.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import { Store } from './store';
export { Store };
diff --git a/ui/imports/ui/store/store.js b/ui/imports/ui/store/store.js
index 76da6a9..acefce2 100644
--- a/ui/imports/ui/store/store.js
+++ b/ui/imports/ui/store/store.js
@@ -1,11 +1,3 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
-// /
-// All rights reserved. This program and the accompanying materials /
-// are made available under the terms of the Apache License, Version 2.0 /
-// which accompanies this distribution, and is available at /
-// http://www.apache.org/licenses/LICENSE-2.0 /
-/////////////////////////////////////////////////////////////////////////////////////////
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import calipsoApp from '/imports/ui/reducers/index';
diff --git a/ui/run b/ui/run
new file mode 100755
index 0000000..ec4aa7c
--- /dev/null
+++ b/ui/run
@@ -0,0 +1,2 @@
+# run meteor with different mongo
+MONGO_URL=mongodb://localhost:27017/osdna meteor run
diff --git a/ui/run-dev.sh b/ui/run-dev.sh
new file mode 100755
index 0000000..d35659e
--- /dev/null
+++ b/ui/run-dev.sh
@@ -0,0 +1,10 @@
+########################################################################################
+# Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others #
+# #
+# All rights reserved. This program and the accompanying materials #
+# are made available under the terms of the Apache License, Version 2.0 #
+# which accompanies this distribution, and is available at #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+########################################################################################
+# run meteor with different mongo
+MONGO_URL=mongodb://osdna:Oki9wse3@10.56.20.80:27017/osdna meteor run