Skip to content

Commit

Permalink
Merge pull request #306 from bcgov/release-v0.2.0
Browse files Browse the repository at this point in the history
Release v0.2.0
  • Loading branch information
kuanfandevops committed May 25, 2018
2 parents d14c118 + 02b022b commit 4d3cfbb
Show file tree
Hide file tree
Showing 163 changed files with 11,873 additions and 58,039 deletions.
18 changes: 18 additions & 0 deletions Release.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Release Notes

## [0.2.0]
### Added
- Credit Balance in the Credit Transactions Page
- Signing Authority Declaration
- Modal before deleting, proposing, accepting and committing
- Compliance Period

### Changed
- Credit Transaction Table Column changes
- Historical Data Entry Input field changes
- Fixed Sorting for Credit Transactions
- Fixed Filtering for Credit Transactions
- Visual Representation Changes
- Text Representation Changes
- Cancelled Transactions should now be hidden
- Approved, but not completed transactions should now be hidden
- Some nav items are now hidden

## [0.1.0]
### Added
- Historical Data Entry
Expand Down
75 changes: 52 additions & 23 deletions backend/Jenkinsfile-bypass
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
def result = 0;

node('python') {
stage('Unit Test') {
checkout scm
try {
sh 'cd backend && pip install --upgrade pip && pip install -r requirements.txt'
sh 'cd backend && coverage erase && coverage run --source=. manage.py test && coverage html && coverage xml'
} catch(Throwable t) {
result = 1;
mail (from: "${EMAIL_FROM}", to: "${EMAIL_TO}", subject: "FYI: Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) unit test failed", body: "See ${env.BUILD_URL} for details. ");
} finally {
if(fileExists('backend/htmlcov/index.html')) {
publishHTML (target: [
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'backend/htmlcov',
reportFiles: 'index.html',
reportName: "Unit Test Code Coverage Report" ])
stage('Unit Test') {
podTemplate(label: "develop-backendbypass-python-${env.BUILD_NUMBER}", name: "develop-backendbypass-python-${env.BUILD_NUMBER}", serviceAccount: 'jenkins', cloud: 'openshift',
containers: [
containerTemplate(
name: 'jnlp',
image: 'docker-registry.default.svc:5000/openshift/jenkins-slave-python-rhel7',
resourceRequestCpu: '500m',
resourceLimitCpu: '1000m',
resourceRequestMemory: '2Gi',
resourceLimitMemory: '4Gi',
workingDir: '/home/jenkins',
command: '',
args: '${computer.jnlpmac} ${computer.name}'
)
]
){
node("develop-backendbypass-python-${env.BUILD_NUMBER}") {

checkout scm
dir('backend') {
try {
sh 'pip install --upgrade pip && pip install -r requirements.txt'
sh 'python manage.py collectstatic && python manage.py migrate'
sh 'python manage.py test -c nose.cfg'
} catch(Throwable t) {
result = 1;
mail (from: "${EMAIL_FROM}", to: "${EMAIL_TO}", subject: "FYI: Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) unit test failed", body: "See ${env.BUILD_URL} for details. ");
} finally {
stash includes: 'nosetests.xml,coverage.xml', name: 'coverage'
junit 'nosetests.xml'
}
}
}

}
}
} //end node
} //end podTemplate
} //end of stage

echo "result is ${result}"
if (result != 0) {
Expand All @@ -31,7 +44,22 @@ if (result != 0) {
return
}

node('maven') {
podTemplate(label: "develop-backendbypass-maven-${env.BUILD_NUMBER}", name: "develop-backend-maven-${env.BUILD_NUMBER}", serviceAccount: 'jenkins', cloud: 'openshift',
containers: [
containerTemplate(
name: 'jnlp',
image: 'registry.access.redhat.com/openshift3/jenkins-slave-maven-rhel7:v3.9',
resourceRequestCpu: '500m',
resourceLimitCpu: '1000m',
resourceRequestMemory: '2Gi',
resourceLimitMemory: '4Gi',
workingDir: '/home/jenkins',
command: '',
args: '${computer.jnlpmac} ${computer.name}'
)
]
) {
node("develop-backendbypass-maven-${env.BUILD_NUMBER}") {

stage('Build') {
openshiftBuild bldCfg: 'tfrs-bypass', showBuildLogs: 'true'
Expand All @@ -49,3 +77,4 @@ node('maven') {
}

}
}
72 changes: 53 additions & 19 deletions backend/Jenkinsfile-develop
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
def result = 0;

node('python') {
stage('Unit Test') {
checkout scm
dir('backend') {
try {
sh 'pip install --upgrade pip && pip install -r requirements.txt'
sh 'python manage.py collectstatic && python manage.py migrate'
sh 'python manage.py test -c nose.cfg'
} catch(Throwable t) {
result = 1;
mail (from: "${EMAIL_FROM}", to: "${EMAIL_TO}", subject: "FYI: Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) unit test failed", body: "See ${env.BUILD_URL} for details. ");
} finally {
stash includes: 'nosetests.xml,coverage.xml', name: 'coverage'
junit 'nosetests.xml'
stage('Unit Test') {
podTemplate(label: "develop-backend-python-${env.BUILD_NUMBER}", name: "develop-backend-python-${env.BUILD_NUMBER}", serviceAccount: 'jenkins', cloud: 'openshift',
containers: [
containerTemplate(
name: 'jnlp',
image: 'docker-registry.default.svc:5000/openshift/jenkins-slave-python-rhel7',
resourceRequestCpu: '500m',
resourceLimitCpu: '1000m',
resourceRequestMemory: '2Gi',
resourceLimitMemory: '4Gi',
workingDir: '/home/jenkins',
command: '',
args: '${computer.jnlpmac} ${computer.name}'
)
]
){
node("develop-backend-python-${env.BUILD_NUMBER}") {

checkout scm
dir('backend') {
try {
sh 'pip install --upgrade pip && pip install -r requirements.txt'
sh 'python manage.py collectstatic && python manage.py migrate'
sh 'python manage.py test -c nose.cfg'
} catch(Throwable t) {
result = 1;
mail (from: "${EMAIL_FROM}", to: "${EMAIL_TO}", subject: "FYI: Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) unit test failed", body: "See ${env.BUILD_URL} for details. ");
} finally {
stash includes: 'nosetests.xml,coverage.xml', name: 'coverage'
junit 'nosetests.xml'
}
}
}
}
}

} //end node
} //end podTemplate
} //end of stage

echo "result is ${result}"
if (result != 0) {
Expand All @@ -26,7 +44,22 @@ if (result != 0) {
return
}

node('maven') {
podTemplate(label: "develop-backend-maven-${env.BUILD_NUMBER}", name: "develop-backend-maven-${env.BUILD_NUMBER}", serviceAccount: 'jenkins', cloud: 'openshift',
containers: [
containerTemplate(
name: 'jnlp',
image: 'registry.access.redhat.com/openshift3/jenkins-slave-maven-rhel7:v3.9',
resourceRequestCpu: '500m',
resourceLimitCpu: '1000m',
resourceRequestMemory: '2Gi',
resourceLimitMemory: '4Gi',
workingDir: '/home/jenkins',
command: '',
args: '${computer.jnlpmac} ${computer.name}'
)
]
) {
node("develop-backend-maven-${env.BUILD_NUMBER}") {

stage('Code Quality Check') {
checkout scm
Expand Down Expand Up @@ -64,4 +97,5 @@ node('maven') {
openshiftVerifyDeployment depCfg: 'tfrs', namespace: 'mem-tfrs-dev', replicaCount: 1, verbose: 'false'
}

}
} //endo of node
} //end of podTemplate
3 changes: 3 additions & 0 deletions backend/api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
from .models.Role import Role
from .models.RolePermission import RolePermission

from .models.SigningAuthorityAssertion import SigningAuthorityAssertion
from .models.SigningAuthorityConfirmation import SigningAuthorityConfirmation

from .models.User import User

from .models.UserRole import UserRole
Expand Down
6 changes: 6 additions & 0 deletions backend/api/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from api.models.OrganizationType import OrganizationType
from api.utils import get_firstname_lastname
from django.conf import settings
from django.contrib.auth.models import Permission
from api.models.CreditTrade import CreditTrade


class UserAuthentication(authentication.BaseAuthentication):
Expand Down Expand Up @@ -41,6 +43,10 @@ def authenticate(self, request):
Q(authorization_guid=header_user_guid) |
Q(authorization_id=header_user_id))

permission = Permission.objects.get(
codename='credit_trade_approve')
user.user_permissions.add(permission)

else:
user = User.objects.get(
~Q(organization_id=gov_organization.id),
Expand Down
30 changes: 30 additions & 0 deletions backend/api/fixtures/signing_authority_assertions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"fields": {
"description": "I confirm that records evidencing each matter reported under section 11.11 (2) of the Regulation are available on request.",
"display_order": "1",
"effective_date": "2018-01-01",
"expiration_date": null
},
"model": "api.signingauthorityassertion",
"pk": "1"
}, {
"fields": {
"description": "I confirm that I am an officer or employee of the fuel supplier, and that records evidencing my authority to submit this proposal are available on request.",
"display_order": "2",
"effective_date": "2018-01-01",
"expiration_date": null
},
"model": "api.signingauthorityassertion",
"pk": "2"
}, {
"fields": {
"description": "I certify that the information in this report is true and complete to the best of my knowledge and I understand that the Director may require records evidencing the truth of that information.",
"display_order": "3",
"effective_date": "2018-01-01",
"expiration_date": null
},
"model": "api.signingauthorityassertion",
"pk": "3"
}
]
19 changes: 19 additions & 0 deletions backend/api/migrations/0008_auto_20180507_1734.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-05-07 17:34
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('api', '0007_credittradehistory_compliance_period'),
]

operations = [
migrations.AlterModelOptions(
name='credittrade',
options={'permissions': (('credit_trade_approve', 'Can approve credit transfers'),)},
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-05-14 15:38
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('api', '0008_auto_20180507_1734'),
]

operations = [
migrations.CreateModel(
name='SigningAuthorityAssertion',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_timestamp', models.DateTimeField(auto_now_add=True, null=True)),
('update_timestamp', models.DateTimeField(auto_now=True, null=True)),
('description', models.CharField(blank=True, max_length=4000, null=True)),
('effective_date', models.DateField(blank=True, null=True)),
('expiration_date', models.DateField(blank=True, null=True)),
('display_order', models.IntegerField()),
('create_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='api_signingauthorityassertion_CREATE_USER', to=settings.AUTH_USER_MODEL)),
('update_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='api_signingauthorityassertion_UPDATE_USER', to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'signing_authority_assertion',
},
),
migrations.CreateModel(
name='SigningAuthorityConfirmation',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_timestamp', models.DateTimeField(auto_now_add=True, null=True)),
('update_timestamp', models.DateTimeField(auto_now=True, null=True)),
('has_accepted', models.BooleanField()),
('create_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='api_signingauthorityconfirmation_CREATE_USER', to=settings.AUTH_USER_MODEL)),
('credit_trade', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='confirmations', to='api.CreditTrade')),
('signing_authority_assertion', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='confirmations', to='api.SigningAuthorityAssertion')),
('update_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='api_signingauthorityconfirmation_UPDATE_USER', to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'signing_authority_confirmation',
},
),
]
4 changes: 4 additions & 0 deletions backend/api/models/CreditTrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,7 @@ def actions(self):

class Meta:
db_table = 'credit_trade'

permissions = (
("credit_trade_approve", "Can approve credit transfers"),
)
35 changes: 35 additions & 0 deletions backend/api/models/SigningAuthorityAssertion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
REST API Documentation for the NRS TFRS Credit Trading Application
The Transportation Fuels Reporting System is being designed to streamline
compliance reporting for transportation fuel suppliers in accordance with
the Renewable & Low Carbon Fuel Requirements Regulation.
OpenAPI spec version: v1
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

from django.db import models

from auditable.models import Auditable


class SigningAuthorityAssertion(Auditable):
description = models.CharField(max_length=4000, blank=True, null=True)
effective_date = models.DateField(blank=True, null=True)
expiration_date = models.DateField(blank=True, null=True)
display_order = models.IntegerField()

class Meta:
db_table = 'signing_authority_assertion'
Loading

0 comments on commit 4d3cfbb

Please sign in to comment.