Skip to content

Commit

Permalink
Merge pull request #36 from cwrc/development
Browse files Browse the repository at this point in the history
Merging development into master
  • Loading branch information
lucaju authored Jan 28, 2020
2 parents 333b2d0 + e6dd57a commit 58c0330
Show file tree
Hide file tree
Showing 8 changed files with 7,130 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ after_success:
- npm run report-coverage
- npm run travis-deploy-once "npm run semantic-release"
branches:
except:
- /^v\d+\.\d+\.\d+$/
only:
- master
80 changes: 80 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"homepage": "https://github.com/cwrc/cwrc-git-dialogs#readme",
"contributors": [
"James Chartrand",
"Andrew MacDonald"
"Andrew MacDonald",
"Luciano Frizzera"
],
"license": "GPL-2.0",
"main": "src/index.js",
"scripts": {
"semantic-release": "semantic-release",
"cm": "git-cz",
"browserify": "mkdirp build && browserify test/development.js -o ./development.js --debug -t babelify",
"watch": "watchify test/development.js -o ./development.js --debug --verbose -t babelify",
"build-css": "lessc src/css/bootstrap.less src/css/bootstrap.css",
"test": "jest",
"report-coverage": "cat ./coverage/coverage-final.json | codecov",
"travis-deploy-once": "travis-deploy-once"
Expand Down Expand Up @@ -55,6 +55,7 @@
"cz-conventional-changelog": "^2.1.0",
"husky": "^2.1.0",
"jest": "^24.9.0",
"less": "^3.10.3",
"mkdirp": "0.5.1",
"semantic-release": "^15.13.12",
"travis-deploy-once": "^5.0.11",
Expand Down
17 changes: 8 additions & 9 deletions src/Load.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { Modal, Button, Tabs, Tab, Well, Grid, Row, Col, PanelGroup, Panel, List
import parseLinks from 'parse-link-header';
import cwrcGit from './GitServerClient.js';

import RepoResultList from "./RepoResultList.js";
import SearchResultList from "./SearchResultList.js";
import FileUpload from "./FileUpload.js";
import Paginator from "./Paginator.js";
import SearchInput from "./SearchInput.js";
import RepoResultCarousel from './RepoResultCarousel.js';

const RESULTS_PER_PAGE = 10;
const RESULTS_PER_PAGE = 100;

function getReposForGithubUser(user, requestedPage, resultsPerPage=RESULTS_PER_PAGE) {
return cwrcGit.getReposForGithubUser(user, requestedPage, resultsPerPage).then((results)=>{
Expand All @@ -35,7 +35,7 @@ function getReposForAuthenticatedGithubUser(requestedPage, affiliation='owner',
});
}

function getSearchResults(gitName, searchTerms, requestedPage, resultsPerPage=RESULTS_PER_PAGE) {
function searchFileContentsForUser(gitName, searchTerms, requestedPage, resultsPerPage=RESULTS_PER_PAGE) {
let queryString = 'language:xml ';
if (searchTerms) queryString += '"' + searchTerms + '" ';
if (gitName) queryString += "user:" + gitName;
Expand All @@ -46,7 +46,7 @@ function getSearchResults(gitName, searchTerms, requestedPage, resultsPerPage=RE
});
}, (fail)=>{
return Promise.reject(fail);
});;
});
}

function getLastPage(results, requestedPage) {
Expand Down Expand Up @@ -151,14 +151,14 @@ class LoadDialog extends Component {
this.setState({loading: true, error: '', isSearch: true, query: value});
let promise;
if (this.state.repoType === 'private') {
promise = getSearchResults(this.props.user.userId, value, pageNum)
promise = searchFileContentsForUser(this.props.user.userId, value, pageNum)
} else {
let filter = this.filterInput.value;
if (filter && !value) {
this.setState({isSearch: false});
promise = getReposForGithubUser(filter, pageNum);
} else {
promise = getSearchResults(filter, value, pageNum);
promise = searchFileContentsForUser(filter, value, pageNum);
}
}
promise.then((result)=>{
Expand Down Expand Up @@ -275,7 +275,7 @@ class LoadDialog extends Component {
</Panel.Collapse>
</Panel>
</PanelGroup>
<SearchInput placeholder="Search within repositories" style={{marginTop: '10px'}} onChange={this.handleSearchChange} onSearch={(value)=>{this.doSearch(1,value)}} onClear={this.handleSearchClear} />
<SearchInput placeholder="Search XML files within repos" style={{marginTop: '10px'}} onChange={this.handleSearchChange} onSearch={(value)=>{this.doSearch(1,value)}} onClear={this.handleSearchClear} />
{false ? <FormGroup style={{marginTop: '10px'}}>
<Checkbox checked={xmlOnly} onChange={this.handleXMLOnlyChange}>
Only show XML repositories
Expand All @@ -300,8 +300,7 @@ class LoadDialog extends Component {
</Well>
:
<Well bsSize="small">
<RepoResultList serverURL={this.props.serverURL} isGitLab={this.props.isGitLab} selectCB={onFileSelect} repos={results} />
<Paginator pagingCB={this.getRepos} currentPage={this.state.currentPage} lastPage={this.state.lastPage} />
<RepoResultCarousel serverURL={this.props.serverURL} isGitLab={this.props.isGitLab} selectCB={onFileSelect} repos={results} />
</Well>
)
)
Expand Down
Loading

0 comments on commit 58c0330

Please sign in to comment.