-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
90 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
ui2/src/components/tags/ActionButtons.tsx → ...eatures/tags/components/ActionButtons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion
6
ui2/src/components/tags/TagRow.tsx → ui2/src/features/tags/components/TagRow.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
ui2/src/pages/tags/Details.tsx → ui2/src/features/tags/pages/Details.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
ui2/src/pages/tags/List.tsx → ui2/src/features/tags/pages/List.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import TagDetails from "./Details" | ||
import TagsList from "./List" | ||
|
||
export {TagsList, TagDetails} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import {createSlice, PayloadAction, createSelector} from "@reduxjs/toolkit" | ||
|
||
import {RootState} from "@/app/types" | ||
import type {PaginationType} from "@/types" | ||
import {PAGINATION_DEFAULT_ITEMS_PER_PAGES} from "@/cconstants" | ||
import {apiSliceWithTags} from "./apiSlice" | ||
|
||
export type TagSlice = { | ||
selectedIds: Array<string> | ||
pagination: PaginationType | null | ||
lastPageSize: number | ||
} | ||
|
||
const initialState: TagSlice = { | ||
selectedIds: [], | ||
pagination: null, | ||
lastPageSize: PAGINATION_DEFAULT_ITEMS_PER_PAGES | ||
} | ||
const tagsSlice = createSlice({ | ||
name: "tags", | ||
initialState, | ||
reducers: { | ||
selectionAdd: (state, action: PayloadAction<string>) => { | ||
state.selectedIds.push(action.payload) | ||
}, | ||
selectionAddMany: (state, action: PayloadAction<Array<string>>) => { | ||
state.selectedIds = action.payload | ||
}, | ||
selectionRemove: (state, action: PayloadAction<string>) => { | ||
const newSelectedIds = state.selectedIds.filter(i => i != action.payload) | ||
state.selectedIds = newSelectedIds | ||
}, | ||
clearSelection: state => { | ||
state.selectedIds = [] | ||
}, | ||
lastPageSizeUpdate: (state, action: PayloadAction<number>) => { | ||
state.lastPageSize = action.payload | ||
} | ||
} | ||
}) | ||
|
||
export const { | ||
selectionAdd, | ||
selectionAddMany, | ||
selectionRemove, | ||
clearSelection, | ||
lastPageSizeUpdate | ||
} = tagsSlice.actions | ||
export default tagsSlice.reducer | ||
|
||
export const selectTagsResult = apiSliceWithTags.endpoints.getTags.select() | ||
export const selectItems = (_: RootState, items: string[]) => items | ||
|
||
export const selectTagsByName = createSelector( | ||
[selectTagsResult, selectItems], | ||
(tagsData, tagNames) => { | ||
return tagsData.data?.filter(t => tagNames.includes(t.name)) || [] | ||
} | ||
) | ||
|
||
export const selectSelectedIds = (state: RootState) => state.tags.selectedIds | ||
|
||
// @ts-ignore | ||
export const selectItemNames = (state: RootState, names: string[]) => names | ||
// @ts-ignore | ||
export const selectItemIds = (state: RootState, itemIds: string[]) => itemIds | ||
|
||
export const selectLastPageSize = (state: RootState): number => { | ||
return state.tags.lastPageSize | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.