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

Add link to list of data dictionaries #4160

Merged
merged 4 commits into from
Apr 17, 2024
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
56 changes: 49 additions & 7 deletions cypress/integration/09_admin_links.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,26 @@ context('Administration pages', () => {
cy.visit(baseurl + "/admin/dkan")
})

it('I should see a link for the dataset properties configuration', () => {
it('DKAN menu contains expected links.', () => {
const links = [
'Datasets',
'Datastore Import Status',
'Datastore settings',
'Data Dictionary',
'Harvests',
'Metastore settings',
'Resources'
]

cy.visit(`${baseurl}/admin`)
cy.get('.toolbar-icon-system-admin-dkan').contains('DKAN').parent().then(($menu) => {
links.forEach((link) => {
cy.get($menu).contains(link)
})
})
})

it('Admin can access the Metastore settings.', () => {
cy.get('.toolbar-icon-system-admin-dkan').contains('DKAN').next('.toolbar-menu').then($el=>{
cy.wrap($el).invoke('show')
cy.wrap($el).contains('Metastore settings')
Expand All @@ -15,7 +34,7 @@ context('Administration pages', () => {
cy.get('.option').should('contain.text', 'Distribution (distribution)')
})

it('I should see a link for the datastore configuration', () => {
it('Admin can access the Datastore settings.', () => {
cy.get('.toolbar-icon-system-admin-dkan').contains('DKAN').next('.toolbar-menu').then($el=>{
cy.wrap($el).invoke('show')
cy.wrap($el).contains('Datastore settings')
Expand All @@ -24,7 +43,7 @@ context('Administration pages', () => {
cy.get('label[for="edit-rows-limit"]').should('have.text', 'Rows limit')
})

it('I should see a link for the datastore status', () => {
it('Admin can access the Datastore import status dashboard.', () => {
cy.get('.toolbar-icon-system-admin-dkan').contains('DKAN').next('.toolbar-menu').then($el=>{
cy.wrap($el).invoke('show')
cy.wrap($el).contains('Datastore Import Status')
Expand All @@ -33,7 +52,7 @@ context('Administration pages', () => {
cy.contains('h1', 'Datastore Import Status');
})

it('I should see a link for the harvest status', () => {
it('Admin can access the Harvest dashboard', () => {
cy.get('.toolbar-icon-system-admin-dkan').contains('DKAN').next('.toolbar-menu').then($el=>{
cy.wrap($el).invoke('show')
cy.wrap($el).contains('Harvests')
Expand All @@ -42,11 +61,34 @@ context('Administration pages', () => {
cy.contains('h1', 'Harvests');
})

it('There is a link in the admin menu to the datasets admin screen.', () => {
it('Admin can access the dataset content view and can click a button to open the dataset form.', () => {
cy.get('.toolbar-icon-system-admin-dkan').contains('DKAN').next('.toolbar-menu').then($el=> {
cy.wrap($el).invoke('show')
cy.wrap($el).contains('Datasets')
cy.wrap($el).invoke('show')
cy.wrap($el).contains('Datasets').click({ force:true })
})
cy.contains('h1', 'Datasets');

cy.get('.button').contains('+ Add new dataset').click( { force:true })
cy.contains('h1', 'Create Data');
})

it('DKAN menu contains link to create a dataset.', () => {
cy.get('.toolbar-icon-system-admin-dkan').contains('DKAN').next('.toolbar-menu').then($el=> {
cy.wrap($el).invoke('show')
cy.wrap($el).contains('Datasets').parent().within(() => {
cy.get('li.menu-item a').contains('Create').click({ force:true })
})
cy.contains('h1', 'Create Data')
})
})

it('DKAN menu contains link to create a data dictionary.', () => {
cy.get('.toolbar-icon-system-admin-dkan').parent().within(() => {
cy.get('li.menu-item a').contains('Data Dictionary').click({ force:true })
})
cy.contains('h1', 'DKAN Metastore (Data Dictionaries)');
cy.get('.button').contains('+ Add new data dictionary').click( { force:true })
cy.get('summary').contains('Project Open Data Data-Dictionary');
})

})
27 changes: 22 additions & 5 deletions modules/metastore/metastore.links.menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ dkan.metastore.config_properties:
weight: 14

metastore.data_dictionary:
title: Data-Dictionary
description: Data-Dictionary Pages
title: Data Dictionary
description: Data Dictionary List
parent: system.admin_dkan
route_name: metastore.data_dictionary
weight: 13

metastore.data_dictionary.create:
title: Create
description: Create Data-Dictionary
description: Create Data Dictionary
parent: metastore.data_dictionary
route_name: node.add
route_parameters:
Expand All @@ -24,7 +24,24 @@ metastore.data_dictionary.create:

metastore.data_dictionary.settings_form:
title: Settings
description: Data-Dictionary Settings
description: Data Dictionary Settings
parent: metastore.data_dictionary
route_name: metastore.data_dictionary.settings
weight: 2
weight: 3

metastore.datasets:
title: Datasets
description: Dataset content view
parent: system.admin_dkan
route_name: metastore.datasets
weight: 1

metastore.datasets.create:
title: Create
description: Create Dataset
parent: metastore.datasets
route_name: node.add
route_parameters:
node_type: data
schema: dataset
weight: 1
23 changes: 19 additions & 4 deletions modules/metastore/metastore.routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,32 @@ dkan.metastore.config_properties:
_admin_route: TRUE

metastore.data_dictionary:
path: '/admin/dkan/data-dictionary'
path: '/admin/dkan/data-dictionaries'
defaults:
_controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
_title: 'Data-Dictionary'
_title: 'Data Dictionary List'
requirements:
_permission: 'create data content'

metastore.data_dictionary.settings:
path: '/admin/dkan/data-dictionary/settings'
defaults:
_title: 'Data-Dictionary Settings'
_title: 'Data Dictionary Settings'
_form: '\Drupal\metastore\Form\DataDictionarySettingsForm'
requirements:
_permission: 'administer data dictionary settings'

metastore.datasets:
path: '/admin/dkan/datasets'
defaults:
_controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
_title: 'Datasets'
requirements:
_permission: 'create data content'

metastore.datasets.create:
path: '/admin/dkan/datasets'
defaults:
_controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
_title: 'Create Dataset'
requirements:
_permission: 'create data content'
Loading