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

Introduce basic admin screen for managing "Rules Collection" and "Suggested Fields" #80

Merged
merged 24 commits into from
Jan 5, 2022

Conversation

epugh
Copy link
Contributor

@epugh epugh commented Oct 14, 2021

I am looking at how we can make it easier to add new Solr Collections to SMUI for organizations that have lots of webshops. This is a very much draft WIP just to help me learn how to write code!

@epugh epugh marked this pull request as draft October 14, 2021 14:34
@epugh
Copy link
Contributor Author

epugh commented Oct 14, 2021

image

@renekrie
Copy link
Collaborator

Much as I like an admin API, I can see a danger that we create even more Solr-specfic code which will impede opening up SMUI to Elasticsearch even further. I think we should abstract the search engine in SMUI first, before building this type of Admin features

@renekrie
Copy link
Collaborator

@epugh Just to share in public the idea that we discussed separately: This features need not depend on Solr. What we manage is a rules collection (better wording anyone?). Per se, it has nothing to do with a Solr collection. All it means: 2 rewriter configurations (1x common rules + 1x replace) that are managed and deployed together. They can be deployed to different environments - preview / production - but always together.

In Solr they happen to end up under a collection, like for ecommerce in /solr/ecommerce/querqy/rewriter/common_rules and /solr/ecommerce/querqy/rewriter/replace. Each collection has its own endpoint for managing rewriters (/solr/<collection>/querqy/rewriter)

In Elasticsearch, the rewriters exist independent of indexes (under /_querqy/rewriter). So they might end up as /_querqy/rewriter/ecommerce_common_rules and /_querqy/rewriter/ecommerce_replace.

A rules collection would probably not need more than a name and URL information (à la ecommerce in the examples above). The search engine specifics could be derived from that (eg. in the rewriter deployment scripts).

…Index.

This lets you list and delete a record out of the SolrIndex table.  Eventually this should all be renamed to "RulesCollection" ;-)
…lection creation and rules collection listing component to the Header Nav component.
@epugh epugh changed the title Introduce basic admin screen Introduce basic admin screen for managing "Rules Collection" Oct 20, 2021
@epugh
Copy link
Contributor Author

epugh commented Oct 20, 2021

I wanted to share my progress... I've now got the "Rules Collection" screen working, it even manages to update the HeaderNav drop down as you add/remove collections ;-).

I'd love to find out what the path is to getting this merged in is... I'm going to be tackling user/rules collections permissions next to support my customer.

image

@epugh epugh marked this pull request as ready for review October 20, 2021 15:24
@epugh epugh linked an issue Oct 28, 2021 that may be closed by this pull request
@epugh
Copy link
Contributor Author

epugh commented Nov 2, 2021

Baby steps:
image

@epugh
Copy link
Contributor Author

epugh commented Nov 2, 2021

image

@epugh epugh linked an issue Nov 2, 2021 that may be closed by this pull request
@epugh
Copy link
Contributor Author

epugh commented Nov 2, 2021

Okay, I think I'm now done ;-) @pbartusch I'd love your review on this. Maybe we need to set up a time and chat?

@xaviersanchez
Copy link

This looks really useful for customers like us who are starting to use SMUI and need to open the role of searchandizer. Anything that helps managing the collections from the Admin is a huge plus!

@pbartusch
Copy link
Collaborator

Hi @xaviersanchez , I agree , the feature is helpful in general. @epugh : Thanks for sharing the effort with this PR.

Just as a note: other clients use the API and ensure in the deployment routine , that the expected deployment channels are present - that might be an attractive alternative , as it works automatically (deployment channels are usually tight to the index structure, and therefore a likely concern to the Search Dev team).

@epugh : The PR is extensive , just as a quick feedback:

Critical:

Deleting a deployment channel (a.k.a SolrIndex) is a critical operation. Maintained rules as well as history items can loose references:

def delete(id: String)(implicit connection: Connection): Int = {
  SQL"delete from #$TABLE_NAME where id = $id".executeUpdate()
}

(In `app/models/SolrIndex.scala`)

It should at least be checked, that a deleted deployment channel is empty.

Other:

  • With the split of backend and frontend, new UI features should be tested in SMUI (e2e-test) to ensure backwards compatibility. I haven't found a frontend test for the admin feature.
  • Deletion of a SuggestedField not tested (e.g. test/models/SuggestedSolrFieldSpec.scala).
  • One further UX note: Creation of a new deployment channel seems not to be reflected in the upper-right channel selection menu (unless manually reloaded).

@pbartusch
Copy link
Collaborator

Just a side note (hint , @epugh ) : when I build SMUI today (sbt docker) it seemed, that the repo location for sbt from debian is not available any more :-( I updated the dependency with branch fix_build_in_3_13_0.

Hope , that'll save you some time.

@pbartusch pbartusch marked this pull request as draft November 5, 2021 14:38
@epugh
Copy link
Contributor Author

epugh commented Nov 5, 2021

I wonder if we need a confirmation button on the delete of a Rules Collection, that mentions that it is in use...? Maybe a more custom warning like "Are you sure you want to delete Spanish webshop, it has X rules"

[email protected] and others added 3 commits November 9, 2021 11:27
…are met for deleting one at the SearchManagementRepository level.

I decided NOT to try and introduce foreign keys, and instead programmatically check the existence of related objects before allowing a delete.
@epugh
Copy link
Contributor Author

epugh commented Nov 9, 2021

Critical:

Deleting a deployment channel (a.k.a SolrIndex) is a critical operation. Maintained rules as well as history items can loose references:

This is now Done! I added checks at the SolrRepostoryManager level

* Deletion of a SuggestedField not tested (e.g. test/models/SuggestedSolrFieldSpec.scala).

Done!

@epugh
Copy link
Contributor Author

epugh commented Nov 9, 2021

* With the split of backend and frontend, new UI features should be tested in SMUI (e2e-test) to ensure backwards compatibility. I haven't found a frontend test for the admin feature.

Check out spec/admin.js which tests out the logic for creating a rules collection! I had to kind of hack things to make it run, like change the base port to 4200, and remove the reference to pg, which is because I am running SMUI locally, not in docker. I am still going to add a test for the Deployment Channel (Rules Collection?) drop down, it WAS working, so great catch!

@epugh
Copy link
Contributor Author

epugh commented Nov 12, 2021

I've retested, and now the drop down does populate when you create new rows.

@epugh epugh marked this pull request as ready for review November 12, 2021 00:40
@epugh epugh changed the title Introduce basic admin screen for managing "Rules Collection" Introduce basic admin screen for managing "Rules Collection" and "Suggested Fields" Dec 3, 2021
epugh pushed a commit to o19s/smui that referenced this pull request Dec 13, 2021
@pbartusch pbartusch merged commit 3c15043 into querqy:master Jan 5, 2022
@epugh epugh deleted the introduce_basic_admin_screen branch January 10, 2022 16:13
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.

Admin Screen to manage Suggested Solr fields Admin Screen to Manage Rules Collections
4 participants