From 14b2ee53b51dd8ef86a97ec9d9a28881ef6bb8ab Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 20 Nov 2021 09:44:12 +0100 Subject: [PATCH] Fixed export servers to ensure autoConnect is not included --- CHANGELOG.md | 7 ++++--- src/servers/data/index.ts | 4 ++++ src/servers/services/ServersExporter.ts | 6 +++--- test/servers/services/ServersExporter.test.ts | 2 ++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50b2ad38..c5d59982 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] ### Added -* [#520](https://github.com/shlinkio/shlink-web-client/issues/520) Allowed to select "all visits" as the default interval for visits. +* *Nothing* ### Changed -* Moved ci workflow to external repo and reused +* *Nothing* ### Deprecated * *Nothing* @@ -18,7 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), * *Nothing* ### Fixed -* *Nothing* +* [#520](https://github.com/shlinkio/shlink-web-client/issues/520) Fixed landing page scroll on mobile devices and improved its design. +* [#526](https://github.com/shlinkio/shlink-web-client/issues/526) Ensured exported servers do not include the `autoConnect` prop. ## [3.4.0] - 2021-11-11 diff --git a/src/servers/data/index.ts b/src/servers/data/index.ts index 809a6636..a06c390e 100644 --- a/src/servers/data/index.ts +++ b/src/servers/data/index.ts @@ -1,3 +1,4 @@ +import { omit } from 'ramda'; import { SemVer } from '../../utils/helpers/version'; export interface ServerData { @@ -43,3 +44,6 @@ export const isNotFoundServer = (server: SelectedServer): server is NotFoundServ !!server?.hasOwnProperty('serverNotFound'); export const getServerId = (server: SelectedServer) => isServerWithId(server) ? server.id : ''; + +export const serverWithIdToServerData = (server: ServerWithId): ServerData => + omit([ 'id', 'autoConnect' ], server); diff --git a/src/servers/services/ServersExporter.ts b/src/servers/services/ServersExporter.ts index f230af67..08874cff 100644 --- a/src/servers/services/ServersExporter.ts +++ b/src/servers/services/ServersExporter.ts @@ -1,7 +1,7 @@ -import { dissoc, values } from 'ramda'; +import { values } from 'ramda'; import { CsvJson } from 'csvjson'; import LocalStorage from '../../utils/services/LocalStorage'; -import { ServersMap } from '../data'; +import { ServersMap, serverWithIdToServerData } from '../data'; import { saveCsv } from '../../utils/helpers/files'; const SERVERS_FILENAME = 'shlink-servers.csv'; @@ -14,7 +14,7 @@ export default class ServersExporter { ) {} public readonly exportServers = async () => { - const servers = values(this.storage.get('servers') ?? {}).map(dissoc('id')); + const servers = values(this.storage.get('servers') ?? {}).map(serverWithIdToServerData); try { const csv = this.csvjson.toCSV(servers, { headers: 'key' }); diff --git a/test/servers/services/ServersExporter.test.ts b/test/servers/services/ServersExporter.test.ts index fc990b1a..cfb69bad 100644 --- a/test/servers/services/ServersExporter.test.ts +++ b/test/servers/services/ServersExporter.test.ts @@ -10,10 +10,12 @@ describe('ServersExporter', () => { abc123: { id: 'abc123', name: 'foo', + autoConnect: true, }, def456: { id: 'def456', name: 'bar', + autoConnect: false, }, })), });