-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'fork/master' into user-edit
- Loading branch information
Showing
116 changed files
with
1,338 additions
and
993 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ FROM cypress/browsers:chrome67 | |
ENV APP /usr/src/app | ||
WORKDIR $APP | ||
|
||
RUN npm install --no-save cypress @percy/cypress > /dev/null | ||
RUN npm install --no-save [email protected] cypress@^3.1.5 @percy/cypress@^0.2.3 > /dev/null | ||
|
||
COPY cypress $APP/cypress | ||
COPY cypress.json $APP/cypress.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,8 @@ jobs: | |
command: | | ||
npm run cypress start | ||
docker-compose run cypress node ./cypress/cypress.js db-seed | ||
# Make sure the API key is the same so Percy snapshots are consistent | ||
docker-compose -p cypress run postgres psql -U postgres -h postgres -c "update users set api_key = 'secret' where email ='[email protected]';" | ||
- run: | ||
name: Execute Cypress tests | ||
command: npm run cypress run-ci | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,38 @@ | ||
engines: | ||
version: "2" | ||
checks: | ||
complex-logic: | ||
enabled: false | ||
file-lines: | ||
enabled: false | ||
method-complexity: | ||
enabled: false | ||
method-count: | ||
enabled: false | ||
method-lines: | ||
config: | ||
threshold: 100 | ||
nested-control-flow: | ||
enabled: false | ||
identical-code: | ||
enabled: false | ||
plugins: | ||
pep8: | ||
enabled: true | ||
eslint: | ||
enabled: true | ||
channel: "eslint-3" | ||
channel: "eslint-5" | ||
config: | ||
config: client/.eslintrc.js | ||
checks: | ||
import/no-unresolved: | ||
enabled: false | ||
ratings: | ||
paths: | ||
- "redash/**/*.py" | ||
- "client/**/*.js" | ||
exclude_paths: | ||
- tests/**/*.py | ||
- migrations/**/*.py | ||
- old_migrations/**/*.py | ||
- setup/**/* | ||
- bin/**/* | ||
|
||
no-multiple-empty-lines: # TODO: Enable | ||
enabled: false | ||
exclude_patterns: | ||
- "tests/**/*.py" | ||
- "migrations/**/*.py" | ||
- "setup/**/*" | ||
- "bin/**/*" | ||
- "**/node_modules/" | ||
- "client/dist/" | ||
- "**/*.pyc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,4 +61,3 @@ export default function init(ngModule) { | |
} | ||
|
||
init.init = true; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { react2angular } from 'react2angular'; | ||
import { $rootScope } from '@/services/ng'; | ||
|
||
function toggleItem(event, item, callback) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
|
||
const action = item.is_favorite ? item.$unfavorite.bind(item) : item.$favorite.bind(item); | ||
const savedIsFavorite = item.is_favorite; | ||
|
||
action().then(() => { | ||
item.is_favorite = !savedIsFavorite; | ||
$rootScope.$broadcast('reloadFavorites'); | ||
callback(); | ||
}); | ||
} | ||
|
||
export function FavoritesControl({ item, onChange }) { | ||
const icon = item.is_favorite ? 'fa fa-star' : 'fa fa-star-o'; | ||
const title = item.is_favorite ? 'Remove from favorites' : 'Add to favorites'; | ||
return ( | ||
<a | ||
href="javascript:void(0)" | ||
title={title} | ||
className="btn-favourite" | ||
onClick={event => toggleItem(event, item, onChange)} | ||
> | ||
<i className={icon} aria-hidden="true" /> | ||
</a> | ||
); | ||
} | ||
|
||
FavoritesControl.propTypes = { | ||
item: PropTypes.shape({ | ||
is_favorite: PropTypes.bool.isRequired, | ||
}).isRequired, | ||
onChange: PropTypes.func, | ||
// Force component update when `item` changes. | ||
// Remove this when `react2angular` will finally go to hell | ||
forceUpdate: PropTypes.string.isRequired, // eslint-disable-line react/no-unused-prop-types | ||
}; | ||
|
||
FavoritesControl.defaultProps = { | ||
onChange: () => {}, | ||
}; | ||
|
||
export default function init(ngModule) { | ||
ngModule.component('favoritesControlImpl', react2angular(FavoritesControl)); | ||
ngModule.component('favoritesControl', { | ||
template: ` | ||
<favorites-control-impl | ||
ng-if="$ctrl.item" | ||
item="$ctrl.item" | ||
on-change="$ctrl.onChange" | ||
force-update="$ctrl.forceUpdateTag" | ||
></favorites-control-impl> | ||
`, | ||
bindings: { | ||
item: '=', | ||
}, | ||
controller($scope) { | ||
// See comment for FavoritesControl.propTypes.forceUpdate | ||
this.forceUpdateTag = 'force' + Date.now(); | ||
$scope.$on('reloadFavorites', () => { | ||
this.forceUpdateTag = 'force' + Date.now(); | ||
}); | ||
|
||
this.onChange = () => { | ||
$scope.$applyAsync(); | ||
}; | ||
}, | ||
}); | ||
} | ||
|
||
init.init = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.