From 661c05bc507a2b6bedec69030b587e772a5b2278 Mon Sep 17 00:00:00 2001 From: Manuel Ruwe Date: Sun, 18 Dec 2022 22:27:01 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Rename=20"services"=20to=20"apps?= =?UTF-8?q?"=20in=20entire=20project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/configs/default.json | 200 ++++++++++++++++-- src/components/About/AboutModal.tsx | 2 +- src/components/AppShelf/AppShelf.tsx | 18 +- src/components/AppShelf/SmallServiceItem.tsx | 18 -- ...onModal.tsx => ChangeAppPositionModal.tsx} | 24 +-- .../EditAppModal.tsx} | 46 ++-- .../Tabs/AppereanceTab/AppereanceTab.tsx | 24 +-- .../IconSelector/IconSelector.tsx | 10 +- .../Tabs/BehaviourTab/BehaviourTab.tsx | 8 +- .../Tabs/GeneralTab/GeneralTab.tsx | 18 +- .../InputElements/GenericSecretInput.tsx | 0 .../InputElements/IntegrationSelector.tsx | 16 +- .../IntegrationOptionsRenderer.tsx | 10 +- .../Tabs/IntegrationTab/IntegrationTab.tsx | 4 +- .../Tabs/NetworkTab/NetworkTab.tsx | 8 +- .../Tabs/Shared/DebouncedAppIcon.tsx} | 10 +- .../Tabs/type.ts | 2 +- .../AvailableIntegrationsTab.tsx | 2 +- .../Overview/AvailableElementsOverview.tsx | 14 +- .../AvailableStaticElementsTab.tsx | 2 +- .../ServiceIcon.tsx => Apps/AppIcon.tsx} | 2 +- .../ServiceMenu.tsx => Apps/AppMenu.tsx} | 18 +- .../ServicePing.tsx => Apps/AppPing.tsx} | 16 +- .../ServiceTile.tsx => Apps/AppTile.tsx} | 38 ++-- .../Dashboard/Tiles/TileWrapper.tsx | 2 +- .../Dashboard/Tiles/tilesDefinitions.tsx | 10 +- .../Dashboard/Wrappers/Category/Category.tsx | 18 +- .../Dashboard/Wrappers/Sidebar/Sidebar.tsx | 18 +- .../Dashboard/Wrappers/Wrapper/Wrapper.tsx | 18 +- .../Wrappers/gridstack/init-gridstack.ts | 4 +- .../Wrappers/gridstack/use-gridstack.ts | 30 +-- .../Customization/Layout/LayoutSelector.tsx | 8 +- src/components/layout/header/Search.tsx | 32 +-- src/components/layout/header/SmallAppItem.tsx | 18 ++ src/modules/calendar/CalendarModule.tsx | 10 +- src/modules/common/MediaDisplay.tsx | 6 +- src/modules/dashdot/DashdotModule.tsx | 2 +- src/modules/docker/ContainerActionBar.tsx | 4 +- src/modules/torrents/TorrentsModule.tsx | 2 +- src/modules/torrents/TotalDownloadsModule.tsx | 4 +- src/modules/usenet/UsenetModule.tsx | 10 +- src/pages/[slug].tsx | 2 +- src/pages/_app.tsx | 10 +- src/pages/api/modules/calendar.ts | 20 +- src/pages/api/modules/overseerr/[id].tsx | 32 +-- src/pages/api/modules/overseerr/index.ts | 12 +- src/pages/api/modules/ping.ts | 2 +- src/pages/api/modules/torrents.ts | 36 ++-- src/pages/api/modules/usenet/history.ts | 26 +-- src/pages/api/modules/usenet/index.ts | 32 ++- .../modules/usenet/nzbget/nzbget-client.ts | 8 +- src/pages/api/modules/usenet/pause.ts | 26 +-- src/pages/api/modules/usenet/queue.ts | 26 +-- src/pages/api/modules/usenet/resume.ts | 28 ++- src/tools/addToHomarr.ts | 4 +- src/tools/config/getFallbackConfig.ts | 2 +- src/tools/config/getFrontendConfig.ts | 2 +- src/tools/hooks/api.ts | 24 +-- src/tools/hooks/useGetServiceByType.ts | 4 +- src/tools/migrate.ts | 4 +- src/tools/state.tsx | 4 +- src/tools/types.ts | 2 +- src/types/{service.ts => app.ts} | 34 +-- src/types/config.ts | 8 +- src/widgets/dashDot/DashDotTile.tsx | 2 +- src/widgets/useNet/UseNetTile.tsx | 40 ++-- src/widgets/useNet/UsenetHistoryList.tsx | 6 +- src/widgets/useNet/UsenetQueueList.tsx | 6 +- yarn.lock | 48 ++--- 69 files changed, 661 insertions(+), 495 deletions(-) delete mode 100644 src/components/AppShelf/SmallServiceItem.tsx rename src/components/Dashboard/Modals/ChangePosition/{ChangeServicePositionModal.tsx => ChangeAppPositionModal.tsx} (68%) rename src/components/Dashboard/Modals/{EditService/EditServiceModal.tsx => EditAppModal/EditAppModal.tsx} (79%) rename src/components/Dashboard/Modals/{EditService => EditAppModal}/Tabs/AppereanceTab/AppereanceTab.tsx (60%) rename src/components/Dashboard/Modals/{EditService => EditAppModal}/Tabs/AppereanceTab/IconSelector/IconSelector.tsx (94%) rename src/components/Dashboard/Modals/{EditService => EditAppModal}/Tabs/BehaviourTab/BehaviourTab.tsx (77%) rename src/components/Dashboard/Modals/{EditService => EditAppModal}/Tabs/GeneralTab/GeneralTab.tsx (70%) rename src/components/Dashboard/Modals/{EditService => EditAppModal}/Tabs/IntegrationTab/Components/InputElements/GenericSecretInput.tsx (100%) rename src/components/Dashboard/Modals/{EditService => EditAppModal}/Tabs/IntegrationTab/Components/InputElements/IntegrationSelector.tsx (87%) rename src/components/Dashboard/Modals/{EditService => EditAppModal}/Tabs/IntegrationTab/Components/IntegrationOptionsRenderer/IntegrationOptionsRenderer.tsx (91%) rename src/components/Dashboard/Modals/{EditService => EditAppModal}/Tabs/IntegrationTab/IntegrationTab.tsx (92%) rename src/components/Dashboard/Modals/{EditService => EditAppModal}/Tabs/NetworkTab/NetworkTab.tsx (84%) rename src/components/Dashboard/Modals/{EditService/Tabs/Shared/DebouncedServiceIcon.tsx => EditAppModal/Tabs/Shared/DebouncedAppIcon.tsx} (82%) rename src/components/Dashboard/Modals/{EditService => EditAppModal}/Tabs/type.ts (70%) rename src/components/Dashboard/Tiles/{Service/ServiceIcon.tsx => Apps/AppIcon.tsx} (53%) rename src/components/Dashboard/Tiles/{Service/ServiceMenu.tsx => Apps/AppMenu.tsx} (67%) rename src/components/Dashboard/Tiles/{Service/ServicePing.tsx => Apps/AppPing.tsx} (78%) rename src/components/Dashboard/Tiles/{Service/ServiceTile.tsx => Apps/AppTile.tsx} (69%) create mode 100644 src/components/layout/header/SmallAppItem.tsx rename src/types/{service.ts => app.ts} (64%) diff --git a/data/configs/default.json b/data/configs/default.json index 3f2acea0d..edc4586dd 100644 --- a/data/configs/default.json +++ b/data/configs/default.json @@ -1,20 +1,196 @@ { - "name": "default", - "services": [ + "schemaVersion": "1.0", + "configProperties": { + "name": "default" + }, + "categories": [], + "wrappers": [ { - "name": "example", - "id": "09c45847-8afc-4c1a-9697-f03192de948a", - "type": "Other", - "icon": "https://c.tenor.com/o656qFKDzeUAAAAC/rick-astley-never-gonna-give-you-up.gif", - "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + "id": "47af36c0-47c1-4e5b-bfc7-ad645ee6a33e", + "position": 1 } ], + "apps": [ + { + "id": "47af36c0-47c1-4e5b-bfc7-ad645ee6a33a", + "name": "Documentation", + "url": "https://homarr.dev", + "behaviour": { + "onClickUrl": "https://homarr.dev", + "isOpeningInNewTab": true + }, + "network": { + "enabledStatusChecker": false, + "okStatus": [ + 200 + ] + }, + "appearance": { + "iconUrl": "/imgs/logo/logo.png" + }, + "integration": { + "type": null, + "properties": [] + }, + "area": { + "type": "wrapper", + "properties": { + "id": "47af36c0-47c1-4e5b-bfc7-ad645ee6a33e" + } + }, + "shape": { + "location": { + "x": 0, + "y": 0 + }, + "size": { + "width": 3, + "height": 3 + } + } + }, + { + "id": "47af36c0-47c1-4e5b-bfc7-ad645ee6a330", + "name": "Support", + "url": "https://github.com/ajnart/homarr", + "behaviour": { + "onClickUrl": "https://github.com/ajnart/homarr", + "isOpeningInNewTab": true + }, + "network": { + "enabledStatusChecker": false, + "okStatus": [ + 200 + ] + }, + "appearance": { + "iconUrl": "https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/github.png" + }, + "integration": { + "type": null, + "properties": [] + }, + "area": { + "type": "wrapper", + "properties": { + "id": "47af36c0-47c1-4e5b-bfc7-ad645ee6a33e" + } + }, + "shape": { + "location": { + "x": 3, + "y": 0 + }, + "size": { + "width": 3, + "height": 3 + } + } + }, + { + "id": "47af36c0-47c1-4e5b-bfc7-ad645ee6a337", + "name": "Community", + "url": "https://discord.com/invite/aCsmEV5RgA", + "behaviour": { + "onClickUrl": "https://discord.com/invite/aCsmEV5RgA", + "isOpeningInNewTab": true + }, + "network": { + "enabledStatusChecker": false, + "okStatus": [ + 200 + ] + }, + "appearance": { + "iconUrl": "https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/discord.png" + }, + "integration": { + "type": null, + "properties": [] + }, + "area": { + "type": "wrapper", + "properties": { + "id": "47af36c0-47c1-4e5b-bfc7-ad645ee6a33e" + } + }, + "shape": { + "location": { + "x": 6, + "y": 0 + }, + "size": { + "width": 3, + "height": 3 + } + } + }, + { + "id": "47af36c0-47c1-4e5b-bfc7-ad645ee6a990", + "name": "Donate", + "url": "https://homarr.dev/docs/community/donate", + "behaviour": { + "onClickUrl": "https://homarr.dev/docs/community/donate", + "isOpeningInNewTab": true + }, + "network": { + "enabledStatusChecker": false, + "okStatus": [ + 200 + ] + }, + "appearance": { + "iconUrl": "/imgs/logo/logo.png" + }, + "integration": { + "type": null, + "properties": [] + }, + "area": { + "type": "wrapper", + "properties": { + "id": "47af36c0-47c1-4e5b-bfc7-ad645ee6a33e" + } + }, + "shape": { + "location": { + "x": 9, + "y": 0 + }, + "size": { + "width": 3, + "height": 3 + } + } + } + ], + "integrations": [], "settings": { - "searchUrl": "https://google.com/search?q=" - }, - "modules": { - "Search Bar": { - "enabled": true + "common": { + "searchEngine": { + "type": "google", + "properties": {} + } + }, + "customization": { + "layout": { + "enabledLeftSidebar": false, + "enabledRightSidebar": false, + "enabledDocker": false, + "enabledPing": false, + "enabledSearchbar": true + }, + "pageTitle": "Homarr", + "logoImageUrl": "/imgs/logo/logo.png", + "faviconUrl": "/imgs/logo/logo.png", + "backgroundImageUrl": "", + "customCss": "", + "colors": { + "primary": "red", + "secondary": "orange", + "shade": 5 + }, + "appOpacity": 100 } } } \ No newline at end of file diff --git a/src/components/About/AboutModal.tsx b/src/components/About/AboutModal.tsx index add258043..ea197383c 100644 --- a/src/components/About/AboutModal.tsx +++ b/src/components/About/AboutModal.tsx @@ -50,7 +50,7 @@ export const AboutModal = ({ opened, closeModal }: AboutModalProps) => { > Homarr is a simple and modern homepage for your server that helps you access all of your - services in one place. It integrates with the services you use to display useful information + apps in one place. It integrates with the apps you use to display useful information or control them. It's easy to install and supports many different devices. diff --git a/src/components/AppShelf/AppShelf.tsx b/src/components/AppShelf/AppShelf.tsx index ff2d118c8..ffb30e986 100644 --- a/src/components/AppShelf/AppShelf.tsx +++ b/src/components/AppShelf/AppShelf.tsx @@ -23,7 +23,7 @@ import { UsenetModule, TorrentsModule } from '../../modules'; const AppShelf = (props: any) => { const { config, setConfig } = useConfig(); // Extract all the categories from the services in config - const categoryList = config.services.reduce((acc, cur) => { + const categoryList = config.apps.reduce((acc, cur) => { if (cur.category && !acc.includes(cur.category)) { acc.push(cur.category); } @@ -67,9 +67,9 @@ const AppShelf = (props: any) => { if (active.id !== over.id) { const newConfig = { ...config }; - const activeIndex = newConfig.services.findIndex((e) => e.id === active.id); - const overIndex = newConfig.services.findIndex((e) => e.id === over.id); - newConfig.services = arrayMove(newConfig.services, activeIndex, overIndex); + const activeIndex = newConfig.apps.findIndex((e) => e.id === active.id); + const overIndex = newConfig.apps.findIndex((e) => e.id === over.id); + newConfig.apps = arrayMove(newConfig.apps, activeIndex, overIndex); setConfig(newConfig); } @@ -78,14 +78,14 @@ const AppShelf = (props: any) => { const getItems = (filter?: string) => { // If filter is not set, return all the services without a category or a null category - let filtered = config.services; + let filtered = config.apps; const modules = Object.values(Modules).map((module) => module); if (!filter) { - filtered = config.services.filter((e) => !e.category || e.category === null); + filtered = config.apps.filter((e) => !e.category || e.category === null); } if (filter) { - filtered = config.services.filter((e) => e.category === filter); + filtered = config.apps.filter((e) => e.category === filter); } return ( { onDragStart={handleDragStart} onDragEnd={handleDragEnd} > - + {filtered.map((service) => ( @@ -112,7 +112,7 @@ const AppShelf = (props: any) => { }} > {activeId ? ( - e.id === activeId)} id={activeId} /> + e.id === activeId)} id={activeId} /> ) : null} diff --git a/src/components/AppShelf/SmallServiceItem.tsx b/src/components/AppShelf/SmallServiceItem.tsx deleted file mode 100644 index 98c8bbf53..000000000 --- a/src/components/AppShelf/SmallServiceItem.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Avatar, Group, Text } from '@mantine/core'; - -interface smallServiceItem { - label: string; - icon?: string; - url?: string; -} - -export default function SmallServiceItem(props: any) { - const { service }: { service: smallServiceItem } = props; - // TODO : Use Next/link - return ( - - {service.icon && } - {service.label} - - ); -} diff --git a/src/components/Dashboard/Modals/ChangePosition/ChangeServicePositionModal.tsx b/src/components/Dashboard/Modals/ChangePosition/ChangeAppPositionModal.tsx similarity index 68% rename from src/components/Dashboard/Modals/ChangePosition/ChangeServicePositionModal.tsx rename to src/components/Dashboard/Modals/ChangePosition/ChangeAppPositionModal.tsx index 506f2b0c5..e98008e40 100644 --- a/src/components/Dashboard/Modals/ChangePosition/ChangeServicePositionModal.tsx +++ b/src/components/Dashboard/Modals/ChangePosition/ChangeAppPositionModal.tsx @@ -2,18 +2,18 @@ import { SelectItem } from '@mantine/core'; import { closeModal, ContextModalProps } from '@mantine/modals'; import { useConfigContext } from '../../../../config/provider'; import { useConfigStore } from '../../../../config/store'; -import { ServiceType } from '../../../../types/service'; +import { AppType } from '../../../../types/app'; import { ChangePositionModal } from './ChangePositionModal'; -type ChangeServicePositionModalInnerProps = { - service: ServiceType; +type ChangeAppPositionModalInnerProps = { + app: AppType; }; -export const ChangeServicePositionModal = ({ +export const ChangeAppPositionModal = ({ id, context, innerProps, -}: ContextModalProps) => { +}: ContextModalProps) => { const { name: configName } = useConfigContext(); const updateConfig = useConfigStore((x) => x.updateConfig); @@ -24,9 +24,9 @@ export const ChangeServicePositionModal = ({ updateConfig(configName, (previousConfig) => ({ ...previousConfig, - services: [ - ...previousConfig.services.filter((x) => x.id !== innerProps.service.id), - { ...innerProps.service, shape: { location: { x, y }, size: { width, height } } }, + apps: [ + ...previousConfig.apps.filter((x) => x.id !== innerProps.app.id), + { ...innerProps.app, shape: { location: { x, y }, size: { width, height } } }, ], })); context.closeModal(id); @@ -45,10 +45,10 @@ export const ChangeServicePositionModal = ({ onCancel={handleCancel} widthData={widthData} heightData={heightData} - initialX={innerProps.service.shape.location.x} - initialY={innerProps.service.shape.location.y} - initialWidth={innerProps.service.shape.size.width} - initialHeight={innerProps.service.shape.size.height} + initialX={innerProps.app.shape.location.x} + initialY={innerProps.app.shape.location.y} + initialWidth={innerProps.app.shape.size.width} + initialHeight={innerProps.app.shape.size.height} /> ); }; diff --git a/src/components/Dashboard/Modals/EditService/EditServiceModal.tsx b/src/components/Dashboard/Modals/EditAppModal/EditAppModal.tsx similarity index 79% rename from src/components/Dashboard/Modals/EditService/EditServiceModal.tsx rename to src/components/Dashboard/Modals/EditAppModal/EditAppModal.tsx index 0ea39a37a..cadb1c028 100644 --- a/src/components/Dashboard/Modals/EditService/EditServiceModal.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/EditAppModal.tsx @@ -13,32 +13,32 @@ import { useTranslation } from 'next-i18next'; import { useState } from 'react'; import { useConfigContext } from '../../../../config/provider'; import { useConfigStore } from '../../../../config/store'; -import { ServiceType } from '../../../../types/service'; +import { AppType } from '../../../../types/app'; import { AppearanceTab } from './Tabs/AppereanceTab/AppereanceTab'; import { BehaviourTab } from './Tabs/BehaviourTab/BehaviourTab'; import { GeneralTab } from './Tabs/GeneralTab/GeneralTab'; import { IntegrationTab } from './Tabs/IntegrationTab/IntegrationTab'; import { NetworkTab } from './Tabs/NetworkTab/NetworkTab'; -import { DebouncedServiceIcon } from './Tabs/Shared/DebouncedServiceIcon'; -import { EditServiceModalTab } from './Tabs/type'; +import { DebouncedAppIcon } from './Tabs/Shared/DebouncedAppIcon'; +import { EditAppModalTab } from './Tabs/type'; -const serviceUrlRegex = +const appUrlRegex = '(https?://(?:www.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9].[^\\s]{2,}|www.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9].[^\\s]{2,}|https?://(?:www.|(?!www))[a-zA-Z0-9]+.[^\\s]{2,}|www.[a-zA-Z0-9]+.[^\\s]{2,})'; -export const EditServiceModal = ({ +export const EditAppModal = ({ context, id, innerProps, -}: ContextModalProps<{ service: ServiceType; allowServiceNamePropagation: boolean }>) => { +}: ContextModalProps<{ app: AppType; allowAppNamePropagation: boolean }>) => { const { t } = useTranslation(); const { name: configName, config } = useConfigContext(); const updateConfig = useConfigStore((store) => store.updateConfig); - const [allowServiceNamePropagation, setAllowServiceNamePropagation] = useState( - innerProps.allowServiceNamePropagation + const [allowAppNamePropagation, setAllowAppNamePropagation] = useState( + innerProps.allowAppNamePropagation ); - const form = useForm({ - initialValues: innerProps.service, + const form = useForm({ + initialValues: innerProps.app, validate: { name: (name) => (!name ? 'Name is required' : null), url: (url) => { @@ -46,7 +46,7 @@ export const EditServiceModal = ({ return 'Url is required'; } - if (!url.match(serviceUrlRegex)) { + if (!url.match(appUrlRegex)) { return 'Value is not a valid url'; } @@ -67,7 +67,7 @@ export const EditServiceModal = ({ return null; } - if (!url.match(serviceUrlRegex)) { + if (!url.match(appUrlRegex)) { return 'Uri override is not a valid uri'; } @@ -78,21 +78,21 @@ export const EditServiceModal = ({ validateInputOnChange: true, }); - const onSubmit = (values: ServiceType) => { + const onSubmit = (values: AppType) => { if (!configName) { return; } updateConfig(configName, (previousConfig) => ({ ...previousConfig, - services: [...previousConfig.services.filter((x) => x.id !== form.values.id), form.values], + apps: [...previousConfig.apps.filter((x) => x.id !== form.values.id), form.values], })); // also close the parent modal context.closeAll(); }; - const [activeTab, setActiveTab] = useState('general'); + const [activeTab, setActiveTab] = useState('general'); const closeModal = () => { context.closeModal(id); @@ -125,17 +125,17 @@ export const EditServiceModal = ({ ))} - + - {form.values.name ?? 'New Service'} + {form.values.name ?? 'New App'}
setActiveTab(tab as EditServiceModalTab)} + onTabChange={(tab) => setActiveTab(tab as EditAppModalTab)} defaultValue="general" > @@ -181,8 +181,8 @@ export const EditServiceModal = ({ setAllowServiceNamePropagation(false)} - allowServiceNamePropagation={allowServiceNamePropagation} + disallowAppNameProgagation={() => setAllowAppNamePropagation(false)} + allowAppNamePropagation={allowAppNamePropagation} /> @@ -199,9 +199,3 @@ export const EditServiceModal = ({ ); }; - -const useStyles = createStyles(() => ({ - serviceImage: { - objectFit: 'contain', - }, -})); diff --git a/src/components/Dashboard/Modals/EditService/Tabs/AppereanceTab/AppereanceTab.tsx b/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/AppereanceTab.tsx similarity index 60% rename from src/components/Dashboard/Modals/EditService/Tabs/AppereanceTab/AppereanceTab.tsx rename to src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/AppereanceTab.tsx index be4e680af..501902479 100644 --- a/src/components/Dashboard/Modals/EditService/Tabs/AppereanceTab/AppereanceTab.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/AppereanceTab.tsx @@ -1,20 +1,20 @@ import { createStyles, Flex, Tabs, TextInput } from '@mantine/core'; import { UseFormReturnType } from '@mantine/form'; import { useTranslation } from 'next-i18next'; -import { ServiceType } from '../../../../../../types/service'; -import { DebouncedServiceIcon } from '../Shared/DebouncedServiceIcon'; +import { AppType } from '../../../../../../types/app'; +import { DebouncedAppIcon } from '../Shared/DebouncedAppIcon'; import { IconSelector } from './IconSelector/IconSelector'; interface AppearanceTabProps { - form: UseFormReturnType ServiceType>; - disallowServiceNameProgagation: () => void; - allowServiceNamePropagation: boolean; + form: UseFormReturnType AppType>; + disallowAppNameProgagation: () => void; + allowAppNamePropagation: boolean; } export const AppearanceTab = ({ form, - disallowServiceNameProgagation, - allowServiceNamePropagation, + disallowAppNameProgagation, + allowAppNamePropagation, }: AppearanceTabProps) => { const { t } = useTranslation(''); const { classes } = useStyles(); @@ -25,9 +25,9 @@ export const AppearanceTab = ({ } - label="Service Icon" - description="Logo of your service displayed in your dashboard. Must return a body content containg an image" + icon={} + label="App Icon" + description="Logo of your app displayed in your dashboard. Must return a body content containg an image" variant="default" withAsterisk required @@ -40,9 +40,9 @@ export const AppearanceTab = ({ iconUrl: item.url, }, }); - disallowServiceNameProgagation(); + disallowAppNameProgagation(); }} - allowServiceNamePropagation={allowServiceNamePropagation} + allowAppNamePropagation={allowAppNamePropagation} form={form} /> diff --git a/src/components/Dashboard/Modals/EditService/Tabs/AppereanceTab/IconSelector/IconSelector.tsx b/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/IconSelector/IconSelector.tsx similarity index 94% rename from src/components/Dashboard/Modals/EditService/Tabs/AppereanceTab/IconSelector/IconSelector.tsx rename to src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/IconSelector/IconSelector.tsx index 2b4f9f640..7ecc48366 100644 --- a/src/components/Dashboard/Modals/EditService/Tabs/AppereanceTab/IconSelector/IconSelector.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/IconSelector/IconSelector.tsx @@ -21,17 +21,17 @@ import { ICON_PICKER_SLICE_LIMIT } from '../../../../../../../../data/constants' import { useRepositoryIconsQuery } from '../../../../../../../tools/hooks/useRepositoryIconsQuery'; import { IconSelectorItem } from '../../../../../../../types/iconSelector/iconSelectorItem'; import { WalkxcodeRepositoryIcon } from '../../../../../../../types/iconSelector/repositories/walkxcodeIconRepository'; -import { ServiceType } from '../../../../../../../types/service'; +import { AppType } from '../../../../../../../types/app'; interface IconSelectorProps { - form: UseFormReturnType ServiceType>; + form: UseFormReturnType AppType>; onChange: (icon: IconSelectorItem) => void; - allowServiceNamePropagation: boolean; + allowAppNamePropagation: boolean; } export const IconSelector = ({ onChange, - allowServiceNamePropagation, + allowAppNamePropagation, form, }: IconSelectorProps) => { const { data, isLoading } = useRepositoryIconsQuery({ @@ -48,7 +48,7 @@ export const IconSelector = ({ const [debouncedValue] = useDebouncedValue(form.values.name, 500); useEffect(() => { - if (allowServiceNamePropagation !== true) { + if (allowAppNamePropagation !== true) { return; } diff --git a/src/components/Dashboard/Modals/EditService/Tabs/BehaviourTab/BehaviourTab.tsx b/src/components/Dashboard/Modals/EditAppModal/Tabs/BehaviourTab/BehaviourTab.tsx similarity index 77% rename from src/components/Dashboard/Modals/EditService/Tabs/BehaviourTab/BehaviourTab.tsx rename to src/components/Dashboard/Modals/EditAppModal/Tabs/BehaviourTab/BehaviourTab.tsx index 4c760ee06..384b5b345 100644 --- a/src/components/Dashboard/Modals/EditService/Tabs/BehaviourTab/BehaviourTab.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/Tabs/BehaviourTab/BehaviourTab.tsx @@ -2,10 +2,10 @@ import { Tabs, TextInput, Switch, Text } from '@mantine/core'; import { UseFormReturnType } from '@mantine/form'; import { IconClick } from '@tabler/icons'; import { useTranslation } from 'next-i18next'; -import { ServiceType } from '../../../../../../types/service'; +import { AppType } from '../../../../../../types/app'; interface BehaviourTabProps { - form: UseFormReturnType ServiceType>; + form: UseFormReturnType AppType>; } export const BehaviourTab = ({ form }: BehaviourTabProps) => { @@ -15,8 +15,8 @@ export const BehaviourTab = ({ form }: BehaviourTabProps) => { } label="On click url" - description="Overrides the service URL when clicking on the service" - placeholder="URL that should be opened instead when clicking on the service" + description="Overrides the app URL when clicking on the app" + placeholder="URL that should be opened instead when clicking on the app" variant="default" mb="md" {...form.getInputProps('behaviour.onClickUrl')} diff --git a/src/components/Dashboard/Modals/EditService/Tabs/GeneralTab/GeneralTab.tsx b/src/components/Dashboard/Modals/EditAppModal/Tabs/GeneralTab/GeneralTab.tsx similarity index 70% rename from src/components/Dashboard/Modals/EditService/Tabs/GeneralTab/GeneralTab.tsx rename to src/components/Dashboard/Modals/EditAppModal/Tabs/GeneralTab/GeneralTab.tsx index b7fcd3dc4..4e4fcc108 100644 --- a/src/components/Dashboard/Modals/EditService/Tabs/GeneralTab/GeneralTab.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/Tabs/GeneralTab/GeneralTab.tsx @@ -2,12 +2,12 @@ import { Tabs, Text, TextInput } from '@mantine/core'; import { UseFormReturnType } from '@mantine/form'; import { IconCursorText, IconLink } from '@tabler/icons'; import { useTranslation } from 'next-i18next'; -import { ServiceType } from '../../../../../../types/service'; -import { EditServiceModalTab } from '../type'; +import { AppType } from '../../../../../../types/app'; +import { EditAppModalTab } from '../type'; interface GeneralTabProps { - form: UseFormReturnType ServiceType>; - openTab: (tab: EditServiceModalTab) => void; + form: UseFormReturnType AppType>; + openTab: (tab: EditAppModalTab) => void; } export const GeneralTab = ({ form, openTab }: GeneralTabProps) => { @@ -16,9 +16,9 @@ export const GeneralTab = ({ form, openTab }: GeneralTabProps) => { } - label="Service name" - description="Used for displaying the service on the dashboard" - placeholder="My example service" + label="App name" + description="Used for displaying the app on the dashboard" + placeholder="My example app" variant="default" mb="md" withAsterisk @@ -26,10 +26,10 @@ export const GeneralTab = ({ form, openTab }: GeneralTabProps) => { /> } - label="Service url" + label="App url" description={ - URL that will be opened when clicking on the service. Can be overwritten using + URL that will be opened when clicking on the app. Can be overwritten using openTab('behaviour')} variant="link" diff --git a/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/InputElements/GenericSecretInput.tsx b/src/components/Dashboard/Modals/EditAppModal/Tabs/IntegrationTab/Components/InputElements/GenericSecretInput.tsx similarity index 100% rename from src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/InputElements/GenericSecretInput.tsx rename to src/components/Dashboard/Modals/EditAppModal/Tabs/IntegrationTab/Components/InputElements/GenericSecretInput.tsx diff --git a/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/InputElements/IntegrationSelector.tsx b/src/components/Dashboard/Modals/EditAppModal/Tabs/IntegrationTab/Components/InputElements/IntegrationSelector.tsx similarity index 87% rename from src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/InputElements/IntegrationSelector.tsx rename to src/components/Dashboard/Modals/EditAppModal/Tabs/IntegrationTab/Components/InputElements/IntegrationSelector.tsx index bc83b42eb..3956a25b9 100644 --- a/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/InputElements/IntegrationSelector.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/Tabs/IntegrationTab/Components/InputElements/IntegrationSelector.tsx @@ -7,13 +7,13 @@ import { IntegrationField, integrationFieldDefinitions, integrationFieldProperties, - ServiceIntegrationPropertyType, - ServiceIntegrationType, - ServiceType, -} from '../../../../../../../../types/service'; + AppIntegrationPropertyType, + AppIntegrationType, + AppType, +} from '../../../../../../../../types/app'; interface IntegrationSelectorProps { - form: UseFormReturnType ServiceType>; + form: UseFormReturnType AppType>; } export const IntegrationSelector = ({ form }: IntegrationSelectorProps) => { @@ -53,9 +53,9 @@ export const IntegrationSelector = ({ form }: IntegrationSelectorProps) => { }, ].filter((x) => Object.keys(integrationFieldProperties).includes(x.value)); - const getNewProperties = (value: string | null): ServiceIntegrationPropertyType[] => { + const getNewProperties = (value: string | null): AppIntegrationPropertyType[] => { if (!value) return []; - const integrationType = value as ServiceIntegrationType['type']; + const integrationType = value as AppIntegrationType['type']; if (integrationType === null) { return []; } @@ -77,7 +77,7 @@ export const IntegrationSelector = ({ form }: IntegrationSelectorProps) => { return ( ({ value: service.id, label: service.name }))} + data={downloadApps.map((app) => ({ value: app.id, label: app.name }))} /> )} - + {!data ? null : data.paused ? (