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/22 14:49:07 UTC

[2/2] fauxton commit: updated refs/heads/master to 4665e30

switch auth to react onepane


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/84b5318f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/84b5318f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/84b5318f

Branch: refs/heads/master
Commit: 84b5318f88a54b3794d4ee32951da5a6ab4ac7da
Parents: 4924a1e
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Nov 15 10:20:32 2016 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Nov 22 16:48:49 2016 +0200

----------------------------------------------------------------------
 app/addons/auth/layout.js        | 31 +++++++++++++++++++++++++++++++
 app/addons/auth/routes.js        | 21 ++++++++++++++++-----
 app/addons/components/layouts.js |  1 +
 3 files changed, 48 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/84b5318f/app/addons/auth/layout.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/layout.js b/app/addons/auth/layout.js
new file mode 100644
index 0000000..24bd9df
--- /dev/null
+++ b/app/addons/auth/layout.js
@@ -0,0 +1,31 @@
+// 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, OnePaneHeader, OnePaneContent} from '../components/layouts';
+
+export const AuthLayout = ({crumbs, component}) => {
+  return (
+    <OnePane>
+      <OnePaneHeader
+        crumbs={crumbs}
+      >
+      </OnePaneHeader>
+      <OnePaneContent>
+        {component}
+      </OnePaneContent>
+    </OnePane>
+  );
+};
+
+export default AuthLayout;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/84b5318f/app/addons/auth/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/routes.js b/app/addons/auth/routes.js
index b0e41d5..be30171 100644
--- a/app/addons/auth/routes.js
+++ b/app/addons/auth/routes.js
@@ -10,15 +10,19 @@
 // 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 Auth from "./resources";
 import AuthActions from "./actions";
 import Components from "./components.react";
 import ClusterActions from "../cluster/cluster.actions";
+import Layout from './layout';
+
+const {LoginForm, CreateAdminForm} = Components;
 
 var AuthRouteObject = FauxtonAPI.RouteObject.extend({
-  layout: 'one_pane',
+  layout: 'empty',
 
   routes: {
     'login?*extra': 'login',
@@ -28,14 +32,18 @@ var AuthRouteObject = FauxtonAPI.RouteObject.extend({
     'createAdmin/:node': 'createAdminForNode'
   },
   hideNotificationCenter: true,
+  hideApiBar: true,
 
   checkNodes: function () {
     ClusterActions.navigateToNodeBasedOnNodeCount('/createAdmin/');
   },
 
   login: function () {
-    this.crumbs = [{ name: 'Log In to CouchDB' }];
-    this.setComponent('#dashboard-content', Components.LoginForm, { urlBack: app.getParams().urlback });
+    const crumbs = [{ name: 'Log In to CouchDB' }];
+    this.setComponent(".template", Layout, {
+      crumbs: crumbs,
+      component: <LoginForm urlBack={app.getParams().urlback } />
+    });
   },
 
   logout: function () {
@@ -47,8 +55,11 @@ var AuthRouteObject = FauxtonAPI.RouteObject.extend({
 
   createAdminForNode: function () {
     ClusterActions.fetchNodes();
-    this.crumbs = [{ name: 'Create Admin' }];
-    this.setComponent('#dashboard-content', Components.CreateAdminForm, { loginAfter: true });
+    const crumbs = [{ name: 'Create Admin' }];
+    this.setComponent(".template", Layout, {
+      crumbs: crumbs,
+      component: <CreateAdminForm loginAfter={true} />
+    });
   }
 });
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/84b5318f/app/addons/components/layouts.js
----------------------------------------------------------------------
diff --git a/app/addons/components/layouts.js b/app/addons/components/layouts.js
index 736f60b..ae014bd 100644
--- a/app/addons/components/layouts.js
+++ b/app/addons/components/layouts.js
@@ -74,6 +74,7 @@ OnePaneHeader.defaultProps = {
 OnePaneHeader.propTypes = {
   docURL: React.PropTypes.string,
   endpoint: React.PropTypes.string,
+  crumbs: React.PropTypes.array
 };
 
 export const OnePaneContent = ({children}) => {