Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion api-editor/gui/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import { AbstractPythonFilter } from '../features/filter/model/AbstractPythonFil
import { UsageCountStore } from '../features/usages/model/UsageCountStore';
import { PythonDeclaration } from '../features/packageData/model/PythonDeclaration';
import { SaveFilterDialog } from '../features/filter/SaveFilterDialog';
import { StatisticsView } from '../features/packageData/selectionView/StatisticsView';
import { StatisticsView } from '../features/statistics/StatisticsView';

export const App: React.FC = function () {
useIndexedDB();
Expand Down
14 changes: 1 addition & 13 deletions api-editor/gui/src/app/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,7 @@ export const store = configureStore({
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: {
// Ignore these action types
ignoredActions: [
'api/initialize',
'api/initialize/fulfilled',
'api/setPythonPackage',
'usages/initialize',
'usages/initialize/fulfilled',
'usages/setUsages',
],
// Ignore these paths in the state
ignoredPaths: ['api.pythonPackage', 'usages.usages'],
},
serializableCheck: false,
}),
});

Expand Down
22 changes: 20 additions & 2 deletions api-editor/gui/src/features/annotations/annotationSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ const annotationsSlice = createSlice({

updateQueue(state);
},
// TODO update
mergeAnnotationStore(state, action: PayloadAction<AnnotationStore>) {
for (const annotationType of Object.keys(action.payload)) {
if (annotationType === 'calledAfters' || annotationType === 'groups') {
Expand Down Expand Up @@ -966,7 +965,7 @@ export const selectTodo =
(target: string) =>
(state: RootState): TodoAnnotation | undefined =>
selectAnnotationStore(state).todos[target];
export const selectNumberOfAnnotations =
export const selectNumberOfAnnotationsOnTarget =
(target: string) =>
(state: RootState): number => {
return Object.entries(selectAnnotationStore(state)).reduce((acc, [annotationType, annotations]) => {
Expand All @@ -979,5 +978,24 @@ export const selectNumberOfAnnotations =
}
}, 0);
};
export const selectAllAnnotationsOnTargets =
(targets: string[]) =>
(state: RootState): Annotation[] =>
targets.flatMap((target) => selectAllAnnotationsOnTarget(target)(state));
const selectAllAnnotationsOnTarget =
(target: string) =>
(state: RootState): Annotation[] => {
return Object.entries(selectAnnotationStore(state)).flatMap(([annotationType, targetToAnnotations]) => {
switch (annotationType) {
case 'completes':
return [];
case 'calledAfters':
case 'groups':
return Object.values(targetToAnnotations[target] ?? {});
default:
return targetToAnnotations[target] ?? [];
}
});
};
export const selectUsername = (state: RootState): string => selectAnnotationSlice(state).username;
export const selectUsernameIsValid = (state: RootState): boolean => isValidUsername(selectUsername(state));
14 changes: 10 additions & 4 deletions api-editor/gui/src/features/packageData/apiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,24 @@ export const selectFilteredPythonPackage = createSelector(
return filter.applyToPackage(pythonPackage, annotations, usages);
},
);
export const selectNumberOfMatchedNodes = createSelector(
export const selectMatchedNodes = createSelector(
[selectFilteredPythonPackage, selectAnnotationStore, selectUsages, selectFilter],
(pythonPackage, annotations, usages, filter) => {
let result = -1; // We start with -1, since the PythonPackage is always kept but should not be counted
const result = [];
for (const declaration of pythonPackage.descendantsOrSelf()) {
if (filter.shouldKeepDeclaration(declaration, annotations, usages)) {
result++;
if (
!(declaration instanceof PythonPackage) &&
filter.shouldKeepDeclaration(declaration, annotations, usages)
) {
result.push(declaration);
}
}
return result;
},
);
export const selectNumberOfMatchedNodes = createSelector([selectMatchedNodes], (matchedNodes) => {
return matchedNodes.length;
});
export const selectFlatSortedDeclarationList = createSelector(
[selectFilteredPythonPackage, selectSortingMode, selectUsages],
(pythonPackage, sortingMode, usages) => {
Expand Down

This file was deleted.

Loading