You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2016/11/30 13:42:22 UTC
[1/5] fauxton commit: updated refs/heads/master to 14224ea
Repository: couchdb-fauxton
Updated Branches:
refs/heads/master 2dc418893 -> 14224ea7e
remove doc_editor template
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/26b797a1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/26b797a1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/26b797a1
Branch: refs/heads/master
Commit: 26b797a194d8fe4651378b28cc173d786ee7c55f
Parents: 2dc4188
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Nov 23 11:03:16 2016 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Nov 30 11:38:38 2016 +0200
----------------------------------------------------------------------
app/addons/components/layouts.js | 24 ++++++++++++++++++
app/addons/documents/routes-doc-editor.js | 35 ++++++++++++++++----------
app/templates/layouts/doc_editor.html | 25 ------------------
3 files changed, 46 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/26b797a1/app/addons/components/layouts.js
----------------------------------------------------------------------
diff --git a/app/addons/components/layouts.js b/app/addons/components/layouts.js
index ddd10df..234e305 100644
--- a/app/addons/components/layouts.js
+++ b/app/addons/components/layouts.js
@@ -113,3 +113,27 @@ export const OnePaneSimpleLayout = ({component, docUrl, endpoint, crumbs}) => {
</OnePane>
);
};
+
+export const DocEditorContent = ({children}) => {
+ return (
+ <div id="dashboard-content">
+ {children}
+ </div>
+ );
+};
+
+export const DocEditorLayout = ({component, docUrl, endpoint, crumbs}) => {
+ return (
+ <div id="dashboard" className="one-pane doc-editor-page">
+ <OnePaneHeader
+ crumbs={crumbs}
+ endpoint={endpoint}
+ docUrl={docUrl}
+ >
+ </OnePaneHeader>
+ <DocEditorContent>
+ {component}
+ </DocEditorContent>
+ </div>
+ );
+};
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/26b797a1/app/addons/documents/routes-doc-editor.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-doc-editor.js b/app/addons/documents/routes-doc-editor.js
index b13fc32..8fcfaae 100644
--- a/app/addons/documents/routes-doc-editor.js
+++ b/app/addons/documents/routes-doc-editor.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+import React from 'react';
import app from "../../app";
import FauxtonAPI from "../../core/api";
import Helpers from "./helpers";
@@ -19,10 +20,13 @@ import Actions from "./doc-editor/actions";
import ReactComponents from "./doc-editor/components.react";
import RevBrowserActions from "./rev-browser/rev-browser.actions";
import RevBrowserComponents from "./rev-browser/rev-browser.components.react";
+import {DocEditorLayout} from '../components/layouts';
const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
- layout: 'doc_editor',
+ layout: 'empty',
+ hideApiBar: true,
+ hideNotificationCenter: true,
selectedHeader: 'Databases',
roles: ['fx_loggedIn'],
@@ -42,26 +46,30 @@ const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
'database/:database/new': 'codeEditor'
},
- crumbs: function () {},
revisionBrowser: function (databaseName, docId) {
const backLink = FauxtonAPI.urls('allDocs', 'app', FauxtonAPI.url.encode(this.database.safeID()));
- const docUrl = FauxtonAPI.urls('document', 'app', this.database.safeID(), this.docId);
+ const docURL = FauxtonAPI.urls('document', 'app', this.database.safeID(), this.docId);
- this.crumbs = [
+ const crumbs = [
{ name: this.database.safeID(), link: backLink },
{ name: this.docId + ' > Conflicts' }
];
RevBrowserActions.showConfirmModal(false, null);
RevBrowserActions.initDiffEditor(databaseName, docId);
- this.setComponent('#dashboard-content', RevBrowserComponents.DiffyController);
+ this.setComponent(".template", DocEditorLayout, {
+ crumbs,
+ endpoint: this.doc.url('apiurl'),
+ docURL,
+ component: <RevBrowserComponents.DiffyController />
+ });
},
codeEditor: function (databaseName, docId) {
const backLink = FauxtonAPI.urls('allDocs', 'app', FauxtonAPI.url.encode(databaseName));
- this.crumbs = [
+ const crumbs = [
{ name: databaseName, link: backLink },
{ name: docId ? docId : 'New Document' }
];
@@ -73,18 +81,19 @@ const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
}
Actions.initDocEditor({ doc: this.doc, database: this.database });
- this.setComponent('#dashboard-content', ReactComponents.DocEditorController, {
- database: this.database,
- isNewDoc: docId ? false : true
+ this.setComponent(".template", DocEditorLayout, {
+ crumbs,
+ endpoint: this.doc.url('apiurl'),
+ docURL: this.doc.documentation(),
+ component: <ReactComponents.DocEditorController
+ database={this.database}
+ isNewDoc={docId ? false : true}
+ />
});
},
showDesignDoc: function (database, ddoc) {
this.codeEditor(database, '_design/' + ddoc);
- },
-
- apiUrl: function () {
- return [this.doc.url('apiurl'), this.doc.documentation()];
}
});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/26b797a1/app/templates/layouts/doc_editor.html
----------------------------------------------------------------------
diff --git a/app/templates/layouts/doc_editor.html b/app/templates/layouts/doc_editor.html
deleted file mode 100644
index 470d930..0000000
--- a/app/templates/layouts/doc_editor.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<%/*
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
-*/%>
-
-<div id="dashboard" class="one-pane doc-editor-page">
- <header>
- <div class="flex-layout flex-row">
- <div id="breadcrumbs" class="flex-body"></div>
- <div id="api-navbar"></div>
- <div id="notification-center-btn"></div>
- </div>
- </header>
-
- <div id="dashboard-content"></div>
-</div>
[2/5] fauxton commit: updated refs/heads/master to 14224ea
Posted by ga...@apache.org.
remove with_sidebar
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/a599d5a4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/a599d5a4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/a599d5a4
Branch: refs/heads/master
Commit: a599d5a44031686b250e2908bfb97ce28b9714d3
Parents: 75b8eb4
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Nov 23 17:14:05 2016 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Nov 30 11:38:39 2016 +0200
----------------------------------------------------------------------
app/addons/auth/layout.js | 25 +++++++++++++++++++++++++
app/addons/auth/routes.js | 25 ++++++++++++++-----------
app/addons/cluster/cluster.actions.js | 4 ++--
app/core/layout.js | 2 +-
app/core/routeObject.js | 2 +-
app/templates/layouts/with_sidebar.html | 27 ---------------------------
6 files changed, 43 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a599d5a4/app/addons/auth/layout.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/layout.js b/app/addons/auth/layout.js
index 32559c4..648502e 100644
--- a/app/addons/auth/layout.js
+++ b/app/addons/auth/layout.js
@@ -14,6 +14,9 @@ import React from 'react';
import FauxtonAPI from "../../core/api";
import {OnePane, OnePaneContent} from '../components/layouts';
import {Breadcrumbs} from '../components/header-breadcrumbs';
+import Components from "./components.react";
+
+const { CreateAdminForm, ChangePasswordForm } = Components;
export const OnePaneHeader = ({crumbs}) => {
return (
@@ -41,4 +44,26 @@ export const AuthLayout = ({crumbs, component}) => {
);
};
+export const AdminLayout = ({crumbs, changePassword, component}) => {
+ let content = changePassword ? <ChangePasswordForm /> : <CreateAdminForm loginAfter={false} />;
+ return (
+ <div id="dashboard" className="template-with-sidebar flex-layout flex-col">
+ <OnePaneHeader
+ crumbs={crumbs}
+ >
+ </OnePaneHeader>
+ <div className="template-content flex-body flex-layout flex-row">
+ <div id="sidebar-content">
+ <Components.CreateAdminSidebar />
+ </div>
+ <div id="dashboard-content" className="flex-body">
+ {content}
+ </div>
+ </div>
+ </div>
+
+ );
+
+};
+
export default AuthLayout;
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a599d5a4/app/addons/auth/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/routes.js b/app/addons/auth/routes.js
index be30171..3f67c64 100644
--- a/app/addons/auth/routes.js
+++ b/app/addons/auth/routes.js
@@ -17,7 +17,7 @@ import Auth from "./resources";
import AuthActions from "./actions";
import Components from "./components.react";
import ClusterActions from "../cluster/cluster.actions";
-import Layout from './layout';
+import {AuthLayout, AdminLayout} from './layout';
const {LoginForm, CreateAdminForm} = Components;
@@ -40,7 +40,7 @@ var AuthRouteObject = FauxtonAPI.RouteObject.extend({
login: function () {
const crumbs = [{ name: 'Log In to CouchDB' }];
- this.setComponent(".template", Layout, {
+ this.setComponent(".template", AuthLayout, {
crumbs: crumbs,
component: <LoginForm urlBack={app.getParams().urlback } />
});
@@ -56,7 +56,7 @@ var AuthRouteObject = FauxtonAPI.RouteObject.extend({
createAdminForNode: function () {
ClusterActions.fetchNodes();
const crumbs = [{ name: 'Create Admin' }];
- this.setComponent(".template", Layout, {
+ this.setComponent(".template", AuthLayout, {
crumbs: crumbs,
component: <CreateAdminForm loginAfter={true} />
});
@@ -65,7 +65,9 @@ var AuthRouteObject = FauxtonAPI.RouteObject.extend({
var UserRouteObject = FauxtonAPI.RouteObject.extend({
- layout: 'with_sidebar',
+ layout: 'empty',
+ hideNotificationCenter: true,
+ hideApiBar: true,
routes: {
'changePassword': {
@@ -98,23 +100,24 @@ var UserRouteObject = FauxtonAPI.RouteObject.extend({
return FauxtonAPI.session.user().name;
},
- initialize: function () {
- this.setComponent('#sidebar-content', Components.CreateAdminSidebar);
- },
-
changePassword: function () {
ClusterActions.fetchNodes();
AuthActions.selectPage('changePassword');
- this.setComponent('#dashboard-content', Components.ChangePasswordForm);
+ this.setComponent(".template", AdminLayout, {
+ crumbs: [{name: 'User Management'}],
+ changePassword: true
+ });
},
addAdmin: function () {
ClusterActions.fetchNodes();
AuthActions.selectPage('addAdmin');
- this.setComponent('#dashboard-content', Components.CreateAdminForm, { loginAfter: false });
+ this.setComponent(".template", AdminLayout, {
+ crumbs: [{name: 'User Management'}],
+ changePassword: false
+ });
},
- crumbs: [{name: 'User Management'}]
});
Auth.RouteObjects = [AuthRouteObject, UserRouteObject];
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a599d5a4/app/addons/cluster/cluster.actions.js
----------------------------------------------------------------------
diff --git a/app/addons/cluster/cluster.actions.js b/app/addons/cluster/cluster.actions.js
index f515548..47dcf0c 100644
--- a/app/addons/cluster/cluster.actions.js
+++ b/app/addons/cluster/cluster.actions.js
@@ -18,11 +18,11 @@ export default {
fetchNodes: function () {
var memberships = new ClusterResources.ClusterNodes();
- memberships.fetch().then(function () {
+ memberships.fetch().then(() => {
this.updateNodes({
nodes: memberships.get('nodes_mapped')
});
- }.bind(this));
+ });
},
updateNodes: function (options) {
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a599d5a4/app/core/layout.js
----------------------------------------------------------------------
diff --git a/app/core/layout.js b/app/core/layout.js
index c277889..21ecfd1 100644
--- a/app/core/layout.js
+++ b/app/core/layout.js
@@ -17,7 +17,7 @@ import "backbone.layoutmanager";
// Allows the main layout of the page to be changed by any plugin.
var Layout = function () {
this.layout = new Backbone.Layout({
- template: "templates/layouts/with_sidebar",
+ template: "templates/layouts/empty",
className: 'pusher'
});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a599d5a4/app/core/routeObject.js
----------------------------------------------------------------------
diff --git a/app/core/routeObject.js b/app/core/routeObject.js
index de1a4bb..61a145f 100644
--- a/app/core/routeObject.js
+++ b/app/core/routeObject.js
@@ -72,7 +72,7 @@ _.extend(RouteObject.prototype, Backbone.Events, {
routes: {},
events: {},
crumbs: [],
- layout: "with_sidebar",
+ layout: "empty",
apiUrl: null,
hideNotificationPanel: null,
loaderClassname: 'loader',
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a599d5a4/app/templates/layouts/with_sidebar.html
----------------------------------------------------------------------
diff --git a/app/templates/layouts/with_sidebar.html b/app/templates/layouts/with_sidebar.html
deleted file mode 100644
index 6edd592..0000000
--- a/app/templates/layouts/with_sidebar.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<%/*
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
-*/%>
-<div id="dashboard" class="template-with-sidebar flex-layout flex-col">
- <header class="flex-layout flex-row">
- <div class="flex-layout flex-row">
- <div id="breadcrumbs" class="flex-body"></div>
- <div id="api-navbar" class="flex-fill"></div>
- <div id="notification-center-btn" class="flex-fill"></div>
- </div>
- </header>
-
- <div class="template-content flex-body flex-layout flex-row">
- <div id="sidebar-content"></div>
- <div id="dashboard-content" class="flex-body"></div>
- </div>
-</div>
[4/5] fauxton commit: updated refs/heads/master to 14224ea
Posted by ga...@apache.org.
remove with_tabs_sidebar
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/63d8923e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/63d8923e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/63d8923e
Branch: refs/heads/master
Commit: 63d8923e62e2f3bff1c9930fadfd35b502cfa7af
Parents: a599d5a
Author: Garren Smith <ga...@gmail.com>
Authored: Thu Nov 24 17:32:12 2016 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Nov 30 11:38:40 2016 +0200
----------------------------------------------------------------------
app/addons/auth/routes.js | 2 -
app/addons/config/assets/less/config.less | 4 +
app/addons/config/layout.js | 82 +++++++++++
app/addons/config/routes.js | 25 ++--
app/addons/documents/layouts.js | 169 ++++++++++++++++++++++
app/addons/documents/mangolayout.js | 34 +++--
app/addons/documents/routes-documents.js | 75 +++++-----
app/addons/documents/routes-index-editor.js | 64 ++++----
app/addons/documents/routes-mango.js | 5 -
app/addons/documents/shared-routes.js | 6 +-
app/addons/fauxton/base.js | 32 ----
app/addons/permissions/layout.js | 42 ++++++
app/addons/permissions/routes.js | 23 ++-
app/templates/layouts/with_tabs_sidebar.html | 36 -----
14 files changed, 415 insertions(+), 184 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/auth/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/routes.js b/app/addons/auth/routes.js
index 3f67c64..8bfb9c0 100644
--- a/app/addons/auth/routes.js
+++ b/app/addons/auth/routes.js
@@ -31,8 +31,6 @@ var AuthRouteObject = FauxtonAPI.RouteObject.extend({
'createAdmin': 'checkNodes',
'createAdmin/:node': 'createAdminForNode'
},
- hideNotificationCenter: true,
- hideApiBar: true,
checkNodes: function () {
ClusterActions.navigateToNodeBasedOnNodeCount('/createAdmin/');
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/config/assets/less/config.less
----------------------------------------------------------------------
diff --git a/app/addons/config/assets/less/config.less b/app/addons/config/assets/less/config.less
index a9d7d7c..2a3bb07 100644
--- a/app/addons/config/assets/less/config.less
+++ b/app/addons/config/assets/less/config.less
@@ -213,3 +213,7 @@ table.config {
margin-left: 50px;
}
}
+
+div.faux__config-breadcrumbs {
+ flex: 0 0 331px !important;
+}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/config/layout.js
----------------------------------------------------------------------
diff --git a/app/addons/config/layout.js b/app/addons/config/layout.js
new file mode 100644
index 0000000..528dcca
--- /dev/null
+++ b/app/addons/config/layout.js
@@ -0,0 +1,82 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+import React from 'react';
+import FauxtonAPI from "../../core/api";
+import {TabsSidebarHeader} from '../documents/layouts';
+import ConfigComponents from "./components.react";
+import CORSComponents from "../cors/components.react";
+import {Breadcrumbs} from '../components/header-breadcrumbs';
+import {NotificationCenterButton} from '../fauxton/notifications/notifications.react';
+import {ApiBarWrapper} from '../components/layouts';
+
+// const sidebarItems = [
+// {
+// title: 'Main config',
+// typeSelect: 'main',
+// link: '_config/' + node
+// },
+// {
+// title: 'CORS',
+// typeSelect: 'cors',
+// link: '_config/' + node + '/cors'
+// }
+// ];
+
+export const ConfigHeader = ({node, crumbs, docURL, endpoint}) => {
+ return (
+ <header className="two-panel-header">
+ <div className="flex-layout flex-row">
+ <div id='breadcrumbs' className="faux__config-breadcrumbs">
+ <Breadcrumbs crumbs={crumbs}/>
+ </div>
+ <div className="right-header-wrapper flex-layout flex-row flex-body">
+ <div id="react-headerbar" className="flex-body"> </div>
+ <div id="right-header" className="flex-fill">
+ <ConfigComponents.AddOptionController node={node} />
+ </div>
+ <ApiBarWrapper docURL={docURL} endpoint={endpoint} />
+ <div id="notification-center-btn" className="flex-fill">
+ <NotificationCenterButton />
+ </div>
+ </div>
+ </div>
+ </header>
+ );
+};
+
+export const ConfigLayout = ({showCors, docURL, node, endpoint, crumbs}) => {
+ const content = showCors ? <CORSComponents.CORSController/> : <ConfigComponents.ConfigTableController node={node} />;
+ return (
+ <div id="dashboard" className="with-sidebar">
+ <ConfigHeader
+ docURL={docURL}
+ endpoint={endpoint}
+ node={node}
+ crumbs={crumbs}
+ />
+ <div className="with-sidebar tabs-with-sidebar content-area">
+ <aside id="sidebar-content" className="scrollable">
+ </aside>
+ <section id="dashboard-content" className="flex-layout flex-col">
+ <div id="dashboard-upper-content"></div>
+ <div id="dashboard-lower-content" className="flex-body">
+ {content}
+ </div>
+ <div id="footer"></div>
+ </section>
+ </div>
+ </div>
+ );
+};
+
+export default ConfigLayout;
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/config/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/config/routes.js b/app/addons/config/routes.js
index b50a132..ee2acff 100644
--- a/app/addons/config/routes.js
+++ b/app/addons/config/routes.js
@@ -19,6 +19,7 @@ import CORSActions from "../cors/actions";
import ClusterActions from "../cluster/cluster.actions";
import ConfigComponents from "./components.react";
import ConfigActions from "./actions";
+import Layout from './layout';
var ConfigDisabledRouteObject = FauxtonAPI.RouteObject.extend({
@@ -39,15 +40,11 @@ var ConfigDisabledRouteObject = FauxtonAPI.RouteObject.extend({
var ConfigPerNodeRouteObject = FauxtonAPI.RouteObject.extend({
- layout: 'with_tabs_sidebar',
+ layout: 'empty',
roles: ['_admin'],
selectedHeader: 'Config',
- crumbs: [
- { name: 'Config' }
- ],
-
apiUrl: function () {
return [this.configs.url(), this.configs.documentation];
},
@@ -80,17 +77,27 @@ var ConfigPerNodeRouteObject = FauxtonAPI.RouteObject.extend({
configForNode: function (node) {
this.removeComponents();
- this.setComponent('#right-header', ConfigComponents.AddOptionController, { node });
- this.setComponent('#dashboard-lower-content', ConfigComponents.ConfigTableController, { node });
ConfigActions.fetchAndEditConfig(node);
this.sidebar.setSelectedTab('main');
+ this.setComponent('.template', Layout, {
+ node: node,
+ docURL: this.configs.documentation,
+ endpoint: this.configs.url(),
+ crumbs: [{ name: 'Config' }],
+ showCors: false
+ });
},
configCorsForNode: function (node) {
- this.removeComponents();
- this.setComponent('#dashboard-lower-content', CORSComponents.CORSController);
CORSActions.fetchAndEditCors(node);
this.sidebar.setSelectedTab('cors');
+ this.setComponent('.template', Layout, {
+ node: node,
+ docURL: this.configs.documentation,
+ endpoint: this.configs.url(),
+ crumbs: [{ name: 'Config' }],
+ showCors: true
+ });
}
});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/documents/layouts.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/layouts.js b/app/addons/documents/layouts.js
new file mode 100644
index 0000000..fd9283d
--- /dev/null
+++ b/app/addons/documents/layouts.js
@@ -0,0 +1,169 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+import React from 'react';
+import FauxtonAPI from "../../core/api";
+import {OnePane, OnePaneContent} from '../components/layouts';
+import IndexResultsComponents from './index-results/index-results.components.react';
+import ReactPagination from './pagination/pagination.react';
+import ReactHeader from './header/header.react';
+import {Breadcrumbs} from '../components/header-breadcrumbs';
+import {RightHeader} from './mangolayout';
+import {NotificationCenterButton} from '../fauxton/notifications/notifications.react';
+import {ApiBarWrapper} from '../components/layouts';
+import SidebarComponents from "./sidebar/sidebar.react";
+import HeaderDocsLeft from './components/header-docs-left';
+import Changes from './changes/components.react';
+import IndexEditorComponents from "./index-editor/components.react";
+import DesignDocInfoComponents from './designdocinfo/components.react';
+import RightAllDocsHeader from './components/header-docs-right';
+
+export const TabsSidebarHeader = ({hideHeaderBar, database, dbName, dropDownLinks, showIncludeAllDocs, docURL, endpoint}) => {
+ return (
+ <header className="two-panel-header">
+ <div className="flex-layout flex-row">
+ <div id="header-docs-left">
+ <HeaderDocsLeft
+ dbName={dbName}
+ dropDownLinks={dropDownLinks}
+ />
+ </div>
+ <div className="right-header-wrapper flex-layout flex-row flex-body">
+ <div id="react-headerbar" className="flex-body">
+ {hideHeaderBar ? null : <ReactHeader.BulkDocumentHeaderController showIncludeAllDocs={showIncludeAllDocs} />}
+ </div>
+ <div id="right-header" className="flex-fill">
+ <RightAllDocsHeader database={database} />
+ </div>
+ <ApiBarWrapper docURL={docURL} endpoint={endpoint} />
+ <div id="notification-center-btn" className="flex-fill">
+ <NotificationCenterButton />
+ </div>
+ </div>
+ </div>
+ </header>
+ );
+};
+
+TabsSidebarHeader.propTypes = {
+ dbName : React.PropTypes.string.isRequired,
+ dropDownLinks : React.PropTypes.array.isRequired,
+ docURL : React.PropTypes.string.isRequired,
+ endpoint : React.PropTypes.string.isRequired,
+ showIncludeAllDocs : React.PropTypes.bool,
+ hideHeaderBar : React.PropTypes.bool,
+ database : React.PropTypes.object.isRequired
+};
+
+TabsSidebarHeader.defaultProps = {
+ hideHeaderBar: false
+};
+
+export const TabsSidebarContent = ({hideFooter, lowerContent, upperContent}) => {
+ return (
+ <div className="with-sidebar tabs-with-sidebar content-area">
+ <aside id="sidebar-content" className="scrollable">
+ <SidebarComponents.SidebarController />
+ </aside>
+ <section id="dashboard-content" className="flex-layout flex-col">
+ <div id="dashboard-upper-content">
+ {upperContent}
+ </div>
+ <div id="dashboard-lower-content" className="flex-body">
+ {lowerContent}
+ </div>
+ <div id="footer">
+ {hideFooter ? null : <ReactPagination.Footer />}
+ </div>
+ </section>
+ </div>
+ );
+};
+TabsSidebarContent.defaultProps = {
+ hideFooter: false
+};
+
+TabsSidebarContent.propTypes = {
+ hideFooter: React.PropTypes.bool,
+ lowerContent: React.PropTypes.object,
+ upperContent: React.PropTypes.object,
+};
+
+export const DocsTabsSidebarLayout = ({database, showIncludeAllDocs, docURL, endpoint, dbName, dropDownLinks}) => {
+ return (
+ <div id="dashboard" className="with-sidebar">
+ <TabsSidebarHeader
+ showIncludeAllDocs={showIncludeAllDocs}
+ docURL={docURL}
+ endpoint={endpoint}
+ dbName={dbName}
+ dropDownLinks={dropDownLinks}
+ database={database}
+ />
+ <TabsSidebarContent
+ lowerContent={<IndexResultsComponents.List />}
+ />
+ </div>
+ );
+};
+
+export const ChangesSidebarLayout = ({docURL, database, endpoint, dbName, dropDownLinks}) => {
+ return (
+ <div id="dashboard" className="with-sidebar">
+ <TabsSidebarHeader
+ hideHeaderBar={true}
+ docURL={docURL}
+ endpoint={endpoint}
+ dbName={dbName}
+ dropDownLinks={dropDownLinks}
+ database={database}
+ />
+ <TabsSidebarContent
+ upperContent={<Changes.ChangesTabContent />}
+ lowerContent={<Changes.ChangesController />}
+ hideFooter={true}
+ />
+ </div>
+ );
+};
+
+export const ViewsTabsSidebarLayout = ({showEditView, database, showIncludeAllDocs, docURL, endpoint, dbName, dropDownLinks}) => {
+ const content = showEditView ? <IndexEditorComponents.EditorController /> : <DesignDocInfoComponents.DesignDocInfo />;
+ return (
+ <div id="dashboard" className="with-sidebar">
+ <TabsSidebarHeader
+ hideHeaderBar={true}
+ endpoint={endpoint}
+ docURL={docURL}
+ dbName={dbName}
+ dropDownLinks={dropDownLinks}
+ database={database}
+ />
+ <TabsSidebarContent
+ lowerContent={content}
+ hideFooter={true}
+ />
+ </div>
+ );
+};
+
+ViewsTabsSidebarLayout.defaultProps = {
+ showEditView: true
+};
+
+ViewsTabsSidebarLayout.propTypes = {
+ showEditView: React.PropTypes.bool,
+ docURL: React.PropTypes.string.isRequired,
+ endpoint: React.PropTypes.string.isRequired,
+ dbName: React.PropTypes.string.isRequired,
+ dropDownLinks: React.PropTypes.array.isRequired
+};
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/documents/mangolayout.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/mangolayout.js b/app/addons/documents/mangolayout.js
index 6da0a83..3c75ed1 100644
--- a/app/addons/documents/mangolayout.js
+++ b/app/addons/documents/mangolayout.js
@@ -17,11 +17,27 @@ import ReactPagination from "./pagination/pagination.react";
import ReactHeader from "./header/header.react";
import {Breadcrumbs} from '../components/header-breadcrumbs';
import {NotificationCenterButton} from '../fauxton/notifications/notifications.react';
-import {ApiBarController} from '../components/components/apibar';
import {ApiBarWrapper} from '../components/layouts';
import MangoComponents from "./mango/mango.components.react";
import IndexResultsComponents from "./index-results/index-results.components.react";
+
+export const RightHeader = ({showIncludeAllDocs, docURL, endpoint}) => {
+ return (
+ <div className="right-header-wrapper flex-layout flex-row flex-body">
+ <div id="react-headerbar" className="flex-body">
+ <ReactHeader.BulkDocumentHeaderController showIncludeAllDocs={showIncludeAllDocs} />
+ </div>
+ <div id="right-header" className="flex-body">
+ </div>
+ <ApiBarWrapper docURL={docURL} endpoint={endpoint} />
+ <div id='notification-center-btn'>
+ <NotificationCenterButton />
+ </div>
+ </div>
+ );
+};
+
export const MangoFooter = () => {
return (
<div id="footer">
@@ -36,17 +52,11 @@ export const MangoHeader = ({showIncludeAllDocs, crumbs, docURL, endpoint}) => {
<div className='flex-body faux__breadcrumbs-mango-header'>
<Breadcrumbs crumbs={crumbs}/>
</div>
- <div className="right-header-wrapper flex-layout flex-row flex-body">
- <div id="react-headerbar" className="flex-body">
- <ReactHeader.BulkDocumentHeaderController showIncludeAllDocs={showIncludeAllDocs} />
- </div>
- <div id="right-header" className="flex-body">
- </div>
- <ApiBarWrapper docURL={docURL} endpoint={endpoint} />
- <div id='notification-center-btn'>
- <NotificationCenterButton />
- </div>
- </div>
+ <RightHeader
+ showIncludeAllDocs={showIncludeAllDocs}
+ docURL={docURL}
+ endpoint={endpoint}
+ />
</div>
);
};
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/documents/routes-documents.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js
index 767453c..1233933 100644
--- a/app/addons/documents/routes-documents.js
+++ b/app/addons/documents/routes-documents.js
@@ -15,26 +15,20 @@ import app from '../../app';
import FauxtonAPI from '../../core/api';
import BaseRoute from './shared-routes';
import Documents from './resources';
-import RightAllDocsHeader from './components/header-docs-right';
-import Changes from './changes/components.react';
import ChangesActions from './changes/actions';
import Databases from '../databases/base';
import Resources from './resources';
-import Components from '../fauxton/components';
import IndexResultStores from './index-results/stores';
import IndexResultsActions from './index-results/actions';
-import IndexResultsComponents from './index-results/index-results.components.react';
-import ReactPagination from './pagination/pagination.react';
-import ReactHeader from './header/header.react';
import ReactActions from './header/header.actions';
import SidebarActions from './sidebar/actions';
import DesignDocInfoActions from './designdocinfo/actions';
-import DesignDocInfoComponents from './designdocinfo/components.react';
import ComponentsActions from '../components/actions';
import QueryOptionsActions from './queryoptions/actions';
+import {DocsTabsSidebarLayout, ViewsTabsSidebarLayout, ChangesSidebarLayout} from './layouts';
var DocumentsRouteObject = BaseRoute.extend({
- layout: "with_tabs_sidebar",
+ layout: "empty",
routes: {
"database/:database/_all_docs(:extra)": {
route: "allDocs",
@@ -67,25 +61,16 @@ var DocumentsRouteObject = BaseRoute.extend({
this.createDesignDocsCollection();
- this.setComponent("#right-header", RightAllDocsHeader, {
- database: this.database
- });
-
this.addLeftHeader();
this.addSidebar();
},
designDocMetadata: function (database, ddoc) {
- this.removeComponent('#footer');
- this.removeComponent('#react-headerbar');
- this.removeComponent('#dashboard-upper-content');
-
var designDocInfo = new Resources.DdocInfo({ _id: "_design/" + ddoc }, { database: this.database });
DesignDocInfoActions.fetchDesignDocInfo({
ddocName: ddoc,
designDocInfo: designDocInfo
});
- this.setComponent("#dashboard-lower-content", DesignDocInfoComponents.DesignDocInfo);
SidebarActions.selectNavItem('designDoc', {
designDocName: ddoc,
@@ -93,8 +78,17 @@ var DocumentsRouteObject = BaseRoute.extend({
});
QueryOptionsActions.hideQueryOptions();
-
- this.apiUrl = [designDocInfo.url('apiurl'), designDocInfo.documentation()];
+ this.apiUrl = [, designDocInfo.documentation()];
+
+ const dropDownLinks = this.getCrumbs(this.database);
+ this.setComponent('.template', ViewsTabsSidebarLayout, {
+ showEditView: false, //a bit of a hack but its fine for now.
+ docURL: designDocInfo.documentation(),
+ endpoint: designDocInfo.url('apiurl'),
+ dbName: this.database.id,
+ dropDownLinks,
+ database: this.database
+ });
},
/*
@@ -108,10 +102,6 @@ var DocumentsRouteObject = BaseRoute.extend({
docParams = params.docParams,
collection;
- this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: true});
- this.setComponent('#footer', ReactPagination.Footer);
-
-
// includes_docs = true if you are visiting the _replicator/_users databases
if (['_replicator', '_users'].indexOf(databaseName) > -1) {
docParams.include_docs = true;
@@ -131,13 +121,11 @@ var DocumentsRouteObject = BaseRoute.extend({
SidebarActions.selectNavItem(tab);
ComponentsActions.showDeleteDatabaseModal({showDeleteModal: false, dbId: ''});
- this.removeComponent('#dashboard-upper-content');
-
if (!docParams) {
docParams = {};
}
- var frozenCollection = app.utils.localStorageGet('include_docs_bulkdocs');
+ const frozenCollection = app.utils.localStorageGet('include_docs_bulkdocs');
window.localStorage.removeItem('include_docs_bulkdocs');
IndexResultsActions.newResultsList({
@@ -148,15 +136,22 @@ var DocumentsRouteObject = BaseRoute.extend({
this.database.allDocs.paging.pageSize = IndexResultStores.indexResultsStore.getPerPage();
- this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
-
- // this used to be a function that returned the object, but be warned: it caused a closure with a reference to
- // the initial this.database object which can change
- this.apiUrl = [this.database.allDocs.urlRef("apiurl", urlParams), this.database.allDocs.documentation()];
+ const endpoint = this.database.allDocs.urlRef("apiurl", urlParams);
+ const docURL = this.database.allDocs.documentation();
// update the query options with the latest & greatest info
QueryOptionsActions.reset({queryParams: urlParams});
QueryOptionsActions.showQueryOptions();
+
+ const dropDownLinks = this.getCrumbs(this.database);
+ this.setComponent('.template', DocsTabsSidebarLayout, {
+ showIncludeAllDocs: true,
+ docURL,
+ endpoint,
+ dbName: this.database.id,
+ dropDownLinks,
+ database: this.database
+ });
},
reloadDesignDocs: function (event) {
@@ -170,21 +165,17 @@ var DocumentsRouteObject = BaseRoute.extend({
ChangesActions.initChanges({
databaseName: this.database.id
});
- this.setComponent('#dashboard-upper-content', Changes.ChangesTabContent);
- this.setComponent("#dashboard-lower-content", Changes.ChangesController);
-
- this.removeComponent('#footer');
- this.removeComponent('#react-headerbar');
-
- this.viewEditor && this.viewEditor.remove();
-
SidebarActions.selectNavItem('changes');
QueryOptionsActions.hideQueryOptions();
- this.apiUrl = function () {
- return [FauxtonAPI.urls('changes', 'apiurl', this.database.id, ''), this.database.documentation()];
- };
+ this.setComponent('.template', ChangesSidebarLayout, {
+ endpoint: FauxtonAPI.urls('changes', 'apiurl', this.database.id, ''),
+ docURL: this.database.documentation(),
+ dbName: this.database.id,
+ dropDownLinks: this.getCrumbs(this.database),
+ database: this.database
+ });
}
});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/documents/routes-index-editor.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-index-editor.js b/app/addons/documents/routes-index-editor.js
index c139b67..5a007dd 100644
--- a/app/addons/documents/routes-index-editor.js
+++ b/app/addons/documents/routes-index-editor.js
@@ -15,22 +15,17 @@ import FauxtonAPI from "../../core/api";
import Helpers from "./helpers";
import BaseRoute from "./shared-routes";
import Documents from "./resources";
-import IndexEditorComponents from "./index-editor/components.react";
import ActionsIndexEditor from "./index-editor/actions";
import Databases from "../databases/base";
-import Components from "../fauxton/components";
import IndexResultsStores from "./index-results/stores";
import IndexResultsActions from "./index-results/actions";
-import IndexResultsComponents from "./index-results/index-results.components.react";
-import ReactPagination from "./pagination/pagination.react";
-import ReactHeader from "./header/header.react";
import ReactHeaderActions from "./header/header.actions";
import SidebarActions from "./sidebar/actions";
-import RightAllDocsHeader from './components/header-docs-right';
+import {DocsTabsSidebarLayout, ViewsTabsSidebarLayout} from './layouts';
var IndexEditorAndResults = BaseRoute.extend({
- layout: 'with_tabs_sidebar',
+ layout: 'empty',
routes: {
'database/:database/new_view': {
route: 'createView',
@@ -57,10 +52,6 @@ var IndexEditorAndResults = BaseRoute.extend({
this.createDesignDocsCollection();
this.addLeftHeader();
this.addSidebar();
-
- this.setComponent("#right-header", RightAllDocsHeader, {
- database: this.database
- });
},
establish: function () {
@@ -76,8 +67,6 @@ var IndexEditorAndResults = BaseRoute.extend({
decodeDdoc = decodeURIComponent(ddoc);
viewName = viewName.replace(/\?.*$/, '');
- this.setComponent('#footer', ReactPagination.Footer);
-
this.indexedDocs = new Documents.IndexCollection(null, {
database: this.database,
design: decodeDdoc,
@@ -109,14 +98,20 @@ var IndexEditorAndResults = BaseRoute.extend({
indexName: viewName
});
- this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: true});
- this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
+ this.showQueryOptions(urlParams, ddoc, viewName);
- this.apiUrl = function () {
- return [this.indexedDocs.urlRef('apiurl'), FauxtonAPI.constants.DOC_URLS.GENERAL];
- };
+ const endpoint = this.indexedDocs.urlRef('apiurl');
+ const docURL = FauxtonAPI.constants.DOC_URLS.GENERAL;
- this.showQueryOptions(urlParams, ddoc, viewName);
+ const dropDownLinks = this.getCrumbs(this.database);
+ this.setComponent('.template', DocsTabsSidebarLayout, {
+ showIncludeAllDocs: true,
+ docURL,
+ endpoint,
+ dbName: this.database.id,
+ dropDownLinks,
+ database: this.database
+ });
},
createView: function (database, _designDoc) {
@@ -137,10 +132,16 @@ var IndexEditorAndResults = BaseRoute.extend({
newDesignDoc: newDesignDoc
});
- this.removeComponent('#react-headerbar');
- this.removeComponent('#footer');
- this.setComponent('#dashboard-lower-content', IndexEditorComponents.EditorController);
SidebarActions.selectNavItem('');
+
+ const dropDownLinks = this.getCrumbs(this.database);
+ this.setComponent('.template', ViewsTabsSidebarLayout, {
+ showIncludeAllDocs: true,
+ docURL: FauxtonAPI.constants.DOC_URLS.GENERAL,
+ dbName: this.database.id,
+ database: this.database,
+ dropDownLinks
+ });
},
editView: function (databaseName, ddocName, viewName) {
@@ -158,14 +159,19 @@ var IndexEditorAndResults = BaseRoute.extend({
indexName: viewName
});
- this.apiUrl = function () {
- return [FauxtonAPI.urls('view', 'apiurl', databaseName, ddocName, viewName), FauxtonAPI.constants.DOC_URLS.GENERAL];
- };
+ const docURL = FauxtonAPI.constants.DOC_URLS.GENERAL;
+ const endpoint = FauxtonAPI.urls('view', 'apiurl', databaseName, ddocName, viewName);
- this.removeView('#right-header');
- this.removeComponent('#react-headerbar');
- this.removeComponent('#footer');
- this.setComponent('#dashboard-lower-content', IndexEditorComponents.EditorController);
+
+ const dropDownLinks = this.getCrumbs(this.database);
+ this.setComponent('.template', ViewsTabsSidebarLayout, {
+ showIncludeAllDocs: true,
+ docURL,
+ endpoint,
+ dbName: this.database.id,
+ dropDownLinks,
+ database: this.database
+ });
}
});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/documents/routes-mango.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-mango.js b/app/addons/documents/routes-mango.js
index 6a0cecb..c63e5a3 100644
--- a/app/addons/documents/routes-mango.js
+++ b/app/addons/documents/routes-mango.js
@@ -15,19 +15,14 @@ import FauxtonAPI from "../../core/api";
import Helpers from "./helpers";
import BaseRoute from "./shared-routes";
import Databases from "../databases/resources";
-import Components from "../fauxton/components";
import Resources from "./resources";
import IndexResultsActions from "./index-results/actions";
import IndexResultStores from "./index-results/stores";
import ReactHeader from "./header/header.react";
import ReactActions from "./header/header.actions";
-import ReactPagination from "./pagination/pagination.react";
-import MangoComponents from "./mango/mango.components.react";
import MangoActions from "./mango/mango.actions";
import MangoStores from "./mango/mango.stores";
-import IndexResultsComponents from "./index-results/index-results.components.react";
import SidebarActions from "./sidebar/actions";
-import RightAllDocsHeader from './components/header-docs-right';
import {MangoLayout} from './mangolayout';
const MangoIndexEditorAndQueryEditor = FauxtonAPI.RouteObject.extend({
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/documents/shared-routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/shared-routes.js b/app/addons/documents/shared-routes.js
index 8c66c4b..136c07a 100644
--- a/app/addons/documents/shared-routes.js
+++ b/app/addons/documents/shared-routes.js
@@ -14,10 +14,8 @@ import app from "../../app";
import FauxtonAPI from "../../core/api";
import Documents from "./shared-resources";
import Databases from "../databases/base";
-import Components from "../fauxton/components";
import PaginationActions from "./pagination/actions";
import IndexResultStores from "./index-results/stores";
-import SidebarComponents from "./sidebar/sidebar.react";
import SidebarActions from "./sidebar/actions";
import QueryActions from './queryoptions/actions';
import HeaderDocsLeft from './components/header-docs-left';
@@ -26,7 +24,7 @@ import HeaderDocsLeft from './components/header-docs-left';
// The Documents section is built up a lot of different route object which share code. This contains
// base functionality that can be used across routes / addons
var BaseRoute = FauxtonAPI.RouteObject.extend({
- layout: 'with_tabs_sidebar',
+ layout: 'empty',
selectedHeader: 'Databases',
createDesignDocsCollection: function () {
@@ -65,7 +63,6 @@ var BaseRoute = FauxtonAPI.RouteObject.extend({
addLeftHeader: function () {
const dropDownLinks = this.getCrumbs(this.database);
- this.setComponent('#header-docs-left', HeaderDocsLeft, {dbName: this.database.id, dropDownLinks: dropDownLinks});
},
addSidebar: function (selectedNavItem) {
@@ -78,7 +75,6 @@ var BaseRoute = FauxtonAPI.RouteObject.extend({
}
SidebarActions.newOptions(options);
- this.setComponent("#sidebar-content", SidebarComponents.SidebarController);
},
getCrumbs: function (database) {
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/fauxton/base.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/base.js b/app/addons/fauxton/base.js
index e02c970..fed1e0b 100644
--- a/app/addons/fauxton/base.js
+++ b/app/addons/fauxton/base.js
@@ -32,38 +32,6 @@ Fauxton.initialize = function () {
FauxtonAPI.RouteObject.on('beforeEstablish', function (routeObject) {
NavigationActions.setNavbarActiveLink(_.result(routeObject, 'selectedHeader'));
-
- if (!routeObject.hideApiBar) {
- // always attempt to render the API Bar. Even if it's hidden on initial load, it may be enabled later
- routeObject.setComponent('#api-navbar', ReactComponents.ApiBarController, {
- buttonVisible: true,
- contentVisible: false
- });
-
- const apiAndDocs = routeObject.get('apiUrl');
- if (apiAndDocs) {
- ComponentActions.updateAPIBar({
- buttonVisible: true,
- contentVisible: false,
- endpoint: apiAndDocs[0],
- docURL: apiAndDocs[1]
- });
- } else {
- ComponentActions.hideAPIBarButton();
- }
- }
-
- if (!routeObject.get('hideNotificationCenter')) {
- routeObject.setComponent('#notification-center-btn', NotificationComponents.NotificationCenterButton);
- }
-
- const crumbs = routeObject.get('crumbs');
-
- if (!crumbs.length) {
- return;
- }
-
- routeObject.setComponent('#breadcrumbs', Breadcrumbs, {crumbs: crumbs});
});
const primaryNavBarEl = $('#primary-navbar')[0];
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/permissions/layout.js
----------------------------------------------------------------------
diff --git a/app/addons/permissions/layout.js b/app/addons/permissions/layout.js
new file mode 100644
index 0000000..0ddeee0
--- /dev/null
+++ b/app/addons/permissions/layout.js
@@ -0,0 +1,42 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+import React from 'react';
+import FauxtonAPI from "../../core/api";
+import {TabsSidebarHeader} from '../documents/layouts';
+import Permissions from "./components.react";
+import SidebarComponents from "../documents/sidebar/sidebar.react";
+
+export const PermissionsLayout = ({docURL, database, endpoint, dbName, dropDownLinks}) => {
+ return (
+ <div id="dashboard" className="with-sidebar">
+ <TabsSidebarHeader
+ hideHeaderBar={true}
+ docURL={docURL}
+ endpoint={endpoint}
+ dbName={dbName}
+ dropDownLinks={dropDownLinks}
+ database={database}
+ />
+ <div className="with-sidebar tabs-with-sidebar content-area">
+ <aside id="sidebar-content" className="scrollable">
+ <SidebarComponents.SidebarController />
+ </aside>
+ <section id="dashboard-content" className="flex-layout flex-col">
+ <Permissions.PermissionsController />
+ </section>
+ </div>
+ </div>
+ );
+};
+
+export default PermissionsLayout;
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/addons/permissions/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/permissions/routes.js b/app/addons/permissions/routes.js
index e6460ec..3b095f4 100644
--- a/app/addons/permissions/routes.js
+++ b/app/addons/permissions/routes.js
@@ -15,10 +15,11 @@ import FauxtonAPI from "../../core/api";
import Databases from "../databases/base";
import Resources from "./resources";
import Actions from "./actions";
-import Permissions from "./components.react";
import BaseRoute from "../documents/shared-routes";
+import Layout from './layout';
var PermissionsRouteObject = BaseRoute.extend({
+ layout: 'empty',
roles: ['fx_loggedIn'],
routes: {
'database/:database/permissions': 'permissions'
@@ -42,10 +43,6 @@ var PermissionsRouteObject = BaseRoute.extend({
this.addSidebar('permissions');
},
- apiUrl: function () {
- return [this.security.url('apiurl'), this.security.documentation];
- },
-
establish: function () {
return [
this.designDocs.fetch({reset: true})
@@ -54,18 +51,20 @@ var PermissionsRouteObject = BaseRoute.extend({
permissions: function () {
Actions.fetchPermissions(this.database, this.security);
- this.setComponent('#dashboard-content', Permissions.PermissionsController);
- },
-
- crumbs: function () {
- return [
+ const crumbs = [
{ name: this.database.id, link: Databases.databaseUrl(this.database)},
{ name: 'Permissions' }
];
+ this.setComponent('.template', Layout, {
+ docURL: this.security.documentation,
+ endpoint: this.security.url('apiurl'),
+ dbName: this.database.id,
+ dropDownLinks: crumbs,
+ database: this.database
+ });
},
- cleanup: function () {
- this.removeComponent('#sidebar-content');
+ crumbs: function () {
}
});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/63d8923e/app/templates/layouts/with_tabs_sidebar.html
----------------------------------------------------------------------
diff --git a/app/templates/layouts/with_tabs_sidebar.html b/app/templates/layouts/with_tabs_sidebar.html
deleted file mode 100644
index 26dc7c9..0000000
--- a/app/templates/layouts/with_tabs_sidebar.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<%/*
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
-*/%>
-
-<div id="dashboard" class="with-sidebar">
- <header class="two-panel-header">
- <div class="flex-layout flex-row">
- <div id="header-docs-left"></div>
- <div class="right-header-wrapper flex-layout flex-row flex-body">
- <div id="react-headerbar" class="flex-body"></div>
- <div id="right-header" class="flex-fill"></div>
- <div id="api-navbar" class="flex-fill"></div>
- <div id="notification-center-btn" class="flex-fill"></div>
- </div>
- </div>
- </header>
-
- <div class="with-sidebar tabs-with-sidebar content-area">
- <aside id="sidebar-content" class="scrollable"></aside>
- <section id="dashboard-content" class="flex-layout flex-col">
- <div id="dashboard-upper-content"></div>
- <div id="dashboard-lower-content" class="flex-body"></div>
- <div id="footer"></div>
- </section>
- </div>
-</div>
[3/5] fauxton commit: updated refs/heads/master to 14224ea
Posted by ga...@apache.org.
remove two_pane
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/75b8eb41
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/75b8eb41
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/75b8eb41
Branch: refs/heads/master
Commit: 75b8eb4167c82d48d2a494104002b0ec5a54537d
Parents: 26b797a
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Nov 23 16:54:53 2016 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Nov 30 11:38:39 2016 +0200
----------------------------------------------------------------------
app/addons/components/assets/less/layouts.less | 8 ++
app/addons/components/layouts.js | 2 +-
app/addons/documents/mangolayout.js | 97 +++++++++++++++++++++
app/addons/documents/routes-mango.js | 50 +++++------
app/templates/layouts/two_pane.html | 33 -------
5 files changed, 128 insertions(+), 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/75b8eb41/app/addons/components/assets/less/layouts.less
----------------------------------------------------------------------
diff --git a/app/addons/components/assets/less/layouts.less b/app/addons/components/assets/less/layouts.less
index adfe63a..99c1730 100644
--- a/app/addons/components/assets/less/layouts.less
+++ b/app/addons/components/assets/less/layouts.less
@@ -19,3 +19,11 @@
flex-direction: row;
height: 100%;
}
+
+//yes !important!!! We have to overridde some styles I can't override any other way for now
+div.faux__breadcrumbs-mango-header {
+ height: 64px !important;
+ -ms-flex: 0 0 440px !important;
+ flex: 0 0 440px !important;
+ overflow: hidden !important;
+}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/75b8eb41/app/addons/components/layouts.js
----------------------------------------------------------------------
diff --git a/app/addons/components/layouts.js b/app/addons/components/layouts.js
index 234e305..5deb24c 100644
--- a/app/addons/components/layouts.js
+++ b/app/addons/components/layouts.js
@@ -17,7 +17,7 @@ import {ApiBarController} from './components/apibar';
import {Breadcrumbs} from './header-breadcrumbs';
import ComponentActions from './actions';
-const ApiBarWrapper = ({docURL, endpoint}) => {
+export const ApiBarWrapper = ({docURL, endpoint}) => {
//TODO once all modules are using this remove actions and make them props
setTimeout(() => {
ComponentActions.updateAPIBar({
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/75b8eb41/app/addons/documents/mangolayout.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/mangolayout.js b/app/addons/documents/mangolayout.js
new file mode 100644
index 0000000..6da0a83
--- /dev/null
+++ b/app/addons/documents/mangolayout.js
@@ -0,0 +1,97 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+import React from 'react';
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import ReactPagination from "./pagination/pagination.react";
+import ReactHeader from "./header/header.react";
+import {Breadcrumbs} from '../components/header-breadcrumbs';
+import {NotificationCenterButton} from '../fauxton/notifications/notifications.react';
+import {ApiBarController} from '../components/components/apibar';
+import {ApiBarWrapper} from '../components/layouts';
+import MangoComponents from "./mango/mango.components.react";
+import IndexResultsComponents from "./index-results/index-results.components.react";
+
+export const MangoFooter = () => {
+ return (
+ <div id="footer">
+ <ReactPagination.Footer />
+ </div>
+ );
+};
+
+export const MangoHeader = ({showIncludeAllDocs, crumbs, docURL, endpoint}) => {
+ return (
+ <div className="header-wrapper flex-layout flex-row">
+ <div className='flex-body faux__breadcrumbs-mango-header'>
+ <Breadcrumbs crumbs={crumbs}/>
+ </div>
+ <div className="right-header-wrapper flex-layout flex-row flex-body">
+ <div id="react-headerbar" className="flex-body">
+ <ReactHeader.BulkDocumentHeaderController showIncludeAllDocs={showIncludeAllDocs} />
+ </div>
+ <div id="right-header" className="flex-body">
+ </div>
+ <ApiBarWrapper docURL={docURL} endpoint={endpoint} />
+ <div id='notification-center-btn'>
+ <NotificationCenterButton />
+ </div>
+ </div>
+ </div>
+ );
+};
+
+MangoHeader.defaultProps = {
+ crumbs: []
+};
+
+const MangoContent = ({edit}) => {
+ const leftContent = edit ?
+ <MangoComponents.MangoIndexEditorController
+ description={app.i18n.en_US['mango-descripton-index-editor']}
+ /> :
+ <MangoComponents.MangoQueryEditorController
+ description={app.i18n.en_US['mango-descripton']}
+ editorTitle={app.i18n.en_US['mango-title-editor']}
+ additionalIndexesText={app.i18n.en_US['mango-additional-indexes-heading']}
+ />;
+
+ return (
+ <div id="two-pane-content" className="flex-layout flex-row flex-body">
+ <div id="left-content" className="flex-body">
+ {leftContent}
+ </div>
+ <div id="right-content" className="flex-body flex-layout flex-col">
+ <div id="dashboard-lower-content" className="flex-body">
+ <IndexResultsComponents.List />
+ </div>
+ <MangoFooter />
+ </div>
+ </div>
+ );
+};
+
+
+export const MangoLayout = ({edit, showIncludeAllDocs, docURL, endpoint, crumbs}) => {
+ return (
+ <div id="dashboard" className="two-pane flex-layout flex-col">
+ <MangoHeader
+ showIncludeAllDocs={showIncludeAllDocs}
+ docURL={docURL}
+ endpoint={endpoint}
+ crumbs={crumbs}
+ />
+ <MangoContent edit={edit} />
+ </div>
+ );
+};
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/75b8eb41/app/addons/documents/routes-mango.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-mango.js b/app/addons/documents/routes-mango.js
index c1e63da..6a0cecb 100644
--- a/app/addons/documents/routes-mango.js
+++ b/app/addons/documents/routes-mango.js
@@ -28,9 +28,12 @@ import MangoStores from "./mango/mango.stores";
import IndexResultsComponents from "./index-results/index-results.components.react";
import SidebarActions from "./sidebar/actions";
import RightAllDocsHeader from './components/header-docs-right';
+import {MangoLayout} from './mangolayout';
const MangoIndexEditorAndQueryEditor = FauxtonAPI.RouteObject.extend({
- layout: 'two_pane',
+ layout: 'empty',
+ hideApiBar: true,
+ hideNotificationCenter: true,
routes: {
'database/:database/_index': {
route: 'createIndex',
@@ -69,8 +72,6 @@ const MangoIndexEditorAndQueryEditor = FauxtonAPI.RouteObject.extend({
});
SidebarActions.selectNavItem('mango-query');
- this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: false});
- this.setComponent('#footer', ReactPagination.Footer);
IndexResultsActions.newMangoResultsList({
collection: mangoResultCollection,
@@ -82,25 +83,22 @@ const MangoIndexEditorAndQueryEditor = FauxtonAPI.RouteObject.extend({
indexList: mangoIndexList
});
- this.setComponent('#left-content', MangoComponents.MangoQueryEditorController, {
- description: app.i18n.en_US['mango-descripton'],
- editorTitle: app.i18n.en_US['mango-title-editor'],
- additionalIndexesText: app.i18n.en_US['mango-additional-indexes-heading']
- });
- this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
-
- this.apiUrl = function () {
- return [mangoResultCollection.urlRef('query-apiurl', ''), FauxtonAPI.constants.DOC_URLS.MANGO_SEARCH];
- };
-
const url = FauxtonAPI.urls(
'allDocs', 'app', this.database.safeID(), '?limit=' + FauxtonAPI.constants.DATABASES.DOCUMENT_LIMIT
);
- this.crumbs = [
+ const crumbs = [
{name: database, link: url},
{name: app.i18n.en_US['mango-title-editor']}
];
+
+ this.setComponent('.template', MangoLayout, {
+ showIncludeAllDocs: false,
+ crumbs: crumbs,
+ docURL: FauxtonAPI.constants.DOC_URLS.MANGO_SEARCH,
+ endpoint: mangoResultCollection.urlRef('query-apiurl', ''),
+ edit: false
+ });
},
createIndex: function (database) {
@@ -118,26 +116,22 @@ const MangoIndexEditorAndQueryEditor = FauxtonAPI.RouteObject.extend({
typeOfIndex: 'mango'
});
- this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: false});
- this.setComponent('#footer', ReactPagination.Footer);
-
- this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
- this.setComponent('#left-content', MangoComponents.MangoIndexEditorController, {
- description: app.i18n.en_US['mango-descripton-index-editor']
- });
-
- this.apiUrl = function () {
- return [mangoIndexCollection.urlRef('index-apiurl', ''), FauxtonAPI.constants.DOC_URLS.MANGO_INDEX];
- };
-
const url = FauxtonAPI.urls(
'allDocs', 'app', this.database.safeID(), '?limit=' + FauxtonAPI.constants.DATABASES.DOCUMENT_LIMIT
);
- this.crumbs = [
+ const crumbs = [
{name: database, link: url},
{name: app.i18n.en_US['mango-indexeditor-title']}
];
+
+ this.setComponent('.template', MangoLayout, {
+ showIncludeAllDocs: false,
+ crumbs: crumbs,
+ docURL: FauxtonAPI.constants.DOC_URLS.MANGO_INDEX,
+ endpoint: mangoIndexCollection.urlRef('index-apiurl', ''),
+ edit: true
+ });
}
});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/75b8eb41/app/templates/layouts/two_pane.html
----------------------------------------------------------------------
diff --git a/app/templates/layouts/two_pane.html b/app/templates/layouts/two_pane.html
deleted file mode 100644
index 2b8d154..0000000
--- a/app/templates/layouts/two_pane.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<%/*
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
-*/%>
-<div id="dashboard" class="two-pane flex-layout flex-col">
-
- <div class="header-wrapper flex-layout flex-row">
- <div id="breadcrumbs"></div>
- <div class="right-header-wrapper flex-layout flex-row flex-body">
- <div id="react-headerbar" class="flex-body"></div>
- <div id="right-header" class="flex-body"></div>
- <div id="api-navbar"></div>
- <div id="notification-center-btn"></div>
- </div>
- </div>
-
- <div id="two-pane-content" class="flex-layout flex-row flex-body">
- <div id="left-content" class="flex-body"></div>
- <div id="right-content" class="flex-body flex-layout flex-col">
- <div id="dashboard-lower-content" class="flex-body"></div>
- <div id="footer"></div>
- </div>
- </div>
-</div>
[5/5] fauxton commit: updated refs/heads/master to 14224ea
Posted by ga...@apache.org.
convert config to layout
Convert config to standard layout, code clean up and fix failing tests.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/14224ea7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/14224ea7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/14224ea7
Branch: refs/heads/master
Commit: 14224ea7e6fc688d23b35c30200daefc46a61df3
Parents: 63d8923
Author: Garren Smith <ga...@gmail.com>
Authored: Mon Nov 28 15:25:36 2016 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Nov 30 15:41:36 2016 +0200
----------------------------------------------------------------------
app/addons/config/components.react.jsx | 50 ++++-
app/addons/config/layout.js | 28 +--
app/addons/config/routes.js | 19 --
app/addons/config/templates/sidebartabs.html | 24 ---
app/addons/config/views.js | 40 ----
.../documents/components/header-docs-right.jsx | 1 -
.../documents/index-editor/components.react.jsx | 1 -
app/addons/documents/layouts.js | 6 +-
app/addons/documents/routes-documents.js | 8 -
app/addons/documents/routes-index-editor.js | 7 -
app/addons/documents/shared-routes.js | 12 --
app/addons/fauxton/base.js | 7 +-
app/addons/fauxton/components.js | 188 -------------------
app/addons/permissions/routes.js | 16 +-
14 files changed, 67 insertions(+), 340 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/config/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/config/components.react.jsx b/app/addons/config/components.react.jsx
index 4432753..f8cd0c6 100644
--- a/app/addons/config/components.react.jsx
+++ b/app/addons/config/components.react.jsx
@@ -387,12 +387,48 @@ var AddOptionButton = React.createClass({
}
});
+const TabItem = ({active, link, title}) => {
+ return (
+ <li className={active ? 'active' : ''}>
+ <a href={`#${link}`}>
+ {title}
+ </a>
+ </li>
+ );
+};
+
+TabItem.propTypes = {
+ active: React.PropTypes.bool.isRequired,
+ link: React.PropTypes.string.isRequired,
+ icon: React.PropTypes.string,
+ title: React.PropTypes.string.isRequired
+};
+
+const Tabs = ({sidebarItems, selectedTab}) => {
+ const tabItems = sidebarItems.map(item => {
+ return <TabItem
+ key={item.title}
+ active={selectedTab === item.title}
+ title={item.title}
+ link={item.link}
+ />;
+ });
+ return (
+ <nav className="sidenav">
+ <ul className="nav nav-list">
+ {tabItems}
+ </ul>
+ </nav>
+ );
+};
+
export default {
- ConfigTableController: ConfigTableController,
- ConfigTable: ConfigTable,
- ConfigOption: ConfigOption,
- ConfigOptionValue: ConfigOptionValue,
- ConfigOptionTrash: ConfigOptionTrash,
- AddOptionController: AddOptionController,
- AddOptionButton: AddOptionButton
+ Tabs,
+ ConfigTableController,
+ ConfigTable,
+ ConfigOption,
+ ConfigOptionValue,
+ ConfigOptionTrash,
+ AddOptionController,
+ AddOptionButton,
};
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/config/layout.js
----------------------------------------------------------------------
diff --git a/app/addons/config/layout.js b/app/addons/config/layout.js
index 528dcca..342551a 100644
--- a/app/addons/config/layout.js
+++ b/app/addons/config/layout.js
@@ -19,19 +19,6 @@ import {Breadcrumbs} from '../components/header-breadcrumbs';
import {NotificationCenterButton} from '../fauxton/notifications/notifications.react';
import {ApiBarWrapper} from '../components/layouts';
-// const sidebarItems = [
-// {
-// title: 'Main config',
-// typeSelect: 'main',
-// link: '_config/' + node
-// },
-// {
-// title: 'CORS',
-// typeSelect: 'cors',
-// link: '_config/' + node + '/cors'
-// }
-// ];
-
export const ConfigHeader = ({node, crumbs, docURL, endpoint}) => {
return (
<header className="two-panel-header">
@@ -55,6 +42,17 @@ export const ConfigHeader = ({node, crumbs, docURL, endpoint}) => {
};
export const ConfigLayout = ({showCors, docURL, node, endpoint, crumbs}) => {
+ const sidebarItems = [
+ {
+ title: 'Main config',
+ link: '_config/' + node
+ },
+ {
+ title: 'CORS',
+ link: '_config/' + node + '/cors'
+ }
+ ];
+ const selectedTab = showCors ? 'CORS' : 'Main config';
const content = showCors ? <CORSComponents.CORSController/> : <ConfigComponents.ConfigTableController node={node} />;
return (
<div id="dashboard" className="with-sidebar">
@@ -66,6 +64,10 @@ export const ConfigLayout = ({showCors, docURL, node, endpoint, crumbs}) => {
/>
<div className="with-sidebar tabs-with-sidebar content-area">
<aside id="sidebar-content" className="scrollable">
+ <ConfigComponents.Tabs
+ sidebarItems={sidebarItems}
+ selectedTab={selectedTab}
+ />
</aside>
<section id="dashboard-content" className="flex-layout flex-col">
<div id="dashboard-upper-content"></div>
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/config/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/config/routes.js b/app/addons/config/routes.js
index ee2acff..8692379 100644
--- a/app/addons/config/routes.js
+++ b/app/addons/config/routes.js
@@ -13,7 +13,6 @@
import app from "../../app";
import FauxtonAPI from "../../core/api";
import Config from "./resources";
-import Views from "./views";
import CORSComponents from "../cors/components.react";
import CORSActions from "../cors/actions";
import ClusterActions from "../cluster/cluster.actions";
@@ -58,27 +57,10 @@ var ConfigPerNodeRouteObject = FauxtonAPI.RouteObject.extend({
var node = options[0];
this.configs = new Config.ConfigModel({ node: node });
-
- this.sidebar = this.setView('#sidebar-content', new Views.Tabs({
- sidebarItems: [
- {
- title: 'Main config',
- typeSelect: 'main',
- link: '_config/' + node
- },
- {
- title: 'CORS',
- typeSelect: 'cors',
- link: '_config/' + node + '/cors'
- }
- ]
- }));
},
configForNode: function (node) {
- this.removeComponents();
ConfigActions.fetchAndEditConfig(node);
- this.sidebar.setSelectedTab('main');
this.setComponent('.template', Layout, {
node: node,
docURL: this.configs.documentation,
@@ -90,7 +72,6 @@ var ConfigPerNodeRouteObject = FauxtonAPI.RouteObject.extend({
configCorsForNode: function (node) {
CORSActions.fetchAndEditCors(node);
- this.sidebar.setSelectedTab('cors');
this.setComponent('.template', Layout, {
node: node,
docURL: this.configs.documentation,
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/config/templates/sidebartabs.html
----------------------------------------------------------------------
diff --git a/app/addons/config/templates/sidebartabs.html b/app/addons/config/templates/sidebartabs.html
deleted file mode 100644
index 46640d9..0000000
--- a/app/addons/config/templates/sidebartabs.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<%/*
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
-*/%>
-
-<ul class="nav nav-list">
- <% _.each(sidebarItems, function (item) { %>
- <li>
- <a data-type-select="<%- item.typeSelect %>" href="#<%- item.link %>">
- <span class="<%- item.icon %>"></span>
- <%- item.title %>
- </a>
- </li>
- <% }); %>
-</ul>
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/config/views.js
----------------------------------------------------------------------
diff --git a/app/addons/config/views.js b/app/addons/config/views.js
deleted file mode 100644
index c20b24a..0000000
--- a/app/addons/config/views.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-import FauxtonAPI from "../../core/api";
-var Views = {};
-
-Views.Tabs = FauxtonAPI.View.extend({
- className: "sidenav",
- tagName: "nav",
- template: 'addons/config/templates/sidebartabs',
- initialize: function (options) {
- this.sidebarItems = options.sidebarItems;
- },
-
- setSelectedTab: function (selectedTab) {
- this.selectedTab = selectedTab;
- this.$('li').removeClass('active');
- this.$('a[data-type-select="' + this.selectedTab + '"]').parent("li").addClass('active');
- },
- afterRender: function () {
- this.setSelectedTab(this.selectedTab);
- },
-
- serialize: function () {
- return {
- sidebarItems: this.sidebarItems
- };
- }
-});
-
-export default Views;
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/documents/components/header-docs-right.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/components/header-docs-right.jsx b/app/addons/documents/components/header-docs-right.jsx
index c06df07..e269414 100644
--- a/app/addons/documents/components/header-docs-right.jsx
+++ b/app/addons/documents/components/header-docs-right.jsx
@@ -12,7 +12,6 @@
import app from '../../../app';
import FauxtonAPI from '../../../core/api';
-import Components from '../../fauxton/components';
import Documents from '../resources';
import Databases from '../../databases/resources';
import React from 'react';
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/documents/index-editor/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-editor/components.react.jsx b/app/addons/documents/index-editor/components.react.jsx
index 4b461e0..dc3f22c 100644
--- a/app/addons/documents/index-editor/components.react.jsx
+++ b/app/addons/documents/index-editor/components.react.jsx
@@ -16,7 +16,6 @@ import React from "react";
import ReactDOM from "react-dom";
import Stores from "./stores";
import Actions from "./actions";
-import Components from "../../fauxton/components";
import ReactComponents from "../../components/react-components.react";
var store = Stores.indexEditorStore;
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/documents/layouts.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/layouts.js b/app/addons/documents/layouts.js
index fd9283d..3f85a10 100644
--- a/app/addons/documents/layouts.js
+++ b/app/addons/documents/layouts.js
@@ -57,8 +57,8 @@ export const TabsSidebarHeader = ({hideHeaderBar, database, dbName, dropDownLink
TabsSidebarHeader.propTypes = {
dbName : React.PropTypes.string.isRequired,
dropDownLinks : React.PropTypes.array.isRequired,
- docURL : React.PropTypes.string.isRequired,
- endpoint : React.PropTypes.string.isRequired,
+ docURL : React.PropTypes.string,
+ endpoint : React.PropTypes.string,
showIncludeAllDocs : React.PropTypes.bool,
hideHeaderBar : React.PropTypes.bool,
database : React.PropTypes.object.isRequired
@@ -163,7 +163,7 @@ ViewsTabsSidebarLayout.defaultProps = {
ViewsTabsSidebarLayout.propTypes = {
showEditView: React.PropTypes.bool,
docURL: React.PropTypes.string.isRequired,
- endpoint: React.PropTypes.string.isRequired,
+ endpoint: React.PropTypes.string,
dbName: React.PropTypes.string.isRequired,
dropDownLinks: React.PropTypes.array.isRequired
};
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/documents/routes-documents.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js
index 1233933..445a5fa 100644
--- a/app/addons/documents/routes-documents.js
+++ b/app/addons/documents/routes-documents.js
@@ -49,19 +49,12 @@ var DocumentsRouteObject = BaseRoute.extend({
this.initViews(options[0]);
},
- establish: function () {
- return [
- this.designDocs.fetch({ reset: true })
- ];
- },
-
initViews: function (dbName) {
this.databaseName = dbName;
this.database = new Databases.Model({id: this.databaseName});
this.createDesignDocsCollection();
- this.addLeftHeader();
this.addSidebar();
},
@@ -78,7 +71,6 @@ var DocumentsRouteObject = BaseRoute.extend({
});
QueryOptionsActions.hideQueryOptions();
- this.apiUrl = [, designDocInfo.documentation()];
const dropDownLinks = this.getCrumbs(this.database);
this.setComponent('.template', ViewsTabsSidebarLayout, {
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/documents/routes-index-editor.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-index-editor.js b/app/addons/documents/routes-index-editor.js
index 5a007dd..eb1e83a 100644
--- a/app/addons/documents/routes-index-editor.js
+++ b/app/addons/documents/routes-index-editor.js
@@ -50,16 +50,9 @@ var IndexEditorAndResults = BaseRoute.extend({
this.databaseName = databaseName;
this.database = new Databases.Model({id: databaseName});
this.createDesignDocsCollection();
- this.addLeftHeader();
this.addSidebar();
},
- establish: function () {
- return [
- this.designDocs.fetch({ reset: true })
- ];
- },
-
showView: function (databaseName, ddoc, viewName) {
var params = this.createParams(),
urlParams = params.urlParams,
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/documents/shared-routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/shared-routes.js b/app/addons/documents/shared-routes.js
index 136c07a..956d502 100644
--- a/app/addons/documents/shared-routes.js
+++ b/app/addons/documents/shared-routes.js
@@ -61,10 +61,6 @@ var BaseRoute = FauxtonAPI.RouteObject.extend({
});
},
- addLeftHeader: function () {
- const dropDownLinks = this.getCrumbs(this.database);
- },
-
addSidebar: function (selectedNavItem) {
var options = {
designDocs: this.designDocs,
@@ -84,14 +80,6 @@ var BaseRoute = FauxtonAPI.RouteObject.extend({
];
},
- ddocInfo: function (designDoc, designDocs, view) {
- return {
- id: "_design/" + designDoc,
- currView: view,
- designDocs: designDocs
- };
- },
-
createParams: function (options) {
var urlParams = app.getParams(options),
params = Documents.QueryParams.parse(urlParams);
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/fauxton/base.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/base.js b/app/addons/fauxton/base.js
index fed1e0b..0811b89 100644
--- a/app/addons/fauxton/base.js
+++ b/app/addons/fauxton/base.js
@@ -13,8 +13,6 @@
import app from "../../app";
import FauxtonAPI from "../../core/api";
import React from "react";
-
-import Components from "./components";
import NotificationComponents from "./notifications/notifications.react";
import Actions from "./notifications/actions";
import NavbarReactComponents from "./navigation/components.react";
@@ -25,10 +23,9 @@ import {Breadcrumbs} from '../components/header-breadcrumbs';
import "./assets/less/fauxton.less";
-var Fauxton = FauxtonAPI.addon();
-
+const Fauxton = FauxtonAPI.addon();
-Fauxton.initialize = function () {
+Fauxton.initialize = () => {
FauxtonAPI.RouteObject.on('beforeEstablish', function (routeObject) {
NavigationActions.setNavbarActiveLink(_.result(routeObject, 'selectedHeader'));
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
deleted file mode 100644
index f62afef..0000000
--- a/app/addons/fauxton/components.js
+++ /dev/null
@@ -1,188 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-import app from "../../app";
-import FauxtonAPI from "../../core/api";
-import ReactComponents from "../components/react-components.react";
-import ComponentsActions from "../components/actions";
-import Helpers from "../documents/helpers";
-import "velocity-animate/velocity.ui";
-var Components = FauxtonAPI.addon();
-
-
-/**
- * Our generic Tray component. All trays should extend this guy - it offers some convenient boilerplate code for
- * hiding/showing, event publishing and so on. The important functions that can be called on the child Views are:
- * - hideTray
- * - showTray
- * - toggleTray
- */
-Components.Tray = FauxtonAPI.View.extend({
-
- // populated dynamically
- events: {},
-
- initTray: function (opts) {
- this.toggleTrayBtnSelector = (_.has(opts, 'toggleTrayBtnSelector')) ? opts.toggleTrayBtnSelector : null;
- this.onShowTray = (_.has(opts, 'onShowTray')) ? opts.onShowTray : null;
-
- // if the component extending this one passed along the selector of the element that toggles the tray,
- // add the appropriate events
- if (!_.isNull(this.toggleTrayBtnSelector)) {
- this.events['click ' + this.toggleTrayBtnSelector] = 'toggleTray';
- }
-
- _.bind(this.toggleTray, this);
- _.bind(this.trayVisible, this);
- _.bind(this.hideTray, this);
- _.bind(this.showTray, this);
-
- // a unique identifier for this tray
- this.trayId = 'tray-' + this.cid;
-
- var that = this;
- $('body').on('click.' + this.trayId, function (e) {
- var $clickEl = $(e.target);
-
- if (!that.trayVisible()) {
- return;
- }
- if (!_.isNull(that.toggleTrayBtnSelector) && $clickEl.closest(that.toggleTrayBtnSelector).length) {
- return;
- }
- if (!$clickEl.closest('.tray').length) {
- that.hideTray();
- }
- });
-
- FauxtonAPI.Events.on(FauxtonAPI.constants.EVENTS.TRAY_OPENED, this.onTrayOpenEvent, this);
- },
-
- cleanup: function () {
- $('body').off('click.' + this.trayId);
- },
-
- // all trays publish a EVENTS.TRAY_OPENED event containing their unique ID. This listens for those events and
- // closes the current tray if it's already open
- onTrayOpenEvent: function (msg) {
- if (!_.has(msg, 'trayId')) {
- return;
- }
- if (msg.trayId !== this.trayId && this.trayVisible()) {
- this.hideTray();
- }
- },
-
- toggleTray: function (e) {
- e.preventDefault();
-
- if (this.trayVisible()) {
- this.hideTray();
- } else {
- this.showTray();
- }
- },
-
- hideTray: function () {
- var $tray = this.$('.tray');
- $tray.velocity('reverse', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () {
- $tray.hide();
- });
-
- if (!_.isNull(this.toggleTrayBtnSelector)) {
- this.$(this.toggleTrayBtnSelector).removeClass('enabled');
- }
- },
-
- showTray: function () {
- this.$('.tray').velocity('transition.slideDownIn', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED);
- if (!_.isNull(this.toggleTrayBtnSelector)) {
- this.$(this.toggleTrayBtnSelector).addClass('enabled');
- }
-
- if (!_.isNull(this.onShowTray)) {
- this.onShowTray();
- }
-
- FauxtonAPI.Events.trigger(FauxtonAPI.constants.EVENTS.TRAY_OPENED, { trayId: this.trayId });
- },
-
- trayVisible: function () {
- return this.$('.tray').is(':visible');
- }
-});
-
-Components.Typeahead = FauxtonAPI.View.extend({
-
- initialize: function (options) {
- this.source = options.source;
- this.onUpdateEventName = options.onUpdateEventName;
- },
-
- afterRender: function () {
- var onUpdateEventName = this.onUpdateEventName;
-
- this.$el.typeahead({
- source: this.source,
- updater: function (item) {
- FauxtonAPI.Events.trigger(onUpdateEventName, item);
- return item;
- }
- });
- }
-});
-
-Components.DbSearchTypeahead = Components.Typeahead.extend({
- initialize: function (options) {
- this.dbLimit = options.dbLimit || 30;
- if (options.filter) {
- this.resultFilter = options.resultFilter;
- }
- _.bindAll(this);
- },
-
- getURL: function (query, dbLimit) {
- query = encodeURIComponent(query);
- return [
- app.host,
- "/_all_dbs?startkey=%22",
- query,
- "%22&endkey=%22",
- query,
- encodeURIComponent("\u9999"),
- "%22&limit=",
- dbLimit
- ].join('');
- },
-
- source: function (query, process) {
- var url = this.getURL(query, this.dbLimit);
- var resultFilter = this.resultFilter;
-
- if (this.ajaxReq) { this.ajaxReq.abort(); }
-
- this.ajaxReq = $.ajax({
- cache: false,
- url: url,
- dataType: 'json',
- success: function (data) {
- if (resultFilter) {
- data = resultFilter(data);
- }
- process(data);
- }
- });
- }
-});
-
-
-export default Components;
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/14224ea7/app/addons/permissions/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/permissions/routes.js b/app/addons/permissions/routes.js
index 3b095f4..46ed6f9 100644
--- a/app/addons/permissions/routes.js
+++ b/app/addons/permissions/routes.js
@@ -18,7 +18,7 @@ import Actions from "./actions";
import BaseRoute from "../documents/shared-routes";
import Layout from './layout';
-var PermissionsRouteObject = BaseRoute.extend({
+const PermissionsRouteObject = BaseRoute.extend({
layout: 'empty',
roles: ['fx_loggedIn'],
routes: {
@@ -39,16 +39,9 @@ var PermissionsRouteObject = BaseRoute.extend({
});
this.createDesignDocsCollection();
- this.addLeftHeader();
this.addSidebar('permissions');
},
- establish: function () {
- return [
- this.designDocs.fetch({reset: true})
- ];
- },
-
permissions: function () {
Actions.fetchPermissions(this.database, this.security);
const crumbs = [
@@ -62,12 +55,11 @@ var PermissionsRouteObject = BaseRoute.extend({
dropDownLinks: crumbs,
database: this.database
});
- },
-
- crumbs: function () {
}
});
-Permissions.RouteObjects = [PermissionsRouteObject];
+const Permissions = {
+ RouteObjects: [PermissionsRouteObject]
+};
export default Permissions;