Skip to content

Commit

Permalink
- add Statuses and Accepted statuses to Spotlight
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-silakov committed Feb 24, 2023
1 parent f20bbe2 commit 4527ac8
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24973,6 +24973,9 @@ function Filter({
setSearchParams
}) {
const [groupsData, setGroupsData] = react.exports.useState(mainGroupInit);
const {
setQuery
} = useParams();
const removeGroupsData = (key) => {
setGroupsData((prev) => {
const {
Expand All @@ -24983,6 +24986,9 @@ function Filter({
});
};
const resetAll = () => {
setQuery({
filter: void 0
});
setGroupsData(() => ({
mainGroup: {
operator: "$and",
Expand Down Expand Up @@ -25212,6 +25218,9 @@ function IndexLayout() {
const queryClient = new QueryClient();
function App() {
const theme = useMantineTheme();
const {
setQuery
} = useParams();
const [colorScheme, toggleColorScheme] = useColorScheme();
const navigate = useNavigate();
const spotlightActions = navigationData().map((item) => ({
Expand All @@ -25235,6 +25244,86 @@ function App() {
size: 18
})
});
spotlightActions.push({
title: "Filter: only successful tests",
description: "Show only New and Passed tests",
onTrigger: () => {
setQuery({
filter: {
$or: [{
status: {
$eq: "Passed"
}
}, {
status: {
$eq: "New"
}
}]
}
});
},
icon: /* @__PURE__ */ jsx(zV, {
size: 18
})
});
spotlightActions.push({
title: "Filter: only failed tests",
description: "Show only Failed tests",
onTrigger: () => {
setQuery({
filter: {
$or: [{
status: {
$eq: "Failed"
}
}]
}
});
},
icon: /* @__PURE__ */ jsx(zV, {
size: 18
})
});
spotlightActions.push({
title: "Filter: not accepted tests",
description: "Show all tests with Unaccepted and Partially accepted status",
onTrigger: () => {
setQuery({
filter: {
$or: [{
markedAs: {
$eq: "Unaccepted"
}
}, {
status: {
$eq: "Partially"
}
}]
}
});
},
icon: /* @__PURE__ */ jsx(zV, {
size: 18
})
});
spotlightActions.push({
title: "Filter: accepted tests",
description: "Show all tests with Accepted status",
onTrigger: () => {
setQuery({
filter: {
$or: [{
markedAs: {
$eq: "Accepted"
}
}]
}
});
},
icon: /* @__PURE__ */ jsx(zV, {
size: 18
})
});
return /* @__PURE__ */ jsx(QueryClientProvider, {
client: queryClient,
children: /* @__PURE__ */ jsx(ColorSchemeProvider, {
Expand Down
2 changes: 1 addition & 1 deletion mvc/views/react/index2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<link rel="icon" href="/assets/favicon.bf5828d5.svg">
<title>Syngrisi</title>
<script type="module" crossorigin src="/assets/root.b0a2fed2.js"></script>
<script type="module" crossorigin src="/assets/root.a6437700.js"></script>
<link rel="modulepreload" crossorigin href="/assets/use-form.83d6f5c0.js">
<link rel="modulepreload" crossorigin href="/assets/LogicalGroup.f95783e9.js">
<link rel="stylesheet" href="/assets/use-form.ecb4391b.css">
Expand Down
65 changes: 64 additions & 1 deletion src/ui-app/index2/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ import { Route, Routes, useNavigate } from 'react-router-dom';
import { NavigationProgress } from '@mantine/nprogress';
import { NotificationsProvider } from '@mantine/notifications';

import { IconMoonStars, IconSearch, IconSun } from '@tabler/icons';
import { IconFilter, IconMoonStars, IconSearch, IconSun } from '@tabler/icons';
import { SpotlightProvider } from '@mantine/spotlight';
import config from '../config';

import IndexLayout from './IndexLayout';
import useColorScheme from '../shared/hooks/useColorSheme';
import { navigationData } from '../shared/navigation/navigationData';
import { INavDataItem } from '../shared/navigation/interfaces';
import { useParams } from './hooks/useParams';

const queryClient = new QueryClient();

function App() {
const theme = useMantineTheme();
const { setQuery } = useParams();

const [colorScheme, toggleColorScheme]: any = useColorScheme();

const navigate = useNavigate();
Expand Down Expand Up @@ -52,6 +55,66 @@ function App() {
} as any,
);

spotlightActions.push(
{
title: 'Filter: only successful tests',
description: 'Show only New and Passed tests',
onTrigger: () => {
setQuery(
{
filter: { $or: [{ status: { $eq: 'Passed' } }, { status: { $eq: 'New' } }] },
},
);
},
icon: <IconFilter size={18} />,
} as any,
);

spotlightActions.push(
{
title: 'Filter: only failed tests',
description: 'Show only Failed tests',
onTrigger: () => {
setQuery(
{
filter: { $or: [{ status: { $eq: 'Failed' } }] },
},
);
},
icon: <IconFilter size={18} />,
} as any,
);

spotlightActions.push(
{
title: 'Filter: not accepted tests',
description: 'Show all tests with Unaccepted and Partially accepted status',
onTrigger: () => {
setQuery(
{
filter: { $or: [{ markedAs: { $eq: 'Unaccepted' } }, { status: { $eq: 'Partially' } }] },
},
);
},
icon: <IconFilter size={18} />,
} as any,
);

spotlightActions.push(
{
title: 'Filter: accepted tests',
description: 'Show all tests with Accepted status',
onTrigger: () => {
setQuery(
{
filter: { $or: [{ markedAs: { $eq: 'Accepted' } }] },
},
);
},
icon: <IconFilter size={18} />,
} as any,
);

return (
<QueryClientProvider client={queryClient}>
<ColorSchemeProvider
Expand Down
5 changes: 4 additions & 1 deletion src/ui-app/index2/components/Tests/Table/Filter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable dot-notation */
/* eslint-disable dot-notation,react-hooks/exhaustive-deps */
import * as React from 'react';
import {
Box,
Expand All @@ -12,6 +12,7 @@ import RelativeDrawer from '../../../../shared/components/RelativeDrawer';
import { tableColumns } from './tableColumns';
import LogicalGroup from '../../../../shared/components/filter/LogicalGroup';
import { SearchParams, uuid } from '../../../../shared/utils';
import { useParams } from '../../../hooks/useParams';

interface Props {
open: boolean
Expand Down Expand Up @@ -39,6 +40,7 @@ function Filter(
}: Props,
) {
const [groupsData, setGroupsData] = useState<{ [key: string]: any }>(mainGroupInit);
const { setQuery } = useParams();

const removeGroupsData = (key: string) => {
setGroupsData((prev) => {
Expand All @@ -48,6 +50,7 @@ function Filter(
};

const resetAll = () => {
setQuery({ filter: undefined });
setGroupsData(() => ({
mainGroup: {
operator: '$and',
Expand Down
4 changes: 4 additions & 0 deletions tests/features/NEW/CP/table/filtering.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Feature: Tests Table Filter
When I wait on element "[data-table-test-name='TestName filter-0']" to not be displayed
When I wait on element "[data-table-test-name='TestName filter-1']" to be displayed

When I click on the element "[data-test='table-filter-reset']"
When I wait on element "[data-table-test-name='TestName filter-0']" to be displayed
When I wait on element "[data-table-test-name='TestName filter-1']" to be displayed

@smoke
Scenario: Main Group, Single Rule with project Filter
When I create "2" tests with:
Expand Down

0 comments on commit 4527ac8

Please sign in to comment.