Files
threetwo/src/client/components/Settings/SystemSettings/SystemSettingsForm.tsx
Rishi Ghan dba520b4c1 🧸 Zustand and Tanstack Query (#96)
* ↪️ Removed node-sass, added sass

* 🏗️ Refactoring Navbar to read from zustand store

* ⬆️ Bumped deps

* 🏗️ Refactored AirDC++ session status indicator

* 🏗️ Refactored Import page to read from global state

* 🏗 Wired up the event emit correctly

* 🏗️ Added import queue related state

* 🏗 Implemented setQueueAction

* 🏗️ Wired up job queue control methods

* 🏗️ Added null check and removed useless deps

* 🏗️ Refactored the Import page

* ↪️ Added cache invalidation to job statistics query

* 🏗️ Refactoring the Library page

* 🏗️ Fixed pagination and disabled states

* ✏️ Changed page to offset

To better reflect what we are doing with the pagination controls

* 🏗️ Refactoring ComicDetail page and its children

* 🏗️ Refactored ComicDetailContainer with useQuery

* 🔧 Fixed the error check on Library page

* 🏗️ Refactoring AcquisitionPanel

* 🏗️ Refactoring the AirDC++ Forms

* 🦃 Thanksgiving Day bug fixes

* ⬆️ Bumped up Vite to 5.0

* 🔧 Refactoring AcquisitionPanel

* 🏗️ Wiring up the DC++ search method

* 🏗️ Refactoring AirDC++ search method

* 🔎 Added some validation to ADC++ Hubs settings form

* 🏗️ Fixed the ADC++ search results

* 🏗️ Cleanup of the search results pane
2023-11-28 22:54:45 -05:00

67 lines
2.0 KiB
TypeScript

import React, { ReactElement } from "react";
import { useMutation } from "@tanstack/react-query";
import axios from "axios";
export const SystemSettingsForm = (): ReactElement => {
const { mutate: flushDb, isLoading } = useMutation({
mutationFn: async () => {
await axios({
url: `http://localhost:3000/api/library/flushDb`,
method: "POST",
});
},
});
return (
<div className="is-clearfix">
<div className="mt-4">
<h3 className="title">Flush DB and Temporary Folders</h3>
<h6 className="subtitle has-text-grey-light">
If you are encountering issues, start over using this functionality.
</h6>
<article className="message is-danger">
<div className="message-body is-size-6 is-family-secondary">
Flushing and resetting will clear out:
<p>
<small>(This action is irreversible)</small>
</p>
<ol>
<li>The mongo collection that holds library metadata</li>
<li>
Your <code>USERDATA_DIRECTORY</code> which includes
<code>covers</code>, <code>temporary</code> and
<code>expanded</code> subfolders.
</li>
<li>
Your <code>Elasticsearch indices</code>
</li>
</ol>
</div>
</article>
<article className="message is-info">
<div className="message-body is-size-6 is-family-secondary">
Your comic book files are not touched, and your settings will remain
intact.
</div>
</article>
<button
className={
isLoading ? "button is-danger is-loading" : "button is-danger"
}
onClick={() => flushDb()}
>
<span className="icon">
<i className="fas fa-eraser"></i>
</span>
<span>Flush DB & Temporary Folders</span>
</button>
</div>
</div>
);
};
export default SystemSettingsForm;