You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by be...@apache.org on 2014/01/09 01:07:50 UTC
[35/96] [abbrv] [partial] move sources to src
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/auth/resources.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/auth/resources.js b/apps/fauxton/app/addons/auth/resources.js
deleted file mode 100644
index b1d40cc..0000000
--- a/apps/fauxton/app/addons/auth/resources.js
+++ /dev/null
@@ -1,364 +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.
-
-define([
- "app",
- "api"
-],
-
-function (app, FauxtonAPI) {
-
- var Auth = new FauxtonAPI.addon();
-
- var Admin = Backbone.Model.extend({
-
- url: function () {
- return app.host + '/_config/admins/' + this.get("name");
- },
-
- isNew: function () { return false; },
-
- sync: function (method, model, options) {
-
- var params = {
- url: model.url(),
- contentType: 'application/json',
- dataType: 'json',
- data: JSON.stringify(model.get('value'))
- };
-
- if (method === 'delete') {
- params.type = 'DELETE';
- } else {
- params.type = 'PUT';
- }
-
- return $.ajax(params);
- }
- });
-
- Auth.Session = FauxtonAPI.Session.extend({
- url: '/_session',
-
- initialize: function (options) {
- if (!options) { options = {}; }
-
- this.messages = _.extend({}, {
- missingCredentials: 'Username or password cannot be blank.',
- passwordsNotMatch: 'Passwords do not match.',
- incorrectCredentials: 'Incorrect username or password.',
- loggedIn: 'You have been logged in.',
- adminCreated: 'Couchdb admin created',
- changePassword: 'Your password has been updated.'
- }, options.messages);
- },
-
- isAdminParty: function () {
- var userCtx = this.get('userCtx');
-
- if (!userCtx.name && userCtx.roles.indexOf("_admin") > -1) {
- return true;
- }
-
- return false;
- },
-
- isLoggedIn: function () {
- var userCtx = this.get('userCtx');
-
- if (userCtx.name) {
- return true;
- }
-
- return false;
- },
-
- userRoles: function () {
- var user = this.user();
-
- if (user && user.roles) {
- return user.roles;
- }
-
- return [];
- },
-
- matchesRoles: function (roles) {
- if (roles.length === 0) {
- return true;
- }
-
- var numberMatchingRoles = _.intersection(this.userRoles(), roles).length;
-
- if (numberMatchingRoles > 0) {
- return true;
- }
-
- return false;
- },
-
- validateUser: function (username, password, msg) {
- if (_.isEmpty(username) || _.isEmpty(password)) {
- var deferred = FauxtonAPI.Deferred();
-
- deferred.rejectWith(this, [msg]);
- return deferred;
- }
- },
-
- validatePasswords: function (password, password_confirm, msg) {
- if (_.isEmpty(password) || _.isEmpty(password_confirm) || (password !== password_confirm)) {
- var deferred = FauxtonAPI.Deferred();
-
- deferred.rejectWith(this, [msg]);
- return deferred;
- }
-
- },
-
- createAdmin: function (username, password, login) {
- var that = this,
- error_promise = this.validateUser(username, password, this.messages.missingCredentials);
-
- if (error_promise) { return error_promise; }
-
- var admin = new Admin({
- name: username,
- value: password
- });
-
- return admin.save().then(function () {
- if (login) {
- return that.login(username, password);
- } else {
- return that.fetchUser({forceFetch: true});
- }
- });
- },
-
- login: function (username, password) {
- var error_promise = this.validateUser(username, password, this.messages.missingCredentials);
-
- if (error_promise) { return error_promise; }
-
- var that = this;
-
- return $.ajax({
- cache: false,
- type: "POST",
- url: "/_session",
- dataType: "json",
- data: {name: username, password: password}
- }).then(function () {
- return that.fetchUser({forceFetch: true});
- });
- },
-
- logout: function () {
- var that = this;
-
- return $.ajax({
- type: "DELETE",
- url: "/_session",
- dataType: "json",
- username : "_",
- password : "_"
- }).then(function () {
- return that.fetchUser({forceFetch: true });
- });
- },
-
- changePassword: function (password, password_confirm) {
- var error_promise = this.validatePasswords(password, password_confirm, this.messages.passwordsNotMatch);
-
- if (error_promise) { return error_promise; }
-
- var that = this,
- info = this.get('info'),
- userCtx = this.get('userCtx');
-
- var admin = new Admin({
- name: userCtx.name,
- value: password
- });
-
- return admin.save().then(function () {
- return that.login(userCtx.name, password);
- });
- }
- });
-
- Auth.CreateAdminView = FauxtonAPI.View.extend({
- template: 'addons/auth/templates/create_admin',
-
- initialize: function (options) {
- options = options || {};
- this.login_after = options.login_after === false ? false : true;
- },
-
- events: {
- "submit #create-admin-form": "createAdmin"
- },
-
- createAdmin: function (event) {
- event.preventDefault();
-
- var that = this,
- username = this.$('#username').val(),
- password = this.$('#password').val();
-
- var promise = this.model.createAdmin(username, password, this.login_after);
-
- promise.then(function () {
- FauxtonAPI.addNotification({
- msg: FauxtonAPI.session.messages.adminCreated,
- });
-
- if (that.login_after) {
- FauxtonAPI.navigate('/');
- } else {
- that.$('#username').val('');
- that.$('#password').val('');
- }
- });
-
- promise.fail(function (rsp) {
- FauxtonAPI.addNotification({
- msg: 'Could not create admin. Reason' + rsp + '.',
- type: 'error'
- });
- });
- }
-
- });
-
- Auth.LoginView = FauxtonAPI.View.extend({
- template: 'addons/auth/templates/login',
-
- events: {
- "submit #login": "login"
- },
-
- login: function (event) {
- event.preventDefault();
-
- var that = this,
- username = this.$('#username').val(),
- password = this.$('#password').val(),
- promise = this.model.login(username, password);
-
- promise.then(function () {
- FauxtonAPI.addNotification({msg: FauxtonAPI.session.messages.loggedIn });
- FauxtonAPI.navigate('/');
- });
-
- promise.fail(function (xhr, type, msg) {
- if (arguments.length === 3) {
- msg = FauxtonAPI.session.messages.incorrectCredentials;
- } else {
- msg = xhr;
- }
-
- FauxtonAPI.addNotification({
- msg: msg,
- type: 'error'
- });
- });
- }
-
- });
-
- Auth.ChangePassword = FauxtonAPI.View.extend({
- template: 'addons/auth/templates/change_password',
-
- events: {
- "submit #change-password": "changePassword"
- },
-
- changePassword: function () {
- event.preventDefault();
-
- var that = this,
- new_password = this.$('#password').val(),
- password_confirm = this.$('#password-confirm').val();
-
- var promise = this.model.changePassword(new_password, password_confirm);
-
- promise.done(function () {
- FauxtonAPI.addNotification({msg: FauxtonAPI.session.messages.changePassword});
- that.$('#password').val('');
- that.$('#password-confirm').val('');
- });
-
- promise.fail(function (xhr, error, msg) {
- if (arguments.length < 3) {
- msg = xhr;
- }
-
- FauxtonAPI.addNotification({
- msg: xhr,
- type: 'error'
- });
- });
- }
- });
-
- Auth.NavLink = FauxtonAPI.View.extend({
- template: 'addons/auth/templates/nav_link_title',
- tagName: 'li',
-
- beforeRender: function () {
- this.listenTo(this.model, 'change', this.render);
- },
-
- serialize: function () {
- return {
- admin_party: this.model.isAdminParty(),
- user: this.model.user()
- };
- }
- });
-
- Auth.NavDropDown = FauxtonAPI.View.extend({
- template: 'addons/auth/templates/nav_dropdown',
-
- beforeRender: function () {
- this.listenTo(this.model, 'change', this.render);
- },
-
- setTab: function (selectedTab) {
- this.selectedTab = selectedTab;
- this.$('.active').removeClass('active');
- var $tab = this.$('a[data-select="' + selectedTab +'"]');
- $tab.parent().addClass('active');
- },
-
- afterRender: function () {
- if (this.selectedTab) {
- this.setTab(this.selectedTab);
- }
- },
-
- serialize: function () {
- return {
- admin_party: this.model.isAdminParty(),
- user: this.model.user()
- };
- }
- });
-
- Auth.NoAccessView = FauxtonAPI.View.extend({
- template: "addons/auth/templates/noAccess"
- });
-
- return Auth;
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/auth/routes.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/auth/routes.js b/apps/fauxton/app/addons/auth/routes.js
deleted file mode 100644
index fe40a77..0000000
--- a/apps/fauxton/app/addons/auth/routes.js
+++ /dev/null
@@ -1,93 +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.
-
-define([
- "app",
- "api",
- "addons/auth/resources"
-],
-
-function(app, FauxtonAPI, Auth) {
- var authRouteObject = FauxtonAPI.RouteObject.extend({
- layout: 'one_pane',
-
- routes: {
- 'login': 'login',
- 'logout': 'logout',
- 'createAdmin': 'createAdmin',
- 'noAccess': 'noAccess'
- },
-
- login: function () {
- this.crumbs = [{name: 'Login', link:"#"}];
- this.setView('#dashboard-content', new Auth.LoginView({model: FauxtonAPI.session}));
- },
-
- logout: function () {
- FauxtonAPI.addNotification({msg: 'You have been logged out.'});
- FauxtonAPI.session.logout().then(function () {
- FauxtonAPI.navigate('/');
- });
- },
-
- changePassword: function () {
- this.crumbs = [{name: 'Change Password', link:"#"}];
- this.setView('#dashboard-content', new Auth.ChangePassword({model: FauxtonAPI.session}));
- },
-
- createAdmin: function () {
- this.crumbs = [{name: 'Create Admin', link:"#"}];
- this.setView('#dashboard-content', new Auth.CreateAdminView({model: FauxtonAPI.session}));
- },
-
- noAccess: function () {
- this.crumbs = [{name: 'Access Denied', link:"#"}];
- this.setView('#dashboard-content', new Auth.NoAccessView());
- this.apiUrl = 'noAccess';
- },
- });
-
- var userRouteObject = FauxtonAPI.RouteObject.extend({
- layout: 'with_sidebar',
-
- routes: {
- 'changePassword': {
- route: 'changePassword',
- roles: ['_admin', '_reader', '_replicator']
- },
- 'addAdmin': {
- roles: ['_admin'],
- route: 'addAdmin',
- },
- },
-
- initialize: function () {
- this.navDrop = this.setView('#sidebar-content', new Auth.NavDropDown({model: FauxtonAPI.session}));
- },
-
- changePassword: function () {
- this.navDrop.setTab('change-password');
- this.setView('#dashboard-content', new Auth.ChangePassword({model: FauxtonAPI.session}));
- },
-
- addAdmin: function () {
- this.navDrop.setTab('add-admin');
- this.setView('#dashboard-content', new Auth.CreateAdminView({login_after: false, model: FauxtonAPI.session}));
- },
-
- crumbs: [{name: 'User Management', link: '#'}]
- });
-
- Auth.RouteObjects = [authRouteObject, userRouteObject];
-
- return Auth;
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/auth/templates/change_password.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/auth/templates/change_password.html b/apps/fauxton/app/addons/auth/templates/change_password.html
deleted file mode 100644
index 64b7d1f..0000000
--- a/apps/fauxton/app/addons/auth/templates/change_password.html
+++ /dev/null
@@ -1,26 +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 class="span12">
- <h2> Change Password </h2>
- <form id="change-password">
- <p class="help-block">
- Enter your new password.
- </p>
- <input id="password" type="password" name="password" placeholder= "New Password:" size="24">
- <br/>
- <input id="password-confirm" type="password" name="password_confirm" placeholder= "Verify New Password" size="24">
- <button type="submit" class="btn btn-primary">Change</button>
- </form>
-</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/auth/templates/create_admin.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/auth/templates/create_admin.html b/apps/fauxton/app/addons/auth/templates/create_admin.html
deleted file mode 100644
index 4715be5..0000000
--- a/apps/fauxton/app/addons/auth/templates/create_admin.html
+++ /dev/null
@@ -1,37 +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 class="span12">
- <h2> Add Admin </h2>
- <form id="create-admin-form">
- <input id="username" type="text" name="name" placeholder= "Username:" size="24">
- <br/>
- <input id="password" type="password" name="password" placeholder= "Password" size="24">
- <p class="help-block">
- Before a server admin is configured, all clients have admin privileges.
- This is fine when HTTP access is restricted
- to trusted users. <strong>If end-users will be accessing this CouchDB, you must
- create an admin account to prevent accidental (or malicious) data loss.</strong>
- </p>
- <p class="help-block">Server admins can create and destroy databases, install
- and update _design documents, run the test suite, and edit all aspects of CouchDB
- configuration.
- </p>
- <p class="help-block">Non-admin users have read and write access to all databases, which
- are controlled by validation functions. CouchDB can be configured to block all
- access to anonymous users.
- </p>
- <button type="submit" href="#" id="create-admin" class="btn btn-primary">Create Admin</button>
- </form>
-</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/auth/templates/login.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/auth/templates/login.html b/apps/fauxton/app/addons/auth/templates/login.html
deleted file mode 100644
index a57f3f0..0000000
--- a/apps/fauxton/app/addons/auth/templates/login.html
+++ /dev/null
@@ -1,26 +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 class="span12">
- <form id="login">
- <p class="help-block">
- Login to CouchDB with your name and password.
- </p>
- <input id="username" type="text" name="name" placeholder= "Username:" size="24">
- <br/>
- <input id="password" type="password" name="password" placeholder= "Password" size="24">
- <br/>
- <button id="submit" class="btn" type="submit"> Login </button>
- </form>
-</div>
-
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/auth/templates/nav_dropdown.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/auth/templates/nav_dropdown.html b/apps/fauxton/app/addons/auth/templates/nav_dropdown.html
deleted file mode 100644
index d61c24a..0000000
--- a/apps/fauxton/app/addons/auth/templates/nav_dropdown.html
+++ /dev/null
@@ -1,26 +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="sidenav">
-<header class="row-fluid">
- <h3> <%= user.name %> </h3>
-</header>
-<nav>
-<ul class="nav nav-list">
- <li class="active" ><a data-select="change-password" id="user-change-password" href="#changePassword"> Change Password </a></li>
- <li ><a data-select="add-admin" href="#addAdmin"> Create Admins </a></li>
-</ul>
-</nav>
-</div>
-
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/auth/templates/nav_link_title.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/auth/templates/nav_link_title.html b/apps/fauxton/app/addons/auth/templates/nav_link_title.html
deleted file mode 100644
index b23157e..0000000
--- a/apps/fauxton/app/addons/auth/templates/nav_link_title.html
+++ /dev/null
@@ -1,31 +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.
--->
-<% if (admin_party) { %>
- <a id="user-create-admin" href="#createAdmin">
- <span class="fonticon-user fonticon"></span>
- Admin Party!
- </a>
-<% } else if (user) { %>
- <a href="#changePassword" >
- <span class="fonticon-user fonticon"></span>
- <%= user.name %>
- </a>
-<% } else { %>
- <a href="#login" >
- <span class="fonticon-user fonticon"></span>
- Login
- </a>
-<% } %>
-
-
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/auth/templates/noAccess.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/auth/templates/noAccess.html b/apps/fauxton/app/addons/auth/templates/noAccess.html
deleted file mode 100644
index ceff992..0000000
--- a/apps/fauxton/app/addons/auth/templates/noAccess.html
+++ /dev/null
@@ -1,20 +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 class="span12">
- <h2> Access Denied </h2>
- <p> You do not have permission to view this page. <br/> You might need to <a href="#login"> login </a> to view this page/ </p>
-
-</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/compaction/assets/less/compaction.less
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/compaction/assets/less/compaction.less b/apps/fauxton/app/addons/compaction/assets/less/compaction.less
deleted file mode 100644
index 70b034b..0000000
--- a/apps/fauxton/app/addons/compaction/assets/less/compaction.less
+++ /dev/null
@@ -1,19 +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.
-
-.compaction-option {
- background-color: #F7F7F7;
- border: 1px solid #DDD;
- margin-bottom: 30px;
- padding: 10px;
-
-}
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/compaction/base.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/compaction/base.js b/apps/fauxton/app/addons/compaction/base.js
deleted file mode 100644
index de0f124..0000000
--- a/apps/fauxton/app/addons/compaction/base.js
+++ /dev/null
@@ -1,31 +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.
-
-define([
- "app",
- "api",
- "addons/compaction/routes"
-],
-
-function(app, FauxtonAPI, Compaction) {
- Compaction.initialize = function() {
- FauxtonAPI.registerExtension('docLinks', {
- title: "Compact & Clean",
- url: "compact",
- icon: "icon-cogs"
- });
-
- FauxtonAPI.registerExtension('advancedOptions:ViewButton', new Compaction.CompactView({}));
- };
-
- return Compaction;
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/compaction/resources.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/compaction/resources.js b/apps/fauxton/app/addons/compaction/resources.js
deleted file mode 100644
index 6633677..0000000
--- a/apps/fauxton/app/addons/compaction/resources.js
+++ /dev/null
@@ -1,48 +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.
-
-define([
- "app",
- "api"
-],
-
-function (app, FauxtonAPI) {
- var Compaction = FauxtonAPI.addon();
-
- Compaction.compactDB = function (db) {
- return $.ajax({
- url: db.url() + '/_compact',
- contentType: 'application/json',
- type: 'POST'
- });
- };
-
- Compaction.cleanupViews = function (db) {
- return $.ajax({
- url: db.url() + '/_view_cleanup',
- contentType: 'application/json',
- type: 'POST'
- });
- };
-
-
- Compaction.compactView = function (db, designDoc) {
- // /some_database/_compact/designname
- return $.ajax({
- url: db.url() + '/_compact/' + designDoc.replace('_design/','') ,
- contentType: 'application/json',
- type: 'POST'
- });
- };
-
- return Compaction;
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/compaction/routes.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/compaction/routes.js b/apps/fauxton/app/addons/compaction/routes.js
deleted file mode 100644
index 2a33e07..0000000
--- a/apps/fauxton/app/addons/compaction/routes.js
+++ /dev/null
@@ -1,65 +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.
-
-define([
- "app",
-
- "api",
-
- // Modules
- "addons/compaction/views",
- "modules/databases/resources"
-],
-
-function(app, FauxtonAPI, Compaction, Databases) {
-
- var CompactionRouteObject = FauxtonAPI.RouteObject.extend({
- layout: "one_pane",
-
- crumbs: function () {
- return [
- {"name": this.database.id, "link": Databases.databaseUrl(this.database)},
- {"name": "Compact & Clean", "link": "compact"}
- ];
- },
-
- routes: {
- "database/:database/compact": "compaction"
- },
-
- initialize: function(route, masterLayout, options) {
- var databaseName = options[0];
-
- this.database = this.database || new Databases.Model({id: databaseName});
- },
-
- compaction: function () {
- this.setView('#dashboard-content', new Compaction.Layout({model: this.database}));
- },
-
- establish: function () {
- return this.database.fetch();
- }
-
- /*apiUrl: function() {
- return [this.compactions.url(), this.compactions.documentation];
- },*/
-
- });
-
- Compaction.RouteObjects = [CompactionRouteObject];
-
- return Compaction;
-
-});
-
-
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/compaction/templates/compact_view.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/compaction/templates/compact_view.html b/apps/fauxton/app/addons/compaction/templates/compact_view.html
deleted file mode 100644
index 8a0b7ec..0000000
--- a/apps/fauxton/app/addons/compaction/templates/compact_view.html
+++ /dev/null
@@ -1,14 +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.
--->
-Compact View
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/compaction/templates/layout.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/compaction/templates/layout.html b/apps/fauxton/app/addons/compaction/templates/layout.html
deleted file mode 100644
index 5125892..0000000
--- a/apps/fauxton/app/addons/compaction/templates/layout.html
+++ /dev/null
@@ -1,28 +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 class="row">
- <div class="span12 compaction-option">
- <h3> Compact Database </h3>
- <p>Compacting a database removes deleted documents and previous revisions. It is an irreversible operation and may take a while to complete for large databases.</p>
- <button id="compact-db" class="btn btn-large btn-primary"> Run </button>
- </div>
-</div>
-
-<div class="row">
- <div class="span12 compaction-option">
- <h3> Cleanup Views </h3>
- <p>Cleaning up views in a database removes old view files still stored on the filesystem. It is an irreversible operation.</p>
- <button id="cleanup-views" class="btn btn-large btn-primary"> Run </button>
- </div>
-</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/compaction/views.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/compaction/views.js b/apps/fauxton/app/addons/compaction/views.js
deleted file mode 100644
index 06a1300..0000000
--- a/apps/fauxton/app/addons/compaction/views.js
+++ /dev/null
@@ -1,140 +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.
-
-define([
- "app",
-
- "api",
- // Modules
- "addons/compaction/resources"
-],
-function (app, FauxtonAPI, Compaction) {
-
- Compaction.Layout = FauxtonAPI.View.extend({
- template: 'addons/compaction/templates/layout',
-
- initialize: function () {
- _.bindAll(this);
- },
-
- events: {
- "click #compact-db": "compactDB",
- "click #compact-view": "compactDB",
- "click #cleanup-views": "cleanupViews"
- },
-
- disableButton: function (selector, text) {
- this.$(selector).attr('disabled', 'disabled').text(text);
- },
-
- enableButton: function (selector, text) {
- this.$(selector).removeAttr('disabled').text(text);
- },
-
- compactDB: function (event) {
- var enableButton = this.enableButton;
- event.preventDefault();
-
- this.disableButton('#compact-db', 'Compacting...');
-
- Compaction.compactDB(this.model).then(function () {
- FauxtonAPI.addNotification({
- type: 'success',
- msg: 'Database compaction has started. Visit <a href="#activetasks">Active Tasks</a> to view the compaction progress.',
- });
- }, function (xhr, error, reason) {
- console.log(arguments);
- FauxtonAPI.addNotification({
- type: 'error',
- msg: 'Error: ' + JSON.parse(xhr.responseText).reason
- });
- }).always(function () {
- enableButton('#compact-db', 'Run');
- });
- },
-
- cleanupViews: function (event) {
- var enableButton = this.enableButton;
- event.preventDefault();
-
- this.disableButton('#cleanup-view', 'Cleaning...');
-
- Compaction.cleanupViews(this.model).then(function () {
- FauxtonAPI.addNotification({
- type: 'success',
- msg: 'View cleanup has started. Visit <a href="#activetasks">Active Tasks</a> to view progress.'
- });
- }, function (xhr, error, reason) {
- FauxtonAPI.addNotification({
- type: 'error',
- msg: 'Error: ' + JSON.parse(xhr.responseText).reason
- });
- }).always(function () {
- enableButton('#cleanup-views', 'Run');
- });
- }
- });
-
- Compaction.CompactView = FauxtonAPI.View.extend({
- template: 'addons/compaction/templates/compact_view',
- className: 'btn btn-info btn-large pull-right',
- tagName: 'button',
-
- initialize: function () {
- _.bindAll(this);
- },
-
- events: {
- "click": "compact"
- },
-
- disableButton: function () {
- this.$el.attr('disabled', 'disabled').text('Compacting...');
- },
-
- enableButton: function () {
- this.$el.removeAttr('disabled').text('Compact View');
- },
-
-
- update: function (database, designDoc, viewName) {
- this.database = database;
- this.designDoc = designDoc;
- this.viewName = viewName;
- },
-
- compact: function (event) {
- event.preventDefault();
- var enableButton = this.enableButton;
-
- this.disableButton();
-
- Compaction.compactView(this.database, this.designDoc).then(function () {
- FauxtonAPI.addNotification({
- type: 'success',
- msg: 'View compaction has started. Visit <a href="#activetasks">Active Tasks</a> to view progress.'
- });
- }, function (xhr, error, reason) {
- FauxtonAPI.addNotification({
- type: 'error',
- msg: 'Error: ' + JSON.parse(xhr.responseText).reason
- });
- }).always(function () {
- enableButton();
- });
-
- }
-
- });
-
- return Compaction;
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/config/assets/less/config.less
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/config/assets/less/config.less b/apps/fauxton/app/addons/config/assets/less/config.less
deleted file mode 100644
index 86d9bf1..0000000
--- a/apps/fauxton/app/addons/config/assets/less/config.less
+++ /dev/null
@@ -1,13 +0,0 @@
-table.config {
- #config-trash {
- width: 5%;
- }
-
- #delete-value {
- text-align: center;
- }
-}
-
-button#add-section {
- float: right;
-}
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/config/base.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/config/base.js b/apps/fauxton/app/addons/config/base.js
deleted file mode 100644
index 8362cb5..0000000
--- a/apps/fauxton/app/addons/config/base.js
+++ /dev/null
@@ -1,28 +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.
-
-define([
- "app",
-
- "api",
-
- // Modules
- "addons/config/routes"
-],
-
-function(app, FauxtonAPI, Config) {
- Config.initialize = function() {
- FauxtonAPI.addHeaderLink({title: "Config", href: "#_config", icon:"fonticon-cog", className: 'config'});
- };
-
- return Config;
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/config/resources.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/config/resources.js b/apps/fauxton/app/addons/config/resources.js
deleted file mode 100644
index 14d2474..0000000
--- a/apps/fauxton/app/addons/config/resources.js
+++ /dev/null
@@ -1,176 +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.
-
-define([
- "app",
- "api"
-],
-
-function (app, FauxtonAPI) {
-
- var Config = FauxtonAPI.addon();
-
- Config.Model = Backbone.Model.extend({});
- Config.OptionModel = Backbone.Model.extend({
- documentation: "config",
-
- url: function () {
- return app.host + '/_config/' + this.get("section") + '/' + this.get("name");
- },
-
- isNew: function () { return false; },
-
- sync: function (method, model, options) {
-
- var params = {
- url: model.url(),
- contentType: 'application/json',
- dataType: 'json',
- data: JSON.stringify(model.get('value'))
- };
-
- if (method === 'delete') {
- params.type = 'DELETE';
- } else {
- params.type = 'PUT';
- }
-
- return $.ajax(params);
- }
- });
-
- Config.Collection = Backbone.Collection.extend({
- model: Config.Model,
- documentation: "config",
- url: function () {
- return app.host + '/_config';
- },
-
- parse: function (resp) {
- return _.map(resp, function (section, section_name) {
- return {
- section: section_name,
- options: _.map(section, function (option, option_name) {
- return {
- name: option_name,
- value: option
- };
- })
- };
- });
- }
- });
-
- Config.ViewItem = FauxtonAPI.View.extend({
- tagName: "tr",
- className: "config-item",
- template: "addons/config/templates/item",
-
- events: {
- "click .edit-button": "editValue",
- "click #delete-value": "deleteValue",
- "click #cancel-value": "cancelEdit",
- "click #save-value": "saveValue"
- },
-
- deleteValue: function (event) {
- var result = confirm("Are you sure you want to delete this configuration value?");
-
- if (!result) { return; }
-
- this.model.destroy();
- this.remove();
- },
-
- editValue: function (event) {
- this.$("#show-value").hide();
- this.$("#edit-value-form").show();
- },
-
- saveValue: function (event) {
- this.model.save({value: this.$(".value-input").val()});
- this.render();
- },
-
- cancelEdit: function (event) {
- this.$("#edit-value-form").hide();
- this.$("#show-value").show();
- },
-
- serialize: function () {
- return {option: this.model.toJSON()};
- }
-
- });
-
- Config.View = FauxtonAPI.View.extend({
- template: "addons/config/templates/dashboard",
-
- events: {
- "click #add-section": "addSection",
- "submit #add-section-form": "submitForm"
- },
-
- submitForm: function (event) {
- event.preventDefault();
- var option = new Config.OptionModel({
- section: this.$('input[name="section"]').val(),
- name: this.$('input[name="name"]').val(),
- value: this.$('input[name="value"]').val()
- });
-
- option.save();
-
- var section = this.collection.find(function (section) {
- return section.get("section") === option.get("section");
- });
-
- if (section) {
- section.get("options").push(option.attributes);
- } else {
- this.collection.add({
- section: option.get("section"),
- options: [option.attributes]
- });
- }
-
- this.$("#add-section-modal").modal('hide');
- this.render();
- },
-
- addSection: function (event) {
- event.preventDefault();
- this.$("#add-section-modal").modal({show:true});
- },
-
- beforeRender: function() {
- this.collection.each(function(config) {
- _.each(config.get("options"), function (option, index) {
- this.insertView("table.config tbody", new Config.ViewItem({
- model: new Config.OptionModel({
- section: config.get("section"),
- name: option.name,
- value: option.value,
- index: index
- })
- }));
- }, this);
- }, this);
- },
-
- establish: function() {
- return [this.collection.fetch()];
- }
- });
-
- return Config;
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/config/routes.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/config/routes.js b/apps/fauxton/app/addons/config/routes.js
deleted file mode 100644
index 6af8157..0000000
--- a/apps/fauxton/app/addons/config/routes.js
+++ /dev/null
@@ -1,59 +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.
-
-define([
- "app",
-
- "api",
-
- // Modules
- "addons/config/resources"
-],
-
-function(app, FauxtonAPI, Config) {
-
- var ConfigRouteObject = FauxtonAPI.RouteObject.extend({
- layout: "one_pane",
-
- initialize: function () {
- this.configs = new Config.Collection();
- },
-
- roles: ["_admin"],
-
- selectedHeader: "Config",
-
- crumbs: [
- {"name": "Config","link": "_config"}
- ],
-
- apiUrl: function () {
- return [this.configs.url(), this.configs.documentation];
- },
-
- routes: {
- "_config": "config"
- },
-
- config: function () {
- this.setView("#dashboard-content", new Config.View({collection: this.configs}));
- },
-
- establish: function () {
- return [this.configs.fetch()];
- }
- });
-
-
- Config.RouteObjects = [ConfigRouteObject];
- return Config;
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/config/templates/dashboard.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/config/templates/dashboard.html b/apps/fauxton/app/addons/config/templates/dashboard.html
deleted file mode 100644
index ffbeb37..0000000
--- a/apps/fauxton/app/addons/config/templates/dashboard.html
+++ /dev/null
@@ -1,52 +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 class="row">
- <div class="span2 offset10">
- <button id="add-section" href="#" class="button button-margin">
- <i class="icon-plus icon-white"> </i>
- Add Section
- </button>
- </div>
-</div>
-<table class="config table table-striped table-bordered">
- <thead>
- <th id="config-section"> Section </th>
- <th id="config-option"> Option </th>
- <th id="config-value"> Value </th>
- <th id="config-trash"></th>
- </thead>
- <tbody>
- </tbody>
-</table>
-<div id="add-section-modal" class="modal hide fade">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <h3>Create Config Option</h3>
- </div>
- <div class="modal-body">
- <form id="add-section-form" class="form well">
- <label>Section</label>
- <input type="text" name="section" placeholder="Section">
- <span class="help-block">Enter an existing section name to add to it.</span>
- <input type="text" name="name" placeholder="Name">
- <br/>
- <input type="text" name="value" placeholder="Value">
- <div class="modal-footer">
- <button type="button" class="btn" data-dismiss="modal">Cancel</button>
- <button type="submit" class="btn btn-primary"> Save </button>
- </div>
- </form>
- </div>
-</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/config/templates/item.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/config/templates/item.html b/apps/fauxton/app/addons/config/templates/item.html
deleted file mode 100644
index 3e6e4ee..0000000
--- a/apps/fauxton/app/addons/config/templates/item.html
+++ /dev/null
@@ -1,31 +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.
--->
-
-<% if (option.index === 0) {%>
-<th> <%= option.section %> </th>
-<% } else { %>
-<td></td>
-<% } %>
-<td> <%= option.name %> </td>
-<td>
- <div id="show-value">
- <%= option.value %> <button class="edit-button"> Edit </button>
- </div>
- <div id="edit-value-form" style="display:none">
- <input class="value-input" type="text" value="<%= option.value %>" />
- <button id="save-value" class="btn btn-success btn-small"> Save </button>
- <button id="cancel-value" class="btn btn-danger btn-small"> Cancel </button>
- </div>
-</td>
-<td id="delete-value"> <i class="icon-trash"> </i> </td>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/contribute/base.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/contribute/base.js b/apps/fauxton/app/addons/contribute/base.js
deleted file mode 100644
index 8f622fe..0000000
--- a/apps/fauxton/app/addons/contribute/base.js
+++ /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.
-
-define([
- // Libraries.
- "jquery",
- "lodash"
-],
-function($, _){
- $.contribute = function(message, file){
- /*
- var JST = window.JST = window.JST || {};
- var template = JST['app/addons/contribute/templates/modal.html'];
- console.log(template);
- var compiled = template({message: message, file: file});
- */
- console.log('contribute!contribute!monorail!contribute!');
- /*
- console.log(compiled);
- var elem = $(compiled);
- elem.modal('show');
- */
- };
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/exampleAuth/base.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/exampleAuth/base.js b/apps/fauxton/app/addons/exampleAuth/base.js
deleted file mode 100644
index aa99670..0000000
--- a/apps/fauxton/app/addons/exampleAuth/base.js
+++ /dev/null
@@ -1,59 +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.
-
-define([
- "app",
-
- "api"
-],
-
-function(app, FauxtonAPI) {
- // This is an example module of using the new auth module.
-
- var noAccessView = FauxtonAPI.View.extend({
- template: "addons/exampleAuth/templates/noAccess"
-
- });
-
- // To utilise the authentication - all that is required, is one callback
- // that is registered with the auth api. This function can return an array
- // of deferred objects.
- // The roles argument that is passed in is the required roles for the current user
- // to be allowed to access the current page.
- // The layout is the main layout for use when you want to render a view onto the page
- var auth = function (roles) {
- var deferred = $.Deferred();
-
- if (roles.indexOf('_admin') > -1) {
- deferred.reject();
- } else {
- deferred.resolve();
- }
-
- return [deferred];
- };
-
- // If you would like to do something with when access is denied you can register this callback.
- // It will be called is access has been denied on the previous page.
- var authFail = function () {
- app.masterLayout.setView('#dashboard', new noAccessView());
- app.masterLayout.renderView('#dashboard');
- };
-
- // Register the auth call back. This will be called before new route rendered
- FauxtonAPI.auth.registerAuth(auth);
- // Register a failed route request callback. This is called if access is denied.
- FauxtonAPI.auth.registerAuthDenied(authFail);
-
-
-
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/exampleAuth/templates/noAccess.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/exampleAuth/templates/noAccess.html b/apps/fauxton/app/addons/exampleAuth/templates/noAccess.html
deleted file mode 100644
index f1a9506..0000000
--- a/apps/fauxton/app/addons/exampleAuth/templates/noAccess.html
+++ /dev/null
@@ -1,19 +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 class="row-fluid" >
- <div class="span6 offset4">
- <h3> You do not have permission to view this page </h3>
-</div>
-</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/logs/base.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/logs/base.js b/apps/fauxton/app/addons/logs/base.js
deleted file mode 100644
index 1aecbdf..0000000
--- a/apps/fauxton/app/addons/logs/base.js
+++ /dev/null
@@ -1,28 +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.
-
-define([
- "app",
-
- "api",
-
- // Modules
- "addons/logs/routes"
-],
-
-function(app, FauxtonAPI, Log) {
- Log.initialize = function() {
- FauxtonAPI.addHeaderLink({title: "Log", href: "#_log", icon: "fonticon-log", className: 'logs'});
- };
-
- return Log;
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/logs/resources.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/logs/resources.js b/apps/fauxton/app/addons/logs/resources.js
deleted file mode 100644
index 3a47b92..0000000
--- a/apps/fauxton/app/addons/logs/resources.js
+++ /dev/null
@@ -1,225 +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.
-
-define([
- "app",
- "api",
- "backbone"
-],
-
-function (app, FauxtonAPI, Backbone) {
-
- var Log = FauxtonAPI.addon();
-
- Log.Model = Backbone.Model.extend({
-
- date: function () {
- var date = new Date(this.get('date'));
-
- var formatted_time = date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
- var formatted_date = date.toDateString().slice(4, 10);
-
- return formatted_date + ' ' + formatted_time;
- },
-
- logLevel: function () {
- return this.get('log_level').replace(/ /g,'');
- },
-
- pid: function () {
- return _.escape(this.get('pid'));
- },
-
- args: function () {
- return _.escape(this.get('args'));
- }
-
- });
-
- Log.Collection = Backbone.Collection.extend({
- model: Log.Model,
-
- initialize: function (options) {
- this.params = {bytes: 5000};
- },
-
- documentation: "log",
-
- url: function () {
- query = "?" + $.param(this.params);
- return app.host + '/_log' + query;
- },
-
- // override fetch because backbone expects json and couchdb sends text/html for logs,
- // I think its more elegant to set the dataType here than where ever fetch is called
- fetch: function (options) {
- options = options ? options : {};
-
- return Backbone.Collection.prototype.fetch.call(this, _.extend(options, {dataType: "html"}));
- },
-
- parse: function (resp) {
- var lines = resp.split(/\n/);
- return _.foldr(lines, function (acc, logLine) {
- var match = logLine.match(/^\[(.*?)\]\s\[(.*?)\]\s\[(.*?)\]\s(.*)/);
-
- if (!match) { return acc;}
-
- acc.push({
- date: match[1],
- log_level: match[2],
- pid: match[3],
- args: match[4]
- });
-
- return acc;
- }, []);
- }
- });
-
- Log.events = {};
- _.extend(Log.events, Backbone.Events);
-
- Log.Views.View = FauxtonAPI.View.extend({
- template: "addons/logs/templates/dashboard",
-
- initialize: function (options) {
- this.refreshTime = options.refreshTime || 5000;
-
- Log.events.on("log:filter", this.filterLogs, this);
- Log.events.on("log:remove", this.removeFilterLogs, this);
-
- this.filters = [];
-
- this.collection.on("add", function () {
- this.render();
- }, this);
- },
-
- establish: function () {
- return [this.collection.fetch()];
- },
-
- serialize: function () {
- return { logs: new Log.Collection(this.createFilteredCollection())};
- },
-
- afterRender: function () {
- this.startRefreshInterval();
- },
-
- cleanup: function () {
- this.stopRefreshInterval();
- },
-
- filterLogs: function (filter) {
- this.filters.push(filter);
- this.render();
- },
-
- createFilteredCollection: function () {
- var that = this;
-
- return _.reduce(this.filters, function (logs, filter) {
-
- return _.filter(logs, function (log) {
- var match = false;
-
- _.each(log, function (value) {
- if (value.toString().match(new RegExp(filter))) {
- match = true;
- }
- });
- return match;
- });
-
-
- }, this.collection.toJSON(), this);
-
- },
-
- removeFilterLogs: function (filter) {
- this.filters.splice(this.filters.indexOf(filter), 1);
- this.render();
- },
-
- startRefreshInterval: function () {
- var collection = this.collection;
-
- // Interval already set
- if (this.intervalId) { return ; }
-
- this.intervalId = setInterval(function () {
- collection.fetch();
- }, this.refreshTime);
-
- },
-
- stopRefreshInterval: function () {
- clearInterval(this.intervalId);
- }
- });
-
- Log.Views.FilterView = FauxtonAPI.View.extend({
- template: "addons/logs/templates/sidebar",
-
- events: {
- "submit #log-filter-form": "filterLogs"
- },
-
- filterLogs: function (event) {
- event.preventDefault();
- var $filter = this.$('input[name="filter"]'),
- filter = $filter.val();
-
- Log.events.trigger("log:filter", filter);
-
- this.insertView("#filter-list", new Log.Views.FilterItemView({
- filter: filter
- })).render();
-
- $filter.val('');
- }
-
- });
-
- Log.Views.FilterItemView = FauxtonAPI.View.extend({
- template: "addons/logs/templates/filterItem",
- tagName: "li",
-
- initialize: function (options) {
- this.filter = options.filter;
- },
-
- events: {
- "click .remove-filter": "removeFilter"
- },
-
- serialize: function () {
- return {
- filter: this.filter
- };
- },
-
- removeFilter: function (event) {
- event.preventDefault();
-
- Log.events.trigger("log:remove", this.filter);
- this.remove();
- }
-
- });
-
-
- return Log;
-
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/logs/routes.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/logs/routes.js b/apps/fauxton/app/addons/logs/routes.js
deleted file mode 100644
index 5c937af..0000000
--- a/apps/fauxton/app/addons/logs/routes.js
+++ /dev/null
@@ -1,58 +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.
-
-define([
- "app",
-
- "api",
-
- // Modules
- "addons/logs/resources"
-],
-
-function(app, FauxtonAPI, Log) {
-
- var LogRouteObject = FauxtonAPI.RouteObject.extend({
- layout: "with_sidebar",
-
- crumbs: [
- {"name": "Logs", "link": "_log"}
- ],
-
- routes: {
- "_log": "showLog"
- },
-
- selectedHeader: "Log",
-
- roles: ["_admin"],
-
- apiUrl: function() {
- return [this.logs.url(), this.logs.documentation];
- },
-
- initialize: function () {
- this.logs = new Log.Collection();
- this.setView("#sidebar-content", new Log.Views.FilterView({}));
- },
-
- showLog: function () {
- this.setView("#dashboard-content", new Log.Views.View({collection: this.logs}));
- }
- });
-
- Log.RouteObjects = [LogRouteObject];
-
- return Log;
-
-});
-
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/logs/templates/dashboard.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/logs/templates/dashboard.html b/apps/fauxton/app/addons/logs/templates/dashboard.html
deleted file mode 100644
index 199794c..0000000
--- a/apps/fauxton/app/addons/logs/templates/dashboard.html
+++ /dev/null
@@ -1,46 +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.
--->
-
- <h2> CouchDB Logs </h2>
- <table class="table table-bordered" >
- <thead>
- <tr>
- <th class="Date">Date</th>
- <th class="Log Level">Log Value</th>
- <th class="Pid">Pid</th>
- <th class="Args">Url</th>
- </tr>
- </thead>
-
- <tbody>
- <% logs.each(function (log) { %>
- <tr class="<%= log.logLevel() %>">
- <td>
- <!-- TODO: better format the date -->
- <%= log.date() %>
- </td>
- <td>
- <%= log.logLevel() %>
- </td>
- <td>
- <%= log.pid() %>
- </td>
- <td>
- <!-- TODO: split the line, maybe put method in it's own column -->
- <%= log.args() %>
- </td>
- </tr>
- <% }); %>
- </tbody>
-</table>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/logs/templates/filterItem.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/logs/templates/filterItem.html b/apps/fauxton/app/addons/logs/templates/filterItem.html
deleted file mode 100644
index c4e885a..0000000
--- a/apps/fauxton/app/addons/logs/templates/filterItem.html
+++ /dev/null
@@ -1,16 +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.
--->
-
-<span class="label label-info"> <%= filter %> </span>
-<a class="label label-info remove-filter" href="#">×</a>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/logs/templates/sidebar.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/logs/templates/sidebar.html b/apps/fauxton/app/addons/logs/templates/sidebar.html
deleted file mode 100644
index 59b10ac..0000000
--- a/apps/fauxton/app/addons/logs/templates/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="log-sidebar">
- <header>Log Filter</header>
- <form class="form-inline" id="log-filter-form">
- <fieldset>
- <input type="text" name="filter" placeholder="Type a filter to sort the logs by">
- <!-- TODO: filter by method -->
- <!-- TODO: correct removed filter behaviour -->
- <button type="submit" class="btn">Filter</button>
- <span class="help-block"> <h6> Eg. debug or <1.4.1> or any regex </h6> </span>
- </fieldset>
- </form>
- <ul id="filter-list"></ul>
-</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/logs/tests/logSpec.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/logs/tests/logSpec.js b/apps/fauxton/app/addons/logs/tests/logSpec.js
deleted file mode 100644
index 621cc9b..0000000
--- a/apps/fauxton/app/addons/logs/tests/logSpec.js
+++ /dev/null
@@ -1,38 +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.
-define([
- 'addons/logs/base',
- 'chai'
-], function (Log, chai) {
- var expect = chai.expect;
-
- describe('Logs Addon', function(){
-
- describe('Log Model', function () {
- var log;
-
- beforeEach(function () {
- log = new Log.Model({
- log_level: 'DEBUG',
- pid: '1234',
- args: 'testing 123',
- date: (new Date()).toString()
- });
- });
-
- it('should have a log level', function () {
- expect(log.logLevel()).to.equal('DEBUG');
- });
-
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/permissions/assets/less/permissions.less
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/permissions/assets/less/permissions.less b/apps/fauxton/app/addons/permissions/assets/less/permissions.less
deleted file mode 100644
index 7ce4d10..0000000
--- a/apps/fauxton/app/addons/permissions/assets/less/permissions.less
+++ /dev/null
@@ -1,44 +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.
-
-.border-hdr {
- border-bottom: 1px solid #E3E3E3;
- margin-bottom: 10px;
- .help{
-
- }
- h3{
- text-transform: capitalize;
- margin-bottom: 0;
- }
-}
-
-
-.permission-items.unstyled{
- margin-left: 0px;
- li {
- padding: 5px;
- border-bottom: 1px solid #E3E3E3;
- border-right: 1px solid #E3E3E3;
- border-left: 3px solid #E3E3E3;
- &:first-child{
- border-top: 1px solid #E3E3E3;
- }
- &:nth-child(odd){
- border-left: 3px solid red;
- }
- button {
- float: right;
- margin-bottom: 6px;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/permissions/base.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/permissions/base.js b/apps/fauxton/app/addons/permissions/base.js
deleted file mode 100644
index 016ba1c..0000000
--- a/apps/fauxton/app/addons/permissions/base.js
+++ /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.
-
-define([
- "app",
- "api",
- "addons/permissions/routes"
-],
-
-function(app, FauxtonAPI, Permissions) {
-
- Permissions.initialize = function() {};
-
- return Permissions;
-});
-
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/permissions/resources.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/permissions/resources.js b/apps/fauxton/app/addons/permissions/resources.js
deleted file mode 100644
index 66eaffd..0000000
--- a/apps/fauxton/app/addons/permissions/resources.js
+++ /dev/null
@@ -1,70 +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.
-
-define([
- "app",
- "api"
-],
-function (app, FauxtonAPI ) {
- var Permissions = FauxtonAPI.addon();
-
- Permissions.Security = Backbone.Model.extend({
- defaults: {
- admins: {
- names: [],
- roles: []
- },
-
- members: {
- names: [],
- roles: []
- }
- },
-
- isNew: function () {
- return false;
- },
-
- initialize: function (attrs, options) {
- this.database = options.database;
- },
-
- url: function () {
- return this.database.id + '/_security';
- },
-
- addItem: function (value, type, section) {
- var sectionValues = this.get(section);
-
- if (!sectionValues || !sectionValues[type]) {
- return {
- error: true,
- msg: 'Section ' + section + 'does not exist'
- };
- }
-
- if (sectionValues[type].indexOf(value) > -1) {
- return {
- error: true,
- msg: 'Role/Name has already been added'
- };
- }
-
- sectionValues[type].push(value);
- return this.set(section, sectionValues);
- }
-
- });
-
- return Permissions;
-});
-
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/permissions/routes.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/permissions/routes.js b/apps/fauxton/app/addons/permissions/routes.js
deleted file mode 100644
index 89c2bd7..0000000
--- a/apps/fauxton/app/addons/permissions/routes.js
+++ /dev/null
@@ -1,63 +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.
-
-define([
- "app",
- "api",
- "modules/databases/base",
- "addons/permissions/views"
-],
-function (app, FauxtonAPI, Databases, Permissions) {
-
- var PermissionsRouteObject = FauxtonAPI.RouteObject.extend({
- layout: 'one_pane',
- selectedHeader: 'Databases',
-
- routes: {
- 'database/:database/permissions': 'permissions'
- },
-
- initialize: function (route, masterLayout, options) {
- var docOptions = app.getParams();
- docOptions.include_docs = true;
-
- this.databaseName = options[0];
- this.database = new Databases.Model({id:this.databaseName});
- this.security = new Permissions.Security(null, {
- database: this.database
- });
- },
-
- establish: function () {
- return [this.database.fetch(), this.security.fetch()];
- },
-
- permissions: function () {
- this.setView('#dashboard-content', new Permissions.Permissions({
- database: this.database,
- model: this.security
- }));
-
- },
-
- crumbs: function () {
- return [
- {"name": this.database.id, "link": Databases.databaseUrl(this.database)},
- {"name": "Permissions", "link": "/permissions"}
- ];
- },
-
- });
-
- Permissions.RouteObjects = [PermissionsRouteObject];
- return Permissions;
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/permissions/templates/item.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/permissions/templates/item.html b/apps/fauxton/app/addons/permissions/templates/item.html
deleted file mode 100644
index 616ffd6..0000000
--- a/apps/fauxton/app/addons/permissions/templates/item.html
+++ /dev/null
@@ -1,17 +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.
--->
-
-<span> <%= item %> </span>
-<button type="button" class="close">×</button>
-
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/permissions/templates/permissions.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/permissions/templates/permissions.html b/apps/fauxton/app/addons/permissions/templates/permissions.html
deleted file mode 100644
index 99c9ff5..0000000
--- a/apps/fauxton/app/addons/permissions/templates/permissions.html
+++ /dev/null
@@ -1,15 +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="sections"> </div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/permissions/templates/section.html
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/permissions/templates/section.html b/apps/fauxton/app/addons/permissions/templates/section.html
deleted file mode 100644
index 3360308..0000000
--- a/apps/fauxton/app/addons/permissions/templates/section.html
+++ /dev/null
@@ -1,46 +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.
--->
-<header class="border-hdr">
-<h3> <%= (section) %> </h3>
-<p id="help"> <%= help %> <a href="<%=getDocUrl('database_permission')%>" target="_blank"><i class="icon-question-sign"> </i> </a></p>
-</header>
-
-<div class="row">
- <div class="span6">
- <header>
- <h4> Users </h4>
- <p>Specify users who will have <%= section %> access to this database.</p>
- </header>
- <form class="permission-item-form form-inline">
- <input data-section="<%= section %>" data-type="names" type="text" class="item input-small" placeholder="Add Name">
- <button type="submit" class="button btn green fonticon-circle-plus">Add Name</button>
- </form>
- <ul class="clearfix unstyled permission-items span10" id="<%= (section) %>-items-names">
- </ul>
- </div>
- <div class="span6">
- <header>
- <h4> Roles </h4>
- <p>All users under the following role(s) will have <%= section %> access.</p>
- </header>
-
-
- <form class="permission-item-form form-inline">
- <input data-section="<%= section %>" data-type="roles" type="text" class="item input-small" placeholder="Add Role">
- <button type="submit" class="button btn green fonticon-circle-plus">Add Role</button>
- </form>
- <ul class="unstyled permission-items span10" id="<%= (section) %>-items-roles">
- </ul>
- </div>
-</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/permissions/tests/resourceSpec.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/permissions/tests/resourceSpec.js b/apps/fauxton/app/addons/permissions/tests/resourceSpec.js
deleted file mode 100644
index f73687a..0000000
--- a/apps/fauxton/app/addons/permissions/tests/resourceSpec.js
+++ /dev/null
@@ -1,51 +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.
-define([
- 'api',
- 'addons/permissions/resources',
- 'testUtils'
-], function (FauxtonAPI, Models, testUtils) {
- var assert = testUtils.assert;
-
- describe('Permissions', function () {
-
- describe('#addItem', function () {
- var security;
-
- beforeEach(function () {
- security = new Models.Security(null, {database: 'fakedb'});
- });
-
- it('Should add value to section', function () {
-
- security.addItem('_user', 'names', 'admins');
- assert.equal(security.get('admins').names[0], '_user');
- });
-
- it('Should handle incorrect type', function () {
- security.addItem('_user', 'asdasd', 'admins');
- });
-
- it('Should handle incorrect section', function () {
- security.addItem('_user', 'names', 'Asdasd');
- });
-
- it('Should reject duplicates', function () {
- security.addItem('_user', 'names', 'admins');
- security.addItem('_user', 'names', 'admins');
- assert.equal(security.get('admins').names.length, 1);
- });
- });
-
- });
-
-});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/941a8236/apps/fauxton/app/addons/permissions/tests/viewsSpec.js
----------------------------------------------------------------------
diff --git a/apps/fauxton/app/addons/permissions/tests/viewsSpec.js b/apps/fauxton/app/addons/permissions/tests/viewsSpec.js
deleted file mode 100644
index e5330c0..0000000
--- a/apps/fauxton/app/addons/permissions/tests/viewsSpec.js
+++ /dev/null
@@ -1,159 +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.
-define([
- 'api',
- 'addons/permissions/views',
- 'addons/permissions/resources',
- 'testUtils'
-], function (FauxtonAPI, Views, Models, testUtils) {
- var assert = testUtils.assert,
- ViewSandbox = testUtils.ViewSandbox;
-
- describe('Permission View', function () {
-
- beforeEach(function () {
- security = new Models.Security({'admins': {
- 'names': ['_user'],
- 'roles': []
- }
- }, {database: 'fakedb'});
-
- section = new Views.Permissions({
- database: 'fakedb',
- model: security
- });
-
- viewSandbox = new ViewSandbox();
- viewSandbox.renderView(section);
- });
-
- afterEach(function () {
- viewSandbox.remove();
- });
-
- describe('itemRemoved', function () {
-
- it('Should set model', function () {
- var saveMock = sinon.spy(security, 'set');
- Views.events.trigger('itemRemoved');
-
- assert.ok(saveMock.calledOnce);
- var args = saveMock.args;
- assert.deepEqual(args[0][0], {"admins":{"names":["_user"],"roles":[]},"members":{"names":[],"roles":[]}});
- });
-
- it('Should save model', function () {
- var saveMock = sinon.spy(security, 'save');
- Views.events.trigger('itemRemoved');
-
- assert.ok(saveMock.calledOnce);
- });
- });
-
- });
-
- describe('PermissionsSection', function () {
- var section, security;
-
- beforeEach(function () {
- security = new Models.Security({'admins': {
- 'names': ['_user'],
- 'roles': []
- }
- }, {database: 'fakedb'});
-
- section = new Views.PermissionSection({
- section: 'admins',
- model: security
- });
-
- viewSandbox = new ViewSandbox();
- viewSandbox.renderView(section);
- });
-
- afterEach(function () {
- viewSandbox.remove();
- });
-
- describe('#discardRemovedViews', function () {
- it('Should not filter out active views', function () {
- section.discardRemovedViews();
-
- assert.equal(section.nameViews.length, 1);
-
- });
-
- it('Should filter out removed views', function () {
- section.nameViews[0].removed = true;
- section.discardRemovedViews();
-
- assert.equal(section.nameViews.length, 0);
-
- });
-
- });
-
- describe('#getItemFromView', function () {
-
- it('Should return item list', function () {
- var items = section.getItemFromView(section.nameViews);
-
- assert.deepEqual(items, ['_user']);
- });
-
- });
-
- describe('#addItems', function () {
-
- it('Should add item to model', function () {
- //todo add a test here
-
- });
-
- });
-
- });
-
- describe('PermissionItem', function () {
- var item;
-
- beforeEach(function () {
- item = new Views.PermissionItem({
- item: '_user'
- });
-
- viewSandbox = new ViewSandbox();
- viewSandbox.renderView(item);
- });
-
- afterEach(function () {
- viewSandbox.remove();
- });
-
- it('should trigger event on remove item', function () {
- var eventSpy = sinon.spy();
-
- Views.events.on('itemRemoved', eventSpy);
-
- item.$('.close').click();
-
- assert.ok(eventSpy.calledOnce);
- });
-
- it('should set removed to true', function () {
- item.$('.close').click();
-
- assert.ok(item.removed);
- });
- });
-
-});