From 720ae86504acf153e19ed7ba92cec03f800bb7f5 Mon Sep 17 00:00:00 2001
From: Bonfire <5704760+Bonfire@users.noreply.github.com>
Date: Fri, 26 Aug 2022 19:31:09 -0400
Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=8C=90=20Fix=20Advanced=20Options=20t?=
=?UTF-8?q?itle?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/locales/en/layout/add-service-app-shelf.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/locales/en/layout/add-service-app-shelf.json b/public/locales/en/layout/add-service-app-shelf.json
index ca88e1f31..d13119302 100644
--- a/public/locales/en/layout/add-service-app-shelf.json
+++ b/public/locales/en/layout/add-service-app-shelf.json
@@ -95,7 +95,7 @@
}
},
"advancedOptions": {
- "title": "Advanced options",
+ "title": "Advanced Options",
"form": {
"httpStatusCodes": {
"label": "HTTP Status Codes",
From beae00a170a16bf3d02fe814659b284187bc5f3a Mon Sep 17 00:00:00 2001
From: Bonfire <5704760+Bonfire@users.noreply.github.com>
Date: Fri, 26 Aug 2022 19:52:20 -0400
Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8=20add=20ping=20service=20toggle?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../en/layout/add-service-app-shelf.json | 3 ++
src/components/AppShelf/AddAppShelfItem.tsx | 49 ++++++++++++-------
src/components/AppShelf/AppShelfItem.tsx | 16 +++---
src/tools/types.ts | 1 +
4 files changed, 44 insertions(+), 25 deletions(-)
diff --git a/public/locales/en/layout/add-service-app-shelf.json b/public/locales/en/layout/add-service-app-shelf.json
index d13119302..936fddf18 100644
--- a/public/locales/en/layout/add-service-app-shelf.json
+++ b/public/locales/en/layout/add-service-app-shelf.json
@@ -97,6 +97,9 @@
"advancedOptions": {
"title": "Advanced Options",
"form": {
+ "ping": {
+ "label": "Ping Service"
+ },
"httpStatusCodes": {
"label": "HTTP Status Codes",
"placeholder": "Select valid status codes",
diff --git a/src/components/AppShelf/AddAppShelfItem.tsx b/src/components/AppShelf/AddAppShelfItem.tsx
index efeba042a..8689cd8d8 100644
--- a/src/components/AppShelf/AddAppShelfItem.tsx
+++ b/src/components/AppShelf/AddAppShelfItem.tsx
@@ -10,6 +10,7 @@ import {
MultiSelect,
PasswordInput,
Select,
+ Space,
Stack,
Switch,
Tabs,
@@ -18,13 +19,13 @@ import {
Tooltip,
} from '@mantine/core';
import { useForm } from '@mantine/form';
+import { useDebouncedValue } from '@mantine/hooks';
import { IconApps } from '@tabler/icons';
+import { useTranslation } from 'next-i18next';
import { useEffect, useState } from 'react';
import { v4 as uuidv4 } from 'uuid';
-import { useDebouncedValue } from '@mantine/hooks';
-import { useTranslation } from 'next-i18next';
import { useConfig } from '../../tools/state';
-import { tryMatchPort, ServiceTypeList, StatusCodes } from '../../tools/types';
+import { ServiceTypeList, StatusCodes, tryMatchPort } from '../../tools/types';
import Tip from '../layout/Tip';
export function AddItemShelfButton(props: any) {
@@ -109,6 +110,7 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
username: props.username ?? undefined,
password: props.password ?? undefined,
openedUrl: props.openedUrl ?? undefined,
+ ping: props.ping ?? true,
status: props.status ?? ['200'],
newTab: props.newTab ?? true,
},
@@ -177,7 +179,11 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
if (newForm.newTab === true) newForm.newTab = undefined;
if (newForm.openedUrl === '') newForm.openedUrl = undefined;
if (newForm.category === null) newForm.category = undefined;
- if (newForm.status.length === 1 && newForm.status[0] === '200') {
+ if (newForm.ping === true) newForm.ping = undefined;
+ if (
+ (newForm.status.length === 1 && newForm.status[0] === '200') ||
+ newForm.ping === false
+ ) {
delete newForm.status;
}
// If service already exists, update it.
@@ -210,6 +216,7 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
{t('modal.tabs.advancedOptions.title')}
+
void } &
+
-
+ {form.values.ping && (
+
+ )}
({
item: {
@@ -134,7 +134,7 @@ export function AppShelfItem(props: any) {
-
+ {service.ping !== false && }
diff --git a/src/tools/types.ts b/src/tools/types.ts
index e08b491e4..1c9c5f6f0 100644
--- a/src/tools/types.ts
+++ b/src/tools/types.ts
@@ -183,5 +183,6 @@ export interface serviceItem {
username?: string;
openedUrl?: string;
newTab?: boolean;
+ ping?: boolean;
status?: string[];
}
From e771e31873de5bd70a06af11a850b4757afba8fb Mon Sep 17 00:00:00 2001
From: Manuel
Date: Sun, 28 Aug 2022 16:28:17 +0200
Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20fix=20language=20switch=20an?=
=?UTF-8?q?d=20add=20search?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
next-i18next.config.js | 2 ++
src/components/Settings/LanguageSwitch.tsx | 12 +++++++++++-
src/languages/language.ts | 2 +-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/next-i18next.config.js b/next-i18next.config.js
index 6ab97a6f6..9c876f550 100644
--- a/next-i18next.config.js
+++ b/next-i18next.config.js
@@ -4,7 +4,9 @@ module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'de', 'en', 'es', 'fr', 'it', 'ja', 'nl', 'pl', 'ru', 'sl', 'sv', 'zh'],
+ fallbackLng: 'en',
localeDetection: true,
+ returnEmptyString: false
},
reloadOnPrerender: process.env.NODE_ENV === 'development',
};
diff --git a/src/components/Settings/LanguageSwitch.tsx b/src/components/Settings/LanguageSwitch.tsx
index 01e2ecfec..c9334c0b4 100644
--- a/src/components/Settings/LanguageSwitch.tsx
+++ b/src/components/Settings/LanguageSwitch.tsx
@@ -12,7 +12,7 @@ export default function LanguageSwitch() {
const { t, i18n } = useTranslation('settings/general/internationalization');
const { changeLanguage } = i18n;
const configLocale = getCookie('config-locale');
- const { locale, locales } = useRouter();
+ const { locale, locales, push } = useRouter();
const [selectedLanguage, setSelectedLanguage] = useState(
(configLocale as string) ?? locale ?? 'en'
);
@@ -37,6 +37,8 @@ export default function LanguageSwitch() {
sameSite: 'strict',
});
+ push('/', '/', { locale: value });
+
showNotification({
title: 'Language changed',
message: `You changed the language to '${newLanguage.originalName}'`,
@@ -65,6 +67,14 @@ export default function LanguageSwitch() {
onChange={onChangeSelect}
value={selectedLanguage}
defaultValue={locale}
+ searchable
+ filter={(value, item) => {
+ const selectItems = item as unknown as { value: string, language: Language };
+ return (
+ selectItems.language.originalName.trim().includes(value.trim()) ||
+ selectItems.language.translatedName.trim().includes(value.trim())
+ );
+ }}
styles={{
icon: {
width: 42,
diff --git a/src/languages/language.ts b/src/languages/language.ts
index c292ea53b..d2cbc5d59 100644
--- a/src/languages/language.ts
+++ b/src/languages/language.ts
@@ -64,4 +64,4 @@ const languages: Language[] = [
];
export const getLanguageByCode = (code: string | null) =>
- languages.find((language) => language.shortName === code) ?? languages[-1];
+ languages.find((language) => language.shortName === code) ?? languages[languages.length - 1];