Skip to content

Commit

Permalink
Merge branch 'develop-postgres' into setup
Browse files Browse the repository at this point in the history
  • Loading branch information
VanshikaSabharwal authored Dec 12, 2024
2 parents e391f42 + 0630cff commit a67137c
Show file tree
Hide file tree
Showing 21 changed files with 502 additions and 473 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ Fixes #<!--Add related issue number here.-->

**Have you read the [contributing guide](https://github.com/PalisadoesFoundation/talawa-admin/blob/master/CONTRIBUTING.md)?**

<!--Yes or No-->
<!--Yes or No-->
1 change: 1 addition & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ jobs:
.node-version
.husky/**
scripts/**
src/style/**
schema.graphql
package.json
tsconfig.json
Expand Down
4 changes: 2 additions & 2 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@
"register": "register"
},
"addOnStore": {
"title": "Add On Store",
"title": "Plugin Store",
"searchName": "Ex: Donations",
"search": "Search",
"enable": "Enabled",
Expand Down Expand Up @@ -1227,7 +1227,7 @@
"RstartDate": "Select Start Date",
"RendDate": "Select End Date",
"RClose": "Close the window",
"addNew": "Create new advertisement",
"addNew": "Create",
"EXname": "Ex. Cookie Shop",
"EXlink": "Ex. http://yourwebsite.com/photo",
"createAdvertisement": "Create Advertisement",
Expand Down
6 changes: 5 additions & 1 deletion src/components/AddOn/core/AddOnEntry/AddOnEntry.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
margin-left: auto;
display: flex !important;
align-items: center;
background-color: transparent;
color: #31bb6b;
}
.card {
border: 4px solid green;
}

.entryaction i {
margin-right: 8px;
}
Expand Down
14 changes: 9 additions & 5 deletions src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ interface InterfaceAddOnEntryProps {
description?: string; // Optional props
createdBy: string;
component?: string; // Optional props
modified?: any; // Optional props
modified?: boolean; // Optional props
uninstalledOrgs: string[];
getInstalledPlugins: () => any;
getInstalledPlugins: () => void;
}

/**
Expand Down Expand Up @@ -59,6 +59,7 @@ function addOnEntry({

// Getting orgId from URL parameters
const { orgId: currentOrg } = useParams();
// console.log(currentOrg);
if (!currentOrg) {
// If orgId is not present in the URL, navigate to the org list page
return <Navigate to={'/orglist'} />;
Expand Down Expand Up @@ -101,7 +102,10 @@ function addOnEntry({

return (
<>
<Card data-testid="AddOnEntry">
<Card
data-testid="AddOnEntry"
style={{ border: '1px solid #31BB6B', borderRadius: '10px' }}
>
{/* {uninstalledOrgs.includes(currentOrg) && (
<Form.Check
type="switch"
Expand All @@ -114,7 +118,7 @@ function addOnEntry({
/>
)} */}
<Card.Body>
<Card.Title>{title}</Card.Title>
<Card.Title style={{ fontWeight: '800' }}>{title}</Card.Title>
<Card.Subtitle className="mb-2 text-muted author">
{createdBy}
</Card.Subtitle>
Expand All @@ -134,7 +138,7 @@ function addOnEntry({
<Spinner animation="grow" />
) : (
<i
className={!isInstalledLocal ? 'fa fa-trash' : 'fa fa-cubes'}
className={!isInstalledLocal ? 'fa fa-trash' : 'fa fa-plus'}
></i>
)}
{/* {installed ? 'Remove' : configurable ? 'Installed' : 'Install'} */}
Expand Down
45 changes: 43 additions & 2 deletions src/components/AddOn/core/AddOnStore/AddOnStore.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
border-bottom: 3px solid #31bb6b;
width: 15%;
}

.actioninput {
.input {
display: flex;
position: relative;
width: 560px;
}
/* .actioninput {
text-decoration: none;
margin-bottom: 50px;
border-color: #e8e5e5;
Expand All @@ -23,9 +27,46 @@
padding-right: 10px;
padding-left: 10px;
box-shadow: none;
} */
.actioninput {
margin-top: 10px;
margin-bottom: 10px;
background-color: white;
box-shadow: 0 1px 1px #31bb6b;
}
.inputField > button {
padding-top: 10px;
padding-bottom: 10px;
}

.actionradio input {
width: fit-content;
margin: inherit;
}
.cardGridItem {
width: 38vw;
}
.justifysp {
display: grid;
width: 100%;
justify-content: space-between;
align-items: baseline;
grid-template-rows: auto;
grid-template-columns: repeat(2, 1fr);
grid-gap: 0.8rem 0.4rem;
}

@media screen and (max-width: 600px) {
.cardGridItem {
width: 100%;
}
.justifysp {
display: grid;
width: 100%;
justify-content: center;
align-items: start;
grid-template-rows: auto;
grid-template-columns: 1fr;
grid-gap: 0.8rem 0.4rem;
}
}
99 changes: 17 additions & 82 deletions src/components/AddOn/core/AddOnStore/AddOnStore.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import useLocalStorage from 'utils/useLocalstorage';
import { MockedProvider } from '@apollo/react-testing';

const { getItem } = useLocalStorage();

interface InterfacePlugin {
enabled: boolean;
pluginName: string;
component: string;
}
jest.mock('components/AddOn/support/services/Plugin.helper', () => ({
__esModule: true,
default: jest.fn().mockImplementation(() => ({
Expand Down Expand Up @@ -60,16 +64,18 @@ jest.mock('components/AddOn/support/services/Plugin.helper', () => ({
},
// Add more mock data as needed
]),
generateLinks: jest.fn().mockImplementation((plugins) => {
return plugins
.filter((plugin: { enabled: any }) => plugin.enabled)
.map((installedPlugin: { pluginName: any; component: string }) => {
return {
name: installedPlugin.pluginName,
url: `/plugin/${installedPlugin.component.toLowerCase()}`,
};
});
}),
generateLinks: jest
.fn()
.mockImplementation((plugins: InterfacePlugin[]) => {
return plugins
.filter((plugin) => plugin.enabled)
.map((installedPlugin) => {
return {
name: installedPlugin.pluginName,
url: `/plugin/${installedPlugin.component.toLowerCase()}`,
};
});
}),
})),
}));

Expand Down Expand Up @@ -301,77 +307,6 @@ describe('Testing AddOnStore Component', () => {
expect(message.length).toBeGreaterThanOrEqual(1);
});

test('check filters enabled and disabled under Installed tab', async () => {
const mocks = [ORGANIZATIONS_LIST_MOCK, PLUGIN_GET_MOCK];
render(
<ApolloProvider client={client}>
<Provider store={store}>
<BrowserRouter>
<I18nextProvider i18n={i18nForTest}>
<MockedProvider mocks={mocks} addTypename={false}>
<AddOnStore />
</MockedProvider>
</I18nextProvider>
</BrowserRouter>
</Provider>
</ApolloProvider>,
);

await wait();
userEvent.click(screen.getByText('Installed'));

expect(screen.getByText('Filters')).toBeInTheDocument();
expect(screen.getByLabelText('Enabled')).toBeInTheDocument();
expect(screen.getByLabelText('Disabled')).toBeInTheDocument();

fireEvent.click(screen.getByLabelText('Enabled'));
expect(screen.getByLabelText('Enabled')).toBeChecked();
fireEvent.click(screen.getByLabelText('Disabled'));
expect(screen.getByLabelText('Disabled')).toBeChecked();
});

test('check the working search bar when on Installed tab', async () => {
const mocks = [ORGANIZATIONS_LIST_MOCK, PLUGIN_GET_MOCK];

const { container } = render(
<ApolloProvider client={client}>
<Provider store={store}>
<BrowserRouter>
<I18nextProvider i18n={i18nForTest}>
<MockedProvider mocks={mocks} addTypename={false}>
<AddOnStore />
</MockedProvider>
</I18nextProvider>
</BrowserRouter>
</Provider>
</ApolloProvider>,
);
await wait();
userEvent.click(screen.getByText('Installed'));

await wait();
let searchText = '';
fireEvent.change(screen.getByPlaceholderText('Ex: Donations'), {
target: { value: searchText },
});
expect(container).toHaveTextContent('Plugin 1');
expect(container).toHaveTextContent('Plugin 3');

searchText = 'Plugin 1';
fireEvent.change(screen.getByPlaceholderText('Ex: Donations'), {
target: { value: searchText },
});
const plugin1Elements = screen.queryAllByText('Plugin 1');
expect(plugin1Elements.length).toBeGreaterThan(1);

searchText = 'Test Plugin';
fireEvent.change(screen.getByPlaceholderText('Ex: Donations'), {
target: { value: searchText },
});
const message = screen.getAllByText('Plugin does not exists');
expect(message.length).toBeGreaterThanOrEqual(1);
});

test('AddOnStore loading test', async () => {
expect(true).toBe(true);
const mocks = [ORGANIZATIONS_LIST_MOCK, PLUGIN_LOADING_MOCK];
Expand Down
Loading

0 comments on commit a67137c

Please sign in to comment.