Skip to content

Commit

Permalink
tweak: small stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed Mar 17, 2024
1 parent 504c908 commit 71186dc
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/webroutes/player/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const SIMPLE_FILTERS = ['isAdmin', 'isOnline', 'isWhitelisted', 'hasNote'];
/**
* Returns the players stats for the Players page table
*/
export default async function PlayerModal(ctx: AuthedCtx) {
export default async function PlayerSearch(ctx: AuthedCtx) {
//Sanity check
if (typeof ctx.query === 'undefined') {
return ctx.utils.error(400, 'Invalid Request');
Expand Down
35 changes: 35 additions & 0 deletions docs/dev_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- [x] temporarily, dropdown redirects:
- Legacy Ban -> old players page
- prune players/hwids (from master actions -> clean database)
- [x] open master actions in the correct tab
- [ ] NEW PAGE: History
- [ ] Add StatisticsManager tracking for players/actions search duration (QuantileArray)
- [ ] fix disallowed intents message
Expand All @@ -41,9 +42,43 @@ https://github.com/citizenfx/fivem/commit/84f724ed04d07e0b3a765601ad19ce54412f13

=======================================================================

export type DatabaseActionType = {
id: string;
type: 'ban' | 'warn';
ids: string[];
hwids?: string[]; //used only in bans
playerName: string | false;
reason: string;
author: string;
timestamp: number;
expiration: number | false;
revocation: {
timestamp: number | null;
author: string | null;
};
};




### Page Changes:
History:
- Columns:
- ID <justify-between> (DUR ban/warn)
- playerName
- reason
- author
- timestamp
- STATUS
- WARN
- active: --
- revoked: revoked by XXX at YYY
- BAN
- active perma: permanent ban
- active temp: expires in XXX
- revoked: revoked by XXX at YYY
- expired: expired on XXX

- list of warns/bans in a table
- search by id OR identifiers or reason
- filter by action type
Expand Down
11 changes: 8 additions & 3 deletions panel/src/hooks/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const useBackendApi = <
}
//The abort controller is not aborted, just forgotten
abortController.current = new AbortController();

//Processing URL
let fetchUrl = hookOpts.path;
if (opts.pathParams) {
Expand Down Expand Up @@ -261,8 +261,13 @@ export const useBackendApi = <
} else {
errorMessage = error.message;
}
console.error('[ERROR]', apiCallDesc, errorMessage);
handleError('Request Error', errorMessage);

if (errorMessage.includes('unmount')) {
console.warn('[UNMOUNTED]', apiCallDesc);
} else {
console.error('[ERROR]', apiCallDesc, errorMessage);
handleError('Request Error', errorMessage);
}
}
}
}
2 changes: 1 addition & 1 deletion panel/src/pages/Players/PlayersSearchBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export function PlayerSearchBox({ doSearch, initialState }: PlayerSearchBoxProps
</Link>
</DropdownMenuItem>
<DropdownMenuItem className="h-10 pl-1 pr-2 py-2" asChild>
<Link href="/system/master-actions" className="cursor-pointer">
<Link href="/system/master-actions#cleandb" className="cursor-pointer">
<ExternalLinkIcon className="inline mr-1 h-4" />
Prune Players/HWIDs
</Link>
Expand Down
14 changes: 14 additions & 0 deletions web/main/masterActions.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,20 @@

<script>
//============================================== General
(()=>{
console.log('masterActions page loaded', window.location.hash);
if(window.location.hash === '#cleandb'){
document.getElementById('nav-cleandb').classList.add('active', 'show');
document.getElementById('nav-cleandb-tab').classList.add('active');
document.getElementById('nav-general').classList.remove('active', 'show');
document.getElementById('nav-general-tab').classList.remove('active');
}else if(window.location.hash === '#revokewl'){
document.getElementById('nav-revokewl').classList.add('active', 'show');
document.getElementById('nav-revokewl-tab').classList.add('active');
document.getElementById('nav-general').classList.remove('active', 'show');
document.getElementById('nav-general-tab').classList.remove('active');
}
})();
(()=>{
const generalBtnBackupDatabase = document.getElementById('general-btnBackupDatabase');
const generalBtnResetFXServer = document.getElementById('general-btnResetFXServer');
Expand Down

0 comments on commit 71186dc

Please sign in to comment.