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

Updated most dropdowns/lists to sort by name #129

Merged
merged 3 commits into from
Feb 23, 2023

Conversation

fcv-iteratorIt
Copy link
Contributor

Following have been updated:
Organization dropdown in app bar
List of sigfox unit types
Device models list
User list
Create/edit user group dropdowns
Edit data target
Create/edit payload decoder
Organization filter dropdown on

Base automatically changed from feature/patch-ua-parser to stage February 21, 2023 13:41
}

ngAfterViewInit() {
console.log(this.sort.active);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove console.log

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@@ -1,4 +1,14 @@
import { AfterViewInit, Component, ComponentFactoryResolver, OnDestroy, OnInit, QueryList, Type, ViewChild, ViewChildren } from '@angular/core';
import {
AfterViewInit,
Copy link
Contributor

Choose a reason for hiding this comment

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

AfterViewInit, QueryList and ViewChildren are unused, maybe just remove them :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed them

}

public deSelectAllDevices(index: number) {
this.payloadDeviceDatatarget[index].iotDeviceIds = [];
}

getPayloadDecoders() {
this.payloadDecoderSubscription = this.payloadDecoderService.getMultiple(1000, 0, 'id', 'ASC')
this.payloadDecoderSubscription = this.payloadDecoderService
.getMultiple(1000, 0, 'name', 'ASC')
Copy link
Contributor

Choose a reason for hiding this comment

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

The dropdown is still not sorted by name even with this implementation..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed sort to frontend based sort

getDevices(): void {
this.applicationSubscription = this.applicationService.getApplication(this.applicationId)
this.applicationSubscription = this.applicationService
.getApplication(this.applicationId)
.subscribe((application: Application) => {
this.devices = application.iotDevices;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should devices also be sorted by name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added sort on device

@@ -6,7 +6,10 @@ import { Observable, Subscription } from 'rxjs';
import { Application } from '@applications/application.model';
Copy link
Contributor

Choose a reason for hiding this comment

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

"Observable" in line 5 is unused. Now that we are editting, we could just as well remove it :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, maybe we should suggest a full run-through of cleanup of this

@@ -295,7 +299,7 @@ export class HttppushEditComponent

getPayloadDecoders() {
this.payloadDecoderSubscription = this.payloadDecoderService
.getMultiple(1000, 0, 'id', 'ASC')
.getMultiple(1000, 0, 'name', 'ASC')
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comments from fiware-edit.component.ts.
This is sadly not sorting the dropdown, and should devices also be sorted? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed ( see first comment)

@@ -84,7 +84,7 @@ export class MqttEditComponent implements DatatargetEdit, OnInit, OnDestroy {

private getPayloadDecoders() {
this.payloadDecoderSubscription = this.payloadDecoderService
.getMultiple(1000, 0, 'id', 'ASC')
.getMultiple(1000, 0, 'name', 'ASC')
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comments from fiware-edit.component.ts.
This is sadly not sorting the dropdown, and should devices also be sorted? :)

Copy link
Contributor Author

@fcv-iteratorIt fcv-iteratorIt Feb 23, 2023

Choose a reason for hiding this comment

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

Fixed (see first comment)

this.iotDevices = application.iotDevices;

this.iotDevices = application.iotDevices.sort((a, b) =>
a.name.localeCompare(b.name, 'en', { numeric: true })
Copy link
Contributor

Choose a reason for hiding this comment

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

We are using this way of sorting a lot - could it be a better solution to make a util method that wil make det localeCompare? If it somehow in the future should be sorted by id instead, there will be a lot of edits instead of one :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, howerver due to time constraints it wont be made in this pass

@fcv-iteratorIt fcv-iteratorIt merged commit 337fca4 into stage Feb 23, 2023
@fcv-iteratorIt fcv-iteratorIt deleted the feature/sort-dropdowns branch February 23, 2023 14:08
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