Skip to content

Commit

Permalink
feat: project tasks basic filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 committed Jul 26, 2024
1 parent 8e682cb commit aaf3a94
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@ open class TaskFilters {
description = """Filter tasks without project""",
)
var filterNotProject: List<Long>? = null

@field:Parameter(
description = """Filter tasks by language""",
)
var filterLanguage: List<Long>? = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ const val FILTERS = """
:#{#filters.filterNotProject} is null
or t.project.id not in :#{#filters.filterNotProject}
)
and (
:#{#filters.filterLanguage} is null
or t.language.id in :#{#filters.filterLanguage}
)
"""

@Repository
Expand Down
94 changes: 49 additions & 45 deletions webapp/src/service/apiSchema.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,21 @@ export interface components {
* @example 200001,200004
*/
permittedLanguageIds?: number[];
/**
* @description List of languages user can translate to. If null, all languages editing is permitted.
* @example 200001,200004
*/
translateLanguageIds?: number[];
/**
* @description List of languages user can view. If null, all languages view is permitted.
* @example 200001,200004
*/
viewLanguageIds?: number[];
/**
* @description List of languages user can change state to. If null, changing state of all language values is permitted.
* @example 200001,200004
*/
stateChangeLanguageIds?: number[];
/**
* @description Granted scopes to the user. When user has type permissions, this field contains permission scopes of the type.
* @example KEYS_EDIT,TRANSLATIONS_VIEW
Expand Down Expand Up @@ -1180,21 +1195,6 @@ export interface components {
| "content-delivery.publish"
| "webhooks.manage"
)[];
/**
* @description List of languages user can translate to. If null, all languages editing is permitted.
* @example 200001,200004
*/
translateLanguageIds?: number[];
/**
* @description List of languages user can view. If null, all languages view is permitted.
* @example 200001,200004
*/
viewLanguageIds?: number[];
/**
* @description List of languages user can change state to. If null, changing state of all language values is permitted.
* @example 200001,200004
*/
stateChangeLanguageIds?: number[];
};
LanguageModel: {
/** Format: int64 */
Expand Down Expand Up @@ -1773,8 +1773,8 @@ export interface components {
secretKey?: string;
endpoint: string;
signingRegion: string;
enabled?: boolean;
contentStorageType?: "S3" | "AZURE";
enabled?: boolean;
};
AzureContentStorageConfigModel: {
containerName?: string;
Expand Down Expand Up @@ -2040,10 +2040,10 @@ export interface components {
convertPlaceholdersToIcu: boolean;
};
ImportSettingsModel: {
/** @description If true, key descriptions will be overridden by the import */
overrideKeyDescriptions: boolean;
/** @description If true, placeholders from other formats will be converted to ICU when possible */
convertPlaceholdersToIcu: boolean;
/** @description If true, key descriptions will be overridden by the import */
overrideKeyDescriptions: boolean;
};
TranslationCommentModel: {
/**
Expand Down Expand Up @@ -2203,14 +2203,14 @@ export interface components {
/** Format: int64 */
id: number;
/** Format: int64 */
expiresAt?: number;
createdAt: number;
/** Format: int64 */
lastUsedAt?: number;
updatedAt: number;
description: string;
/** Format: int64 */
createdAt: number;
expiresAt?: number;
/** Format: int64 */
updatedAt: number;
lastUsedAt?: number;
};
SetOrganizationRoleDto: {
roleType: "MEMBER" | "OWNER";
Expand Down Expand Up @@ -2350,15 +2350,15 @@ export interface components {
id: number;
projectName: string;
userFullName?: string;
scopes: string[];
username?: string;
description: string;
/** Format: int64 */
projectId: number;
/** Format: int64 */
expiresAt?: number;
/** Format: int64 */
lastUsedAt?: number;
/** Format: int64 */
projectId: number;
username?: string;
description: string;
scopes: string[];
};
SuperTokenRequest: {
/** @description Has to be provided when TOTP enabled */
Expand Down Expand Up @@ -3501,17 +3501,17 @@ export interface components {
/** Format: int64 */
id: number;
basePermissions: components["schemas"]["PermissionModel"];
avatar?: components["schemas"]["Avatar"];
/** @example btforg */
slug: string;
/** @example This is a beautiful organization full of beautiful and clever people */
description?: string;
/**
* @description The role of currently authorized user.
*
* Can be null when user has direct access to one of the projects owned by the organization.
*/
currentUserRole?: "MEMBER" | "OWNER";
/** @example This is a beautiful organization full of beautiful and clever people */
description?: string;
/** @example btforg */
slug: string;
avatar?: components["schemas"]["Avatar"];
};
PublicBillingConfigurationDTO: {
enabled: boolean;
Expand Down Expand Up @@ -3654,20 +3654,20 @@ export interface components {
name: string;
/** Format: int64 */
id: number;
baseTranslation?: string;
translation?: string;
namespace?: string;
description?: string;
baseTranslation?: string;
translation?: string;
};
KeySearchSearchResultModel: {
view?: components["schemas"]["KeySearchResultView"];
name: string;
/** Format: int64 */
id: number;
baseTranslation?: string;
translation?: string;
namespace?: string;
description?: string;
baseTranslation?: string;
translation?: string;
};
PagedModelKeySearchSearchResultModel: {
_embedded?: {
Expand Down Expand Up @@ -4216,14 +4216,14 @@ export interface components {
/** Format: int64 */
id: number;
/** Format: int64 */
expiresAt?: number;
createdAt: number;
/** Format: int64 */
lastUsedAt?: number;
updatedAt: number;
description: string;
/** Format: int64 */
createdAt: number;
expiresAt?: number;
/** Format: int64 */
updatedAt: number;
lastUsedAt?: number;
};
PagedModelOrganizationModel: {
_embedded?: {
Expand Down Expand Up @@ -4344,15 +4344,15 @@ export interface components {
id: number;
projectName: string;
userFullName?: string;
scopes: string[];
username?: string;
description: string;
/** Format: int64 */
projectId: number;
/** Format: int64 */
expiresAt?: number;
/** Format: int64 */
lastUsedAt?: number;
/** Format: int64 */
projectId: number;
username?: string;
description: string;
scopes: string[];
};
PagedModelUserAccountModel: {
_embedded?: {
Expand Down Expand Up @@ -10525,6 +10525,8 @@ export interface operations {
filterProject?: number[];
/** Filter tasks without project */
filterNotProject?: number[];
/** Filter tasks by language */
filterLanguage?: number[];
/** Zero-based page index (0..N) */
page?: number;
/** The size of the page to be returned */
Expand Down Expand Up @@ -13506,6 +13508,8 @@ export interface operations {
filterProject?: number[];
/** Filter tasks without project */
filterNotProject?: number[];
/** Filter tasks by language */
filterLanguage?: number[];
/** Zero-based page index (0..N) */
page?: number;
/** The size of the page to be returned */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type LanguageModel = components['schemas']['LanguageModel'];

type Props = {
languages: LanguageModel[] | undefined;
className: string;
className?: string;
};

export const LanguageSelector: React.FC<Props> = ({ languages, className }) => {
Expand Down
17 changes: 11 additions & 6 deletions webapp/src/views/projects/tasks/ProjectTasksView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react';
import { Checkbox, Dialog, ListProps, PaperProps, styled } from '@mui/material';
import { Dialog, ListProps, PaperProps, styled } from '@mui/material';
import { useTranslate } from '@tolgee/react';

import { useProject } from 'tg.hooks/useProject';
Expand All @@ -11,6 +11,7 @@ import { TaskDetail } from 'tg.component/task/TaskDetail';
import { components } from 'tg.service/apiSchema.generated';

import { BaseProjectView } from '../BaseProjectView';
import { TasksHeader } from './TasksHeader';

type TaskModel = components['schemas']['TaskModel'];

Expand All @@ -26,6 +27,7 @@ export const ProjectTasksView = () => {
const [page, setPage] = useState(0);
const [search, setSearch] = useState('');
const [showClosed, setShowClosed] = useState(false);
const [filterLanguages, setFilterLanguages] = useState<number[]>([]);

const [detail, setDetail] = useState<TaskModel>();

Expand All @@ -42,6 +44,7 @@ export const ProjectTasksView = () => {
page,
search,
filterNotState: showClosed ? undefined : ['CLOSED', 'DONE'],
filterLanguage: filterLanguages,
},
options: {
keepPreviousData: true,
Expand All @@ -62,15 +65,17 @@ export const ProjectTasksView = () => {
],
]}
>
<Checkbox
checked={showClosed}
onChange={(e) => setShowClosed(e.target.checked)}
<TasksHeader
sx={{ mb: '20px', mt: '-12px' }}
onSearchChange={setSearch}
showClosed={showClosed}
onShowClosedChange={setShowClosed}
filterLanguages={filterLanguages}
onFilterLanguagesChange={setFilterLanguages}
/>
<PaginatedHateoasList
loadable={tasksLoadable}
onPageChange={setPage}
searchText={search}
onSearchChange={setSearch}
listComponentProps={
{
sx: {
Expand Down
Loading

0 comments on commit aaf3a94

Please sign in to comment.