Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add Tdarr integration and widget #1882

Merged
merged 18 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Format
  • Loading branch information
jbruell committed Feb 12, 2024
commit e9afdacee77a91c0708123d9c9d7e41b82c0ce6c
3 changes: 2 additions & 1 deletion src/pages/auth/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
Alert,
Button,
Card,
Divider, Flex,
Divider,
Flex,
PasswordInput,
Stack,
Text,
Expand Down
9 changes: 5 additions & 4 deletions src/pages/board/[slug].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import fs from 'fs';
import { GetServerSidePropsContext, InferGetServerSidePropsType } from 'next';
import { env } from 'process';
import { z } from 'zod';
import { Dashboard } from '~/components/Dashboard/Dashboard';
import { BoardLayout } from '~/components/layout/Templates/BoardLayout';
Expand All @@ -11,12 +13,10 @@ import { getServerSideTranslations } from '~/tools/server/getServerSideTranslati
import { checkForSessionOrAskForLogin } from '~/tools/server/loginBuilder';
import { boardNamespaces } from '~/tools/server/translation-namespaces';
import { api } from '~/utils/api';
import { env } from 'process';
import fs from 'fs';

export default function BoardPage({
config: initialConfig,
isDockerEnabled: isDockerEnabled
isDockerEnabled: isDockerEnabled,
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
useInitConfig(initialConfig);

Expand Down Expand Up @@ -65,7 +65,8 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
return result;
}

const isDockerEnabled: boolean = !!env.DOCKER_HOST || !!env.DOCKER_PORT || fs.existsSync('/var/run/docker.sock');
const isDockerEnabled: boolean =
!!env.DOCKER_HOST || !!env.DOCKER_PORT || fs.existsSync('/var/run/docker.sock');

return {
props: {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/board/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
return result;
}

const isDockerEnabled: boolean = !!env.DOCKER_HOST || !!env.DOCKER_PORT || fs.existsSync('/var/run/docker.sock');
const isDockerEnabled: boolean =
!!env.DOCKER_HOST || !!env.DOCKER_PORT || fs.existsSync('/var/run/docker.sock');

return {
props: {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/auth/ldap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type InferrableSearchOptions<
type SearchResultIndex<Attributes extends AttributeConstraint> = Attributes extends string
? Attributes
: Attributes extends readonly string[]
? Attributes[number]
: string;
? Attributes[number]
: string;

type SearchResult<
Attributes extends AttributeConstraint,
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/notebook/NotebookEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ export function Editor({ widget }: { widget: INotebookWidget }) {
addAttributes() {
return {
...this.parent?.(),
target: { default: null }
}
}
target: { default: null },
};
},
}),
StarterKit,
Table.configure({
Expand Down
29 changes: 16 additions & 13 deletions src/widgets/smart-home/entity-state/entity-state.widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,22 @@ function EntityStateTile({ widget }: SmartHomeEntityStateWidgetProps) {
}
);

const attribute = (widget.properties.appendUnit && data?.attributes.unit_of_measurement ?
" " + data?.attributes.unit_of_measurement : ""
)

const displayName = (widget.properties.displayFriendlyName && data?.attributes.friendly_name ?
data?.attributes.friendly_name : widget.properties.displayName
)

const { mutateAsync: mutateTriggerAutomationAsync } = api.smartHomeEntityState.triggerAutomation.useMutation({
onSuccess: () => {
void utils.smartHomeEntityState.invalidate();
},
});
const attribute =
widget.properties.appendUnit && data?.attributes.unit_of_measurement
? ' ' + data?.attributes.unit_of_measurement
: '';

const displayName =
widget.properties.displayFriendlyName && data?.attributes.friendly_name
? data?.attributes.friendly_name
: widget.properties.displayName;

const { mutateAsync: mutateTriggerAutomationAsync } =
api.smartHomeEntityState.triggerAutomation.useMutation({
onSuccess: () => {
void utils.smartHomeEntityState.invalidate();
},
});

const handleClick = async () => {
if (!widget.properties.automationId) {
Expand Down
6 changes: 3 additions & 3 deletions tests/pages/auth/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('login page', () => {
_i18Next: 'hello',
oidcAutoLogin: null,
oidcProviderName: null,
providers: undefined
providers: undefined,
},
});

Expand Down Expand Up @@ -80,7 +80,7 @@ describe('login page', () => {
_i18Next: 'hello',
oidcAutoLogin: null,
oidcProviderName: null,
providers: undefined
providers: undefined,
},
});

Expand Down Expand Up @@ -120,7 +120,7 @@ describe('login page', () => {
_i18Next: 'hello',
oidcAutoLogin: null,
oidcProviderName: null,
providers: undefined
providers: undefined,
},
});

Expand Down