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

MEN-7551 - fix: added path for all devices on device page #60

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

mineralsfree
Copy link
Contributor

Ticket: MEN-7551
Changelog: None

@@ -28,7 +28,7 @@ import DocsLink from './common/docslink';

const listItems = [
{ route: '/', text: 'Dashboard', canAccess },
{ route: '/devices', text: 'Devices', canAccess: ({ userCapabilities: { canReadDevices } }) => canReadDevices },
{ route: '/devices/accepted', text: 'Devices', canAccess: ({ userCapabilities: { canReadDevices } }) => canReadDevices },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should remain /devices as it is expected to be set by the previously selected state, if that wasn't selected before the devices should always default to accepted

@@ -147,7 +147,7 @@ export const DeviceGroups = () => {
}
// preset selectedIssues and selectedId with empty values, in case if remain properties are missing them
let listState = { ...remainder };
if (statusParam && Object.values(DEVICE_STATES).some(state => state === statusParam)) {
if (statusParam && Object.values(DEVICE_STATES).some(state => state === statusParam || statusParam === 'any')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (statusParam && Object.values(DEVICE_STATES).some(state => state === statusParam || statusParam === 'any')) {
if (statusParam && (Object.values(DEVICE_STATES).some(state => state === statusParam) || statusParam === routes.allDevices.key)) {

to not have the check in every iteration there

@@ -219,7 +219,7 @@ export const formatDeviceSearch = ({ pageState, filters, selectedGroup }) => {
export const generateDevicePath = ({ pageState }) => {
const { state: selectedState } = pageState;
const path = ['/devices'];
if (![routes.allDevices.key, ''].includes(selectedState)) {
if (![''].includes(selectedState)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (![''].includes(selectedState)) {
if (selectedState !== '') {

I think

Ticket: MEN-7551
Changelog: None

Signed-off-by: Mikita Pilinka <[email protected]>
@mineralsfree mineralsfree merged commit 4b456b2 into mendersoftware:main Oct 1, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants