mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-26 03:36:36 +00:00
Compare commits
151 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d18ebf8911 | ||
|
|
e7d3380223 | ||
|
|
580a625082 | ||
|
|
7e43f67629 | ||
|
|
344e1f37fe | ||
|
|
af30986350 | ||
|
|
ba0605fab4 | ||
|
|
0751549214 | ||
|
|
415de7a29a | ||
|
|
f23592c3c8 | ||
|
|
f495c1af33 | ||
|
|
13b434959e | ||
|
|
4b16d9f566 | ||
|
|
e7138b2dc6 | ||
|
|
e410ca0999 | ||
|
|
5c2e99cba1 | ||
|
|
5a7e8a0079 | ||
|
|
734ff22499 | ||
|
|
b9fb398d3b | ||
|
|
0e0ea3fd26 | ||
|
|
f9c3ac3925 | ||
|
|
b399523124 | ||
|
|
ae7adb04f6 | ||
|
|
19021c39a5 | ||
|
|
4fcead4e12 | ||
|
|
644adf3ab7 | ||
|
|
bfb8cedec9 | ||
|
|
46cba9c880 | ||
|
|
4bee757b19 | ||
|
|
631f0667c7 | ||
|
|
dbf02f3390 | ||
|
|
10ba009f8e | ||
|
|
d6a5c99061 | ||
|
|
6d0ba991c9 | ||
|
|
4103ab298f | ||
|
|
af02b3b03f | ||
|
|
65b9e1e2a8 | ||
|
|
af3f5074d1 | ||
|
|
c007c96d8b | ||
|
|
576eb703d8 | ||
|
|
db47307fcd | ||
|
|
bc2c626505 | ||
|
|
514d469331 | ||
|
|
2d3754e3cc | ||
|
|
726ea4c869 | ||
|
|
fa01543a8c | ||
|
|
3a608748e4 | ||
|
|
578c710d6c | ||
|
|
633f525a3a | ||
|
|
f63fa26316 | ||
|
|
9ee49dca37 | ||
|
|
ed37cc7472 | ||
|
|
fe66215261 | ||
|
|
4a62f97331 | ||
|
|
ee6184e649 | ||
|
|
f56bd1a1e9 | ||
|
|
c005fd8f18 | ||
|
|
66d16b1507 | ||
|
|
c75a3a4073 | ||
|
|
16cd6442e6 | ||
|
|
36e2ba59c9 | ||
|
|
3192aa6981 | ||
|
|
479583281a | ||
|
|
80b4d26f01 | ||
|
|
1e547c2fa3 | ||
|
|
6f098dd198 | ||
|
|
0a037cb040 | ||
|
|
96b0956baf | ||
|
|
487d466b13 | ||
|
|
9a390c7850 | ||
|
|
fda1a00f21 | ||
|
|
f8c62bb9b5 | ||
|
|
c32cbb4b48 | ||
|
|
7dbe85b417 | ||
|
|
6cf64fb008 | ||
|
|
c11cd31cfd | ||
|
|
fe33648f92 | ||
|
|
58558f0437 | ||
|
|
5d4dd8fde0 | ||
|
|
eb897b567b | ||
|
|
836d6ba7c0 | ||
|
|
bc573b8552 | ||
|
|
d261fff273 | ||
|
|
f5c784c153 | ||
|
|
1545cd6c2e | ||
|
|
fbf3669c23 | ||
|
|
0b90a042b1 | ||
|
|
45e49eca55 | ||
|
|
0c7da43cbb | ||
|
|
e47dcb30b5 | ||
|
|
9ac88a7fd7 | ||
|
|
f6baa7169d | ||
|
|
675235f37e | ||
|
|
0dc645b7b7 | ||
|
|
64f5b9adf0 | ||
|
|
e03036ddbe | ||
|
|
d794c2150b | ||
|
|
40db7b5ef4 | ||
|
|
229fb03a9f | ||
|
|
435a993ff0 | ||
|
|
599e8e5256 | ||
|
|
11fb2f9db0 | ||
|
|
c4f0b82091 | ||
|
|
19c00fd13e | ||
|
|
8427fd306e | ||
|
|
83e490ae9c | ||
|
|
fe86a4e3cf | ||
|
|
76bf520026 | ||
|
|
4a3786f3b7 | ||
|
|
11a5e9e724 | ||
|
|
a8c798bf46 | ||
|
|
6acaf260e7 | ||
|
|
3f60a5074a | ||
|
|
f99b6a1d2a | ||
|
|
6f4783b663 | ||
|
|
2d154ecb63 | ||
|
|
285146a87f | ||
|
|
62906b8cf9 | ||
|
|
3b8a2452cb | ||
|
|
da1290ae69 | ||
|
|
b3182c1a5a | ||
|
|
2f262c4f4f | ||
|
|
a47977b2f4 | ||
|
|
5d93fbe942 | ||
|
|
9ae0ede2b5 | ||
|
|
553095c7dc | ||
|
|
e465486486 | ||
|
|
bc66db0caf | ||
|
|
95b8c9f016 | ||
|
|
cbd3d50263 | ||
|
|
c5cf0a3930 | ||
|
|
ebe0ac9ce2 | ||
|
|
d0fe6d840d | ||
|
|
a92b428c3b | ||
|
|
23ea2bfa33 | ||
|
|
f67d5ae16f | ||
|
|
cdc5593617 | ||
|
|
178973dee2 | ||
|
|
e78fbdefdd | ||
|
|
20a0cfb01f | ||
|
|
083b603c2b | ||
|
|
2bcb5b1618 | ||
|
|
e68643108a | ||
|
|
29630d41db | ||
|
|
a7da090cef | ||
|
|
ac419f1b82 | ||
|
|
03b402a88a | ||
|
|
713c13f502 | ||
|
|
92b12e708c | ||
|
|
75f87692a2 | ||
|
|
9854c45fb2 |
9
.github/ISSUE_TEMPLATE/Bug.yml
vendored
9
.github/ISSUE_TEMPLATE/Bug.yml
vendored
@@ -34,5 +34,10 @@ body:
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: How to reproduce
|
||||
value: '<!-- Provide steps to reproduce the bug. -->'
|
||||
label: Minimum steps to reproduce
|
||||
value: |
|
||||
<!--
|
||||
Emphasis in MINIMUM: What is the simplest way to reproduce the bug?
|
||||
Avoid things like "Create a kubernetes cluster", or anything related with cloud providers, as that is rarely the root cause and the bug may be closed as "not reproducible".
|
||||
If you can provide a simple docker compose config, that's even better.
|
||||
-->
|
||||
|
||||
5
.github/dependabot.yml
vendored
5
.github/dependabot.yml
vendored
@@ -12,6 +12,11 @@ updates:
|
||||
fontawesome:
|
||||
patterns:
|
||||
- '@fortawesome/*'
|
||||
eslint:
|
||||
patterns:
|
||||
- '@shlinkio/eslint-config-js-coding-standard'
|
||||
- '@typescript-eslint/*'
|
||||
- 'eslint'
|
||||
shlink:
|
||||
patterns:
|
||||
- '@shlinkio/*'
|
||||
|
||||
76
CHANGELOG.md
76
CHANGELOG.md
@@ -4,6 +4,82 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org).
|
||||
|
||||
## [4.1.2] - 2024-04-17
|
||||
### Added
|
||||
* *Nothing*
|
||||
|
||||
### Changed
|
||||
* *Nothing*
|
||||
|
||||
### Deprecated
|
||||
* *Nothing*
|
||||
|
||||
### Removed
|
||||
* *Nothing*
|
||||
|
||||
### Fixed
|
||||
* [shlink-web-component#244](https://github.com/shlinkio/shlink-web-component/issues/244) Display `visitedUrl` in visits table if the visit object has it, regardless of it being an orphan visit or not.
|
||||
* [shlink-web-component#327](https://github.com/shlinkio/shlink-web-component/issues/327) Ensure orphan visits type is sent to the server, to enable server-side filtering when consumed Shlink supports it.
|
||||
|
||||
|
||||
## [4.1.1] - 2024-04-11
|
||||
### Added
|
||||
* [shlink-web-component#293](https://github.com/shlinkio/shlink-web-component/issues/293) Allow ordering redirect rules via drag'n'drop.
|
||||
|
||||
### Changed
|
||||
* Update JS coding standard
|
||||
* [#1132](https://github.com/shlinkio/shlink-web-client/issues/1132) Add warning message in "validate URLs" setting, indicating it is ignored when consuming Shlink >=4.0.0.
|
||||
|
||||
### Deprecated
|
||||
* *Nothing*
|
||||
|
||||
### Removed
|
||||
* *Nothing*
|
||||
|
||||
### Fixed
|
||||
* [shlink-web-component#294](https://github.com/shlinkio/shlink-web-component/issues/294) Make sure "validate URL" control is not displayed in short URL creation/edition, when consuming Shlink >=4.0.0.
|
||||
* [#1130](https://github.com/shlinkio/shlink-web-client/issues/1130) Fix importing servers in Firefox for Android when the CSV file contains spaces.
|
||||
* [#1133](https://github.com/shlinkio/shlink-web-client/issues/1133) Fix Shlink versions alignment in server error pages.
|
||||
|
||||
|
||||
## [4.1.0] - 2024-03-17
|
||||
### Added
|
||||
* [#1079](https://github.com/shlinkio/shlink-web-client/issues/1079) Add support Shlink 4.0.0.
|
||||
* [shlink-web-component#271](https://github.com/shlinkio/shlink-web-component/issues/271) Add support for redirect rules when consuming Shlink 4.0.0.
|
||||
|
||||
Now, if the server supports it, there will be a new item for every short URL dropdown, which will take you to a page where it will be possible to edit that short URL's redirect rules.
|
||||
|
||||
### Changed
|
||||
* [shlink-web-component#249](https://github.com/shlinkio/shlink-web-component/issues/249) Replace `react-datepicker` with native `input[type="date"]` and `input[type="datetime-local"]` elements.
|
||||
* Update dependencies.
|
||||
|
||||
### Deprecated
|
||||
* *Nothing*
|
||||
|
||||
### Removed
|
||||
* [shlink-web-component#276](https://github.com/shlinkio/shlink-web-component/issues/276) Drop support for Shlink older than 3.3.0
|
||||
|
||||
### Fixed
|
||||
* [#1084](https://github.com/shlinkio/shlink-web-client/issues/1084) Fix broken server dropdown menu when auto-connect is enabled.
|
||||
|
||||
|
||||
## [4.0.1] - 2024-02-01
|
||||
### Added
|
||||
* *Nothing*
|
||||
|
||||
### Changed
|
||||
* [#821](https://github.com/shlinkio/shlink-web-client/issues/821) Update app gif from README.md
|
||||
|
||||
### Deprecated
|
||||
* *Nothing*
|
||||
|
||||
### Removed
|
||||
* *Nothing*
|
||||
|
||||
### Fixed
|
||||
* [#1046](https://github.com/shlinkio/shlink-web-client/issues/1046) Fix running docker image when server env vars are provided.
|
||||
|
||||
|
||||
## [4.0.0] - 2024-01-29
|
||||
### Added
|
||||
* [shlink-web-component #7](https://github.com/shlinkio/shlink-web-component/issues/7) Allow comparing visits for multiple short URLs, tags or domains.
|
||||
|
||||
11
Dockerfile
11
Dockerfile
@@ -1,4 +1,4 @@
|
||||
FROM node:21.6-alpine as node
|
||||
FROM node:21.7-alpine as node
|
||||
COPY . /shlink-web-client
|
||||
ARG VERSION="latest"
|
||||
ENV VERSION ${VERSION}
|
||||
@@ -7,9 +7,16 @@ RUN cd /shlink-web-client && npm ci && npm run build
|
||||
FROM nginxinc/nginx-unprivileged:1.25-alpine
|
||||
ARG UID=101
|
||||
LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>"
|
||||
|
||||
USER root
|
||||
RUN rm -r /usr/share/nginx/html && rm /etc/nginx/conf.d/default.conf
|
||||
USER $UID
|
||||
COPY config/docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY scripts/docker/servers_from_env.sh /docker-entrypoint.d/30-shlink-servers-json.sh
|
||||
COPY --from=node /shlink-web-client/build /usr/share/nginx/html
|
||||
|
||||
# This is required by 30-shlink-servers-json.sh to be writable for UID
|
||||
RUN echo '[]' > /usr/share/nginx/html/servers.json \
|
||||
&& chown $UID:0 /usr/share/nginx/html/servers.json
|
||||
|
||||
# Switch to non-privileged UID as the last step
|
||||
USER $UID
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
[](https://github.com/shlinkio/shlink-web-client/releases/latest)
|
||||
[](https://hub.docker.com/r/shlinkio/shlink-web-client/)
|
||||
[](https://github.com/shlinkio/shlink-web-client/blob/main/LICENSE)
|
||||
[](https://twitter.com/shlinkio)
|
||||
|
||||
[](https://fosstodon.org/@shlinkio)
|
||||
[](https://twitter.com/shlinkio)
|
||||
[](https://bsky.app/profile/shlinkio.bsky.social)
|
||||
[](https://slnk.to/donate)
|
||||
|
||||
A ReactJS-based progressive web application for [Shlink](https://shlink.io).
|
||||
@@ -73,7 +75,7 @@ If you are using the shlink-web-client docker image, you can mount the `servers.
|
||||
|
||||
Alternatively, you can mount a `conf.d` directory, which in turn contains the `servers.json` file, in a volume inside `/usr/share/nginx/html`. *(since shlink-web-client 3.2.0)*.
|
||||
|
||||
docker run --name shlink-web-client -p 8000:80 -v ${PWD}/my-config/:/usr/share/nginx/html/conf.d/ shlinkio/shlink-web-client
|
||||
docker run --name shlink-web-client -p 8000:8080 -v ${PWD}/my-config/:/usr/share/nginx/html/conf.d/ shlinkio/shlink-web-client
|
||||
|
||||
If you want to pre-configure a single server, you can provide its config via env vars. When the container starts up, it will build the `servers.json` file dynamically based on them. *(since shlink-web-client 3.2.0)*.
|
||||
|
||||
@@ -84,7 +86,7 @@ If you want to pre-configure a single server, you can provide its config via env
|
||||
```shell
|
||||
docker run \
|
||||
--name shlink-web-client \
|
||||
-p 8000:80 \
|
||||
-p 8000:8080 \
|
||||
-e SHLINK_SERVER_URL=https://s.test \
|
||||
-e SHLINK_SERVER_API_KEY=6aeb82c6-e275-4538-a747-31f9abfba63c \
|
||||
shlinkio/shlink-web-client
|
||||
|
||||
3038
package-lock.json
generated
3038
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
56
package.json
56
package.json
@@ -24,29 +24,29 @@
|
||||
"test:verbose": "npm run test -- --verbose"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^6.5.1",
|
||||
"@fortawesome/fontawesome-svg-core": "^6.5.1",
|
||||
"@fortawesome/free-brands-svg-icons": "^6.5.1",
|
||||
"@fortawesome/free-regular-svg-icons": "^6.5.1",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
||||
"@fortawesome/fontawesome-free": "^6.5.2",
|
||||
"@fortawesome/fontawesome-svg-core": "^6.5.2",
|
||||
"@fortawesome/free-brands-svg-icons": "^6.5.2",
|
||||
"@fortawesome/free-regular-svg-icons": "^6.5.2",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.5.2",
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"@json2csv/plainjs": "^7.0.5",
|
||||
"@reduxjs/toolkit": "^2.1.0",
|
||||
"@json2csv/plainjs": "^7.0.6",
|
||||
"@reduxjs/toolkit": "^2.2.3",
|
||||
"@shlinkio/data-manipulation": "^1.0.3",
|
||||
"@shlinkio/shlink-frontend-kit": "^0.4.2",
|
||||
"@shlinkio/shlink-js-sdk": "^0.2.2",
|
||||
"@shlinkio/shlink-web-component": "^0.5.0",
|
||||
"@shlinkio/shlink-frontend-kit": "^0.5.1",
|
||||
"@shlinkio/shlink-js-sdk": "^1.1.0",
|
||||
"@shlinkio/shlink-web-component": "^0.6.2",
|
||||
"bootstrap": "5.2.3",
|
||||
"bottlejs": "^2.0.1",
|
||||
"clsx": "^2.1.0",
|
||||
"compare-versions": "^6.1.0",
|
||||
"csvtojson": "^2.0.10",
|
||||
"date-fns": "^3.3.1",
|
||||
"date-fns": "^3.6.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-external-link": "^2.2.0",
|
||||
"react-external-link": "^2.3.1",
|
||||
"react-redux": "^9.1.0",
|
||||
"react-router-dom": "^6.21.3",
|
||||
"react-router-dom": "^6.22.3",
|
||||
"reactstrap": "^9.2.2",
|
||||
"redux-localstorage-simple": "^2.5.1",
|
||||
"uuid": "^9.0.1",
|
||||
@@ -57,28 +57,30 @@
|
||||
"workbox-strategies": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@shlinkio/eslint-config-js-coding-standard": "~2.3.0",
|
||||
"@shlinkio/eslint-config-js-coding-standard": "~2.4.1",
|
||||
"@shlinkio/stylelint-config-css-coding-standard": "~1.1.1",
|
||||
"@testing-library/jest-dom": "^6.3.0",
|
||||
"@testing-library/react": "^14.1.2",
|
||||
"@testing-library/jest-dom": "^6.4.2",
|
||||
"@testing-library/react": "^15.0.1",
|
||||
"@testing-library/user-event": "^14.5.2",
|
||||
"@total-typescript/shoehorn": "^0.1.1",
|
||||
"@types/react": "^18.2.48",
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"@total-typescript/shoehorn": "^0.1.2",
|
||||
"@types/react": "^18.2.77",
|
||||
"@types/react-dom": "^18.2.25",
|
||||
"@types/uuid": "^9.0.8",
|
||||
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
||||
"@typescript-eslint/parser": "^7.5.0",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"@vitest/coverage-v8": "^1.2.2",
|
||||
"adm-zip": "^0.5.10",
|
||||
"axe-core": "^4.8.3",
|
||||
"@vitest/coverage-v8": "^1.5.0",
|
||||
"adm-zip": "^0.5.12",
|
||||
"axe-core": "^4.9.0",
|
||||
"chalk": "^5.3.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint": "^8.57.0",
|
||||
"history": "^5.3.0",
|
||||
"jsdom": "^24.0.0",
|
||||
"sass": "^1.70.0",
|
||||
"sass": "^1.75.0",
|
||||
"stylelint": "^15.11.0",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.0.12",
|
||||
"vite-plugin-pwa": "^0.17.5",
|
||||
"typescript": "^5.4.5",
|
||||
"vite": "^5.2.8",
|
||||
"vite-plugin-pwa": "^0.19.8",
|
||||
"vitest": "^1.2.2"
|
||||
},
|
||||
"browserslist": [
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 2.8 MiB |
@@ -1,7 +1,6 @@
|
||||
import { clsx } from 'clsx';
|
||||
import { useMemo } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import type { SelectedServer } from '../servers/data';
|
||||
import { isReachableServer } from '../servers/data';
|
||||
import { ShlinkVersions } from './ShlinkVersions';
|
||||
import './ShlinkVersionsContainer.scss';
|
||||
|
||||
@@ -9,19 +8,12 @@ export type ShlinkVersionsContainerProps = {
|
||||
selectedServer: SelectedServer;
|
||||
};
|
||||
|
||||
const SHLINK_CONTAINER_PATH_PATTERN = /^\/server\/[a-zA-Z0-9-]*\/(?!edit)/;
|
||||
|
||||
export const ShlinkVersionsContainer = ({ selectedServer }: ShlinkVersionsContainerProps) => {
|
||||
const { pathname } = useLocation();
|
||||
const withPadding = useMemo(() => SHLINK_CONTAINER_PATH_PATTERN.test(pathname), [pathname]);
|
||||
|
||||
const classes = clsx('text-center', {
|
||||
'shlink-versions-container--with-sidebar': withPadding,
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={classes}>
|
||||
<ShlinkVersions selectedServer={selectedServer} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export const ShlinkVersionsContainer = ({ selectedServer }: ShlinkVersionsContainerProps) => (
|
||||
<div
|
||||
className={clsx('text-center', {
|
||||
'shlink-versions-container--with-sidebar': isReachableServer(selectedServer),
|
||||
})}
|
||||
>
|
||||
<ShlinkVersions selectedServer={selectedServer} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -37,7 +37,7 @@ const ManageServersRowDropdown: FCWithDeps<ManageServersRowDropdownConnectProps,
|
||||
const autoConnectIcon = isAutoConnect ? toggleOffIcon : toggleOnIcon;
|
||||
|
||||
return (
|
||||
<RowDropdownBtn minWidth={170}>
|
||||
<RowDropdownBtn minWidth={isAutoConnect ? 210 : 170}>
|
||||
<DropdownItem tag={Link} to={serverUrl}>
|
||||
<FontAwesomeIcon icon={connectIcon} fixedWidth /> Connect
|
||||
</DropdownItem>
|
||||
|
||||
@@ -87,7 +87,7 @@ const ImportServersBtn: FCWithDeps<ImportServersBtnConnectProps, ImportServersBt
|
||||
You can create servers by importing a CSV file with <b>name</b>, <b>apiKey</b> and <b>url</b> columns.
|
||||
</UncontrolledTooltip>
|
||||
|
||||
<input type="file" accept="text/csv" className="d-none" ref={ref} onChange={onFile} aria-hidden />
|
||||
<input type="file" accept=".csv" className="d-none" ref={ref} onChange={onFile} aria-hidden />
|
||||
|
||||
<DuplicatedServersModal
|
||||
isOpen={isModalOpen}
|
||||
|
||||
@@ -33,7 +33,8 @@ export const ShortUrlCreationSettings: FC<ShortUrlCreationProps> = ({ settings,
|
||||
checked={shortUrlCreation.validateUrls ?? false}
|
||||
onChange={(validateUrls) => setShortUrlCreationSettings({ ...shortUrlCreation, validateUrls })}
|
||||
>
|
||||
Request validation on long URLs when creating new short URLs.
|
||||
Request validation on long URLs when creating new short URLs.{' '}
|
||||
<b>This option is ignored by Shlink {'>='}4.0.0</b>
|
||||
<FormText>
|
||||
The initial state of the <b>Validate URL</b> checkbox will
|
||||
be <b>{shortUrlCreation.validateUrls ? 'checked' : 'unchecked'}</b>.
|
||||
|
||||
@@ -1,30 +1,26 @@
|
||||
import { render } from '@testing-library/react';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { createMemoryHistory } from 'history';
|
||||
import { Router } from 'react-router-dom';
|
||||
import { ShlinkVersionsContainer } from '../../src/common/ShlinkVersionsContainer';
|
||||
import type { ReachableServer, SelectedServer } from '../../src/servers/data';
|
||||
import { checkAccessibility } from '../__helpers__/accessibility';
|
||||
|
||||
describe('<ShlinkVersionsContainer />', () => {
|
||||
const setUp = (activeRoute: string = '') => {
|
||||
const history = createMemoryHistory();
|
||||
history.push(activeRoute);
|
||||
|
||||
return render(
|
||||
<Router location={history.location} navigator={history}>
|
||||
<ShlinkVersionsContainer selectedServer={fromPartial({})} />
|
||||
</Router>,
|
||||
);
|
||||
};
|
||||
|
||||
it('passes a11y checks', () => checkAccessibility(setUp()));
|
||||
const setUp = (selectedServer: SelectedServer = null) => render(
|
||||
<ShlinkVersionsContainer selectedServer={selectedServer} />,
|
||||
);
|
||||
|
||||
it.each([
|
||||
['/something', 'text-center'],
|
||||
['/server/foo/edit', 'text-center'],
|
||||
['/server/foo/bar', 'text-center shlink-versions-container--with-sidebar'],
|
||||
])('renders proper col classes based on sidebar status', (sidebar, expectedClasses) => {
|
||||
const { container } = setUp(sidebar);
|
||||
[null],
|
||||
[fromPartial<SelectedServer>({})],
|
||||
[fromPartial<ReachableServer>({ version: '1.0.0', printableVersion: 'v1.0.0' })],
|
||||
])('passes a11y checks', (selectedServer) => checkAccessibility(setUp(selectedServer)));
|
||||
|
||||
it.each([
|
||||
[null, 'text-center'],
|
||||
[fromPartial<SelectedServer>({}), 'text-center'],
|
||||
[fromPartial<ReachableServer>({ version: '1.0.0' }), 'text-center shlink-versions-container--with-sidebar'],
|
||||
])('renders proper col classes based on sidebar status', (selectedServer, expectedClasses) => {
|
||||
const { container } = setUp(selectedServer);
|
||||
expect(container.firstChild).toHaveAttribute('class', `${expectedClasses}`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -67,4 +67,9 @@ describe('<ManageServersRowDropdown />', () => {
|
||||
expect(screen.getByText('DeleteServerModal [OPEN]')).toBeInTheDocument();
|
||||
expect(screen.queryByText('DeleteServerModal [CLOSED]')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it.each([[true], [false]])('renders expected size and icon', (autoConnect) => {
|
||||
const { container } = setUp(autoConnect);
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`<ManageServersRowDropdown /> > renders expected size and icon 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="dropdown"
|
||||
>
|
||||
<button
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
aria-label="Options"
|
||||
class="dropdown-btn__toggle btn btn-primary btn-sm"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="svg-inline--fa fa-ellipsis-vertical px-1"
|
||||
data-icon="ellipsis-vertical"
|
||||
data-prefix="fas"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewBox="0 0 128 512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="w-100 dropdown-menu dropdown-menu-end"
|
||||
data-bs-popper="static"
|
||||
role="menu"
|
||||
style="min-width: 210px;"
|
||||
tabindex="-1"
|
||||
>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href="/server/abc123"
|
||||
role="menuitem"
|
||||
tabindex="0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="svg-inline--fa fa-plug fa-fw "
|
||||
data-icon="plug"
|
||||
data-prefix="fas"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewBox="0 0 384 512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M96 0C78.3 0 64 14.3 64 32v96h64V32c0-17.7-14.3-32-32-32zM288 0c-17.7 0-32 14.3-32 32v96h64V32c0-17.7-14.3-32-32-32zM32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32v32c0 77.4 55 142 128 156.8V480c0 17.7 14.3 32 32 32s32-14.3 32-32V412.8C297 398 352 333.4 352 256V224c17.7 0 32-14.3 32-32s-14.3-32-32-32H32z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
Connect
|
||||
</a>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href="/server/abc123/edit"
|
||||
role="menuitem"
|
||||
tabindex="0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="svg-inline--fa fa-pen-to-square fa-fw "
|
||||
data-icon="pen-to-square"
|
||||
data-prefix="fas"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewBox="0 0 512 512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0L362.3 51.7l97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7zm-299.2 220c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5L437.7 172.3 339.7 74.3 172.4 241.7zM96 64C43 64 0 107 0 160V416c0 53 43 96 96 96H352c53 0 96-43 96-96V320c0-17.7-14.3-32-32-32s-32 14.3-32 32v96c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V160c0-17.7 14.3-32 32-32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H96z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
Edit server
|
||||
</a>
|
||||
<button
|
||||
class="dropdown-item"
|
||||
role="menuitem"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="svg-inline--fa fa-ban fa-fw "
|
||||
data-icon="ban"
|
||||
data-prefix="fas"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewBox="0 0 512 512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M367.2 412.5L99.5 144.8C77.1 176.1 64 214.5 64 256c0 106 86 192 192 192c41.5 0 79.9-13.1 111.2-35.5zm45.3-45.3C434.9 335.9 448 297.5 448 256c0-106-86-192-192-192c-41.5 0-79.9 13.1-111.2 35.5L412.5 367.2zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
|
||||
Do not a
|
||||
uto-connect
|
||||
</button>
|
||||
<hr
|
||||
class="dropdown-divider"
|
||||
tabindex="-1"
|
||||
/>
|
||||
<button
|
||||
class="dropdown-item--danger dropdown-item"
|
||||
role="menuitem"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="svg-inline--fa fa-circle-minus fa-fw "
|
||||
data-icon="circle-minus"
|
||||
data-prefix="fas"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewBox="0 0 512 512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM184 232H328c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
Remove server
|
||||
</button>
|
||||
<span>
|
||||
DeleteServerModal
|
||||
[CLOSED]
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<ManageServersRowDropdown /> > renders expected size and icon 2`] = `
|
||||
<div>
|
||||
<div
|
||||
class="dropdown"
|
||||
>
|
||||
<button
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
aria-label="Options"
|
||||
class="dropdown-btn__toggle btn btn-primary btn-sm"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="svg-inline--fa fa-ellipsis-vertical px-1"
|
||||
data-icon="ellipsis-vertical"
|
||||
data-prefix="fas"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewBox="0 0 128 512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="w-100 dropdown-menu dropdown-menu-end"
|
||||
data-bs-popper="static"
|
||||
role="menu"
|
||||
style="min-width: 170px;"
|
||||
tabindex="-1"
|
||||
>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href="/server/abc123"
|
||||
role="menuitem"
|
||||
tabindex="0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="svg-inline--fa fa-plug fa-fw "
|
||||
data-icon="plug"
|
||||
data-prefix="fas"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewBox="0 0 384 512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M96 0C78.3 0 64 14.3 64 32v96h64V32c0-17.7-14.3-32-32-32zM288 0c-17.7 0-32 14.3-32 32v96h64V32c0-17.7-14.3-32-32-32zM32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32v32c0 77.4 55 142 128 156.8V480c0 17.7 14.3 32 32 32s32-14.3 32-32V412.8C297 398 352 333.4 352 256V224c17.7 0 32-14.3 32-32s-14.3-32-32-32H32z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
Connect
|
||||
</a>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href="/server/abc123/edit"
|
||||
role="menuitem"
|
||||
tabindex="0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="svg-inline--fa fa-pen-to-square fa-fw "
|
||||
data-icon="pen-to-square"
|
||||
data-prefix="fas"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewBox="0 0 512 512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0L362.3 51.7l97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7zm-299.2 220c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5L437.7 172.3 339.7 74.3 172.4 241.7zM96 64C43 64 0 107 0 160V416c0 53 43 96 96 96H352c53 0 96-43 96-96V320c0-17.7-14.3-32-32-32s-32 14.3-32 32v96c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V160c0-17.7 14.3-32 32-32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H96z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
Edit server
|
||||
</a>
|
||||
<button
|
||||
class="dropdown-item"
|
||||
role="menuitem"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="svg-inline--fa fa-circle fa-fw "
|
||||
data-icon="circle"
|
||||
data-prefix="far"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewBox="0 0 512 512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
|
||||
A
|
||||
uto-connect
|
||||
</button>
|
||||
<hr
|
||||
class="dropdown-divider"
|
||||
tabindex="-1"
|
||||
/>
|
||||
<button
|
||||
class="dropdown-item--danger dropdown-item"
|
||||
role="menuitem"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="svg-inline--fa fa-circle-minus fa-fw "
|
||||
data-icon="circle-minus"
|
||||
data-prefix="fas"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewBox="0 0 512 512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM184 232H328c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
Remove server
|
||||
</button>
|
||||
<span>
|
||||
DeleteServerModal
|
||||
[CLOSED]
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
Reference in New Issue
Block a user