Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : Implemented search and pagination in Dashboard #804

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a28685d
feat: pagination component
darkhorse-420 Oct 26, 2024
d33e216
feat: pagination styling
darkhorse-420 Oct 26, 2024
52d59c1
feat: pagination in userList(with dummy values)
darkhorse-420 Oct 27, 2024
6270432
feat: search component users repositories
darkhorse-420 Oct 27, 2024
b5aabf7
fix: search and pagination
darkhorse-420 Nov 6, 2024
51a003a
fix: search and pagination
darkhorse-420 Nov 6, 2024
8d12a5a
fix: clean
darkhorse-420 Nov 6, 2024
2781867
Merge pull request #1 from darkhorse-420/Search
darkhorse-420 Nov 6, 2024
7ffc0d6
Merge branch 'finos:main' into main
darkhorse-420 Nov 6, 2024
e784109
Merge branch 'finos:main' into Search
darkhorse-420 Nov 6, 2024
0e0eee5
Merge branch 'main' into main
darkhorse-420 Nov 7, 2024
cdcbbdb
Merge branch 'main' into main
JamieSlome Nov 8, 2024
17bbe69
Merge branch 'main' into main
JamieSlome Nov 8, 2024
67b2ed0
feat: pagination and search in dashboard
darkhorse-420 Nov 11, 2024
dd8ead1
feat: real-time search
darkhorse-420 Nov 11, 2024
7bc412f
Merge branch 'main' into Search
darkhorse-420 Nov 11, 2024
0d39de4
Merge branch 'finos:main' into Search
darkhorse-420 Nov 11, 2024
d186dcb
fix: code clean
darkhorse-420 Nov 11, 2024
86e331f
Merge branch 'Search' of https://github.com/darkhorse-420/git-proxy i…
darkhorse-420 Nov 11, 2024
7886540
fix: code clean
darkhorse-420 Nov 15, 2024
5a42ec8
Merge branch 'finos:main' into Search
darkhorse-420 Nov 15, 2024
fd1d2bf
fix: package
darkhorse-420 Nov 15, 2024
03f0dba
feat: dashboard
darkhorse-420 Nov 15, 2024
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
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"react-dom": "^16.13.1",
"react-html-parser": "^2.0.2",
"react-router-dom": "6.26.2",
"simple-git": "^3.25.0",
"simple-git": "^3.27.0",
"uuid": "^10.0.0",
"yargs": "^17.7.2"
},
Expand Down
55 changes: 55 additions & 0 deletions src/ui/components/Filtering/Filtering.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.filtering-container {
position: relative;
display: inline-block;
padding-bottom: 10px;
}

.dropdown-toggle {
padding: 10px 10px;
padding-right: 10px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #fff;
color: #333;
cursor: pointer;
font-size: 14px;
text-align: left;
width: 130px;
display: inline-flex;
align-items: center;
justify-content: space-between;
}

.dropdown-toggle:hover {
background-color: #f0f0f0;
}

.dropdown-arrow {
border: none;
background: none;
cursor: pointer;
font-size: 15px;
margin-left: 1px;
margin-right: 10px;
}

.dropdown-menu {
position: absolute;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 5px;
margin-top: 5px;
z-index: 1000;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.dropdown-item {
padding: 10px 15px;
cursor: pointer;
font-size: 14px;
color: #333;
}

.dropdown-item:hover {
background-color: #f0f0f0;
}
66 changes: 66 additions & 0 deletions src/ui/components/Filtering/Filtering.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import React, { useState } from 'react';
import './Filtering.css';

const Filtering = ({ onFilterChange }) => {
const [isOpen, setIsOpen] = useState(false); // State to toggle dropdown open/close
const [selectedOption, setSelectedOption] = useState('Sort by'); // Initial state
const [sortOrder, setSortOrder] = useState('asc'); // Track sort order (asc/desc)

const toggleDropdown = () => {
setIsOpen(!isOpen); // Toggle dropdown open/close state
};

const toggleSortOrder = () => {
// Toggle sort order only if an option is selected
if (selectedOption !== 'Sort by') {
const newSortOrder = sortOrder === 'asc' ? 'desc' : 'asc';
setSortOrder(newSortOrder);
onFilterChange(selectedOption, newSortOrder); // Trigger filtering with new order
}
};

const handleOptionClick = (option) => {
// Handle filter option selection
setSelectedOption(option);
onFilterChange(option, sortOrder); // Call the parent function with selected filter and order
setIsOpen(false); // Collapse the dropdown after selection
};

return (
<div className="filtering-container">
<div className="dropdown">
{/* Make the entire button clickable for toggling dropdown */}
<button onClick={toggleDropdown} className="dropdown-toggle">
{selectedOption}
{/* Render the up/down arrow next to selected option */}
{selectedOption !== 'Sort by' && (
<span onClick={(e) => { e.stopPropagation(); toggleSortOrder(); }}>
{sortOrder === 'asc' ? ' ↑' : ' ↓'}
</span>
)}
<span className="dropdown-arrow">▼</span>
</button>

{isOpen && (
<div className="dropdown-menu">
<div onClick={() => handleOptionClick('Date Modified')} className="dropdown-item">
Date Modified
</div>
<div onClick={() => handleOptionClick('Date Created')} className="dropdown-item">
Date Created
</div>
<div onClick={() => handleOptionClick('Alphabetical')} className="dropdown-item">
Alphabetical
</div>
</div>
)}
</div>
</div>
);
};

export default Filtering;




28 changes: 28 additions & 0 deletions src/ui/components/Pagination/Pagination.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.paginationContainer {
display: flex;
justify-content: center;
padding: 1rem;
margin-top: 20px;
gap: 10px;
}

.pageButton {
padding: 8px 12px;
font-size: 14px;
color: #333;
border: 1px solid #ccc;
background-color: #f9f9f9;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s ease;
}

.pageButton:hover {
background-color: #e2e6ea;
}

.activeButton {
background-color: #007bff;
color: #fff;
border-color: #007bff;
}
37 changes: 37 additions & 0 deletions src/ui/components/Pagination/Pagination.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import './Pagination.css';

export default function Pagination({ currentPage, totalItems = 0, itemsPerPage, onPageChange }) {

const totalPages = Math.ceil(totalItems / itemsPerPage);

const handlePageClick = (page) => {
if (page >= 1 && page <= totalPages) {
onPageChange(page);
}
};

return (
<div className='paginationContainer'>
<button
className='pageButton'
onClick={() => handlePageClick(currentPage - 1)}
disabled={currentPage === 1}
>
Previous
</button>

<span>
Page {currentPage} of {totalPages}
</span>

<button
className='pageButton'
onClick={() => handlePageClick(currentPage + 1)}
disabled={currentPage === totalPages}
>
Next
</button>
</div>
);
}
18 changes: 18 additions & 0 deletions src/ui/components/Search/Search.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.search-bar {
width: 100%;
max-width:100%;
margin: 0 auto 20px auto;
}

.search-input {
width: 100%;
padding: 10px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}

.search-input:focus {
border-color: #007bff;
}
37 changes: 37 additions & 0 deletions src/ui/components/Search/Search.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import { TextField } from '@material-ui/core';
import './Search.css';
import InputAdornment from '@material-ui/core/InputAdornment';
import SearchIcon from '@material-ui/icons/Search';


export default function Search({ onSearch }) {
const handleSearchChange = (event) => {
const query = event.target.value;
onSearch(query);
};

return (
<div style={{ margin: '20px 0' }}>
<TextField
label="Search"
variant="outlined"
fullWidth
margin="normal"
onChange={handleSearchChange}
placeholder="Search..."
InputProps={{
startAdornment: (
<InputAdornment position="start">
<SearchIcon />
</InputAdornment>
),
}}
/>
</div>
);
}




15 changes: 12 additions & 3 deletions src/ui/views/OpenPushRequests/OpenPushRequests.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ import GridContainer from '../../components/Grid/GridContainer';
import PushesTable from './components/PushesTable';
import CustomTabs from '../../components/CustomTabs/CustomTabs';


import { Visibility, CheckCircle, Cancel, Block } from '@material-ui/icons';

export default function Dashboard() {



return (
<div>
<GridContainer>
<GridItem xs={12} sm={12} md={12}>

<CustomTabs
headerColor='primary'
tabs={[
Expand All @@ -23,23 +28,27 @@ export default function Dashboard() {
authorised={false}
rejected={false}
canceled={false}

/>
),
},
{
tabName: 'Approved',
tabIcon: CheckCircle,
tabContent: <PushesTable authorised={true} />,
tabContent: <PushesTable
authorised={true}

/>,
},
{
tabName: 'Canceled',
tabIcon: Cancel,
tabContent: <PushesTable authorised={false} rejected={false} canceled={true} />,
tabContent: <PushesTable authorised={false} rejected={false} canceled={true} />,
},
{
tabName: 'Rejected',
tabIcon: Block,
tabContent: <PushesTable authorised={false} rejected={true} canceled={false} />,
tabContent: <PushesTable authorised={false} rejected={true} canceled={false} />,
},
]}
/>
Expand Down
Loading
Loading