Skip to content

Commit 277861a

Browse files
Aaron TobiasAaron Tobias
Aaron Tobias
authored and
Aaron Tobias
committed
Merged with latest master - 1205
2 parents 66a8775 + 1e60fd8 commit 277861a

36 files changed

+17661
-18876
lines changed

.babelrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"presets": [
3-
"react",
4-
"es2015"
3+
"@babel/react",
4+
"@babel/env"
55
],
6-
"plugins": ["transform-object-assign", "transform-object-rest-spread",
7-
"transform-class-properties", "array-includes","transform-async-to-generator"]
6+
"plugins": ["@babel/plugin-transform-object-assign", "@babel/plugin-proposal-object-rest-spread",
7+
"@babel/plugin-proposal-class-properties", "babel-plugin-array-includes","@babel/plugin-transform-async-to-generator"]
88
}

.eslintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,11 @@
7878
"expect": true,
7979
"prettyPrint": true,
8080
"jest": true
81+
},
82+
83+
"settings": {
84+
"react": {
85+
"version": "detect"
86+
}
8187
}
8288
}

CONTRIBUTING.md

Lines changed: 9 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -12,72 +12,23 @@ Contributions to CouchDB are governed by our [Code of Conduct][6] and a set of
1212
[Project Bylaws][7]. Apache CouchDB itself also has a [CONTRIBUTING.md][9] if
1313
you want to help with the larger project. Come join us!
1414

15-
1615
## Contributor quick start
1716

1817
If you never created a pull request before, welcome :tada: :smile: [Here is a great tutorial](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
1918
on how to send one :)
2019

21-
The [Readme file](https://github.com/apache/couchdb-fauxton/blob/master/readme.md) has information about how to get the project running.
22-
23-
Instructions to get a dev environment up and running as fast as possible:
24-
25-
First, ensure that you have Node and npm installed. You should also have either CouchDB 2.0+ or PouchDB Server. The easiest to install is PouchDB Server:
26-
27-
```
28-
npm install -g pouchdb-server
29-
pouchdb-server --port 5984
30-
```
31-
32-
Now that we have a CouchDB (or PouchDB Server) up and running, check out the code:
33-
34-
```
35-
git clone https://github.com/apache/couchdb-fauxton
36-
cd couchdb-fauxton
37-
npm install
38-
```
39-
40-
Next, copy `settings.json.default.json` to `settings.json`. This will be our local settings file.
41-
42-
In the `settings.json`, under `"development"` -> `"app"`, change the `"host"` to point to your local CouchDB or PouchDB Server, e.g.:
43-
44-
```js
45-
"development": {
46-
/* ... */
47-
"app": {
48-
/* ... */
49-
"host": "http://localhost:5984"
50-
}
51-
}
52-
```
53-
54-
Now run:
55-
56-
npm run dev
57-
58-
And your Fauxton dev server will be up and running at `localhost:8000`.
59-
20+
The [Readme file](https://github.com/apache/couchdb-fauxton/blob/master/readme.md) has information about how to get the project set up for development.
6021

6122
## Guide to Contributions
6223

63-
We follow our coding-styleguide to make it easier for everyone to write, read and review code:
24+
We follow our coding-styleguide to make it easier for everyone to write, read and review code:
6425
[https://github.com/apache/couchdb-fauxton/blob/master/styleguide.md](https://github.com/apache/couchdb-fauxton/blob/master/styleguide.md)
6526

6627
To start working on a specific ticket, create a branch with the GitHub Issue # followed by a traincase description of the issue.
6728

68-
> e.g. 1234-Added-support-for-list-functions
69-
70-
If there is no GH Issue for the issue you have, you don't have to create one.
29+
> e.g. 1234-Added-support-for-list-functions
7130
72-
Please describe the issue, how it happens and how you fixed it in the commit message. Before you submit the Pull
73-
Request, please run our testsuite and make sure that it passes:
74-
75-
```
76-
grunt test
77-
```
78-
79-
You can also open `couchdb-fauxton/test/runner.html` in a browser. Click on the headlines of the testcases to just run
80-
a specific test that fails - it should be faster than running the whole testsuite every time.
31+
If there is no GH Issue for the issue you have, you don't have to create one. Please describe the issue, how it happens and how you fixed it in the commit message.
8132

8233
Commit messages should follow the following style:
8334

@@ -92,20 +43,21 @@ Fixes #XXX (if there is a GH Issue)
9243
Fixes apache/couchdb#XXX (if there is a CouchDB project GH Issue)
9344
```
9445

95-
When you're ready for a review, submit a Pull Request. We regularly check the PR list for Fauxton and should get back
96-
to you with a code review. If no one has responded to you yet, you can find us on [Freenode IRC in #couchdb-dev][8].
46+
Before you submit the Pull Request, please [run our test suite](#tests.md) and make sure that it passes.
47+
48+
We regularly check the PR list for Fauxton and should get back
49+
to you with a code review. If no one has responded to you yet, you can find us on [Freenode IRC in #couchdb-dev][8].
9750
Ping **garren**, **robertkowalski** or **michellep** though anyone in the room should be able to help you.
9851

9952
## Get in Touch
10053

101-
We appreciate constructive feedback from people who use CouchDB, so don't be shy. We know there are bugs and we know
54+
We appreciate constructive feedback from people who use CouchDB, so don't be shy. We know there are bugs and we know
10255
there is room for improvement.
10356

10457
ʕ´•ᴥ•`ʔ Thanks!
10558

10659
-- Fauxton team
10760

108-
10961
[6]: http://couchdb.apache.org/conduct.html
11062
[7]: http://couchdb.apache.org/bylaws.html
11163
[8]: http://webchat.freenode.net?channels=%23couchdb-dev

app/addons/activetasks/container.js

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,16 @@
1010
// License for the specific language governing permissions and limitations under
1111
// the License.
1212

13-
import { connect } from 'react-redux';
13+
import {connect} from 'react-redux';
1414
import Controller from './layout';
15-
import {
16-
init,
17-
changePollingInterval,
18-
setSearchTerm,
19-
sortByColumnHeader,
20-
switchTab,
21-
runPollingUpdate
22-
} from './actions';
15+
import {init, setSearchTerm, sortByColumnHeader, switchTab, runPollingUpdate} from './actions';
2316
import {
2417
getTasks,
2518
getHeaderIsAscending,
2619
getSelectedRadio,
2720
getSortByHeader,
2821
getSearchTerm,
29-
getIsLoading
22+
getIsLoading,
3023
} from './reducers';
3124

3225
const mapStateToProps = ({activetasks}) => {
@@ -36,18 +29,17 @@ const mapStateToProps = ({activetasks}) => {
3629
selectedRadio: getSelectedRadio(activetasks),
3730
sortByHeader: getSortByHeader(activetasks),
3831
searchTerm: getSearchTerm(activetasks),
39-
isLoading: getIsLoading(activetasks)
32+
isLoading: getIsLoading(activetasks),
4033
};
4134
};
4235

43-
const mapDispatchToProps = (dispatch) => {
36+
const mapDispatchToProps = dispatch => {
4437
return {
4538
init: () => dispatch(init()),
46-
changePollingInterval: (interval) => dispatch(changePollingInterval(interval)),
47-
setSearchTerm: (term) => dispatch(setSearchTerm(term)),
48-
sortByColumnHeader: (column) => dispatch(sortByColumnHeader(column)),
49-
switchTab: (tab) => dispatch(switchTab(tab)),
50-
runPollingUpdate: () => dispatch(runPollingUpdate())
39+
setSearchTerm: term => dispatch(setSearchTerm(term)),
40+
sortByColumnHeader: column => dispatch(sortByColumnHeader(column)),
41+
switchTab: tab => dispatch(switchTab(tab)),
42+
runPollingUpdate: () => dispatch(runPollingUpdate()),
5143
};
5244
};
5345

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
2+
// use this file except in compliance with the License. You may obtain a copy of
3+
// the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
// License for the specific language governing permissions and limitations under
11+
// the License.
12+
13+
import {Accordion, AccordionItem} from '../components/accordion';
14+
import {mount} from 'enzyme';
15+
import React from 'react';
16+
import sinon from 'sinon';
17+
18+
describe('Accordion', () => {
19+
it('Shows and hides content after clicking on header', () => {
20+
const el = mount(
21+
<Accordion>
22+
<AccordionItem title={'Click to open'}>
23+
<p id="test_content">Have a great day</p>
24+
</AccordionItem>
25+
</Accordion>
26+
);
27+
28+
expect(el.find('.faux--accordion__item-content').hasClass('in')).toBe(false);
29+
el.find('.faux--accordion__item-header').simulate('click');
30+
expect(el.find('.faux--accordion__item-content').hasClass('in')).toBe(true);
31+
});
32+
33+
it('Calls onClick event', () => {
34+
const spy = sinon.spy();
35+
const el = mount(
36+
<Accordion>
37+
<AccordionItem title={'Click to open'} onClick={spy}>
38+
<p id="test_content">Have a great day</p>
39+
</AccordionItem>
40+
</Accordion>
41+
);
42+
43+
el.find('.faux--accordion__item-header').simulate('click');
44+
sinon.assert.called(spy);
45+
});
46+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.faux--accordion {
2+
list-style: none;
3+
margin: 0px;
4+
width: 100%;
5+
}
6+
7+
.faux--accordion__item {
8+
background-color: transparent;
9+
transition: all 0.5s linear;
10+
}
11+
12+
.faux--accordion__item-header {
13+
border: 0;
14+
background-color: transparent;
15+
color: inherit;
16+
font-size: inherit;
17+
padding-left: 0px;
18+
span {
19+
padding-left: 0.5rem;
20+
}
21+
}
22+
23+
.faux--accordion__item-content {
24+
padding-left: 1.35rem;
25+
padding-top: 0.75rem;
26+
font-size: inherit;
27+
}

app/addons/components/assets/less/components.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
@import "../../../../../assets/less/variables.less";
1414

15+
@import "accordion.less";
1516
@import "header-togglebutton.less";
1617
@import "styled-select.less";
1718
@import "docs.less";

app/addons/components/assets/less/jsonlink.less

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
padding: 16px 12px 12px 12px !important;
1717
height: 64px;
1818
background-color: rgba(0, 0, 0, 0);
19+
text-align: center;
20+
min-width: 55px;
1921
}
2022

2123
.faux__jsonlink-link {
@@ -38,15 +40,6 @@
3840
font-weight: 500;
3941
}
4042

41-
@media screen and (max-width: 1200px) {
42-
.faux__jsonlink-link {
43-
font-size: 10px;
44-
}
45-
.faux__jsonlink-link-brackets {
46-
font-size: 12px;
47-
}
48-
}
49-
5043
.faux__doclink {
5144
text-align: center;
5245
width: 55px;
@@ -69,3 +62,19 @@
6962
text-decoration: none;
7063
color: #666;
7164
}
65+
66+
@media (max-width: 1090px) {
67+
#main:not(.closeMenu) {
68+
.faux__jsonlink-link-label{
69+
display: none;
70+
}
71+
}
72+
}
73+
74+
@media (max-width: 1120px) {
75+
#main.closeMenu {
76+
.faux__jsonlink-link-label{
77+
display: none;
78+
}
79+
}
80+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
2+
// use this file except in compliance with the License. You may obtain a copy of
3+
// the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
// License for the specific language governing permissions and limitations under
11+
// the License.
12+
13+
import PropTypes from 'prop-types';
14+
import React from 'react';
15+
import {Collapse} from 'react-bootstrap';
16+
import classnames from 'classnames';
17+
18+
export const Accordion = props => {
19+
const {children, className, style} = props;
20+
const classNames = classnames('faux--accordion', className);
21+
return (
22+
<ul className={classNames} style={style}>
23+
{children}
24+
</ul>
25+
);
26+
};
27+
28+
export class AccordionItem extends React.Component {
29+
static propTypes = {
30+
title: PropTypes.string.isRequired,
31+
};
32+
33+
static defaultProps = {
34+
onClick: () => {},
35+
};
36+
37+
state = {
38+
open: false,
39+
};
40+
41+
handleClick = event => {
42+
const newOpen = !this.state.open;
43+
this.setState({open: newOpen});
44+
this.props.onClick({isOpen: newOpen, event});
45+
};
46+
47+
render() {
48+
const {children, title} = this.props;
49+
const icon = this.state.open ? 'fonticon-down-open' : 'fonticon-right-open';
50+
const contentClassNames = classnames('faux--accordion__item-content', 'collapse', {in: this.state.open});
51+
52+
return (
53+
<li className="faux--accordion__item" onClick={this.handleClick}>
54+
<button type="button" className={`faux--accordion__item-header`} onClick={this.handleClick}>
55+
<i className={icon}></i>
56+
<span>{title}</span>
57+
</button>
58+
<Collapse in={this.state.open}>
59+
<div className={contentClassNames}>{children}</div>
60+
</Collapse>
61+
</li>
62+
);
63+
}
64+
}

app/addons/components/components/apibar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
// License for the specific language governing permissions and limitations under
1111
// the License.
1212

13-
import React from "react";
14-
import ReactDOM from "react-dom";
13+
import React from 'react';
14+
import ReactDOM from 'react-dom';
1515

1616
export const JSONLink = ({endpoint}) => {
1717
if (!endpoint) {
@@ -22,7 +22,7 @@ export const JSONLink = ({endpoint}) => {
2222
<div className="faux__jsonlink">
2323
<a data-bypass={true} className="faux__jsonlink-link" href={endpoint} target="_blank" rel="noopener noreferrer">
2424
<span className="faux__jsonlink-link-brackets">{'{\u00a0}'}</span>
25-
<span>JSON</span>
25+
<span className="faux__jsonlink-link-label">JSON</span>
2626
</a>
2727
</div>
2828
);

0 commit comments

Comments
 (0)