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

Improved visibility sensor + improved route parameters #53

Merged
merged 6 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [3.0.13](https://github.com/eea/volto-datablocks/compare/3.0.12...3.0.13)

- Update cypress.json [`91507ae`](https://github.com/eea/volto-datablocks/commit/91507aebd34ac8d74448b5989ad8f1b5f0d03582)
- Add date-fns dependency [`e1f1426`](https://github.com/eea/volto-datablocks/commit/e1f142699ad00776f6c34d1d84458ad43de0c34c)
- Improved visibility sensor + improved route parameters [`a2e1188`](https://github.com/eea/volto-datablocks/commit/a2e118825464c2fae2ffda2aa37de97d97e42fbc)
- Fix route parameters [`f915261`](https://github.com/eea/volto-datablocks/commit/f915261ea8831fc34f8187a5bd21f083c4288946)

#### [3.0.12](https://github.com/eea/volto-datablocks/compare/3.0.11...3.0.12)

- Check URL protocol and add if not present [`68277e5`](https://github.com/eea/volto-datablocks/commit/68277e5fee32760e7b52aab49475fe6580055fbf)
> 20 May 2022

- Check URL protocol and add if not present [`#52`](https://github.com/eea/volto-datablocks/pull/52)

#### [3.0.11](https://github.com/eea/volto-datablocks/compare/3.0.10...3.0.11)

Expand Down
5 changes: 3 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pipeline {
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,biodiversity.europa.eu,water.europa.eu-freshwater"
DEPENDENCIES = "@eeacms/volto-embed"
VOLTO = "alpha"
}

stages {
Expand Down Expand Up @@ -124,8 +125,8 @@ pipeline {
node(label: 'docker') {
script {
try {
sh '''docker pull plone; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" plone/volto-addon-ci cypress'''
sh '''docker pull eeacms/plone-backend; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend'''
sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=development -e VOLTO="$VOLTO" plone/volto-addon-ci cypress'''
} finally {
try {
sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
Expand Down
7 changes: 6 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"baseUrl": "http://localhost:3000",
"viewportWidth": 1280,
"defaultCommandTimeout": 15000,
"defaultCommandTimeout": 8888,
"reporter": "junit",
"video": true,
"reporterOptions": {
"mochaFile": "cypress/reports/cypress-[hash].xml",
"jenkinsMode": true,
"toConsole": true
},
"chromeWebSecurity": false,
"retries": {
"runMode": 8,
"openMode": 0
}
}
1 change: 0 additions & 1 deletion cypress/integration/block-basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const groups = {
const data_blocks_ids = [
'dataqueryfilter',
'dottedTableChart',
// 'routeParameter',
'simpleDataConnectedTable',
];

Expand Down
2 changes: 1 addition & 1 deletion cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ coverage-end */
export const setupBeforeEach = () => {
cy.autologin();
cy.createContent({
contentType: 'Folder',
contentType: 'Document',
contentId: 'cypress',
contentTitle: 'Cypress',
});
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-datablocks",
"version": "3.0.12",
"version": "3.0.13",
"description": "(EEA) Provides primitives for data connectivity to volto-plotlycharts and other blocks",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand All @@ -21,12 +21,14 @@
],
"dependencies": {
"@eeacms/volto-embed": "*",
"@eeacms/volto-matomo": "*",
"@eeacms/volto-group-block": "*",
"@eeacms/volto-matomo": "*",
"d3": "7.1.1",
"date-fns": "2.28.0",
"humanize-plus": "^1.8.2",
"object-hash": "2.2.0",
"react-countup": "6.1.1",
"react-visibility-sensor": "5.1.1",
"sanitize-html": "^2.3.3",
"slate": "^0.62.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/DataConnectedValue/DataConnectedValue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const DataConnectedValue = (props) => {
row,
]);

const collapsable = props.collapsable && value.length > collapseLimit;
const collapsable = props.collapsable && value?.length > collapseLimit;

return !isNil(value) ? (
<>
Expand Down
1 change: 0 additions & 1 deletion src/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { GET_SPARQL_DATA, CHANGE_SIDEBAR_STATE } from '../constants';

export * from './blockData';
export * from './routeParameters';
export * from './dataProvider';
export * from './connectedDataParameters';

Expand Down
16 changes: 0 additions & 16 deletions src/actions/routeParameters.js

This file was deleted.

4 changes: 1 addition & 3 deletions src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
export DataConnectorView from './theme/DataConnector/View';
export Placeholder from './theme/Placeholder/View';
export VisibilitySensor from './theme/VisibilitySensor/VisibilitySensor';

export CountryFlagEdit from './manage/Blocks/CountryFlag/Edit';
// export DataConnectedEmbedBlockEdit from './manage/Blocks/DataConnectedEmbedBlock/Edit';
export DataQueryFilterEdit from './manage/Blocks/DataQueryFilter/Edit';
export DottedTableChartEdit from './manage/Blocks/DottedTableChart/Edit';
export SimpleDataTableEdit from './manage/Blocks/SimpleDataTable/Edit';
export SourcesBlockEdit from './manage/Blocks/SourcesBlock/Edit';
export RouteParameterEdit from './manage/Blocks/RouteParameter/Edit';

export CountryFlagView from './manage/Blocks/CountryFlag/View';
// export DataConnectedEmbedBlockView from './manage/Blocks/DataConnectedEmbedBlock/View';
export DataQueryFilterView from './manage/Blocks/DataQueryFilter/View';
export DottedTableChartView from './manage/Blocks/DottedTableChart/View';
export SimpleDataTableView from './manage/Blocks/SimpleDataTable/View';
export SourcesBlockView from './manage/Blocks/SourcesBlock/View';
export RouteParameterView from './manage/Blocks/RouteParameter/View';

export PickObjectWidget from './manage/Widgets/PickObjectWidget';
export DataQueryWidget from './manage/Widgets/DataQueryWidget';
Expand Down
11 changes: 10 additions & 1 deletion src/components/manage/Blocks/CustomConnectedBlock/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { compose } from 'redux';
import { SidebarPortal } from '@plone/volto/components';
import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
import config from '@plone/volto/registry';
import { VisibilitySensor } from '@eeacms/volto-datablocks/components';
import { connectToProviderData } from '@eeacms/volto-datablocks/hocs';
import getSchema from './schema';
import { View } from './View';
Expand Down Expand Up @@ -39,8 +40,16 @@ const Edit = (props) => {
);
};

export default compose(
const EditWrapper = compose(
connectToProviderData((props) => ({
provider_url: props.data?.provider_url,
})),
)(Edit);

export default (props) => {
return (
<VisibilitySensor>
<EditWrapper {...props} />
</VisibilitySensor>
);
};
18 changes: 14 additions & 4 deletions src/components/manage/Blocks/CustomConnectedBlock/View.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useMemo } from 'react';
import { isNil } from 'lodash';
import { compose } from 'redux';
import config from '@plone/volto/registry';
import { VisibilitySensor } from '@eeacms/volto-datablocks/components';
import { connectToProviderData } from '@eeacms/volto-datablocks/hocs';
import './style.less';

Expand Down Expand Up @@ -34,15 +36,23 @@ const View = (props) => {
<RenderCustomConnectedBlock
{...props}
mode={props.mode}
placeholder={props.data.placeholder}
placeholder={!isNil(props.provider_data) ? props.data.placeholder : null}
/>
);
};

export { View };

export default compose(
const BlockView = compose(
connectToProviderData((props) => ({
provider_url: props.data?.provider_url,
})),
)(View);

export { View };

export default (props) => {
return (
<VisibilitySensor Placeholder={() => <div>loading....&nbsp;</div>}>
<BlockView {...props} />
</VisibilitySensor>
);
};
31 changes: 0 additions & 31 deletions src/components/manage/Blocks/RouteParameter/Edit.jsx

This file was deleted.

56 changes: 0 additions & 56 deletions src/components/manage/Blocks/RouteParameter/View.jsx

This file was deleted.

22 changes: 0 additions & 22 deletions src/components/manage/Blocks/RouteParameter/index.js

This file was deleted.

26 changes: 0 additions & 26 deletions src/components/manage/Blocks/RouteParameter/schema.js

This file was deleted.

13 changes: 10 additions & 3 deletions src/components/manage/Blocks/SimpleDataTable/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import React, { Component } from 'react';
import { compose } from 'redux';
import { SidebarPortal } from '@plone/volto/components'; // EditBlock
import InlineForm from '@plone/volto/components/manage/Form/InlineForm';

import config from '@plone/volto/registry';

import { VisibilitySensor } from '@eeacms/volto-datablocks/components';
import { connectToProviderData } from '@eeacms/volto-datablocks/hocs';

import { SimpleDataTableSchema } from './schema';
Expand Down Expand Up @@ -91,7 +90,7 @@ class Edit extends Component {
}
}

export default compose(
const EditWrapper = compose(
connectToProviderData((props) => {
const { max_count = 5 } = props.data;
return {
Expand All @@ -107,3 +106,11 @@ export default compose(
};
}),
)(Edit);

export default (props) => {
return (
<VisibilitySensor offset={{ top: -150, bottom: -150 }}>
<EditWrapper {...props} />
</VisibilitySensor>
);
};
Loading