Skip to content

Commit

Permalink
v2.1.0 (#60)
Browse files Browse the repository at this point in the history
* add table slice to time series, fix default variable determination

* add tombstone availability status support

* fix runtime validation of tombstoned status type

* add table slice to time series, fix default variable determination

* enable multi citation support for bundles

* update citation bundle display

* update citation bundle display

* create bundle presentation component, update citation display

* pull out bundle content builder from component

* regen drupal assets

* update bundle blurbs and display

* tweak citation use language

* improve drupal asset handling, font, style loading

* improve css response handling, script await refinement, regen assets

* update image asset location update in drupal css cleaning

* update assets script options, allow env var for disabling drupal fetch

* helper script for apps to synchronize cached public assets

* handle multi-citation release case

* inject only single metadata tags for multi parent

* add bundled information link, generate lib

* prepare v2.1.0

* remove parent language from bundle subtitles
  • Loading branch information
sampsonj authored Apr 3, 2023
1 parent b88dc1f commit 01ced3e
Show file tree
Hide file tree
Showing 133 changed files with 4,998 additions and 15,088 deletions.
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ REACT_APP_NEON_AUTH_DISABLE_WS="true"
REACT_APP_NEON_USE_GRAPHQL="true"
REACT_APP_NEON_SHOW_AOP_VIEWER="true"
REACT_APP_NEON_ENABLE_GLOBAL_SIGNIN_STATE="false"
# Option to disable fetching Drupal assets and utilize cached assets
REACT_APP_NEON_FETCH_DRUPAL_ASSETS="true"

#-------------------------------------------------------------------------------
# Third party APIs and options
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"src/**/__tests__",
"src/**/__mocks__",
"lib/",
"scripts/*.js",
"config/",
"jest.config.js",
"server.js"
Expand Down
12 changes: 12 additions & 0 deletions lib/components/Bundles/BundleContentBuilder.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// <reference types="react" />
import { IDataProductLike } from '../../types/internal';
export interface IBundleContentBuilder {
getParentProductLink: (dataProduct: IDataProductLike, release?: string) => JSX.Element;
getBundledLink: () => JSX.Element;
buildManyParentsMainContent: (dataProducts: IDataProductLike[], release?: string) => JSX.Element;
buildDefaultTitleContent: (dataProduct: IDataProductLike, release?: string) => JSX.Element;
buildDefaultSplitTitleContent: (isRelease: boolean, terminalChar?: string) => JSX.Element;
buildDefaultSubTitleContent: (forwardAvailability: boolean, hasManyParents: boolean) => JSX.Element;
}
declare const BundleContentBuilder: IBundleContentBuilder;
export default BundleContentBuilder;
61 changes: 61 additions & 0 deletions lib/components/Bundles/BundleContentBuilder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _Link = _interopRequireDefault(require("@material-ui/core/Link"));
var _RouteService = _interopRequireDefault(require("../../service/RouteService"));
var _Theme = _interopRequireDefault(require("../Theme/Theme"));
var _typeUtil = require("../../util/typeUtil");
var _ReleaseService = require("../../service/ReleaseService");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var BundleContentBuilder = {
getParentProductLink: function getParentProductLink(dataProduct, release) {
var isRelease = (0, _typeUtil.isStringNonEmpty)(release) && release !== _ReleaseService.LATEST_AND_PROVISIONAL;
var href = _RouteService.default.getProductDetailPath(dataProduct.productCode, isRelease ? release : undefined);
return /*#__PURE__*/_react.default.createElement(_Link.default, {
href: href,
target: "_blank"
}, "".concat(dataProduct.productName, " (").concat(dataProduct.productCode, ")"));
},
getBundledLink: function getBundledLink() {
var href = _RouteService.default.getDataProductBundlesPath();
return /*#__PURE__*/_react.default.createElement(_Link.default, {
href: href,
target: "_blank"
}, "bundled");
},
buildManyParentsMainContent: function buildManyParentsMainContent(dataProducts, release) {
return /*#__PURE__*/_react.default.createElement("ul", {
style: {
margin: _Theme.default.spacing(1, 0)
}
}, dataProducts.map(function (dataProduct) {
return /*#__PURE__*/_react.default.createElement("li", {
key: dataProduct.productCode
}, BundleContentBuilder.getParentProductLink(dataProduct, release));
}));
},
buildDefaultTitleContent: function buildDefaultTitleContent(dataProduct, release) {
var isRelease = (0, _typeUtil.isStringNonEmpty)(release) && release !== _ReleaseService.LATEST_AND_PROVISIONAL;
var bundleParentLink = BundleContentBuilder.getParentProductLink(dataProduct, isRelease ? release : undefined);
var bundledLink = BundleContentBuilder.getBundledLink();
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "This data product ", isRelease ? 'release ' : '', "is ", bundledLink, " into ", bundleParentLink);
},
buildDefaultSplitTitleContent: function buildDefaultSplitTitleContent(isRelease, terminalChar) {
var bundledLink = BundleContentBuilder.getBundledLink();
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "This data product ", isRelease ? 'release ' : '', "is ", bundledLink, " into the following data product", isRelease ? ' releases' : 's', "".concat(terminalChar));
},
buildDefaultSubTitleContent: function buildDefaultSubTitleContent(forwardAvailability, hasManyParents) {
return (
/*#__PURE__*/
// eslint-disable-next-line react/jsx-no-useless-fragment
_react.default.createElement(_react.default.Fragment, null, forwardAvailability ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "It is not available as a standalone download. Data availability shown below reflects availability of the entire bundle.") : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "It is not available as a standalone download. Data availability information and data product download is only available through the bundle data ", hasManyParents ? 'products' : 'product', "."))
);
}
};
Object.freeze(BundleContentBuilder);
var _default = BundleContentBuilder;
exports.default = _default;
6 changes: 6 additions & 0 deletions lib/components/Bundles/BundleListItemIcon.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
export interface BundleListItemIconProps {
isSplit?: boolean;
}
declare const BundleListItemIcon: React.FC<BundleListItemIconProps>;
export default BundleListItemIcon;
35 changes: 35 additions & 0 deletions lib/components/Bundles/BundleListItemIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _ListItemIcon = _interopRequireDefault(require("@material-ui/core/ListItemIcon"));
var _styles = require("@material-ui/core/styles");
var _reactFontawesome = require("@fortawesome/react-fontawesome");
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
var _Theme = _interopRequireDefault(require("../Theme/Theme"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var useStyles = (0, _styles.makeStyles)(function (theme) {
return {
bundleIcon: {
padding: '5px',
marginRight: theme.spacing(2)
}
};
});
var BundleListItemIcon = function BundleListItemIcon(props) {
var classes = useStyles(_Theme.default);
var isSplit = props.isSplit;
return /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
icon: isSplit ? _freeSolidSvgIcons.faBoxesStacked : _freeSolidSvgIcons.faBox,
size: "2x",
className: classes.bundleIcon
}));
};
BundleListItemIcon.defaultProps = {
isSplit: false
};
var _default = BundleListItemIcon;
exports.default = _default;
19 changes: 19 additions & 0 deletions lib/components/Bundles/DataProductBundleCard.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
export interface DataProductBundleCardClasses {
card?: string;
cardContent?: string;
cardContentFlexContainer?: string;
cardContentContainer?: string;
cardIcon?: string;
}
export interface DataProductBundleCardProps {
titleContent?: React.ReactNode;
detailContent?: React.ReactNode;
subTitleContent?: React.ReactNode;
customContent?: React.ReactNode;
isSplit?: boolean;
showIcon?: boolean;
classes?: DataProductBundleCardClasses;
}
declare const DataProductBundleCard: React.FC<DataProductBundleCardProps>;
export default DataProductBundleCard;
106 changes: 106 additions & 0 deletions lib/components/Bundles/DataProductBundleCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _Card = _interopRequireDefault(require("@material-ui/core/Card"));
var _CardContent = _interopRequireDefault(require("@material-ui/core/CardContent"));
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
var _styles = require("@material-ui/core/styles");
var _reactFontawesome = require("@fortawesome/react-fontawesome");
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
var _Theme = _interopRequireDefault(require("../Theme/Theme"));
var _typeUtil = require("../../util/typeUtil");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var useStyles = (0, _styles.makeStyles)(function (theme) {
return {
card: {
backgroundColor: _Theme.default.colors.GOLD[50],
borderColor: _Theme.default.colors.GOLD[200],
marginTop: theme.spacing(1)
},
cardContent: {
padding: theme.spacing(2),
paddingBottom: "".concat(theme.spacing(2), "px !important")
},
cardContentFlexContainer: {
display: 'flex',
alignItems: 'center',
padding: theme.spacing(2),
paddingBottom: "".concat(theme.spacing(2), "px !important")
},
cardContentContainer: {
flexGrow: 1
},
cardIcon: {
color: theme.colors.GOLD[700],
padding: '5px',
fontSize: '2.3875em',
marginRight: theme.spacing(2)
},
cardIconBoxesStacked: {
color: theme.colors.GOLD[700],
fontSize: '2.3875em',
marginRight: theme.spacing(2)
}
};
});
var DataProductBundleCard = function DataProductBundleCard(props) {
var classes = useStyles(_Theme.default);
var titleContent = props.titleContent,
subTitleContent = props.subTitleContent,
detailContent = props.detailContent,
customContent = props.customContent,
isSplit = props.isSplit,
showIcon = props.showIcon,
customClasses = props.classes;
var customCardClass = customClasses ? customClasses.card : undefined;
var customCardContentClass = customClasses ? customClasses.cardContent : undefined;
var customCardContentFlexContainerClass = customClasses ? customClasses.cardContentFlexContainer : undefined;
var customCardContentContainerClass = customClasses ? customClasses.cardContentContainer : undefined;
var customIconClass = customClasses ? customClasses.cardIcon : undefined;
var renderContent = function renderContent() {
if ((0, _typeUtil.exists)(customContent)) {
// eslint-disable-next-line react/jsx-no-useless-fragment
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, customContent);
}
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !(0, _typeUtil.exists)(titleContent) ? null : /*#__PURE__*/_react.default.createElement(_Typography.default, {
variant: "subtitle2"
}, titleContent), !(0, _typeUtil.exists)(detailContent) ? null :
/*#__PURE__*/
// eslint-disable-next-line react/jsx-no-useless-fragment
_react.default.createElement(_react.default.Fragment, null, detailContent), !(0, _typeUtil.exists)(subTitleContent) ? null : /*#__PURE__*/_react.default.createElement(_Typography.default, {
variant: "body2"
}, subTitleContent));
};
var renderCardContent = function renderCardContent() {
if (!showIcon) {
return renderContent();
}
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
icon: isSplit ? _freeSolidSvgIcons.faBoxesStacked : _freeSolidSvgIcons.faBox,
size: "2x",
className: customIconClass || isSplit ? classes.cardIconBoxesStacked : classes.cardIcon
}), /*#__PURE__*/_react.default.createElement("div", {
className: customCardContentContainerClass || classes.cardContentContainer
}, renderContent()));
};
return /*#__PURE__*/_react.default.createElement(_Card.default, {
className: customCardClass || classes.card
}, /*#__PURE__*/_react.default.createElement(_CardContent.default, {
className: showIcon ? customCardContentFlexContainerClass || classes.cardContentFlexContainer : customCardContentClass || classes.cardContent
}, renderCardContent()));
};
DataProductBundleCard.defaultProps = {
titleContent: undefined,
detailContent: undefined,
subTitleContent: undefined,
customContent: undefined,
isSplit: false,
showIcon: true,
classes: undefined
};
var _default = DataProductBundleCard;
exports.default = _default;
1 change: 1 addition & 0 deletions lib/components/Bundles/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./DataProductBundleCard";
13 changes: 13 additions & 0 deletions lib/components/Bundles/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function get() {
return _DataProductBundleCard.default;
}
});
var _DataProductBundleCard = _interopRequireDefault(require("./DataProductBundleCard"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6 changes: 6 additions & 0 deletions lib/components/Bundles/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"private": true,
"name": "bundles",
"main": "./DataProductBundleCard.tsx",
"module": "./DataProductBundleCard.tsx"
}
3 changes: 2 additions & 1 deletion lib/components/Citation/DataProductCitation/Actions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export interface FetchProductReleaseDoiFailedAction extends AnyAction {
}
export interface FetchProductReleaseDoiSucceededAction extends AnyAction {
type: typeof ActionTypes.FETCH_PRODUCT_RELEASE_DOI_SUCCEEDED;
productCode: string;
release: string;
data: DataProductDoiStatus;
}
Expand Down Expand Up @@ -159,7 +160,7 @@ declare const ActionCreator: {
fetchProductReleaseSucceeded: (release: string, data: ContextDataProduct) => FetchProductReleaseSucceededAction;
fetchProductReleaseDoiStarted: (release: string) => FetchProductReleaseDoiStartedAction;
fetchProductReleaseDoiFailed: (release: string, error: Nullable<AjaxResponse<unknown> | string>) => FetchProductReleaseDoiFailedAction;
fetchProductReleaseDoiSucceeded: (release: string, data: DataProductDoiStatus) => FetchProductReleaseDoiSucceededAction;
fetchProductReleaseDoiSucceeded: (productCode: string, release: string, data: DataProductDoiStatus) => FetchProductReleaseDoiSucceededAction;
fetchBundleParentStarted: (bundleParent: string) => FetchBundleParentStartedAction;
fetchBundleParentFailed: (bundleParent: string, error: Nullable<AjaxResponse<unknown> | string>) => FetchBundleParentFailedAction;
fetchBundleParentSucceeded: (bundleParent: string, data: ContextDataProduct) => FetchBundleParentSucceededAction;
Expand Down
3 changes: 2 additions & 1 deletion lib/components/Citation/DataProductCitation/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ var ActionCreator = {
error: error
};
},
fetchProductReleaseDoiSucceeded: function fetchProductReleaseDoiSucceeded(release, data) {
fetchProductReleaseDoiSucceeded: function fetchProductReleaseDoiSucceeded(productCode, release, data) {
return {
type: ActionTypes.FETCH_PRODUCT_RELEASE_DOI_SUCCEEDED,
productCode: productCode,
release: release,
data: data
};
Expand Down
4 changes: 2 additions & 2 deletions lib/components/Citation/DataProductCitation/Context.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { Dispatch } from 'react';
import { DataProductCitationState } from './State';
import { AnyAction, Nullable, Undef } from '../../../types/core';
import { DataProductCitationState } from './State';
export interface ProviderProps {
productCode?: string;
release?: Nullable<string>;
contextControlled?: boolean;
children?: React.ReactNode | React.ReactNodeArray;
children?: React.ReactNode | React.ReactNode[];
}
declare const DataProductCitationContext: {
Provider: React.FC<ProviderProps>;
Expand Down
4 changes: 2 additions & 2 deletions lib/components/Citation/DataProductCitation/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ var _react = _interopRequireWildcard(require("react"));
var _NeonApi = _interopRequireDefault(require("../../NeonApi/NeonApi"));
var _NeonContext = _interopRequireDefault(require("../../NeonContext/NeonContext"));
var _NeonGraphQL = _interopRequireDefault(require("../../NeonGraphQL/NeonGraphQL"));
var _typeUtil = require("../../../util/typeUtil");
var _Actions = _interopRequireDefault(require("./Actions"));
var _Reducer = _interopRequireDefault(require("./Reducer"));
var _Service = _interopRequireDefault(require("./Service"));
var _State = require("./State");
var _typeUtil = require("../../../util/typeUtil");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
Expand Down Expand Up @@ -167,7 +167,7 @@ var Provider = function Provider(props) {
dispatch(_Actions.default.fetchProductReleaseDoiFailed(fetchRelease, 'Failed to fetch product release doi status'));
return;
}
dispatch(_Actions.default.fetchProductReleaseDoiSucceeded(fetchRelease, response.data));
dispatch(_Actions.default.fetchProductReleaseDoiSucceeded(queryProductCode, fetchRelease, response.data));
},
error: function error(_error3) {
dispatch(_Actions.default.fetchProductReleaseDoiFailed(fetchRelease, _error3));
Expand Down
4 changes: 4 additions & 0 deletions lib/components/Citation/DataProductCitation/ItemView.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React from 'react';
import { DataProductCitationItemViewProps } from './ViewState';
declare const DataProductCitationItemView: React.FC<DataProductCitationItemViewProps>;
export default DataProductCitationItemView;
Loading

0 comments on commit 01ced3e

Please sign in to comment.