Skip to content
Open
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
2 changes: 1 addition & 1 deletion e2e/tests/plugin-explorer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ test('Delete folder with content', async ({ page }) => {
})

test('Create entity with required name', async ({ page }) => {
await page.getByRole('button', { name: 'form' }).click()
await page.getByTestId('tree-button_form').click()
await page.getByRole('button', { name: 'uncontained_object' }).click({
button: 'right',
})
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/plugin-form-dimensional_scalar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test('Dimensional scalar', async ({ page }) => {
await page.goto('http://localhost:3000/')
await page.getByRole('button', { name: 'DemoDataSource' }).click()
await page.getByRole('button', { name: 'plugins' }).click()
await page.getByRole('button', { name: 'form' }).click()
await page.getByTestId('tree-button_form').click()
await page.getByRole('button', { name: 'dimensional_scalar' }).click()
await page.getByRole('button', { name: 'waveForm' }).click()
}
Expand Down
3 changes: 1 addition & 2 deletions e2e/tests/plugin-header-roles_header_example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ test('Change to operator role and back', async ({ page }) => {

await test.step('Change back to admin', async () => {
await page.getByLabel('AppSelector').nth(1).click()

await page.getByRole('menuitem', { name: 'Yaml' }).first().click()
await page.getByRole('button', { name: 'User' }).click()
await page.getByLabel('admin').check()
await page.getByTestId('impersonate-role-dmss-admin').check()
await page.getByRole('button', { name: 'Save' }).click()
await page.getByLabel('AppSelector').nth(1).click()
await expect(page.getByRole('menuitem', { name: 'Edit' })).toBeVisible()
Expand Down
21 changes: 13 additions & 8 deletions e2e/tests/plugin-header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ test.beforeEach(async ({ page }) => {

test('Load header', async ({ page }) => {
await expect(page.getByLabel('AppSelector')).toBeVisible()
await expect(page.getByLabel('main-heading')).toBeVisible()
await expect(page.getByRole('button', { name: 'User' })).toBeVisible()
await expect(page.getByRole('button', { name: 'About' })).toBeVisible()
await expect(page.getByTestId('application-label')).toBeVisible()
await expect(page.getByTestId('header-user-info-button')).toBeVisible()
await expect(page.getByTestId('header-about-button')).toBeVisible()
})

test('User info', async ({ page }) => {
await page.getByRole('button', { name: 'User' }).click()
await page.getByTestId('header-user-info-button').click()
await expect(page.getByRole('dialog')).toBeVisible()
await expect(
page.getByRole('dialog').getByText('User info', { exact: true })
).toBeVisible()
await expect(
page
.getByRole('dialog')
.getByText('Name:Not authenticated', { exact: true })
.getByText('Name: Not authenticated', { exact: true })
).toBeVisible()
})

test('About', async ({ page }) => {
await page.getByRole('button', { name: 'About' }).click()
await page.getByTestId('header-about-button').click()
await expect(page.getByRole('dialog')).toBeVisible()
await expect(
page
Expand All @@ -39,12 +39,17 @@ test('About', async ({ page }) => {
{ exact: true }
)
).toBeVisible()
await page.getByRole('dialog').getByRole('button', { name: 'Ok' }).click()
await page
.getByRole('dialog')
.getByTestId('about-dialog-close-button')
.click()
await expect(page.getByRole('dialog')).not.toBeVisible()
})

test('Recipe list', async ({ page }) => {
await page.getByLabel('AppSelector').click()
await page.getByTestId('application-selector-button').click()
await expect(page.getByRole('menu')).toBeVisible()
await expect(page.getByRole('menuitem', { name: 'Edit' })).toBeVisible()
await page.getByRole('menuitem', { name: 'Edit' }).click()
await expect(page.getByTestId('form-text-widget-Name')).toHaveValue('example')
})
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test('Change role to operator and back', async ({ page }) => {
).not.toBeVisible()
await expect(page.getByTestId('form-text-widget-Name')).not.toBeEditable()
await page.getByRole('button', { name: 'User' }).click()
await page.getByLabel('admin').check()
await page.getByTestId('impersonate-role-dmss-admin').check()
await page.getByRole('button', { name: 'Save', exact: true }).click()
await page.getByRole('tab', { name: 'Hogwarts Admin', exact: true }).click()
await expect(page.getByTestId('form-text-widget-Name')).toBeEditable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@
"type": "PLUGINS:dm-core-plugins/header/HeaderPluginConfig",
"hideAbout": false,
"hideUserInfo": false,
"uiRecipesList": ["Explorer", "Yaml"]
"uiRecipesList": [
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Explorer"
},
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Yaml",
"label": "YAML"
}
]
},
"plugin": "@development-framework/dm-core-plugins/header"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,21 @@
"type": "PLUGINS:dm-core-plugins/header/HeaderPluginConfig",
"hideAbout": false,
"hideUserInfo": true,
"uiRecipesList": ["View study", "Explorer", "Yaml"]
"uiRecipesList": [
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "View study"
},
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Explorer"
},
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Yaml",
"label": "YAML"
}
]
},
"plugin": "@development-framework/dm-core-plugins/header"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,21 @@
"type": "PLUGINS:dm-core-plugins/header/HeaderPluginConfig",
"hideAbout": false,
"hideUserInfo": false,
"uiRecipesList": ["Yaml", "Edit", "Explorer"]
"uiRecipesList": [
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Yaml",
"label": "YAML"
},
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Edit"
},
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Explorer"
}
]
},
"plugin": "@development-framework/dm-core-plugins/header"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,21 @@
"type": "PLUGINS:dm-core-plugins/header/HeaderPluginConfig",
"hideAbout": false,
"hideUserInfo": true,
"uiRecipesList": ["Yaml", "Edit", "Explorer"]
"uiRecipesList": [
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Yaml",
"label": "YAML"
},
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Edit"
},
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Explorer"
}
]
},
"plugin": "@development-framework/dm-core-plugins/header"
},
Expand All @@ -44,7 +58,16 @@
"type": "PLUGINS:dm-core-plugins/header/HeaderPluginConfig",
"hideAbout": false,
"hideUserInfo": true,
"uiRecipesList": ["Yaml", "Explorer"]
"uiRecipesList": [
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Yaml"
},
{
"type": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"recipeName": "Explorer"
}
]
},
"plugin": "@development-framework/dm-core-plugins/header"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
{
"name": "HeaderPluginConfig",
"type": "dmss://system/SIMOS/Blueprint",
"type": "CORE:Blueprint",
"attributes": [
{
"name": "type",
"type": "dmss://system/SIMOS/BlueprintAttribute",
"type": "CORE:BlueprintAttribute",
"attributeType": "string"
},
{
"name": "hideAbout",
"type": "dmss://system/SIMOS/BlueprintAttribute",
"type": "CORE:BlueprintAttribute",
"attributeType": "boolean",
"description": "Hide the about link in the header",
"default": false
},
{
"name": "hideUserInfo",
"type": "dmss://system/SIMOS/BlueprintAttribute",
"type": "CORE:BlueprintAttribute",
"attributeType": "boolean",
"description": "Hide the user info in the header",
"default": false
},
{
"name": "uiRecipesList",
"type": "dmss://system/SIMOS/BlueprintAttribute",
"attributeType": "string",
"type": "CORE:BlueprintAttribute",
"attributeType": "PLUGINS:dm-core-plugins/header/HeaderUIRecipeItem",
"dimensions": "*",
"description": "Can be used to specify a list of UI recipes the user can select. By default, the fist UI recipe in\n the list is displayed. If the list is empty, all UI recipes will be included."
},
{
"name": "adminRole",
"type": "dmss://system/SIMOS/BlueprintAttribute",
"type": "CORE:BlueprintAttribute",
"attributeType": "string",
"default": "dmss-admin",
"description": "The role that is considered an admin role. If the user has this role, the user will see the 'admin menu' in the header.",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "HeaderUIRecipeItem",
"type": "CORE:Blueprint",
"attributes": [
{
"name": "type",
"type": "CORE:BlueprintAttribute",
"attributeType": "string"
},
{
"name": "label",
"type": "CORE:BlueprintAttribute",
"description": "Label for item in dropdown selection",
"optional": true,
"attributeType": "string"
},
{
"name": "recipeName",
"type": "CORE:BlueprintAttribute",
"description": "Name of recipe to select",
"attributeType": "string"
}
]
}
9 changes: 9 additions & 0 deletions packages/dm-core-plugins/src/header/HeaderPlugin.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import styled from 'styled-components'

export const Logo = styled.span`
color: #007079;
font-weight: 500;
margin-right: 1rem;
margin-left: 0.5rem;
font-size: 18px;
`
Loading
Loading