|
|
|
/*jslint laxbreak:true */
|
|
|
|
/*jslint laxcomma:true */
|
|
|
|
/*jslint loopfunc:true */
|
|
|
|
/*jslint strict:true */
|
|
|
|
/*jslint browser:true */
|
|
|
|
/*jslint devel:true */
|
|
|
|
|
|
|
|
define([
|
|
|
|
"underscore"
|
|
|
|
, "jquery"
|
|
|
|
, "backbone"
|
|
|
|
|
|
|
|
, "views/browser"
|
|
|
|
, "views/list"
|
|
|
|
|
|
|
|
, "text!../../templates/client/layout.html"
|
|
|
|
|
|
|
|
, "jquery-layout"
|
|
|
|
]
|
|
|
|
, function (
|
|
|
|
_
|
|
|
|
, $
|
|
|
|
, Backbone
|
|
|
|
|
|
|
|
, BrowserView
|
|
|
|
, ListView
|
|
|
|
|
|
|
|
, tmplClientLayout
|
|
|
|
) {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var Client = Backbone.View.extend({
|
|
|
|
id: null
|
|
|
|
|
|
|
|
, el: $(tmplClientLayout)
|
|
|
|
|
|
|
|
, Server: null
|
|
|
|
|
|
|
|
, Layout: null
|
|
|
|
|
|
|
|
, Views: {}
|
|
|
|
|
|
|
|
, initialize: function (options) {
|
|
|
|
_.bindAll(this
|
|
|
|
, "_initLayout"
|
|
|
|
, "show"
|
|
|
|
, "hide"
|
|
|
|
);
|
|
|
|
|
|
|
|
var that = this
|
|
|
|
, appendEl = options.appendEl
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
that.Server = options.server;
|
|
|
|
|
|
|
|
delete options.server;
|
|
|
|
delete options.appendEl;
|
|
|
|
|
|
|
|
Client.__super__.initialize.apply(that, arguments);
|
|
|
|
|
|
|
|
that.el.id = "__view-cient-" + that.Server.client.attributes.hostname.replace(".", "_");
|
|
|
|
that.id = that.Server.client.attributes.hostname;
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
, _initLayout: function () {
|
|
|
|
var that = this
|
|
|
|
;
|
|
|
|
|
|
|
|
that.Layout = that.$el.layout({
|
|
|
|
defaults: {
|
|
|
|
closable: false
|
|
|
|
, resizable: true
|
|
|
|
, slidable: true
|
|
|
|
, spacing_open: 5
|
|
|
|
, spacing_closed: 5
|
|
|
|
}
|
|
|
|
|
|
|
|
, north: {
|
|
|
|
minSize: 100
|
|
|
|
, size: 200
|
|
|
|
, closable: true
|
|
|
|
}
|
|
|
|
|
|
|
|
, center: {
|
|
|
|
minSize: 200
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
that.Views.Browser = new BrowserView(that.Client, {
|
|
|
|
el: that.Layout.panes.north
|
|
|
|
});
|
|
|
|
|
|
|
|
var dbId = that.Server.client.collections.databasesInfo.get("dmap_listing").at(0).id
|
|
|
|
, dbCollection = that.Server.client.collections.databases[dbId].get("dmap_listing")
|
|
|
|
;
|
|
|
|
|
|
|
|
that.Views.List = new ListView({
|
|
|
|
el: that.Layout.panes.center
|
|
|
|
, collection: dbCollection
|
|
|
|
, type: "client"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
, show: function () {
|
|
|
|
var that = this
|
|
|
|
;
|
|
|
|
|
|
|
|
if (that.Layout === null) {
|
|
|
|
that._initLayout();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$el.show();
|
|
|
|
//console.debug(that.Server.client.collections.databases[that.Server.client.collections.databasesInfo.get("dmap_listing").at(0).id].get("dmap_listing"));
|
|
|
|
}
|
|
|
|
|
|
|
|
, hide: function () {
|
|
|
|
var that = this
|
|
|
|
;
|
|
|
|
|
|
|
|
this.$el.hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return Client;
|
|
|
|
});
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
that.layoutItems = $(that.layout.panes.center).layout({
|
|
|
|
defaults: {
|
|
|
|
closable: false
|
|
|
|
, resizable: true
|
|
|
|
, slidable: true
|
|
|
|
, spacing_open: 5
|
|
|
|
, spacing_closed: 5
|
|
|
|
}
|
|
|
|
|
|
|
|
, north: {
|
|
|
|
minSize: 100
|
|
|
|
, size: 200
|
|
|
|
, closable: true
|
|
|
|
//, onresize: function (pane, $pane, state, options) {
|
|
|
|
// var viewportHeight = $pane.innerHeight() - App.BrowserView.$el.find(".dataTables_scrollHead").height();
|
|
|
|
// App.BrowserView.$el.find(".dataTables_scrollBody").height(viewportHeight);
|
|
|
|
// //App.BrowserView.reDraw();
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
, center: {
|
|
|
|
minSize: 200
|
|
|
|
//, onresize: function (pane, $pane, state, options) {
|
|
|
|
// var viewportHeight = $pane.innerHeight() - App.ListView.$el.find(".dataTables_scrollHead").height();
|
|
|
|
// App.ListView.$el.find(".dataTables_scrollBody").height(viewportHeight);
|
|
|
|
// //App.ListView.render();
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
});
|
|
|
|
*/
|