Skip to content

Commit

Permalink
Merge pull request #1116 from nasa/develop
Browse files Browse the repository at this point in the history
Release v12.1.0 (#1115) to master
  • Loading branch information
jennyhliu committed Oct 27, 2023
2 parents ee76f8e + 89bde85 commit 1541214
Show file tree
Hide file tree
Showing 14 changed files with 2,652 additions and 4,786 deletions.
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,29 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [v12.1.0] - 2023-10-27

### Breaking Changes

This version of the dashboard requires Cumulus API >= v18.1.0

### Changed

- **CUMULUS-3095**
- Updated all PUT /rules/${ruleName} actions to supply the required `Cumulus-API-Version` headers
- Updates the dashboard to use alpha version `@cumulus/[email protected]` for testing.
- **CICD updates**
- Switched `docker-compose` commands to `docker compose`

### Fixed

- **CUMULUS-3265**
- Fixed bulk granule operation modal to correctly pass selected granules into bulk operation
- **CUMULUS-3434**
- Fixed `getGranuleRecoveryStatus` action to take granuleId and collectionId.

## [v12.0.1] - 2023-05-25

### Breaking Changes

This version of the dashboard requires Cumulus API v2 (Core version >= v16.0.0)
Expand Down Expand Up @@ -1327,7 +1349,8 @@ Fix for serving the dashboard through the Cumulus API.
### Added

- Versioning and changelog [CUMULUS-197] by @kkelly51
[Unreleased]: https://github.com/nasa/cumulus-dashboard/compare/v12.0.1...HEAD
[Unreleased]: https://github.com/nasa/cumulus-dashboard/compare/v12.1.0...HEAD
[v12.1.0]: https://github.com/nasa/cumulus-dashboard/compare/v12.0.1...v12.1.0
[v12.0.1]: https://github.com/nasa/cumulus-dashboard/compare/v12.0.0...v12.0.1
[v12.0.0]: https://github.com/nasa/cumulus-dashboard/compare/v11.0.0...v12.0.0
[v11.0.0]: https://github.com/nasa/cumulus-dashboard/compare/v10.0.0...v11.0.0
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ When the cypress editor opens, click on `run all specs`.

### Local API server

For **development** and **testing** purposes only, you can run a Cumulus API locally. This requires `docker-compose` in order to stand up the Docker containers that serve Cumulus API. There are a number of commands that will stand up different portions of the stack. See the [Docker Service Diagram](#dockerdiagram) and examine the `docker-compose*.yml` file in the `/localAPI/` directory to see all of the possible combinations. Described below are each of the provided commands for running the dashboard and Cumulus API locally.
For **development** and **testing** purposes only, you can run a Cumulus API locally. This requires `docker compose` in order to stand up the Docker containers that serve Cumulus API. There are a number of commands that will stand up different portions of the stack. See the [Docker Service Diagram](#dockerdiagram) and examine the `docker-compose*.yml` file in the `/localAPI/` directory to see all of the possible combinations. Described below are each of the provided commands for running the dashboard and Cumulus API locally.

*Important Note: These `docker-compose` commands do not build distributable containers, but are a provided as testing conveniences. The docker-compose[-\*].yml files show that they work by linking your local directories into the container.*
*Important Note: These `docker compose` commands do not build distributable containers, but are a provided as testing conveniences. The docker-compose[-\*].yml files show that they work by linking your local directories into the container.*

In order to run the Cumulus API locally you must first [build the dashboard](#build-the-dashboard) and then run the containers that provide LocalStack and Elasticsearch services.

Expand Down Expand Up @@ -249,7 +249,7 @@ the start command, will exit successfully long before the stack is actually read
The output looks like this:
```bash
> [email protected] start-cumulusapi /Users/savoie/projects/cumulus/cumulus-dashboard
> docker-compose -f ./localAPI/docker-compose.yml -f ./localAPI/docker-compose-serve-api.yml up -d
> docker compose -f ./localAPI/docker-compose.yml -f ./localAPI/docker-compose-serve-api.yml up -d

Creating localapi_shim_1 ... done
Creating localapi_elasticsearch_1 ... done
Expand Down
18 changes: 15 additions & 3 deletions app/src/js/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ export const getGranule = (granuleId, params) => ({
}
});

export const getGranuleRecoveryStatus = (granuleId) => ({
export const getGranuleRecoveryStatus = (granuleId, collectionId) => ({
[CALL_API]: {
type: types.RECOVERY_GRANULE,
method: 'POST',
id: granuleId,
path: 'orca/recovery/granules',
data: { granuleId }
data: { granuleId, collectionId }
}
});

Expand Down Expand Up @@ -758,7 +758,10 @@ export const updateRule = (payload) => ({
type: types.UPDATE_RULE,
method: 'PUT',
path: `rules/${payload.name}`,
data: payload
data: payload,
headers: {
'Cumulus-API-Version': '2',
}
}
});

Expand Down Expand Up @@ -795,6 +798,9 @@ export const enableRule = (payload) => {
data: {
...rule,
state: 'ENABLED'
},
headers: {
'Cumulus-API-Version': '2',
}
}
};
Expand All @@ -812,6 +818,9 @@ export const disableRule = (payload) => {
data: {
...rule,
state: 'DISABLED'
},
headers: {
'Cumulus-API-Version': '2',
}
}
};
Expand All @@ -826,6 +835,9 @@ export const rerunRule = (payload) => ({
data: {
...payload,
action: 'rerun'
},
headers: {
'Cumulus-API-Version': '2',
}
}
});
Expand Down
16 changes: 6 additions & 10 deletions app/src/js/components/Granules/bulk-granule-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,17 @@ const BulkGranuleModal = ({
if (!inflight) {
try {
json = JSON.parse(query);
const granuleIds = json.ids.map((granule) => granule.granuleId);
json.ids = granuleIds;
} catch (jsonError) {
return setErrorState('Syntax error in JSON');
return setErrorState(`Syntax error in JSON ${jsonError.message}`);
}
dispatch(bulkRequestAction({ requestId, json }));
}
}

function queryGranulesWorkflows(queryParams) {
const { ids, index, query: esQuery } = queryParams;
if ((index && esQuery) || ids.length > 0) {
const granuleWorkflowsQuery = { ...queryParams, granules: ids };
delete granuleWorkflowsQuery[ids];
dispatch(getGranulesWorkflows(granuleWorkflowsQuery));
const { granules, index, query: esQuery } = queryParams;
if ((index && esQuery) || granules.length > 0) {
dispatch(getGranulesWorkflows(queryParams));
}
}

Expand All @@ -100,7 +96,7 @@ const BulkGranuleModal = ({
}

useEffect(() => {
const queryParams = { ...JSON.parse(query), ids: selected };
const queryParams = { ...JSON.parse(query), granules: selected };
setQuery(JSON.stringify(queryParams, null, 2));

if (showModal && queryWorkflowOptions) {
Expand Down Expand Up @@ -158,7 +154,7 @@ const BulkGranuleModal = ({
{selected &&
<>
<p>Selected granules:</p>
<p>[{selected.map((selection) => `"${selection.granuleId}"`).join(', ')}]</p>
<p>[{selected.map((selection) => `{"granuleId": "${selection.granuleId}", "collectionId": "${selection.collectionId}"}`).join(', ')}]</p>
</>
}
<br/>
Expand Down
2 changes: 1 addition & 1 deletion app/src/js/components/Granules/bulk.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const bulkOperationsDefaultQuery = {
workflowName: '',
index: '',
query: '',
granules: '',
granules: [],
meta: {}
};

Expand Down
3 changes: 2 additions & 1 deletion app/src/js/components/Granules/granule.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ class GranuleOverview extends React.Component {

toggleShowRecoveryStatus() {
const { granuleId } = this.props.match.params;
const collectionId = get(this.props.granules.map, [granuleId, 'data', 'collectionId']);
const newState = !this.state.showRecoveryStatus;
this.setState({ showRecoveryStatus: newState });
if (newState) {
this.props.dispatch(getGranuleRecoveryStatus(granuleId));
this.props.dispatch(getGranuleRecoveryStatus(granuleId, collectionId));
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/js/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const deploymentConfig = require('./config');
const baseConfig = {
environment: 'development',
requireEarthdataLogin: false,
minCompatibleApiVersion: 'v16.0.0',
minCompatibleApiVersion: 'v18.1.0',
oauthMethod: 'earthdata',

graphicsPath: '/src/assets/images/',
Expand Down
2 changes: 1 addition & 1 deletion audit-ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"high": true,
"pass-enoaudit": true,
"retry-count": 20,
"allowlist": ["fast-xml-parser", "d3-color", "json5"]
"allowlist": ["d3-color"]
}
2 changes: 1 addition & 1 deletion bin/build_dashboard_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
set -evx

IMAGE_NAME="${1:-cumulus-dashboard:latest}"
IMAGE_NAME=$IMAGE_NAME docker-compose -f docker/docker-compose.yml build dashboard
IMAGE_NAME=$IMAGE_NAME docker compose -f docker/docker-compose.yml build dashboard
2 changes: 1 addition & 1 deletion bin/build_dashboard_via_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DIST="$(pwd)/dist"
echo "Cleaning $DIST directory"
rm -rf $DIST && mkdir $DIST

TAG=${TAG} docker-compose -f docker/docker-compose.yml build build
TAG=${TAG} docker compose -f docker/docker-compose.yml build build
docker create --name dashboard-build-container dashboard-build:${TAG}
docker cp dashboard-build-container:/cumulus-dashboard/dist/. ./dist
docker rm dashboard-build-container
3 changes: 2 additions & 1 deletion cypress/integration/granules_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ describe('Dashboard Granules Page', () => {

it('Should show or hide granule recovery status on the granule detail page.', () => {
const granuleId = 'MOD09GQ.A9344328.K9yI3O.006.4625818663028';
const collectionId = 'MOD09GQ___006';
cy.intercept(
{ method: 'POST', url: 'orca/recovery/granules' },
{ fixture: 'granule-recovery-status.json', statusCode: 200 }
Expand All @@ -404,7 +405,7 @@ describe('Dashboard Granules Page', () => {
cy.get('.status--process .meta__row .button').as('showRecoveryStatusButton');
cy.get('@showRecoveryStatusButton').should('have.text', 'Show Recovery Status');
cy.get('@showRecoveryStatusButton').click();
cy.wait('@getGranuleRecoveryStatus');
cy.wait('@getGranuleRecoveryStatus').its('request.body').should('deep.equal', { granuleId, collectionId });
cy.get('.status--process .meta__row > dd').children().should('have.length', 4);
cy.get('.status--process .meta__row > dd').children().eq(2).should('have.text', 'Recovery');
cy.get('.status--process .meta__row > dd').children().eq(3).should('have.class', 'status-indicator--running');
Expand Down
6 changes: 3 additions & 3 deletions cypress/integration/rules_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,20 +260,20 @@ describe('Rules page', () => {

// Test error flow
const errorRuleType = 'test';
const errorMessage = "Rule type 'test' not supported.";
const errMsgRegx = /The record has validation errors:.*rule.type.*should be equal to one of the allowed values/;
cy.contains('.ace_variable', 'name');
cy.editJsonTextarea({ data: { rule: { type: errorRuleType } }, update: true });

// Edit Rule should allow for continued editing
cy.contains('form button', 'Submit').click();
cy.contains('.default-modal .edit-rule__title', 'Edit Rule');
cy.contains('.default-modal .modal-body', `Rule ${testRuleName} has encountered an error.`);
cy.contains('.default-modal .modal-body .error', errorMessage);
cy.get('.default-modal .modal-body .error').invoke('text').should('match', errMsgRegx);
cy.contains('.modal-footer button', 'Continue Editing Rule').click();
cy.url().should('include', `rules/edit/${testRuleName}`);

// There should be an error report
cy.contains('.error__report', errorMessage);
cy.contains('.error__report', errMsgRegx);

// Cancel Request should return to rule page
cy.contains('form button', 'Submit').click();
Expand Down
Loading

0 comments on commit 1541214

Please sign in to comment.