Skip to content

Commit

Permalink
merge with develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pusztaienike committed Mar 18, 2021
2 parents 7826695 + 243e4bc commit 05ac61f
Show file tree
Hide file tree
Showing 25 changed files with 520 additions and 36 deletions.
17 changes: 13 additions & 4 deletions apps/sensenet/cypress/integration/drawer/custom-menuitem.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PATHS } from '../../../src/application-paths'
import { PATHS, resolvePathParams } from '../../../src/application-paths'
import { pathWithQueryParams } from '../../../src/services/query-string-builder'

describe('Custom menu item', () => {
Expand Down Expand Up @@ -42,7 +42,10 @@ describe('Custom menu item', () => {
]

cy.visit(
pathWithQueryParams({ path: PATHS.personalSettings.appPath, newParams: { repoUrl: Cypress.env('repoUrl') } }),
pathWithQueryParams({
path: resolvePathParams({ path: PATHS.settings.appPath, params: { submenu: 'adminui' } }),
newParams: { repoUrl: Cypress.env('repoUrl') },
}),
)

cy.get('.monaco-editor textarea')
Expand Down Expand Up @@ -91,7 +94,10 @@ describe('Custom menu item', () => {
}).as('getCalendar')

cy.visit(
pathWithQueryParams({ path: PATHS.personalSettings.appPath, newParams: { repoUrl: Cypress.env('repoUrl') } }),
pathWithQueryParams({
path: resolvePathParams({ path: PATHS.settings.appPath, params: { submenu: 'adminui' } }),
newParams: { repoUrl: Cypress.env('repoUrl') },
}),
)

cy.get('.monaco-editor textarea')
Expand Down Expand Up @@ -124,7 +130,10 @@ describe('Custom menu item', () => {
cy.restoreLocalStorage()

cy.visit(
pathWithQueryParams({ path: PATHS.personalSettings.appPath, newParams: { repoUrl: Cypress.env('repoUrl') } }),
pathWithQueryParams({
path: resolvePathParams({ path: PATHS.settings.appPath, params: { submenu: 'adminui' } }),
newParams: { repoUrl: Cypress.env('repoUrl') },
}),
)

cy.get('[data-test="drawer-menu-item-test"]').should('exist')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,10 @@ describe('Drawer menu icons', () => {
cy.get('@contentTypesIcon').should('have.class', 'Mui-selected')
})

it('clicking on the Localization icon on the drawer should open the Localization page', () => {
cy.get('[data-test="drawer-menu-item-localization"]').as('localizationIcon')
cy.get('@localizationIcon').should('not.have.class', 'Mui-selected')
cy.get('@localizationIcon').click()
cy.get('@localizationIcon').should('have.class', 'Mui-selected')
})

it('clicking on the Setup icon on the drawer should open the Setup page', () => {
cy.get('[data-test="drawer-menu-item-setup"]').as('setupIcon')
cy.get('@setupIcon').should('not.have.class', 'Mui-selected')
cy.get('@setupIcon').click()
cy.get('@setupIcon').should('have.class', 'Mui-selected')
cy.get('[data-test="drawer-menu-item-settings"]').as('settingsIcon')
cy.get('@settingsIcon').should('not.have.class', 'Mui-selected')
cy.get('@settingsIcon').click()
cy.get('@settingsIcon').should('have.class', 'Mui-selected')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,11 @@ describe('Drawer items navigation', () => {
})
})

it('clicking on the Localization icon on the drawer should navigate to the Localization page', () => {
cy.get('[data-test="drawer-menu-item-localization"]').as('localizationIcon')
cy.get('@localizationIcon').click()
it('clicking on the Settings icon on the drawer should navigate to the Settings page', () => {
cy.get('[data-test="drawer-menu-item-settings"]').as('settingsIcon')
cy.get('@settingsIcon').click()
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/localization/explorer/')
})
})

it('clicking on the Setup icon on the drawer should navigate to the Setup page', () => {
cy.get('[data-test="drawer-menu-item-setup"]').as('setupIcon')
cy.get('@setupIcon').click()
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/setup/')
expect(loc.pathname).to.eq('/settings/stats')
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ describe('Localization', () => {
beforeEach(() => {
cy.login()
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
.get('[data-test="drawer-menu-item-localization"]')
.get('[data-test="drawer-menu-item-settings"]')
.click()
cy.get('[data-test="drawer-submenu-item-localization"]').click()
})

it('should contain a row with ActionResources.xml', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ describe('Permission.settings effect on permission dialog', () => {
})

it('adding a new group in Permission.settings file should appear on permission editor dialog', () => {
cy.get('[data-test="drawer-menu-item-setup"]').click()
cy.get('[data-test="drawer-menu-item-settings"]').click()
cy.get('[data-test="drawer-submenu-item-configuration"]').click()
cy.get('[data-test="permission.settings-edit-button"]').click()
cy.get('.react-monaco-editor-container textarea')
.click({ force: true })
Expand Down Expand Up @@ -65,7 +66,8 @@ describe('Permission.settings effect on permission dialog', () => {
})

it('removing a group in Permission.settings file should disappear on permission editor dialog', () => {
cy.get('[data-test="drawer-menu-item-setup"]').click()
cy.get('[data-test="drawer-menu-item-settings"]').click()
cy.get('[data-test="drawer-submenu-item-configuration"]').click()
cy.get('[data-test="permission.settings-edit-button"]').click()
cy.get('.react-monaco-editor-container textarea')
.click({ force: true })
Expand Down
3 changes: 2 additions & 1 deletion apps/sensenet/cypress/integration/setup/setup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ describe('Setup', () => {
beforeEach(() => {
cy.login()
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
.get('[data-test="drawer-menu-item-setup"]')
.get('[data-test="drawer-menu-item-settings"]')
.click()
cy.get('[data-test="drawer-submenu-item-configuration"]').click()
})

it('should open the context menu if a "settings item" is clicked with the right mouse button', () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/sensenet/src/application-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const PATHS = {
settings: { appPath: '/settings/:submenu?' },
} as const

type SettingsItemType = 'stats' | 'apiKeys' | 'webhooks' | 'adminui'
type SettingsItemType = 'stats' | 'apikeys' | 'webhooks' | 'adminui'

type RoutesWithContentBrowser = keyof Pick<typeof PATHS, 'content' | 'usersAndGroups' | 'contentTypes' | 'trash'>

Expand Down
1 change: 1 addition & 0 deletions apps/sensenet/src/assets/js.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/sensenet/src/assets/net.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/sensenet/src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/sensenet/src/assets/redux.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions apps/sensenet/src/components/settings/api-key.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export interface Secret {
id: string
value: string
creationDate: string
validTill: string
}

export enum ApiKeyType {
ExternalClient = 'ExternalClient',
ExternalSpa = 'ExternalSpa',
}

export interface ApiKey {
name: string
repository: string
clientId: string
userName: string
authority: string
type: ApiKeyType
secrets: Secret[]
}
144 changes: 144 additions & 0 deletions apps/sensenet/src/components/settings/api-keys-endpoint-widget.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import { useRepository } from '@sensenet/hooks-react'
import {
createStyles,
Divider,
Grid,
Hidden,
Link,
makeStyles,
Paper,
TextField,
Theme,
Tooltip,
} from '@material-ui/core'
import React from 'react'
import jslogo from '../../assets/js.svg'
import dotnetlogo from '../../assets/net.svg'
import reactlogo from '../../assets/react.svg'
import reduxlogo from '../../assets/redux.svg'
import { useWidgetStyles } from '../../globalStyles'
import { useLocalization } from '../../hooks'

const useStyles = makeStyles((theme: Theme) => {
return createStyles({
rowContainer: {
display: 'flex',
justifyContent: 'space-between',
padding: '10px 0 16px 0',
fontSize: '16px',
},
clientLink: {
color: theme.palette.primary.main,
},
input: {
paddingTop: '10px',
paddingBottom: '10px',
backgroundColor: theme.palette.common.white,
color: theme.palette.common.black,
},
paragraph: {
padding: '16px 0',
},
logo: {
margin: '30px 16px 16px',
cursor: 'pointer',
},
apiDocsLink: {
display: 'inline-block',
'&:hover': {
textDecoration: 'none',
},
},
})
})

export const ApiEndpointWidget: React.FunctionComponent = () => {
const classes = useStyles()
const widgetClasses = useWidgetStyles()
const localization = useLocalization().settings
const repository = useRepository()

return (
<div className={widgetClasses.root}>
<Paper elevation={0} className={widgetClasses.container} style={{ padding: 0 }}>
<Grid container spacing={1} style={{ padding: '10px' }}>
<Grid item xs={12} lg={6} style={{ padding: '1.5rem' }}>
<div className={classes.rowContainer}>{localization.apiEndpoint}</div>
<div>{localization.apiEndPointApi}</div>
<TextField
name="endpoint"
variant="outlined"
fullWidth
value={repository.configuration.repositoryUrl}
inputProps={{
readOnly: true,
className: classes.input,
}}
className={classes.paragraph}
/>
<div>{localization.apiEndPointIs}</div>
<TextField
name="endpoint"
variant="outlined"
fullWidth
value={repository.configuration.identityServerUrl}
inputProps={{
readOnly: true,
className: classes.input,
}}
className={classes.paragraph}
/>
</Grid>

<Hidden mdDown>
<Divider orientation="vertical" flexItem />
</Hidden>

<Grid item style={{ padding: '1.5rem' }}>
<div className={classes.rowContainer}>
<span>{localization.apiClients}</span>
</div>
<div style={{ margin: '0 0 16px 0' }}>{localization.learnAboutApi}</div>
<Link target="_blank" className={classes.clientLink} href={localization.clientLink}>
{localization.clientLink}
</Link>
<div>
<Tooltip title="javascript" placement="bottom">
<Link
className={classes.apiDocsLink}
target="_blank"
href="https://docs.sensenet.com/api-docs/basic-concepts?chosenLanguage=js-snclient">
<img className={classes.logo} src={jslogo} alt="js-logo" width="35" height="35" />
</Link>
</Tooltip>
<Tooltip title=".net" placement="bottom">
<Link
className={classes.apiDocsLink}
target="_blank"
href="https://docs.sensenet.com/api-docs/basic-concepts?chosenLanguage=dotnet">
<img className={classes.logo} src={dotnetlogo} alt="dotnet-logo" width="35" height="35" />
</Link>
</Tooltip>
<Tooltip title="react" placement="bottom">
<Link
className={classes.apiDocsLink}
target="_blank"
href="https://docs.sensenet.com/api-docs/basic-concepts?chosenLanguage=reactjs">
<img className={classes.logo} src={reactlogo} alt="react-logo" width="35" height="35" />
</Link>
</Tooltip>
<Tooltip title="redux" placement="bottom">
<Link
className={classes.apiDocsLink}
target="_blank"
href="https://docs.sensenet.com/api-docs/basic-concepts?chosenLanguage=react-redux">
<img className={classes.logo} src={reduxlogo} alt="reduc-logo" width="35" height="35" />
</Link>
</Tooltip>
</div>
</Grid>
</Grid>
</Paper>
</div>
)
}
Loading

0 comments on commit 05ac61f

Please sign in to comment.