Skip to content

Commit

Permalink
Merge pull request #6724 from TheThingsNetwork/fix/refactor-old-compo…
Browse files Browse the repository at this point in the history
…nents

Refactor old components
  • Loading branch information
PavelJankoski committed Nov 29, 2023
2 parents 0c60b5a + 22127c9 commit eef2d78
Show file tree
Hide file tree
Showing 49 changed files with 1,820 additions and 2,480 deletions.
3 changes: 1 addition & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ To decide whether a component is a container component, ask yourself:
- Is this component more concerned with how things work, rather than how things look?
- Does this component connect to the store?
- Does this component fetch or send data?
- Is the component generated by higher order components (e.g. `withFeatureRequirement`)?
- Is the component generated by higher order components?
- Does this component render simple nodes, like a single presentational component?

If you can answer more than 2 questions with yes, then you likely have a container component.
Expand All @@ -692,7 +692,6 @@ View components always represent a single view of the application, represented b
- Fetching necessary data (via `withRequest` HOC), if not done by a container
- Unavailable "catch-all"-routes are caught by `<NotFoundRoute />` component, including subviews
- Errors should be caught by the `<ErrorView />` error boundary component
- `withFeatureRequirement` HOC is used to prevent access to routes that the user has no rights for
- Ensured responsiveness and usage of the grid system

#### Utility components
Expand Down
81 changes: 81 additions & 0 deletions cypress/e2e/console/integrations/pub-subs/create.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,85 @@ describe('Application Pub/Sub create', () => {
})
})
})

describe('Disabled Providers', () => {
const description = 'Changing the Pub/Sub provider has been disabled by an administrator'

describe('NATS disabled', () => {
const response = {
configuration: {
pubsub: {
providers: {
nats: 'DISABLED',
},
},
},
}

beforeEach(() => {
cy.loginConsole({ user_id: userId, password: user.password })
cy.visit(
`${Cypress.config('consoleRootPath')}/applications/${appId}/integrations/pubsubs/add`,
)

cy.intercept('GET', `/api/v3/as/configuration`, response)
})
it('succeeds setting MQTT as default provider', () => {
cy.findByLabelText('NATS').should('be.disabled')
cy.findByText(description).should('be.visible')
})
})

describe('MQTT disabled', () => {
const description = 'Changing the Pub/Sub provider has been disabled by an administrator'
const response = {
configuration: {
pubsub: {
providers: {
mqtt: 'DISABLED',
},
},
},
}

beforeEach(() => {
cy.loginConsole({ user_id: userId, password: user.password })
cy.visit(
`${Cypress.config('consoleRootPath')}/applications/${appId}/integrations/pubsubs/add`,
)
cy.intercept('GET', `/api/v3/as/configuration`, response)
})

it('succeeds setting NATS as default provider', () => {
cy.findByLabelText('MQTT').should('be.disabled')
cy.findByText(description).should('be.visible')
})
})

describe('MQTT and NATS disabled', () => {
const response = {
configuration: {
pubsub: {
providers: {
mqtt: 'DISABLED',
nats: 'DISABLED',
},
},
},
}

beforeEach(() => {
cy.loginConsole({ user_id: userId, password: user.password })
cy.on('uncaught:exception', () => false)
cy.visit(
`${Cypress.config('consoleRootPath')}/applications/${appId}/integrations/pubsubs/add`,
)
cy.intercept('GET', `/api/v3/as/configuration`, response)
})

it('succeeds showing not found page', () => {
cy.findByRole('heading', { name: /Not found/ }).should('be.visible')
})
})
})
})
40 changes: 0 additions & 40 deletions pkg/webui/console/components/downlink-form/connect.js

This file was deleted.

210 changes: 0 additions & 210 deletions pkg/webui/console/components/downlink-form/downlink-form.js

This file was deleted.

Loading

0 comments on commit eef2d78

Please sign in to comment.