TODO:write documentation
Install
This package will extend the newUI through a "Template Package" or "Central Package".
- Install and configure primo-explore-devenv
- Download a "Template Package" or "Central Package" from the Primo Back Office
- Extract the downloaded package to
primo-explore-devenv/primo-explore/custom
- Rename the "Template Package" directory to reflect your view code
- Create a
package.json
file if you do not have one by running npm init -y
- Install and store a reference to this package
npm install primo-explore-dom --save-dev
- Test.
*
gulp run --view YOUR_VIEW_CODE
* Open your web browser and go to http://localhost:8003/primo-explore/search?vid=YOUR_VIEW_CODE
PS: __ YOUR_VIEW_CODE __ must be replaced with the code you use for your view.
General
If you are using this library to understand the newUI always load debug info first.
angular.reloadWithDebugInfo();
For now it is not possible to access the $scope and $ctrl without the debug info. The library will throw an error if this is the case and try an alternative method but this does not work for component access.
(± will mark methods that absolutely need $scope access)
Check if the library is loaded with debug info enabled
Primo.isDebugEnabled()
This is an artifact. Should not be used!
Primo.isPrimoAvailable()
Session
Getting the session id (only available when logged in)
Primo.explore.session.id
user
TODO
view
TODO
ip
TODO
institution
TODO
Components
Getting available components
The components list changes over time. Some components are only available in certain situations
Primo.explore.components.keys();
Getting the 'prm-icon' component
var prmIcons = Primo.explore.components.get('prm-icon');
Examining the prmIcon component
Get component name
primIcons[0].name
Get DOM element
primIcons[0].element
Find out css path to component
primIcons[0].cssPath
Get $scope for component (±)
primIcons[0].scope()
Get $ctrl form component (±)
primIcons[0].ctrl()
Make component blink on screen
primIcons[0].blink()
Records
Getting access to all records
Primo.explore.records
Mapping all recordid's into a list
Primo.explore.records.map((m) => m.pnx.control.recordid[0])
Facets
Getting access to all facets
Primo.explore.facets
Examining a facet
Getting the facet name
Primo.explore.facets[0].name
Getting facet count
Primo.explore.facets[0].count
Getting facet values
Primo.explore.facets[0].values
UI
TODO: Should this go into its own repo?
Active the UI
Primo.ui.toggle()