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

administration: integrate banners view module #15

Conversation

anikachurilova
Copy link
Member

@anikachurilova anikachurilova commented Feb 8, 2023

Search view page (with pagination):
Screenshot 2023-02-14 at 17 11 09
Screenshot 2023-02-08 at 17 15 46

Details view:
Screenshot 2023-02-14 at 17 16 46
details view

Create banner view:
Screenshot 2023-02-14 at 17 13 37

Create banner action:
create action

Edit banner view:
Screenshot 2023-02-14 at 17 14 18

Edit banner action:
update action

Delete banner action:
delete action

Sort banners action:
By Url path
Screenshot 2023-02-08 at 17 35 33

By Active
Screenshot 2023-02-08 at 17 36 17

By Start Datetime
Screenshot 2023-02-08 at 17 37 05

Search banners action:
Search by string field
Screenshot 2023-02-08 at 17 38 35

Search by datetime field
Screenshot 2023-02-08 at 17 39 59

Search by bool field
Screenshot 2023-02-08 at 17 40 28

Loader preview:
loader

Plain HTML into banner message:
html

@anikachurilova anikachurilova force-pushed the integrate-invenio-administration-panel branch from b6a5166 to d248ea9 Compare February 8, 2023 17:04
Copy link
Contributor

@ntarocco ntarocco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Added a couple of comments

"description": _(
"Message to be displayed on the banner. HTML format is supported."
),
"rows": 10,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might want to add to this PR the bump of the min version of react-invenio-forms in the webpack.py?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be done in invenio-administration PR inveniosoftware/invenio-administration#154
After the react-invenio-forms is released

Copy link
Member

@alejandromumo alejandromumo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

Left some minor comments

* integrate admin banners list, edit, create and details view
* disable expired banners after each create and update action
* improve banners marshmallow schema
* add http request data validation at create and update actions
* improve banners macro
* override banners list result to_dict()
* move getting active banners to only db layer
* cover macros with tests
* closes inveniosoftware#10
@anikachurilova anikachurilova force-pushed the integrate-invenio-administration-panel branch from d248ea9 to 03882d8 Compare February 14, 2023 16:05
def test_disable_expired_after_create_action(client, admin, headers):
"""Disable expired banners after a create a banner action."""
# create banner first
banner1 = BannerModel.create(banners["banner1"])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this but maybe as we are testing the resource we shouldn't use the model directly?

Comment on lines -37 to -54
def read_active_banners(self, identity, url_path):
"""Retrieve the list of active banners with the given url_path."""
self.require_permission(identity, "read")

active_banners = self.record_cls.get_active()

# filter by url_path
banners = []
for banner in active_banners:
if banner.url_path is None or url_path.startswith(banner.url_path):
banners.append(banner)

return self.result_list(
self,
identity,
banners,
links_item_tpl=self.links_item_tpl,
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just by curiosity. Why removing this function?

Copy link
Member Author

@anikachurilova anikachurilova Feb 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the filtering to the db layer, because it's easier to access from utils get_active_banners_for_request (I had some issues with accessing service methods from there).

Copy link
Contributor

@jrcastro2 jrcastro2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the tests!

@ppanero ppanero merged commit 3733a8a into inveniosoftware:master Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate invenio-administration
6 participants