Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src-tauri/src/database/models/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Instance<Id> {
let instances = query_as!(
Self,
"SELECT id \"id: _\", name, uuid, url, proxy_url, username, token \"token?\", \
disable_all_traffic, enterprise_enabled, openid_display_name FROM instance;"
disable_all_traffic, enterprise_enabled, openid_display_name FROM instance ORDER BY name ASC;"
)
.fetch_all(executor)
.await?;
Expand Down Expand Up @@ -123,7 +123,7 @@ impl Instance<Id> {
Self,
"SELECT id \"id: _\", name, uuid, url, proxy_url, username, token, \
disable_all_traffic, enterprise_enabled, openid_display_name FROM instance
WHERE token IS NOT NULL;"
WHERE token IS NOT NULL ORDER BY name ASC;"
)
.fetch_all(executor)
.await?;
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/src/database/models/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl Location<Id> {
Self,
"SELECT id, instance_id, name, address, pubkey, endpoint, allowed_ips, dns, network_id,\
route_all_traffic, keepalive_interval, location_mfa_mode \"location_mfa_mode: LocationMfaMode\" \
FROM location;"
FROM location ORDER BY name ASC;"
)
.fetch_all(executor)
.await
Expand Down Expand Up @@ -129,7 +129,7 @@ impl Location<Id> {
Self,
"SELECT id \"id: _\", instance_id, name, address, pubkey, endpoint, allowed_ips, dns, \
network_id, route_all_traffic, keepalive_interval, location_mfa_mode \"location_mfa_mode: LocationMfaMode\" \
FROM location WHERE instance_id = $1",
FROM location WHERE instance_id = $1 ORDER BY name ASC",
instance_id
)
.fetch_all(executor)
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/database/models/tunnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl Tunnel<Id> {
"SELECT id \"id: _\", name, pubkey, prvkey, address, server_pubkey, preshared_key, \
allowed_ips, endpoint, dns, persistent_keep_alive, route_all_traffic, pre_up, \
post_up, pre_down, post_down \
FROM tunnel;"
FROM tunnel ORDER BY name ASC;"
)
.fetch_all(executor)
.await?;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import './style.scss';

import classNames from 'classnames';
import { useMemo } from 'react';

import { Badge } from '../../../../../../../../shared/defguard-ui/components/Layout/Badge/Badge';
import { BadgeStyleVariant } from '../../../../../../../../shared/defguard-ui/components/Layout/Badge/types';
import { FloatingMenu } from '../../../../../../../../shared/defguard-ui/components/Layout/FloatingMenu/FloatingMenu';
import { FloatingMenuProvider } from '../../../../../../../../shared/defguard-ui/components/Layout/FloatingMenu/FloatingMenuProvider';
import { FloatingMenuTrigger } from '../../../../../../../../shared/defguard-ui/components/Layout/FloatingMenu/FloatingMenuTrigger';
import SvgIconConnection from '../../../../../../../../shared/defguard-ui/components/svg/IconConnection';
import { CommonWireguardFields } from '../../../../../../types';

Expand All @@ -19,7 +23,40 @@ export const LocationCardTitle = ({ location }: Props) => {
<div className={cn}>
<SvgIconConnection />
<span className="location-name">{location?.name}</span>
<Badge text={location?.address || ''} styleVariant={BadgeStyleVariant.STANDARD} />

<AddressBadge addresses={location?.address || ''} />
</div>
);
};

type AddressBadgeProps = {
// comma-separated list of addresses
addresses: string;
};

const AddressBadge = ({ addresses: address }: AddressBadgeProps) => {
// split into separate addreses to show in tooltip
const addresses = useMemo(() => address.split(','), [address]);

return (
<FloatingMenuProvider placement="right" disabled={addresses.length === 0}>
<FloatingMenuTrigger asChild>
<div className="addresses-badge-container">
<Badge
className="client-addresses"
text={address}
styleVariant={BadgeStyleVariant.STANDARD}
// ref={containerRef}
/>
</div>
</FloatingMenuTrigger>
<FloatingMenu>
<ul className="list-addresses-floating">
{addresses.map((d) => (
<li key={d}>{d}</li>
))}
</ul>
</FloatingMenu>
</FloatingMenuProvider>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,35 @@
}
}
}

& > .addresses-badge-container {
position: relative;
cursor: help;

& > .client-addresses {
max-width: 90px;

& > span {
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}

.list-addresses-floating {
list-style: none;
display: flex;
flex-flow: column;
row-gap: var(--spacing-xs);
max-height: 250px;
max-width: 100dvh;
overflow: auto;
padding: var(--spacing-xs);
margin: 0;

li {
@include typography(app-modal-1);
color: var(--text-body-secondary);
}
}
2 changes: 1 addition & 1 deletion src/shared/defguard-ui
Submodule defguard-ui updated 67 files
+3 −1 components/Form/FormCheckBox/FormCheckBox.tsx
+1 −1 components/Form/FormDevTools/FormDevTools.tsx
+0 −1 components/Form/FormLocationIp/FormLocationIp.tsx
+38 −0 components/Form/FormTextarea/FormTextarea.tsx
+6 −3 components/Layout/Badge/Badge.tsx
+1 −1 components/Layout/Button/Button.tsx
+27 −1 components/Layout/Button/style.scss
+2 −0 components/Layout/Button/types.ts
+5 −5 components/Layout/CardTabs/CardTabs.tsx
+0 −2 components/Layout/CardTabs/style.scss
+2 −2 components/Layout/DeviceAvatar/DeviceAvatar.tsx
+41 −35 components/Layout/EditButton/EditButton.tsx
+1 −1 components/Layout/EditButton/style.scss
+36 −0 components/Layout/FieldError/FieldError.tsx
+11 −0 components/Layout/FieldError/style.scss
+2 −2 components/Layout/FloatingArrow/FloatingArrow.tsx
+3 −0 components/Layout/FloatingArrow/style.scss
+1 −1 components/Layout/FloatingBox/style.scss
+63 −0 components/Layout/FloatingMenu/FloatingMenu.tsx
+46 −0 components/Layout/FloatingMenu/FloatingMenuArrow.tsx
+16 −0 components/Layout/FloatingMenu/FloatingMenuProvider.tsx
+41 −0 components/Layout/FloatingMenu/FloatingMenuTrigger.tsx
+15 −0 components/Layout/FloatingMenu/arrow.scss
+13 −0 components/Layout/FloatingMenu/floating.scss
+13 −0 components/Layout/FloatingMenu/types.ts
+99 −0 components/Layout/FloatingMenu/useFloatingMenuContext.tsx
+2 −2 components/Layout/Helper/Helper.tsx
+11 −17 components/Layout/Input/Input.tsx
+2 −2 components/Layout/Input/style.scss
+48 −0 components/Layout/InteractionBox/InteractionBox.tsx
+26 −0 components/Layout/InteractionBox/style.scss
+1 −1 components/Layout/LabeledCheckbox/style.scss
+17 −2 components/Layout/LimitedText/LimitedText.tsx
+5 −1 components/Layout/LimitedText/style.scss
+13 −0 components/Layout/ListItemCount/ListItemCount.tsx
+22 −0 components/Layout/ListItemCount/style.scss
+31 −23 components/Layout/MessageBox/MessageBox.tsx
+68 −56 components/Layout/MessageBox/style.scss
+5 −0 components/Layout/MessageBox/types.ts
+7 −2 components/Layout/NoData/NoData.tsx
+5 −0 components/Layout/NoData/style.scss
+60 −4 components/Layout/Search/Search.tsx
+29 −14 components/Layout/Search/style.scss
+13 −7 components/Layout/Select/Select.tsx
+8 −8 components/Layout/Tag/Tag.tsx
+2 −2 components/Layout/Tag/style.scss
+75 −26 components/Layout/Textarea/Textarea.tsx
+83 −0 components/Layout/Textarea/style.scss
+8 −3 components/Layout/Textarea/types.ts
+33 −0 components/Layout/TextareaAutoResizable/TextareaAutoResizable.tsx
+0 −0 components/Layout/TextareaAutoResizable/style.scss
+3 −0 components/Layout/TextareaAutoResizable/types.ts
+0 −1 components/Layout/ToastManager/Toast/Toast.tsx
+1 −1 components/Layout/Toggle/Toggle.tsx
+24 −19 components/Layout/modals/ConfirmModal/ConfirmModal.tsx
+13 −7 components/Layout/modals/ConfirmModal/style.scss
+2 −2 components/Layout/modals/ModalWithTitle/ModalWithTitle.tsx
+12 −29 components/Layout/modals/ModalWithTitle/style.scss
+25 −7 components/icons/ActivityIcon/ActivityIcon.tsx
+5 −0 components/icons/ActivityIcon/style.scss
+1 −0 components/icons/ActivityIcon/types.ts
+7 −0 scss/_spacing.scss
+2 −0 scss/_tokens.scss
+8 −1 scss/_typography.scss
+9 −0 scss/helpers/_animation.scss
+1 −0 scss/helpers/_index.scss
+1 −0 scss/index.scss