summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux')
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/class.js50
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/dragdrop.js124
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/fieldCollection.js25
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/observable.js46
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/singleton.js21
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/singletonSpec.js41
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/table.css20
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/templates/templateSpec.js81
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/templates/templates.js32
9 files changed, 0 insertions, 440 deletions
diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/class.js b/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/class.js
deleted file mode 100644
index 80142637c..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/class.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * base class for creating inheritable classes
- * based on resigs 'Simple Javascript Inheritance Class' (based on base2 and prototypejs)
- * modified with static super and auto config
- * @name Class
- * @constructor
- */
-(function( $, app ){
-
- var ux = app.ns("ux");
-
- var initializing = false, fnTest = /\b_super\b/;
-
- ux.Class = function(){};
-
- ux.Class.extend = function(prop) {
- function Class() {
- if(!initializing) {
- var args = Array.prototype.slice.call(arguments);
- this.config = $.extend( function(t) { // automatically construct a config object based on defaults and last item passed into the constructor
- return $.extend(t._proto && t._proto() && arguments.callee(t._proto()) || {}, t.defaults);
- } (this) , args.pop() );
- this.init && this.init.apply(this, args); // automatically run the init function when class created
- }
- }
-
- initializing = true;
- var prototype = new this();
- initializing = false;
-
- var _super = this.prototype;
- prototype._proto = function() {
- return _super;
- };
-
- for(var name in prop) {
- prototype[name] = typeof prop[name] === "function" && typeof _super[name] === "function" && fnTest.test(prop[name]) ?
- (function(name, fn){
- return function() { this._super = _super[name]; return fn.apply(this, arguments); };
- })(name, prop[name]) : prop[name];
- }
-
- Class.prototype = prototype;
- Class.constructor = Class;
-
- Class.extend = arguments.callee; // make class extendable
-
- return Class;
- };
-})( this.jQuery, this.app );
diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/dragdrop.js b/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/dragdrop.js
deleted file mode 100644
index 17ca9be1f..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/dragdrop.js
+++ /dev/null
@@ -1,124 +0,0 @@
-(function( $, app ) {
-
- var ux = app.ns("ux");
-
- /**
- * Provides drag and drop functionality<br>
- * a DragDrop instance is created for each usage pattern and then used over and over again<br>
- * first a dragObj is defined - this is the jquery node that will be dragged around<br>
- * second, the event callbacks are defined - these allow you control the ui during dragging and run functions when successfully dropping<br>
- * thirdly drop targets are defined - this is a list of DOM nodes, the constructor works in one of two modes:
- * <li>without targets - objects can be picked up and dragged around, dragStart and dragStop events fire</li>
- * <li>with targets - as objects are dragged over targets dragOver, dragOut and DragDrop events fire
- * to start dragging call the DragDrop.pickup_handler() function, dragging stops when the mouse is released.
- * @constructor
- * The following options are supported
- * <dt>targetSelector</dt>
- * <dd>an argument passed directly to jquery to create a list of targets, as such it can be a CSS style selector, or an array of DOM nodes<br>if target selector is null the DragDrop does Drag only and will not fire dragOver dragOut and dragDrop events</dd>
- * <dt>pickupSelector</dt>
- * <dd>a jquery selector. The pickup_handler is automatically bound to matched elements (eg clicking on these elements starts the drag). if pickupSelector is null, the pickup_handler must be manually bound <code>$(el).bind("mousedown", dragdrop.pickup_handler)</code></dd>
- * <dt>dragObj</dt>
- * <dd>the jQuery element to drag around when pickup is called. If not defined, dragObj must be set in onDragStart</dd>
- * <dt>draggingClass</dt>
- * <dd>the class(es) added to items when they are being dragged</dd>
- * The following observables are supported
- * <dt>dragStart</dt>
- * <dd>a callback when start to drag<br><code>function(jEv)</code></dd>
- * <dt>dragOver</dt>
- * <dd>a callback when we drag into a target<br><code>function(jEl)</code></dd>
- * <dt>dragOut</dt>
- * <dd>a callback when we drag out of a target, or when we drop over a target<br><code>function(jEl)</code></dd>
- * <dt>dragDrop</dt>
- * <dd>a callback when we drop on a target<br><code>function(jEl)</code></dd>
- * <dt>dragStop</dt>
- * <dd>a callback when we stop dragging<br><code>function(jEv)</code></dd>
- */
- ux.DragDrop = ux.Observable.extend({
- defaults : {
- targetsSelector : null,
- pickupSelector: null,
- dragObj : null,
- draggingClass : "dragging"
- },
-
- init: function(options) {
- this._super(); // call the class initialiser
-
- this.drag_handler = this.drag.bind(this);
- this.drop_handler = this.drop.bind(this);
- this.pickup_handler = this.pickup.bind(this);
- this.targets = [];
- this.dragObj = null;
- this.dragObjOffset = null;
- this.currentTarget = null;
- if(this.config.pickupSelector) {
- $(this.config.pickupSelector).bind("mousedown", this.pickup_handler);
- }
- },
-
- drag : function(jEv) {
- jEv.preventDefault();
- var mloc = acx.vector( this.lockX || jEv.pageX, this.lockY || jEv.pageY );
- this.dragObj.css(mloc.add(this.dragObjOffset).asOffset());
- if(this.targets.length === 0) {
- return;
- }
- if(this.currentTarget !== null && mloc.within(this.currentTarget[1], this.currentTarget[2])) {
- return;
- }
- if(this.currentTarget !== null) {
- this.fire('dragOut', this.currentTarget[0]);
- this.currentTarget = null;
- }
- for(var i = 0; i < this.targets.length; i++) {
- if(mloc.within(this.targets[i][1], this.targets[i][2])) {
- this.currentTarget = this.targets[i];
- break;
- }
- }
- if(this.currentTarget !== null) {
- this.fire('dragOver', this.currentTarget[0]);
- }
- },
-
- drop : function(jEv) {
- $(document).unbind("mousemove", this.drag_handler);
- $(document).unbind("mouseup", this.drop_handler);
- this.dragObj.removeClass(this.config.draggingClass);
- if(this.currentTarget !== null) {
- this.fire('dragOut', this.currentTarget[0]);
- this.fire('dragDrop', this.currentTarget[0]);
- }
- this.fire('dragStop', jEv);
- this.dragObj = null;
- },
-
- pickup : function(jEv, opts) {
- $.extend(this.config, opts);
- this.fire('dragStart', jEv);
- this.dragObj = this.dragObj || this.config.dragObj;
- this.dragObjOffset = this.config.dragObjOffset || acx.vector(this.dragObj.offset()).sub(jEv.pageX, jEv.pageY);
- this.lockX = this.config.lockX ? jEv.pageX : 0;
- this.lockY = this.config.lockY ? jEv.pageY : 0;
- this.dragObj.addClass(this.config.draggingClass);
- if(!this.dragObj.get(0).parentNode || this.dragObj.get(0).parentNode.nodeType === 11) { // 11 = document fragment
- $(document.body).append(this.dragObj);
- }
- if(this.config.targetsSelector) {
- this.currentTarget = null;
- var targets = ( this.targets = [] );
- // create an array of elements optimised for rapid collision detection calculation
- $(this.config.targetsSelector).each(function(i, el) {
- var jEl = $(el);
- var tl = acx.vector(jEl.offset());
- var br = tl.add(jEl.width(), jEl.height());
- targets.push([jEl, tl, br]);
- });
- }
- $(document).bind("mousemove", this.drag_handler);
- $(document).bind("mouseup", this.drop_handler);
- this.drag_handler(jEv);
- }
- });
-
-})( this.jQuery, this.app );
diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/fieldCollection.js b/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/fieldCollection.js
deleted file mode 100644
index ce4064f45..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/fieldCollection.js
+++ /dev/null
@@ -1,25 +0,0 @@
-(function( app ) {
-
- var ux = app.ns("ux");
-
- ux.FieldCollection = ux.Observable.extend({
- defaults: {
- fields: [] // the collection of fields
- },
- init: function() {
- this._super();
- this.fields = this.config.fields;
- },
- validate: function() {
- return this.fields.reduce(function(r, field) {
- return r && field.validate();
- }, true);
- },
- getData: function(type) {
- return this.fields.reduce(function(r, field) {
- r[field.name] = field.val(); return r;
- }, {});
- }
- });
-
-})( this.app );
diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/observable.js b/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/observable.js
deleted file mode 100644
index 013039787..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/observable.js
+++ /dev/null
@@ -1,46 +0,0 @@
-(function( app ) {
-
- var ux = app.ns("ux");
-
- ux.Observable = ux.Class.extend((function() {
- return {
- init: function() {
- this.observers = {};
- for( var opt in this.config ) { // automatically install observers that are defined in the configuration
- if( opt.indexOf( 'on' ) === 0 ) {
- this.on( opt.substring(2) , this.config[ opt ] );
- }
- }
- },
- _getObs: function( type ) {
- return ( this.observers[ type.toLowerCase() ] || ( this.observers[ type.toLowerCase() ] = [] ) );
- },
- on: function( type, fn, params, thisp ) {
- this._getObs( type ).push( { "cb" : fn, "args" : params || [] , "cx" : thisp || this } );
- return this;
- },
- fire: function( type ) {
- var params = Array.prototype.slice.call( arguments, 1 );
- this._getObs( type ).slice().forEach( function( ob ) {
- ob["cb"].apply( ob["cx"], ob["args"].concat( params ) );
- } );
- return this;
- },
- removeAllObservers: function() {
- this.observers = {};
- },
- removeObserver: function( type, fn ) {
- var obs = this._getObs( type ),
- index = obs.reduce( function(p, t, i) { return (t.cb === fn) ? i : p; }, -1 );
- if(index !== -1) {
- obs.splice( index, 1 );
- }
- return this; // make observable functions chainable
- },
- hasObserver: function( type ) {
- return !! this._getObs( type ).length;
- }
- };
- })());
-
-})( this.app ); \ No newline at end of file
diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/singleton.js b/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/singleton.js
deleted file mode 100644
index 953e4a095..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/singleton.js
+++ /dev/null
@@ -1,21 +0,0 @@
-(function( app ) {
-
- var ux = app.ns("ux");
-
- var extend = ux.Observable.extend;
- var instance = function() {
- if( ! ("me" in this) ) {
- this.me = new this();
- }
- return this.me;
- };
-
- ux.Singleton = ux.Observable.extend({});
-
- ux.Singleton.extend = function() {
- var Self = extend.apply( this, arguments );
- Self.instance = instance;
- return Self;
- };
-
-})( this.app );
diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/singletonSpec.js b/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/singletonSpec.js
deleted file mode 100644
index 96ef6a282..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/singletonSpec.js
+++ /dev/null
@@ -1,41 +0,0 @@
-describe("app.ux.singleton", function(){
-
-var Singleton = window.app.ux.Singleton;
-
- describe("creating a singleton", function() {
- var X = Singleton.extend({
- foo: function() {
- return "bar";
- }
- });
-
- var Y = Singleton.extend({
- bar: function() {
- return "baz";
- }
- });
-
- it("should have properties like a normal class", function() {
- var a = X.instance();
-
- expect( a instanceof X ).toBe( true );
- expect( a.foo() ).toBe( "bar" );
- });
-
- it("should return single instance each time instance() is called", function() {
- var a = X.instance();
- var b = X.instance();
-
- expect( a ).toBe( b );
- });
-
- it("should not share instances with different singletons", function() {
- var a = X.instance();
- var c = Y.instance();
-
- expect( a ).not.toBe( c );
- });
-
- });
-
-});
diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/table.css b/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/table.css
deleted file mode 100644
index 7d829c4ce..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/table.css
+++ /dev/null
@@ -1,20 +0,0 @@
-TABLE.table {
- border-collapse: collapse;
-}
-
-
-TABLE.table TH {
- font-weight: normal;
- text-align: left;
- vertical-align: middle;
-}
-
-TABLE.table TBODY.striped TR:nth-child(odd) {
- background: #eee;
-}
-
-TABLE.table H3 {
- margin: 0;
- font-weight: bold;
- font-size: 140%;
-}
diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/templates/templateSpec.js b/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/templates/templateSpec.js
deleted file mode 100644
index db76b1326..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/templates/templateSpec.js
+++ /dev/null
@@ -1,81 +0,0 @@
-describe("app.ut.byteSize_template", function() {
-
- describe("byteSize_template()", function() {
- var byteSize_template = window.app.ut.byteSize_template;
-
- it("should postfix with a B and have not decimal for number less than 1000", function() {
- expect( byteSize_template( 0 ) ).toBe( "0B" );
- expect( byteSize_template( 1 ) ).toBe( "1B" );
- expect( byteSize_template( 10 ) ).toBe( "10B" );
- expect( byteSize_template( 100 ) ).toBe( "100B" );
- expect( byteSize_template( 999 ) ).toBe( "999B" );
- });
-
- it("should have 0.xxX for values between 1000 and 1023", function() {
- expect( byteSize_template( 1000 ) ).toBe( "0.98ki" );
- expect( byteSize_template( 1024 * 1000 ) ).toBe( "0.98Mi" );
- });
-
- it("should always have three significant digits", function() {
- expect( byteSize_template( 1023 ) ).toBe( "1.00ki" );
- expect( byteSize_template( 1024 ) ).toBe( "1.00ki" );
- expect( byteSize_template( 1025 ) ).toBe( "1.00ki" );
- expect( byteSize_template( 1024 * 5 ) ).toBe( "5.00ki" );
- expect( byteSize_template( 1024 * 55 ) ).toBe( "55.0ki" );
- expect( byteSize_template( 1024 * 555 ) ).toBe( "555ki" );
- });
-
- it("should have the correct postfix", function() {
- expect( byteSize_template( 3 * Math.pow( 1024, 1) ) ).toBe( "3.00ki" );
- expect( byteSize_template( 3 * Math.pow( 1024, 2) ) ).toBe( "3.00Mi" );
- expect( byteSize_template( 3 * Math.pow( 1024, 3) ) ).toBe( "3.00Gi" );
- expect( byteSize_template( 3 * Math.pow( 1024, 4) ) ).toBe( "3.00Ti" );
- expect( byteSize_template( 3 * Math.pow( 1024, 5) ) ).toBe( "3.00Pi" );
- expect( byteSize_template( 3 * Math.pow( 1024, 6) ) ).toBe( "3.00Ei" );
- expect( byteSize_template( 3 * Math.pow( 1024, 7) ) ).toBe( "3.00Zi" );
- expect( byteSize_template( 3 * Math.pow( 1024, 8) ) ).toBe( "3.00Yi" );
- });
-
- it("should show an overflow for stupidly big numbers", function() {
- expect( byteSize_template( 3 * Math.pow( 1024, 10) ) ).toBe( "3.00..E" );
- });
- });
-
- describe("count_template()", function() {
- var count_template = window.app.ut.count_template;
-
- it("should not postfix and not decimal for number less than 1000", function() {
- expect( count_template( 0 ) ).toBe( "0" );
- expect( count_template( 1 ) ).toBe( "1" );
- expect( count_template( 10 ) ).toBe( "10" );
- expect( count_template( 100 ) ).toBe( "100" );
- expect( count_template( 999 ) ).toBe( "999" );
- });
-
- it("should always have three significant digits", function() {
- expect( count_template( 1000 ) ).toBe( "1.00k" );
- expect( count_template( 1005 ) ).toBe( "1.00k" );
- expect( count_template( 1055 ) ).toBe( "1.05k" );
- expect( count_template( 1000 * 5 ) ).toBe( "5.00k" );
- expect( count_template( 1000 * 55 ) ).toBe( "55.0k" );
- expect( count_template( 1000 * 555 ) ).toBe( "555k" );
- });
-
- it("should have the correct postfix", function() {
- expect( count_template( 3 * Math.pow( 1000, 1) ) ).toBe( "3.00k" );
- expect( count_template( 3 * Math.pow( 1000, 2) ) ).toBe( "3.00M" );
- expect( count_template( 3 * Math.pow( 1000, 3) ) ).toBe( "3.00G" );
- expect( count_template( 3 * Math.pow( 1000, 4) ) ).toBe( "3.00T" );
- expect( count_template( 3 * Math.pow( 1000, 5) ) ).toBe( "3.00P" );
- expect( count_template( 3 * Math.pow( 1000, 6) ) ).toBe( "3.00E" );
- expect( count_template( 3 * Math.pow( 1000, 7) ) ).toBe( "3.00Z" );
- expect( count_template( 3 * Math.pow( 1000, 8) ) ).toBe( "3.00Y" );
- });
-
- it("should show an overflow for stupidly big numbers", function() {
- expect( count_template( 3 * Math.pow( 1000, 10) ) ).toBe( "3.00..E" );
- });
- });
-
-
-});
diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/templates/templates.js b/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/templates/templates.js
deleted file mode 100644
index 3fdb5087a..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ux/templates/templates.js
+++ /dev/null
@@ -1,32 +0,0 @@
-(function( app ) {
-
- var ut = app.ns("ut");
-
- ut.option_template = function(v) { return { tag: "OPTION", value: v, text: v }; };
-
- ut.require_template = function(f) { return f.require ? { tag: "SPAN", cls: "require", text: "*" } : null; };
-
-
- var sib_prefix = ['B','ki','Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'];
-
- ut.byteSize_template = function(n) {
- var i = 0;
- while( n >= 1000 ) {
- i++;
- n /= 1024;
- }
- return (i === 0 ? n.toString() : n.toFixed( 3 - parseInt(n,10).toString().length )) + ( sib_prefix[ i ] || "..E" );
- };
-
- var sid_prefix = ['','k','M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
-
- ut.count_template = function(n) {
- var i = 0;
- while( n >= 1000 ) {
- i++;
- n /= 1000;
- }
- return i === 0 ? n.toString() : ( n.toFixed( 3 - parseInt(n,10).toString().length ) + ( sid_prefix[ i ] || "..E" ) );
- };
-
-})( this.app );