Skip to content

Commit

Permalink
New: Show author names after task name when applicable
Browse files Browse the repository at this point in the history
(cherry picked from commit 6d552f2a60f44052079b5e8944f5e1bbabac56e0)

Closes #3361
  • Loading branch information
markus101 authored and mynameisbogdan committed Mar 15, 2024
1 parent 77f1e8f commit 93ee466
Show file tree
Hide file tree
Showing 19 changed files with 494 additions and 459 deletions.
4 changes: 4 additions & 0 deletions frontend/src/App/State/AppState.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import AuthorsAppState from './AuthorsAppState';
import CommandAppState from './CommandAppState';
import SettingsAppState from './SettingsAppState';
import TagsAppState from './TagsAppState';

Expand Down Expand Up @@ -34,6 +36,8 @@ export interface CustomFilter {
}

interface AppState {
authors: AuthorsAppState;
commands: CommandAppState;
settings: SettingsAppState;
tags: TagsAppState;
}
Expand Down
18 changes: 18 additions & 0 deletions frontend/src/App/State/AuthorsAppState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import AppSectionState, {
AppSectionDeleteState,
AppSectionSaveState,
} from 'App/State/AppSectionState';
import Author from 'Author/Author';

interface AuthorsAppState
extends AppSectionState<Author>,
AppSectionDeleteState,
AppSectionSaveState {
itemMap: Record<number, number>;

deleteOptions: {
addImportListExclusion: boolean;
};
}

export default AuthorsAppState;
6 changes: 6 additions & 0 deletions frontend/src/App/State/CommandAppState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import AppSectionState from 'App/State/AppSectionState';
import Command from 'Commands/Command';

export type CommandAppState = AppSectionState<Command>;

export default CommandAppState;
18 changes: 18 additions & 0 deletions frontend/src/Author/Author.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import ModelBase from 'App/ModelBase';

interface Author extends ModelBase {
added: string;
genres: string[];
monitored: boolean;
overview: string;
path: string;
qualityProfileId: number;
metadataProfileId: number;
rootFolderPath: string;
sortName: string;
tags: number[];
authorName: string;
isSaving?: boolean;
}

export default Author;
38 changes: 38 additions & 0 deletions frontend/src/Commands/Command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import ModelBase from 'App/ModelBase';

export interface CommandBody {
sendUpdatesToClient: boolean;
updateScheduledTask: boolean;
completionMessage: string;
requiresDiskAccess: boolean;
isExclusive: boolean;
isLongRunning: boolean;
name: string;
lastExecutionTime: string;
lastStartTime: string;
trigger: string;
suppressMessages: boolean;
authorId?: number;
authorIds?: number[];
}

interface Command extends ModelBase {
name: string;
commandName: string;
message: string;
body: CommandBody;
priority: string;
status: string;
result: string;
queued: string;
started: string;
ended: string;
duration: string;
trigger: string;
stateChangeTime: string;
sendUpdatesToClient: boolean;
updateScheduledTask: boolean;
lastExecutionTime: string;
}

export default Command;
17 changes: 17 additions & 0 deletions frontend/src/Helpers/Hooks/useModalOpenState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useCallback, useState } from 'react';

export default function useModalOpenState(
initialState: boolean
): [boolean, () => void, () => void] {
const [isOpen, setOpen] = useState(initialState);

const setModalOpen = useCallback(() => {
setOpen(true);
}, [setOpen]);

const setModalClosed = useCallback(() => {
setOpen(false);
}, [setOpen]);

return [isOpen, setModalOpen, setModalClosed];
}
14 changes: 14 additions & 0 deletions frontend/src/Store/Selectors/createMultiAuthorsSelector.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { createSelector } from 'reselect';
import AppState from 'App/State/AppState';

function createMultiAuthorsSelector(authorIds: number[]) {
return createSelector(
(state: AppState) => state.authors.itemMap,
(state: AppState) => state.authors.items,
(itemMap, allAuthors) => {
return authorIds.map((authorId) => allAuthors[itemMap[authorId]]);
}
);
}

export default createMultiAuthorsSelector;
9 changes: 0 additions & 9 deletions frontend/src/System/Tasks/Queued/QueuedTaskRow.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@
width: 100%;
}

.commandName {
display: inline-block;
min-width: 220px;
}

.userAgent {
color: #b0b0b0;
}

.queued,
.started,
.ended {
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/System/Tasks/Queued/QueuedTaskRow.css.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
// Please do not change this file!
interface CssExports {
'actions': string;
'commandName': string;
'duration': string;
'ended': string;
'queued': string;
'started': string;
'trigger': string;
'triggerContent': string;
'userAgent': string;
}
export const cssExports: CssExports;
export default cssExports;

0 comments on commit 93ee466

Please sign in to comment.