Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production Increment 0.1.13 #239

Merged
merged 9 commits into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ GENERATE_SOURCEMAP=true
REACT_APP_ENV=production
REACT_APP_UI_VERSION=${UI_VERSION}

REACT_APP_UI_DISABLED_TOOLBAR=true
REACT_APP_UI_DISABLED_TOOLBAR=false
23 changes: 22 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@
"plugins": [
"import",
"jest",
"jsdoc",
"json",
"prettier",
"react"
],
"extends": [
"react-app",
"airbnb",
"airbnb/hooks",
"prettier",
"plugin:jest/recommended"
"plugin:jest/recommended",
"plugin:jsdoc/recommended"
],
"rules": {
"arrow-parens": [
Expand Down Expand Up @@ -45,6 +48,24 @@
"import/no-named-as-default-member": 0,
"jest/no-test-callback": 0,
"jest/prefer-to-have-length": 0,
"jsdoc/check-tag-names": [
2,
{
"definedTags": [
"api",
"apiDescription",
"apiSuccess",
"apiSuccessExample",
"apiError",
"apiErrorExample",
"apiMock",
"apiParam"
]
}
],
"jsdoc/require-param-description": 0,
"jsdoc/require-property-description": 0,
"jsdoc/require-returns-description": 0,
"max-len": [
"error",
{
Expand Down
46 changes: 25 additions & 21 deletions .travis/custom_release.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
#!/bin/bash
#
#
# CI/Dev beta release for "ci-beta" and "qa-beta" branches, based on deploy stage name
# Release a branch
release()
{
local DEPLOY_BRANCH=$1

printf "${YELLOW}PUSHING ${DEPLOY_BRANCH}${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "${DEPLOY_BRANCH}"
printf "${GREEN}COMPLETED ${DEPLOY_BRANCH}${NOCOLOR}\n"
}
#
#
# CI/Dev beta release for "ci" and "qa" "beta" and "stable" branches, based on deploy stage name
#
releaseDev()
{
if [[ "${TRAVIS_BRANCH}" = "ci" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
printf "${YELLOW}PUSHING ci-beta${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "ci-beta"
printf "${GREEN}COMPLETED ci-beta${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "ci-beta" || "${TRAVIS_BRANCH}" = "dev" || "${TRAVIS_BRANCH}" = "ci" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
release "ci-beta"
release "qa-beta"
fi

printf "${YELLOW}PUSHING qa-beta${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "qa-beta"
printf "${GREEN}COMPLETED qa-beta${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "ci-stable" || "${TRAVIS_BRANCH}" = "test" || "${TRAVIS_BRANCH}" = "qa" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
release "ci-stable"
release "qa-stable"
fi
}
#
#
# Prod release for "master" branch based on deploy stage name.
# Prod release for "master" and "stage" branches based on deploy stage name.
#
releaseProd()
{
if [[ "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
printf "${YELLOW}PUSHING prod-beta${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "prod-beta"
printf "${GREEN}COMPLETED prod-beta${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "prod-beta" || "${TRAVIS_BRANCH}" = "stage" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
release "prod-beta"
fi

if [[ "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
printf "${YELLOW}PUSHING prod-stable${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "prod-stable"
printf "${GREEN}COMPLETED prod-stable${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "prod-stable" || "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
release "prod-stable"
fi
}
#
Expand Down
42 changes: 34 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,36 @@ Settings for [Standard Version](https://github.com/conventional-changelog/standa
## Branching, Pull Requests, and Releases

### Branches
Curiosity makes use of only two branches `master` and `ci`.
Curiosity primarily makes use of the branches `master`, `qa`, and `ci`.
- `master` branch is a protected representation of production environments
- Adding commits, or a PR, into `master` should generate `prod-*` branches within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `prod-*` branches are manually deployed through coordination with the operations team.
- `ci` branch is a representation of `ci`, or `dev`, and `qa`.
- Adding commits, or a PR, into `ci` should generate `ci-*` and `qa-*` branches within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `ci-*` and `qa-*` branches are automatically deployed within an averaged timeframe for both `https://ci.*.redhat.com` and `https://qa.*.redhat.com`
- Adding commits, or a PR, into `master` should generate a `prod-stable` branch within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `prod-stable` branch is manually deployed through coordination with the operations team.
- `qa` branch is a representation of `qa-stable`, and `ci-stable`.
- Adding commits, or a PR, into `ci-stable` should generate `ci-*` and `qa-*` branches within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `ci-*` and `qa-*` branches are automatically deployed within an averaged time for both `https://ci.*.redhat.com` and `https://qa.*.redhat.com`
- `ci` branch is a representation of `ci-beta`, and `qa-beta`.
- Adding commits, or a PR, into `ci-beta` should generate `ci-*` and `qa-*` branches within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `ci-*` and `qa-*` branches are automatically deployed within an averaged time for both `https://ci.*.redhat.com` and `https://qa.*.redhat.com`

#### Additional branches
A staging branch can also be utilized.
- `stage` branch is a protected representation of production environments
- Adding commits, or a PR, into `stage` should generate a `prod-beta` branch within the deploy repository [curiosity-frontend-build](https://github.com/RedHatInsights/curiosity-frontend-build)
- The `prod-beta` branch is manually deployed through coordination with the operations team.

#### Branching and Pull Request Workflow
It is preferred that all work is handled through GitHub's fork and pull workflow. Working directly on the master repository is discouraged
since a form of Continuous Integration is implemented and dependent on branch structure.

1. General development PRs should be opened against the `ci` branch.
1. PRs to master branch are considered production ready releases.
1. It is preferred that PRs to `qa` originate from `ci`, but development PRs opened against `qa` are allowed.
1. PRs to master branch are considered production ready releases. It is preferred that PRs originate from `qa`, or `stage` if available.
1. Development PRs opened against master, unless a team agreed exception occurs, will be closed.
1. All PRs to master branch should include a final review, or coordination, from Quality Engineering.
1. All PRs to production, master branch, should have a final review, coordination, from Quality Engineering.

```
PR -> ci <-> qa -> stage -> master
```

### Releases and Tagging
1. Merging a PR into `master` is considered production ready.
Expand Down Expand Up @@ -87,6 +104,14 @@ This project makes use of reserved CSS class prefixes used by external resources

CSS classes with the prefix `uiux-` are used by external resources to identify elements for use in 3rd party tooling. Changes to the class name or element should be broadcast towards our UI/UX team members.

### Reserved QE testing attributes
This project makes use of reserved DOM attributes used by the QE team.
> Updating elements with these attributes should be done with the knowledge "you are affecting" QE's ability to test.

1. Attribute `data-test`

DOM attributes with `data-test=""` are used by QE as a means to identify specific DOM elements.

## Testing
To test content you'll need to have Node and Yarn installed.

Expand Down Expand Up @@ -161,6 +186,7 @@ If you're having trouble getting an accurate code coverage report, or it's faili

## Typical Development Workflow
After setting up the repository...
1. Confirm you have access to the network
1. Make sure Docker is running
1. Open a couple of instances of Terminal and run...
```
Expand Down
9 changes: 9 additions & 0 deletions config/spandx.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ module.exports = {
'/static': {
host: `https://${localhost}:5001`
},
'/apps/subscriptions': {
host: `https://${localhost}:5001`
},
'/beta/apps/subscriptions': {
host: `https://${localhost}:5001`
},
'/staging/subscriptions': {
host: `https://${localhost}:5001`
},
'/beta/staging/subscriptions': {
host: `https://${localhost}:5001`
},
'/subscriptions': {
host: `https://${localhost}:5001`
},
'/beta/subscriptions': {
host: `https://${localhost}:5001`
},
Expand Down
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
"node-sass": "^4.13.1",
"numbro": "^2.1.2",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-i18next": "^11.3.3",
"react-redux": "^7.2.0",
"react-router": "^5.1.2",
Expand All @@ -108,34 +108,36 @@
"redux-promise-middleware": "^6.1.2",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"victory": "^34.1.1",
"victory-core": "^34.1.1",
"victory-legend": "^34.1.1"
"victory": "^34.1.3",
"victory-core": "^34.1.3",
"victory-legend": "^34.1.3"
},
"devDependencies": {
"apidoc-mock": "^3.0.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-to-json": "^3.4.4",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jest": "^23.7.0",
"eslint-plugin-json": "^2.0.1",
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-jsdoc": "^22.0.1",
"eslint-plugin-json": "^2.1.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.0",
"express": "^4.17.1",
"gettext-extractor": "^3.5.2",
"moxios": "^0.4.0",
"npm-run-all": "^4.1.5",
"prettier": "^1.18.2",
"prettier": "^1.19.1",
"redux-mock-store": "^1.5.4",
"standard-version": "^7.1.0",
"swagger-ui-express": "^4.1.3",
"yamljs": "^0.3.0"
},
"resolutions": {
"**/eslint": "6.6.0"
"**/eslint": "6.8.0"
}
}
1 change: 1 addition & 0 deletions public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dateLabel": "Date",
"coresLabel": "Cores",
"socketsLabel": "Sockets",
"cloudSocketsLabel": "Public cloud",
"hypervisorCoresLabel": "Virtualized cores",
"hypervisorSocketsLabel": "Virtualized {{product}}",
"physicalCoresLabel": "Physical cores",
Expand Down
8 changes: 4 additions & 4 deletions scripts/pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
#
deployPaths()
{
local CI_BRANCH=$1
local CI_BUILD_STAGE=$2
local DEPLOY_BRANCH=$1
local DEPLOY_BUILD_STAGE=$2

DEPLOY_PATH_PREFIX=""

if [[ $CI_BUILD_STAGE == *"Beta"* ]]; then
if [[ $DEPLOY_BUILD_STAGE == *"Beta"* ]]; then
DEPLOY_PATH_PREFIX=/beta
fi

echo UI_DEPLOY_PATH_PREFIX="$DEPLOY_PATH_PREFIX" >> ./.env.production.local

echo "\"${CI_BUILD_STAGE}\" build stage config for branch \"${CI_BRANCH}\"..."
echo "\"${DEPLOY_BUILD_STAGE}\" build stage config for branch \"${DEPLOY_BRANCH}\"..."
printf "Deploy path prefix ... ${GREEN}UI_DEPLOY_PATH_PREFIX=$DEPLOY_PATH_PREFIX${NOCOLOR}\n"
}
#
Expand Down
31 changes: 30 additions & 1 deletion src/common/dateHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@ import moment from 'moment/moment';
import { helpers } from './helpers';
import { RHSM_API_QUERY_GRANULARITY_TYPES as GRANULARITY_TYPES } from '../types/rhsmApiTypes';

/**
* Return a date.
*
* @returns {string|Date}
*/
const getCurrentDate = () =>
(helpers.TEST_MODE && '20190720') || (helpers.DEV_MODE && process.env.REACT_APP_DEBUG_DEFAULT_DATETIME) || new Date();

/**
* Set a date range based on a granularity type.
*
* @param {object} params
* @property {Date} date Start date, typically the current date.
* @property {number} subtract Number of granularity type to subtract from the current date.
* @property {string} measurement Granularity type.
* @returns {{endDate: Date, startDate: Date}}
*/
const setRangedDateTime = ({ date, subtract, measurement }) => ({
startDate: moment
.utc(date)
Expand All @@ -24,7 +38,7 @@ const monthlyDateTime = setRangedDateTime({ date: getCurrentDate(), subtract: 12
const quarterlyDateTime = setRangedDateTime({ date: getCurrentDate(), subtract: 36, measurement: 'months' });

/**
* Return a range of time based on granularity.
* Return a range of time based on known granularity types.
*
* @param {string} granularity
* @returns {{endDate: Date, startDate: Date}}
Expand All @@ -43,20 +57,35 @@ const getRangedDateTime = granularity => {
}
};

/**
* Consistent timestamp day formats.
*
* @type {{short: string, yearShort: string, yearLong: string, long: string}}
*/
const timestampDayFormats = {
long: 'MMMM D',
yearLong: 'MMMM D YYYY',
short: 'MMM D',
yearShort: 'MMM D YYYY'
};

/**
* Consistent timestamp month formats.
*
* @type {{short: string, yearShort: string, yearLong: string, long: string}}
*/
const timestampMonthFormats = {
long: 'MMMM',
yearLong: 'MMMM YYYY',
short: 'MMM',
yearShort: 'MMM YYYY'
};

/**
* Consistent timestamp quarter formats.
*
* @type {{short: string, yearShort: string, yearLong: string, long: string}}
*/
const timestampQuarterFormats = {
...timestampMonthFormats
};
Expand Down
Loading