Skip to content

Commit c8499dd

Browse files
authored
Merge pull request #1053 from nasa/develop
merge develop branch back to master for v10.0.0
2 parents 3f4888e + 589ec77 commit c8499dd

File tree

13 files changed

+1467
-2377
lines changed

13 files changed

+1467
-2377
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"root": false,
23
"extends": [
34
"airbnb-base",
45
"standard",

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [v10.0.0] - 2022-02-25
11+
12+
## Breaking Changes
13+
14+
This version of the dashboard requires Cumulus API v10.1.0
15+
16+
### Changed
17+
18+
- **CUMULUS-2843**
19+
- Create provider and create rule modals now dislpay the provider [rule]
20+
schema title directly as read from the Cumulus API.
21+
1022
## [v9.0.0] - 2022-02-01
1123

1224
## Breaking Changes
@@ -1226,7 +1238,8 @@ Fix for serving the dashboard through the Cumulus API.
12261238
### Added
12271239

12281240
- Versioning and changelog [CUMULUS-197] by @kkelly51
1229-
[Unreleased]: https://github.com/nasa/cumulus-dashboard/compare/v9.0.0...HEAD
1241+
[Unreleased]: https://github.com/nasa/cumulus-dashboard/compare/v10.0.0...HEAD
1242+
[v10.0.0]: https://github.com/nasa/cumulus-dashboard/compare/v9.0.0...v10.0.0
12301243
[v9.0.0]: https://github.com/nasa/cumulus-dashboard/compare/v8.0.0...v9.0.0
12311244
[v8.0.0]: https://github.com/nasa/cumulus-dashboard/compare/v7.1.0...v8.0.0
12321245
[v7.1.0]: https://github.com/nasa/cumulus-dashboard/compare/v7.0.0...v7.1.0

app/src/js/components/DeleteCollection/DeleteCollectionModal.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { Alert } from 'react-bootstrap';
44
import DefaultModal from '../Modal/modal';
5-
import {
6-
collectionName as collectionLabelForId,
7-
} from '../../utils/format';
85

96
class DeleteCollectionModal extends React.Component {
107
constructor (props) {
@@ -40,7 +37,7 @@ class DeleteCollectionModal extends React.Component {
4037
<p> You have submitted a request to delete the following collection: </p>
4138
<br />
4239
<h1>
43-
<strong>{collectionLabelForId(this.props.collectionLabel)}</strong>
40+
<strong>{this.props.collectionLabel}</strong>
4441
</h1>
4542
<br />
4643
<p> Are you sure you want to permanently delete this collection? </p>

app/src/js/components/FormSchema/schema.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import React from 'react';
44
import PropTypes from 'prop-types';
55
import { get, set } from 'object-path';
6-
import startCase from 'lodash/startCase';
76
import noop from 'lodash/noop';
7+
import startCase from 'lodash/startCase';
88
import { Form, formTypes } from '../Form/Form';
99
import {
1010
arrayWithLength,
@@ -104,7 +104,7 @@ export const createFormConfig = ({
104104
isArray(schemaProperty.required) &&
105105
schemaProperty.required.includes(property);
106106

107-
const labelText = startCase(meta.title || property);
107+
const labelText = meta.title || startCase(property);
108108
const label = (
109109
<span>
110110
<span className="label__name">{labelText}</span>

app/src/js/config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const deploymentConfig = require('./config');
88
const baseConfig = {
99
environment: 'development',
1010
requireEarthdataLogin: false,
11-
minCompatibleApiVersion: 'v10.0.0',
11+
minCompatibleApiVersion: 'v10.1.0',
1212
oauthMethod: 'earthdata',
1313

1414
graphicsPath: '/src/assets/images/',

app/src/js/utils/format.js

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,52 @@ export const truncate = (string, to = 100) => {
332332
return `${string.slice(0, to)}...`;
333333
};
334334

335+
const collectionIdSeparator = '___';
336+
/**
337+
* Returns the name and version of a collection based on
338+
* the collectionId used in elasticsearch indexing
339+
*
340+
* @param {string} collectionId - collectionId used in elasticsearch index
341+
* @returns {Object} name and version as object
342+
*/
343+
export const deconstructCollectionId = (collectionId) => {
344+
let name;
345+
let version;
346+
try {
347+
const last = collectionId.lastIndexOf(collectionIdSeparator);
348+
name = collectionId.substring(0, last);
349+
version = collectionId.substring(last + collectionIdSeparator.length);
350+
if (name && version) {
351+
return {
352+
name,
353+
version,
354+
};
355+
}
356+
} catch (error) {
357+
// do nothing error thrown below
358+
}
359+
if (collectionId && collectionId.match(' / ')) {
360+
console.debug(`deconstructCollectionId called with previously deconstructed ID ${collectionId}`);
361+
return collectionId;
362+
}
363+
throw new Error(`invalid collectionId: ${JSON.stringify(collectionId)}`);
364+
};
365+
366+
// "MYD13A1___006" => "MYD13A1 / 006"
367+
// "trailing_____1.0" => "trailing__ / 1.0"
368+
export const collectionName = (collectionId) => {
369+
if (!collectionId) return nullValue;
370+
const collection = deconstructCollectionId(collectionId);
371+
return `${collection.name} / ${collection.version}`;
372+
};
373+
374+
export const collectionNameVersion = (collectionId) => {
375+
if (!collectionId) return nullValue;
376+
return deconstructCollectionId(collectionId);
377+
};
378+
379+
export const constructCollectionId = (name, version) => `${name}${collectionIdSeparator}${version}`;
380+
335381
export const getFormattedCollectionId = (collection) => {
336382
const collectionId = getCollectionId(collection);
337383
return formatCollectionId(collectionId);
@@ -341,46 +387,17 @@ export const formatCollectionId = (collectionId) => (collectionId === undefined
341387

342388
export const getCollectionId = (collection) => {
343389
if (collection && collection.name && collection.version) {
344-
return `${collection.name}___${collection.version}`;
390+
return constructCollectionId(collection.name, collection.version);
345391
}
346392
};
347393

348394
export const getEncodedCollectionId = (collection) => {
349395
if (collection && collection.name && collection.version) {
350-
return `${collection.name}___${encodeURIComponent(collection.version)}`;
396+
return constructCollectionId(collection.name, encodeURIComponent(collection.version));
351397
}
352398
return nullValue;
353399
};
354400

355-
// "MYD13A1___006" => "MYD13A1 / 006"
356-
export const collectionName = (collectionId) => {
357-
if (!collectionId) return nullValue;
358-
return collectionId.split('___').join(' / ');
359-
};
360-
361-
export const collectionNameVersion = (collectionId) => {
362-
if (!collectionId) return nullValue;
363-
const [name, version] = collectionId.split('___');
364-
return { name, version };
365-
};
366-
367-
export const constructCollectionNameVersion = (name, version) => `${name}___${version}`;
368-
369-
/**
370-
* Returns the name and version of a collection based on
371-
* the collectionId used in elasticsearch indexing
372-
*
373-
* @param {string} collectionId - collectionId used in elasticsearch index
374-
* @returns {Object} name and version as object
375-
*/
376-
export const deconstructCollectionId = (collectionId) => {
377-
const [name, version] = collectionId.split('___');
378-
return {
379-
name,
380-
version,
381-
};
382-
};
383-
384401
export const collectionLink = (collectionId) => {
385402
if (!collectionId || collectionId === nullValue) return nullValue;
386403
return (

cypress/integration/pdrs_spec.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { shouldBeRedirectedToLogin } from '../support/assertions';
2+
import { collectionName, collectionHrefFromId } from '../../app/src/js/utils/format';
23

34
describe('Dashboard PDRs Page', () => {
45
describe('When not logged in', () => {
@@ -159,8 +160,8 @@ describe('Dashboard PDRs Page', () => {
159160
.should('have.attr', 'href', `/providers/provider/${pdr.provider}`);
160161

161162
cy.contains('Collection').next()
162-
.contains('a', pdr.collectionId.split('___').join(' / '))
163-
.should('have.attr', 'href', `/collections/collection/${pdr.collectionId.split('___').join('/')}`);
163+
.contains('a', collectionName(pdr.collectionId))
164+
.should('have.attr', 'href', collectionHrefFromId(pdr.collectionId));
164165

165166
cy.contains('Execution').next()
166167
.contains('a', 'link')
@@ -215,8 +216,8 @@ describe('Dashboard PDRs Page', () => {
215216
.should('have.attr', 'href')
216217
.and('be.eq', `/granules/granule/${granule.granuleId}`);
217218
cy.get('@columns').eq(3)
218-
.contains('a', granule.collectionId.split('___').join(' / '))
219-
.should('have.attr', 'href', `/collections/collection/${granule.collectionId.split('___').join('/')}`);
219+
.contains('a', collectionName(granule.collectionId))
220+
.should('have.attr', 'href', collectionHrefFromId(granule.collectionId));
220221
cy.get('@columns').eq(4)
221222
.should('have.text', `${Number(granule.duration.toFixed(2))}s`);
222223
cy.get('@columns').eq(5).invoke('text')

cypress/integration/providers_spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ describe('Dashboard Providers Page', () => {
4646
'Host',
4747
];
4848
const expectedFieldsAuth = ['Port', 'Username', 'Password'];
49-
const expectedFieldsHttp = ['Allowed Redirects', 'S 3 URI For Custom SSL Certificate'];
49+
const expectedFieldsHttp = ['Allowed Redirects', 'S3 URI For Custom SSL Certificate'];
5050
const expectedFieldsSftp = ['Private Key', 'AWS KMS Customer Master Key ARN Or Alias'];
51+
5152
it('should go to add providers page', () => {
5253
cy.visit('/providers');
5354
cy.contains('.heading--large', 'Provider Overview');

0 commit comments

Comments
 (0)