Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nicolas Frandeboeuf
kresus
Commits
63d75b59
Commit
63d75b59
authored
May 30, 2017
by
ZeHiro
Browse files
Migration React
parent
a1776b3b
Changes
45
Hide whitespace changes
Inline
Side-by-side
client/components/budget/index.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
moment
from
'
moment
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
get
,
actions
}
from
'
../../store
'
;
...
...
@@ -215,20 +216,20 @@ class Budget extends React.Component {
Budget
.
propTypes
=
{
// The list of categories.
categories
:
React
.
PropTypes
.
array
.
isRequired
,
categories
:
PropTypes
.
array
.
isRequired
,
// The list of current operations.
operations
:
React
.
PropTypes
.
array
.
isRequired
,
operations
:
PropTypes
.
array
.
isRequired
,
// The method to update a category.
updateCategory
:
React
.
PropTypes
.
func
.
isRequired
,
updateCategory
:
PropTypes
.
func
.
isRequired
,
// A method to display the reports component inside the main app, pre-filled
// with the year/month and category filters.
showOperations
:
React
.
PropTypes
.
func
.
isRequired
,
showOperations
:
PropTypes
.
func
.
isRequired
,
// An array of the months/years tuples available since the first operation.
periods
:
React
.
PropTypes
.
array
.
isRequired
periods
:
PropTypes
.
array
.
isRequired
};
const
Export
=
connect
((
state
,
ownProps
)
=>
{
...
...
client/components/budget/item.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
Link
}
from
'
react-router-dom
'
;
import
{
connect
}
from
'
react-redux
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
actions
}
from
'
../../store
'
;
...
...
@@ -195,23 +196,23 @@ const BudgetListItem = props => {
BudgetListItem
.
propTypes
=
{
// The category related to this budget item.
cat
:
React
.
PropTypes
.
object
.
isRequired
,
cat
:
PropTypes
.
object
.
isRequired
,
// The total amount
amount
:
React
.
PropTypes
.
number
.
isRequired
,
amount
:
PropTypes
.
number
.
isRequired
,
// Whether to display in percent or not
displayInPercent
:
React
.
PropTypes
.
bool
.
isRequired
,
displayInPercent
:
PropTypes
.
bool
.
isRequired
,
// The method to update a category.
updateCategory
:
React
.
PropTypes
.
func
.
isRequired
,
updateCategory
:
PropTypes
.
func
.
isRequired
,
// A method to display the reports component inside the main app, pre-filled
// with the year/month and category filters.
showOperations
:
React
.
PropTypes
.
func
.
isRequired
,
showOperations
:
PropTypes
.
func
.
isRequired
,
// A string indicating which account is active
currentAccountId
:
React
.
PropTypes
.
string
.
isRequired
currentAccountId
:
PropTypes
.
string
.
isRequired
};
const
Export
=
connect
(
null
,
dispatch
=>
(
...
...
client/components/categories/item.js
View file @
63d75b59
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
translate
as
$t
,
NONE_CATEGORY_ID
,
assert
}
from
'
../../helpers
'
;
...
...
@@ -209,22 +210,22 @@ class CategoryListItem extends React.Component {
CategoryListItem
.
propTypes
=
{
// The category related to this item.
cat
:
React
.
PropTypes
.
object
.
isRequired
,
cat
:
PropTypes
.
object
.
isRequired
,
// The list of categories.
categories
:
React
.
PropTypes
.
array
.
isRequired
,
categories
:
PropTypes
.
array
.
isRequired
,
// The method to create a category.
createCategory
:
React
.
PropTypes
.
func
,
createCategory
:
PropTypes
.
func
,
// The method to update a category.
updateCategory
:
React
.
PropTypes
.
func
,
updateCategory
:
PropTypes
.
func
,
// The method to delete a category.
deleteCategory
:
React
.
PropTypes
.
func
,
deleteCategory
:
PropTypes
.
func
,
// A method to call when the creation of a category is cancelled.
onCancelCreation
:
React
.
PropTypes
.
func
onCancelCreation
:
PropTypes
.
func
};
export
default
CategoryListItem
;
client/components/charts/default-params-modal.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
actions
,
get
}
from
'
../../store
'
;
...
...
@@ -146,28 +147,28 @@ class DefaultParamsModal extends React.Component {
DefaultParamsModal
.
propTypes
=
{
// Unique identifier of the modal.
modalId
:
React
.
PropTypes
.
string
.
isRequired
,
modalId
:
PropTypes
.
string
.
isRequired
,
// Whether to display positive operations.
showPositiveOps
:
React
.
PropTypes
.
bool
.
isRequired
,
showPositiveOps
:
PropTypes
.
bool
.
isRequired
,
// Whether to display negative operations.
showNegativeOps
:
React
.
PropTypes
.
bool
.
isRequired
,
showNegativeOps
:
PropTypes
.
bool
.
isRequired
,
// The function to set the default amount type.
setAmountType
:
React
.
PropTypes
.
func
.
isRequired
,
setAmountType
:
PropTypes
.
func
.
isRequired
,
// The current default chart display type.
displayType
:
React
.
PropTypes
.
string
.
isRequired
,
displayType
:
PropTypes
.
string
.
isRequired
,
// The function to set the default chart display type.
setDisplayType
:
React
.
PropTypes
.
func
.
isRequired
,
setDisplayType
:
PropTypes
.
func
.
isRequired
,
// The current default chart period.
period
:
React
.
PropTypes
.
string
.
isRequired
,
period
:
PropTypes
.
string
.
isRequired
,
// The function to set the default chart period.
setPeriod
:
React
.
PropTypes
.
func
.
isRequired
setPeriod
:
PropTypes
.
func
.
isRequired
};
const
Export
=
connect
(
state
=>
{
...
...
client/components/charts/index.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
Route
,
Switch
,
Redirect
}
from
'
react-router-dom
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
get
}
from
'
../../store
'
;
import
{
translate
as
$t
}
from
'
../../helpers
'
;
...
...
@@ -86,23 +87,23 @@ const ChartsComponent = props => {
ChartsComponent
.
propTypes
=
{
// The kind of chart to display: by categories, balance, or in and outs for all accounts.
defaultDisplay
:
React
.
PropTypes
.
string
.
isRequired
,
defaultDisplay
:
PropTypes
.
string
.
isRequired
,
// The current account.
account
:
React
.
PropTypes
.
object
.
isRequired
,
account
:
PropTypes
.
object
.
isRequired
,
// The operations for the current account.
operations
:
React
.
PropTypes
.
array
.
isRequired
,
operations
:
PropTypes
.
array
.
isRequired
,
// The operations for the current accounts.
operationsCurrentAccounts
:
React
.
PropTypes
.
array
.
isRequired
,
operationsCurrentAccounts
:
PropTypes
.
array
.
isRequired
,
// The history object, providing access to the history API.
// Automatically added by the Route component.
history
:
React
.
PropTypes
.
object
.
isRequired
,
history
:
PropTypes
.
object
.
isRequired
,
// Location object (contains the current path). Automatically added by react-router.
location
:
React
.
PropTypes
.
object
.
isRequired
location
:
PropTypes
.
object
.
isRequired
};
const
Export
=
connect
((
state
,
ownProps
)
=>
{
...
...
client/components/charts/operations-by-amount-type-select.js
View file @
63d75b59
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
translate
as
$t
}
from
'
../../helpers
'
;
...
...
@@ -66,16 +67,16 @@ const OpAmountTypeSelect = props => {
OpAmountTypeSelect
.
propTypes
=
{
// The components CSS classes.
className
:
React
.
PropTypes
.
string
,
className
:
PropTypes
.
string
,
// Whether to display positive operations.
showPositiveOps
:
React
.
PropTypes
.
bool
.
isRequired
,
showPositiveOps
:
PropTypes
.
bool
.
isRequired
,
// Whether to display negative operations.
showNegativeOps
:
React
.
PropTypes
.
bool
.
isRequired
,
showNegativeOps
:
PropTypes
.
bool
.
isRequired
,
// A callback called whenever one of the inputs change.
onChange
:
React
.
PropTypes
.
func
.
isRequired
onChange
:
PropTypes
.
func
.
isRequired
};
export
default
OpAmountTypeSelect
;
client/components/charts/operations-by-category-period-select.js
View file @
63d75b59
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
translate
as
$t
}
from
'
../../helpers
'
;
...
...
@@ -40,13 +41,13 @@ const OpCatChartPeriodSelect = props => {
OpCatChartPeriodSelect
.
propTypes
=
{
// Initial value.
defaultValue
:
React
.
PropTypes
.
string
.
isRequired
,
defaultValue
:
PropTypes
.
string
.
isRequired
,
// Callback getting the id of the selected option whenever it changes.
onChange
:
React
.
PropTypes
.
func
.
isRequired
,
onChange
:
PropTypes
.
func
.
isRequired
,
// CSS unique id.
htmlId
:
React
.
PropTypes
.
string
.
isRequired
htmlId
:
PropTypes
.
string
.
isRequired
};
export
default
OpCatChartPeriodSelect
;
client/components/duplicates/default-params-modal.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
actions
,
get
}
from
'
../../store
'
;
...
...
@@ -99,13 +100,13 @@ class DefaultParamsModal extends React.Component {
DefaultParamsModal
.
propTypes
=
{
// Unique identifier of the modal
modalId
:
React
.
PropTypes
.
string
.
isRequired
,
modalId
:
PropTypes
.
string
.
isRequired
,
// The current default threshold
threshold
:
React
.
PropTypes
.
string
.
isRequired
,
threshold
:
PropTypes
.
string
.
isRequired
,
// The function to set the default threshold to detect duplicates
setThreshold
:
React
.
PropTypes
.
func
.
isRequired
setThreshold
:
PropTypes
.
func
.
isRequired
};
const
Export
=
connect
(
state
=>
{
...
...
client/components/menu/account.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
NavLink
}
from
'
react-router-dom
'
;
import
PropTypes
from
'
prop-types
'
;
const
AccountListItem
=
props
=>
{
let
{
account
,
location
}
=
props
;
...
...
@@ -30,14 +31,14 @@ const AccountListItem = props => {
AccountListItem
.
propTypes
=
{
// the account object
account
:
React
.
PropTypes
.
object
.
isRequired
,
account
:
PropTypes
.
object
.
isRequired
,
// the account balance
balance
:
React
.
PropTypes
.
number
,
balance
:
PropTypes
.
number
,
// The location object containing the current path.
// Needed to rerender the accounts links on route change
location
:
React
.
PropTypes
.
object
.
isRequired
location
:
PropTypes
.
object
.
isRequired
};
export
default
AccountListItem
;
client/components/menu/bank.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
get
}
from
'
../../store
'
;
import
{
translate
as
$t
}
from
'
../../helpers
'
;
...
...
@@ -88,14 +89,14 @@ class BankListItemComponent extends React.Component {
BankListItemComponent
.
propTypes
=
{
// the bank object
access
:
React
.
PropTypes
.
object
.
isRequired
,
access
:
PropTypes
.
object
.
isRequired
,
// Whether the bank is the current bank selected
active
:
React
.
PropTypes
.
bool
.
isRequired
,
active
:
PropTypes
.
bool
.
isRequired
,
// The location object containing the current path.
// Needed to rerender the accounts links on route change
location
:
React
.
PropTypes
.
object
.
isRequired
location
:
PropTypes
.
object
.
isRequired
};
const
Export
=
connect
((
state
,
props
)
=>
{
...
...
client/components/menu/banks.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
get
}
from
'
../../store
'
;
import
BankListItemComponent
from
'
./bank
'
;
...
...
@@ -28,14 +29,14 @@ const BankListComponent = props => {
BankListComponent
.
propTypes
=
{
// The list of bank accesses
accesses
:
React
.
PropTypes
.
array
.
isRequired
,
accesses
:
PropTypes
.
array
.
isRequired
,
// The id of the current access
currentAccessId
:
React
.
PropTypes
.
string
.
isRequired
,
currentAccessId
:
PropTypes
.
string
.
isRequired
,
// The location object containing the current path.
// Needed to rerender the accounts links on route change
location
:
React
.
PropTypes
.
object
.
isRequired
location
:
PropTypes
.
object
.
isRequired
};
const
Export
=
connect
((
state
,
oldProps
)
=>
{
...
...
client/components/menu/index.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
NavLink
}
from
'
react-router-dom
'
;
import
{
connect
}
from
'
react-redux
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
translate
as
$t
}
from
'
../../helpers
'
;
import
{
get
}
from
'
../../store
'
;
...
...
@@ -103,9 +104,9 @@ const Menu = props => {
Menu
.
propTypes
=
{
// The kind of chart to display: by categories, balance, or in and outs for all accounts.
defaultChart
:
React
.
PropTypes
.
string
.
isRequired
,
defaultChart
:
PropTypes
.
string
.
isRequired
,
// Tells whether the menu shall be shown or not
isHidden
:
React
.
PropTypes
.
bool
.
isRequired
isHidden
:
PropTypes
.
bool
.
isRequired
};
const
Export
=
connect
(
state
=>
{
...
...
client/components/operations/category-select.js
View file @
63d75b59
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
ButtonSelect
from
'
../ui/button-select
'
;
import
{
NONE_CATEGORY_ID
}
from
'
../../helpers
'
;
...
...
@@ -25,16 +26,16 @@ const CategorySelect = props => {
CategorySelect
.
propTypes
=
{
// The operation which own the category selector.
operation
:
React
.
PropTypes
.
object
.
isRequired
,
operation
:
PropTypes
.
object
.
isRequired
,
// The list of categories.
categories
:
React
.
PropTypes
.
array
.
isRequired
,
categories
:
PropTypes
.
array
.
isRequired
,
// A function mapping category id => category.
getCategory
:
React
.
PropTypes
.
func
.
isRequired
,
getCategory
:
PropTypes
.
func
.
isRequired
,
// A function called on change.
onSelectId
:
React
.
PropTypes
.
func
.
isRequired
onSelectId
:
PropTypes
.
func
.
isRequired
};
export
default
CategorySelect
;
client/components/operations/details.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
translate
as
$t
}
from
'
../../helpers
'
;
import
{
get
,
actions
}
from
'
../../store
'
;
...
...
@@ -225,19 +226,19 @@ let ConnectedModal = connect((state, props) => {
ConnectedModal
.
propTypes
=
{
// An operation id (can be null) from which we may retrieve a full
// operation.
operationId
:
React
.
PropTypes
.
string
,
operationId
:
PropTypes
.
string
,
// Function called to format amounts.
formatCurrency
:
React
.
PropTypes
.
func
.
isRequired
,
formatCurrency
:
PropTypes
.
func
.
isRequired
,
// Array of categories (used for the category select).
categories
:
React
.
PropTypes
.
array
.
isRequired
,
categories
:
PropTypes
.
array
.
isRequired
,
// Array of types (used for the type select).
types
:
React
.
PropTypes
.
array
.
isRequired
,
types
:
PropTypes
.
array
.
isRequired
,
// A function mapping category id => category
getCategory
:
React
.
PropTypes
.
func
.
isRequired
getCategory
:
PropTypes
.
func
.
isRequired
};
// Simple wrapper that exposes one setter (setOperationId), to not expose a
...
...
client/components/operations/item.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
actions
}
from
'
../../store
'
;
...
...
@@ -101,19 +102,19 @@ let Operation = props => {
Operation
.
propTypes
=
{
// The operation this item is representing.
operation
:
React
.
PropTypes
.
object
.
isRequired
,
operation
:
PropTypes
.
object
.
isRequired
,
// A method to compute the currency.
formatCurrency
:
React
.
PropTypes
.
func
.
isRequired
,
formatCurrency
:
PropTypes
.
func
.
isRequired
,
// An array of categories.
categories
:
React
.
PropTypes
.
array
.
isRequired
,
categories
:
PropTypes
.
array
.
isRequired
,
// An array of types.
types
:
React
.
PropTypes
.
array
.
isRequired
,
types
:
PropTypes
.
array
.
isRequired
,
// A function mapping category id => category
getCategory
:
React
.
PropTypes
.
func
.
isRequired
getCategory
:
PropTypes
.
func
.
isRequired
};
export
default
connect
(
null
,
(
dispatch
,
props
)
=>
{
...
...
client/components/operations/label.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
translate
as
$t
}
from
'
../../helpers
'
;
import
{
actions
}
from
'
../../store
'
;
...
...
@@ -122,13 +123,13 @@ class LabelComponent_ extends React.Component {
LabelComponent_
.
propTypes
=
{
// The operation from which to get the label.
operation
:
React
.
PropTypes
.
object
.
isRequired
,
operation
:
PropTypes
.
object
.
isRequired
,
// Whether to display the operation label if there is no custom label.
displayLabelIfNoCustom
:
React
.
PropTypes
.
bool
,
displayLabelIfNoCustom
:
PropTypes
.
bool
,
// A function to set the custom label when modified.
setCustomLabel
:
React
.
PropTypes
.
func
.
isRequired
setCustomLabel
:
PropTypes
.
func
.
isRequired
};
LabelComponent_
.
defaultProps
=
{
...
...
@@ -172,13 +173,13 @@ const OperationListViewLabel_ = props => {
OperationListViewLabel_
.
propTypes
=
{
// The operation from which to get the label.
operation
:
React
.
PropTypes
.
object
.
isRequired
,
operation
:
PropTypes
.
object
.
isRequired
,
// A function to set the custom label when modified.
setCustomLabel
:
React
.
PropTypes
.
func
.
isRequired
,
setCustomLabel
:
PropTypes
.
func
.
isRequired
,
// A link associated to the label
link
:
React
.
PropTypes
.
object
link
:
PropTypes
.
object
};
export
const
OperationListViewLabel
=
mapDispatch
(
OperationListViewLabel_
);
client/components/operations/sync-button.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
translate
as
$t
,
formatDate
}
from
'
../../helpers
'
;
...
...
@@ -31,7 +32,7 @@ const Export = connect(null, (dispatch, ownProps) => {
Export
.
PropTypes
=
{
// Account to be resynced
account
:
React
.
PropTypes
.
object
.
isRequired
account
:
PropTypes
.
object
.
isRequired
};
export
default
Export
;
client/components/operations/type-select.js
View file @
63d75b59
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
translate
as
$t
}
from
'
../../helpers
'
;
...
...
@@ -21,13 +22,13 @@ const TypeSelect = props => {
TypeSelect
.
propTypes
=
{
// Operation for which we want to change the type.
operation
:
React
.
PropTypes
.
object
.
isRequired
,
operation
:
PropTypes
.
object
.
isRequired
,
// The array of all possible types.
types
:
React
.
PropTypes
.
array
.
isRequired
,
types
:
PropTypes
.
array
.
isRequired
,
// A function to call whenever the type has been changed.
onSelectId
:
React
.
PropTypes
.
func
.
isRequired
onSelectId
:
PropTypes
.
func
.
isRequired
};
export
default
TypeSelect
;
client/components/settings/bank-accesses/add-operation-modal.js
View file @
63d75b59
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
actions
,
get
}
from
'
../../../store
'
;
...
...
@@ -192,10 +193,10 @@ class AddOperationModal extends React.Component {
AddOperationModal
.
propTypes
=
{
// Unique identifier of the modal
modalId
:
React
.
PropTypes
.
string
.
isRequired
,
modalId
:
PropTypes
.
string
.
isRequired
,
// The account for which the operation has to be added. instanceof Account
account
:
React
.
PropTypes
.
object
.
isRequired
account
:
PropTypes
.
object
.
isRequired
};
const
Export
=
connect
(
state
=>
{
...
...
client/components/settings/bank-accesses/custom-bank-field.js
View file @
63d75b59
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
translate
as
$t
}
from
'
../../../helpers
'
;
...
...
@@ -108,7 +109,7 @@ class CustomBankField extends React.Component {
CustomBankField
.
propTypes
=
{
// An object with parameters according to the type of custom field
params
:
React
.
PropTypes
.
object
.
isRequired
params
:
PropTypes
.
object
.
isRequired
};
export
default
CustomBankField
;
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment