summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2022-05-25 08:55:26 +0200
committerDavid Lönnhager <david.l@mullvad.net>2022-05-25 12:44:47 +0200
commit07155230b61970204c07353db96a6fb507503644 (patch)
treece7c4a2a4b9e794f539498afea2a1538f894d5ce /gui/src
parent9ba3d70b85950cd0f8c00d96c06d8e56cd4018dc (diff)
downloadmullvadvpn-07155230b61970204c07353db96a6fb507503644.tar.xz
mullvadvpn-07155230b61970204c07353db96a6fb507503644.zip
Sort devices chronologically in the "too many devices" view
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/daemon-rpc.ts2
-rw-r--r--gui/src/renderer/redux/account/actions.ts2
-rw-r--r--gui/src/shared/daemon-rpc-types.ts1
3 files changed, 4 insertions, 1 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts
index 166a48c9cb..e704979a40 100644
--- a/gui/src/main/daemon-rpc.ts
+++ b/gui/src/main/daemon-rpc.ts
@@ -1476,11 +1476,13 @@ function convertFromDeviceRemoval(deviceRemoval: grpcTypes.RemoveDeviceEvent): A
}
function convertFromDevice(device: grpcTypes.Device): IDevice {
+ const created = ensureExists(device.getCreated(), "no 'created' field for device").toDate();
const asObject = device.toObject();
return {
...asObject,
ports: asObject.portsList.map((port) => port.id),
+ created: created,
};
}
diff --git a/gui/src/renderer/redux/account/actions.ts b/gui/src/renderer/redux/account/actions.ts
index cfa672a407..594a96f71f 100644
--- a/gui/src/renderer/redux/account/actions.ts
+++ b/gui/src/renderer/redux/account/actions.ts
@@ -213,7 +213,7 @@ function updateAccountExpiry(expiry?: string): IUpdateAccountExpiryAction {
function updateDevices(devices: Array<IDevice>): IUpdateDevicesAction {
return {
type: 'UPDATE_DEVICES',
- devices: devices.sort((a, b) => a.name.localeCompare(b.name)),
+ devices: devices.sort((a, b) => a.created.getDate() - b.created.getDate()),
};
}
diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts
index 6e70c3f9b6..45af1c605e 100644
--- a/gui/src/shared/daemon-rpc-types.ts
+++ b/gui/src/shared/daemon-rpc-types.ts
@@ -359,6 +359,7 @@ export interface IDevice {
id: string;
name: string;
ports?: Array<string>;
+ created: Date;
}
export interface IDeviceRemoval {