Skip to content

Commit

Permalink
Merge pull request #315 from bcgov/release-v0.2.0
Browse files Browse the repository at this point in the history
Release v0.2.0.1
  • Loading branch information
kuanfandevops committed May 29, 2018
2 parents 4d3cfbb + d61654e commit f886eab
Show file tree
Hide file tree
Showing 29 changed files with 320 additions and 64 deletions.
3 changes: 2 additions & 1 deletion backend/api/models/CreditTrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class CreditTrade(Auditable):
fair_market_value_per_credit = models.DecimalField(
null=True, blank=True, max_digits=999,
decimal_places=2,
default=Decimal('0.00'))
default=Decimal('0.00'),
validators=[validators.CreditTradeFairMarketValueValidator])
zero_reason = models.ForeignKey(
'CreditTradeZeroReason',
related_name='credit_trades',
Expand Down
8 changes: 7 additions & 1 deletion backend/api/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

from .exceptions import PositiveIntegerException


def CreditTradeNumberOfCreditsValidator(value):
if value <= 0:
raise PositiveIntegerException()
raise PositiveIntegerException()


def CreditTradeFairMarketValueValidator(value):
if value < 0:
raise PositiveIntegerException()
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tfrs",
"version": "0.1.0",
"version": "0.2.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome": "^1.1.3",
Expand Down
13 changes: 7 additions & 6 deletions frontend/src/actions/compliancePeriodsActions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import axios from 'axios';

import ActionTypes from '../constants/actionTypes/CompliancePeriods';
import * as Routes from '../constants/routes';

const getCompliancePeriods = () => (dispatch) => {
Expand All @@ -13,20 +14,20 @@ const getCompliancePeriods = () => (dispatch) => {
};

const getCompliancePeriodsRequest = () => ({
name: 'GET_COMPLIANCE_PERIODS_REQUEST',
type: 'GET_COMPLIANCE_PERIODS'
name: ActionTypes.GET_COMPLIANCE_PERIODS_REQUEST,
type: ActionTypes.GET_COMPLIANCE_PERIODS
});

const getCompliancePeriodsSuccess = compliancePeriods => ({
name: 'RECEIVE_COMPLIANCE_PERIODS_REQUEST',
type: 'RECEIVE_COMPLIANCE_PERIODS',
name: ActionTypes.RECEIVE_COMPLIANCE_PERIODS_REQUEST,
type: ActionTypes.RECEIVE_COMPLIANCE_PERIODS,
data: compliancePeriods,
receivedAt: Date.now()
});

const getCompliancePeriodsError = error => ({
name: 'ERROR_COMPLIANCE_PERIODS_REQUEST',
type: 'ERROR',
name: ActionTypes.ERROR_COMPLIANCE_PERIODS_REQUEST,
type: ActionTypes.ERROR_COMPLIANCE_PERIODS,
errorMessage: error
});

Expand Down
9 changes: 8 additions & 1 deletion frontend/src/actions/creditTransfersActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const getApprovedCreditTransfers = () => (dispatch) => {

return axios.get(`${Routes.BASE_URL}${Routes.CREDIT_TRADE_API}/list_approved`)
.then((response) => {
dispatch(getCreditTransfersSuccess(response.data));
dispatch(getApprovedCreditTransfersSuccess(response.data));
}).catch((error) => {
dispatch(getCreditTransfersError(error.response));
});
Expand All @@ -155,6 +155,13 @@ const getApprovedCreditTransfersRequest = () => ({
type: ActionTypes.GET_APPROVED_CREDIT_TRANSFERS
});

const getApprovedCreditTransfersSuccess = creditTransfers => ({
name: 'RECEIVE_APPROVED_CREDIT_TRANSFERS_REQUEST',
type: 'RECEIVE_APPROVED_CREDIT_TRANSFERS',
data: creditTransfers,
receivedAt: Date.now()
});

/*
* Credit Transfer Detail
*/
Expand Down
13 changes: 7 additions & 6 deletions frontend/src/actions/signingAuthorityAssertionsActions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import axios from 'axios';

import ActionTypes from '../constants/actionTypes/SigningAuthorityAssertions';
import * as Routes from '../constants/routes';

const getSigningAuthorityAssertions = () => (dispatch) => {
Expand All @@ -13,20 +14,20 @@ const getSigningAuthorityAssertions = () => (dispatch) => {
};

const getSigningAuthorityAssertionsRequest = () => ({
name: 'GET_SIGNING_AUTHORITY_ASSERTIONS_REQUEST',
type: 'GET_SIGNING_AUTHORITY_ASSERTIONS'
name: ActionTypes.GET_SIGNING_AUTHORITY_ASSERTIONS_REQUEST,
type: ActionTypes.GET_SIGNING_AUTHORITY_ASSERTIONS
});

const getSigningAuthorityAssertionsSuccess = compliancePeriods => ({
name: 'RECEIVE_SIGNING_AUTHORITY_ASSERTIONS_REQUEST',
type: 'RECEIVE_SIGNING_AUTHORITY_ASSERTIONS',
name: ActionTypes.RECEIVE_SIGNING_AUTHORITY_ASSERTIONS_REQUEST,
type: ActionTypes.RECEIVE_SIGNING_AUTHORITY_ASSERTIONS,
data: compliancePeriods,
receivedAt: Date.now()
});

const getSigningAuthorityAssertionsError = error => ({
name: 'ERROR_SIGNING_AUTHORITY_ASSERTIONS_REQUEST',
type: 'ERROR',
name: ActionTypes.ERROR_SIGNING_AUTHORITY_ASSERTIONS_REQUEST,
type: ActionTypes.ERROR_SIGNING_AUTHORITY_ASSERTIONS,
errorMessage: error
});

Expand Down
13 changes: 7 additions & 6 deletions frontend/src/actions/signingAuthorityConfirmationsActions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import axios from 'axios';

import ActionTypes from '../constants/actionTypes/SigningAuthorityConfirmations';
import * as Routes from '../constants/routes';

export const prepareSigningAuthorityConfirmations = (creditTradeId, terms) => {
Expand Down Expand Up @@ -29,18 +30,18 @@ export const addSigningAuthorityConfirmation = data => (dispatch) => {
};

const addSigningAuthorityConfirmationRequest = () => ({
name: 'ADD_SIGNING_AUTHORITY_CONFIRMATION_REQUEST',
type: 'ADD_SIGNING_AUTHORITY_CONFIRMATION'
name: ActionTypes.ADD_SIGNING_AUTHORITY_CONFIRMATION_REQUEST,
type: ActionTypes.ADD_SIGNING_AUTHORITY_CONFIRMATION
});

const addSigningAuthorityConfirmationSuccess = data => ({
name: 'SUCCESS_ADD_SIGNING_AUTHORITY_CONFIRMATION_SUCCESS',
type: 'SUCCESS_ADD_SIGNING_AUTHORITY_CONFIRMATION_SUCCESS',
name: ActionTypes.SUCCESS_ADD_SIGNING_AUTHORITY_CONFIRMATION_SUCCESS,
type: ActionTypes.SUCCESS_ADD_SIGNING_AUTHORITY_CONFIRMATION_SUCCESS,
data
});

const addSigningAuthorityConfirmationError = error => ({
name: 'ERROR_ADD_SIGNING_AUTHORITY_CONFIRMATION',
type: 'ERROR',
name: ActionTypes.ERROR_ADD_SIGNING_AUTHORITY_CONFIRMATION,
type: ActionTypes.ERROR_ADD_SIGNING_AUTHORITY_CONFIRMATION,
errorMessage: error
});
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class HistoricalDataEntryContainer extends Component {
}

componentWillMount () {
this.props.invalidateCreditTransfers();
this.loadData();
this.props.getCompliancePeriods();
this.props.getFuelSuppliers();
Expand Down Expand Up @@ -106,7 +107,6 @@ class HistoricalDataEntryContainer extends Component {

_processApprovedCreditTransfers () {
this.props.processApprovedCreditTransfers().then(() => {
this.props.invalidateCreditTransfers();
this.loadData();
});
}
Expand Down Expand Up @@ -192,13 +192,13 @@ HistoricalDataEntryContainer.propTypes = {

const mapStateToProps = state => ({
addErrors: state.rootReducer.creditTransfer.errors,
commitErrors: state.rootReducer.creditTransfers.errors,
commitMessage: state.rootReducer.creditTransfers.message,
commitErrors: state.rootReducer.approvedCreditTransfers.errors,
commitMessage: state.rootReducer.approvedCreditTransfers.message,
compliancePeriods: state.rootReducer.compliancePeriods.items,
fuelSuppliers: state.rootReducer.fuelSuppliersRequest.fuelSuppliers,
historicalData: {
items: state.rootReducer.creditTransfers.items,
isFetching: state.rootReducer.creditTransfers.isFetching
items: state.rootReducer.approvedCreditTransfers.items,
isFetching: state.rootReducer.approvedCreditTransfers.isFetching
}
});

Expand Down
7 changes: 6 additions & 1 deletion frontend/src/app/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';
import { Link } from 'react-router-dom';
import * as Routes from '../../constants/routes';

/* global __VERSION__ */

const Footer = props => (
<div id="footer" role="contentinfo">
<img
Expand Down Expand Up @@ -36,9 +38,12 @@ const Footer = props => (
<a id="footer-about-copyright" href="http://gov.bc.ca/copyright" target="_self">Copyright</a>
</li>
<li>
<a id="footer-about-contact" href="#" target="_self">Contact Us</a>
<a id="footer-about-contact" href="/contact_us" target="_self">Contact Us</a>
</li>
</ul>
<div id="footer-about-version" className="inline">
v{__VERSION__}
</div>
</div>
</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/constants/actionTypes/CompliancePeriods.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
ERROR_COMPLIANCE_PERIODS: 'ERROR_COMPLIANCE_PERIODS',
ERROR_COMPLIANCE_PERIODS_REQUEST: 'ERROR_COMPLIANCE_PERIODS_REQUEST',
GET_COMPLIANCE_PERIODS: 'GET_COMPLIANCE_PERIODS',
GET_COMPLIANCE_PERIODS_REQUEST: 'GET_COMPLIANCE_PERIODS_REQUEST',
RECEIVE_COMPLIANCE_PERIODS: 'RECEIVE_COMPLIANCE_PERIODS',
RECEIVE_COMPLIANCE_PERIODS_REQUEST: 'RECEIVE_COMPLIANCE_PERIODS_REQUEST'
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
ERROR_SIGNING_AUTHORITY_ASSERTIONS: 'ERROR_SIGNING_AUTHORITY_ASSERTIONS',
ERROR_SIGNING_AUTHORITY_ASSERTIONS_REQUEST: 'ERROR_SIGNING_AUTHORITY_ASSERTIONS_REQUEST',
GET_SIGNING_AUTHORITY_ASSERTIONS: 'GET_SIGNING_AUTHORITY_ASSERTIONS',
GET_SIGNING_AUTHORITY_ASSERTIONS_REQUEST: 'GET_SIGNING_AUTHORITY_ASSERTIONS_REQUEST',
RECEIVE_SIGNING_AUTHORITY_ASSERTIONS: 'RECEIVE_SIGNING_AUTHORITY_ASSERTIONS',
RECEIVE_SIGNING_AUTHORITY_ASSERTIONS_REQUEST: 'RECEIVE_SIGNING_AUTHORITY_ASSERTIONS_REQUEST'
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
ADD_SIGNING_AUTHORITY_CONFIRMATION: 'ADD_SIGNING_AUTHORITY_CONFIRMATION',
ADD_SIGNING_AUTHORITY_CONFIRMATION_REQUEST: 'ADD_SIGNING_AUTHORITY_CONFIRMATION_REQUEST',
ERROR_ADD_SIGNING_AUTHORITY_CONFIRMATION: 'ERROR_ADD_SIGNING_AUTHORITY_CONFIRMATION',
SUCCESS_ADD_SIGNING_AUTHORITY_CONFIRMATION_SUCCESS: 'SUCCESS_ADD_SIGNING_AUTHORITY_CONFIRMATION_SUCCESS'
};
1 change: 1 addition & 0 deletions frontend/src/constants/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ export const CURRENT_USER = '/users/current';
export const DELETE = '/delete';

export { default as COMPLIANCE_PERIODS } from './routes/CompliancePeriods';
export { default as CONTACT_US } from './routes/ContactUs';
export { default as SIGNING_AUTHORITY_ASSERTIONS } from './routes/SigningAuthorityAssertions';
export { default as SIGNING_AUTHORITY_CONFIRMATIONS } from './routes/SigningAuthorityConfirmations';
7 changes: 7 additions & 0 deletions frontend/src/constants/routes/ContactUs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const BASE_PATH = '/contact_us';

const CONTACT_US = {
DETAILS: BASE_PATH
};

export default CONTACT_US;
21 changes: 21 additions & 0 deletions frontend/src/contact_us/ContactUsContainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Container component
* All data handling & manipulation should be handled here.
*/

import React from 'react';
import { connect } from 'react-redux';

import ContactUsPage from './components/ContactUsPage';

const ContactUsContainer = props => (
<ContactUsPage />
);

const mapStateToProps = state => ({
});

const mapDispatchToProps = dispatch => ({
});

export default connect(mapStateToProps, mapDispatchToProps)(ContactUsContainer);
25 changes: 25 additions & 0 deletions frontend/src/contact_us/components/ContactUsPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';

const ContactUsPage = props => (
<div className="page_contact_us">
<h1>Contact Us</h1>
<h3>Need help with TFRS?</h3>
<p>
Contact the Low Carbon Fuels Branch at <a href="mailto:[email protected]">[email protected]</a>
</p>
<h3>Need help with BCeID?</h3>
<p>
<a href="https://www.bceid.ca/aboutbceid/contact_us.aspx" rel="noopener noreferrer" target="_blank">Contact the BCeID Help Desk</a>
</p>
<h3>Need help with IDIR?</h3>
<p>
Contact your IDIR security administrator or the 7-7000 Service Desk at:
</p>
<p>
Phone: 250-387-7000 <br />
Email: <a href="mailto:[email protected]">[email protected]</a>
</p>
</div>
);

export default ContactUsPage;
8 changes: 7 additions & 1 deletion frontend/src/credit_transfers/CreditTransferAddContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ModalSubmitCreditTransfer from './components/ModalSubmitCreditTransfer';

import { getFuelSuppliers } from '../actions/organizationActions';
import { getLoggedInUser } from '../actions/userActions';
import { addCreditTransfer, invalidateCreditTransfers } from '../actions/creditTransfersActions';
import { addCreditTransfer, invalidateCreditTransfer, invalidateCreditTransfers } from '../actions/creditTransfersActions';
import {
addSigningAuthorityConfirmation,
prepareSigningAuthorityConfirmations
Expand Down Expand Up @@ -51,6 +51,7 @@ class CreditTransferAddContainer extends Component {
}

componentDidMount () {
this.props.invalidateCreditTransfer();
this.props.getFuelSuppliers();
}

Expand Down Expand Up @@ -162,6 +163,8 @@ class CreditTransferAddContainer extends Component {
history.push(CREDIT_TRANSACTIONS.LIST);
});

this.props.invalidateCreditTransfers();

return false;
}

Expand Down Expand Up @@ -218,6 +221,7 @@ class CreditTransferAddContainer extends Component {
numberOfCredits: this.state.fields.numberOfCredits
}
}
key="confirmSubmit"
/>
]);
}
Expand All @@ -233,6 +237,7 @@ CreditTransferAddContainer.propTypes = {
errors: PropTypes.shape({}),
fuelSuppliers: PropTypes.arrayOf(PropTypes.shape()).isRequired,
getFuelSuppliers: PropTypes.func.isRequired,
invalidateCreditTransfer: PropTypes.func.isRequired,
invalidateCreditTransfers: PropTypes.func.isRequired,
loggedInUser: PropTypes.shape({
displayName: PropTypes.string,
Expand All @@ -255,6 +260,7 @@ const mapDispatchToProps = dispatch => ({
addSigningAuthorityConfirmation: bindActionCreators(addSigningAuthorityConfirmation, dispatch),
getFuelSuppliers: bindActionCreators(getFuelSuppliers, dispatch),
getLoggedInUser: bindActionCreators(getLoggedInUser, dispatch),
invalidateCreditTransfer: bindActionCreators(invalidateCreditTransfer, dispatch),
invalidateCreditTransfers: bindActionCreators(invalidateCreditTransfers, dispatch),
prepareSigningAuthorityConfirmations: (creditTradeId, terms) =>
prepareSigningAuthorityConfirmations(creditTradeId, terms)
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/credit_transfers/CreditTransferEditContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class CreditTransferEditContainer extends Component {
}

componentDidMount () {
this.props.invalidateCreditTransfer();
this.loadData(this.props.match.params.id);
this.props.getFuelSuppliers();
}
Expand Down Expand Up @@ -272,8 +273,12 @@ class CreditTransferEditContainer extends Component {
numberOfCredits: item.numberOfCredits
}
}
key="confirmSubmit"
/>,
<ModalDeleteCreditTransfer handleSubmit={() => this._deleteCreditTransfer(item.id)} />
<ModalDeleteCreditTransfer
handleSubmit={() => this._deleteCreditTransfer(item.id)}
key="confirmDelete"
/>
]);
}
}
Expand Down
Loading

0 comments on commit f886eab

Please sign in to comment.