🦃 Thanksgiving Day bug fixes
This commit is contained in:
@@ -8,19 +8,17 @@ import { useStore } from "../../../store";
|
|||||||
import { useShallow } from "zustand/react/shallow";
|
import { useShallow } from "zustand/react/shallow";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
export const AirDCPPHubsForm = (airDCPPClientUserSettings): ReactElement => {
|
export const AirDCPPHubsForm = (): ReactElement => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const {
|
const {
|
||||||
airDCPPSocketInstance,
|
airDCPPSocketInstance,
|
||||||
airDCPPClientConfiguration,
|
airDCPPClientConfiguration,
|
||||||
airDCPPSessionInformation,
|
airDCPPSessionInformation,
|
||||||
} = useStore(
|
} = useStore((state) => ({
|
||||||
useShallow((state) => ({
|
airDCPPSocketInstance: state.airDCPPSocketInstance,
|
||||||
airDCPPSocketInstance: state.airDCPPSocketInstance,
|
airDCPPClientConfiguration: state.airDCPPClientConfiguration,
|
||||||
airDCPPClientConfiguration: state.airDCPPClientConfiguration,
|
airDCPPSessionInformation: state.airDCPPSessionInformation,
|
||||||
airDCPPSessionInformation: state.airDCPPSessionInformation,
|
}));
|
||||||
})),
|
|
||||||
);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: settings,
|
data: settings,
|
||||||
@@ -35,17 +33,12 @@ export const AirDCPPHubsForm = (airDCPPClientUserSettings): ReactElement => {
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Asd", settings);
|
/**
|
||||||
// const {
|
* Get the hubs list from an AirDCPP Socket
|
||||||
// settings: {
|
*/
|
||||||
// data: { directConnect },
|
|
||||||
// },
|
|
||||||
// } = data;
|
|
||||||
|
|
||||||
const { data: hubs } = useQuery({
|
const { data: hubs } = useQuery({
|
||||||
queryKey: [],
|
queryKey: [],
|
||||||
queryFn: async () => await airDCPPSocketInstance.get(`hubs`),
|
queryFn: async () => await airDCPPSocketInstance.get(`hubs`),
|
||||||
enabled: !!settings,
|
|
||||||
});
|
});
|
||||||
let hubList = {};
|
let hubList = {};
|
||||||
if (hubs) {
|
if (hubs) {
|
||||||
@@ -105,24 +98,28 @@ export const AirDCPPHubsForm = (airDCPPClientUserSettings): ReactElement => {
|
|||||||
</form>
|
</form>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<div className="mt-4">
|
|
||||||
<article className="message is-warning">
|
{settings?.directConnect?.client.hubs ? (
|
||||||
<div className="message-body is-size-6 is-family-secondary">
|
<>
|
||||||
Your selection in the dropdown <strong>will replace</strong> the
|
<div className="mt-4">
|
||||||
existing selection.
|
<article className="message is-warning">
|
||||||
|
<div className="message-body is-size-6 is-family-secondary">
|
||||||
|
Your selection in the dropdown <strong>will replace</strong> the
|
||||||
|
existing selection.
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
<div className="box mt-3">
|
||||||
</div>
|
<h6>Selected hubs</h6>
|
||||||
<div className="box mt-3">
|
{settings?.directConnect?.client.hubs.map(({ value, label }) => (
|
||||||
<h6>Selected hubs</h6>
|
<div key={value}>
|
||||||
{settings &&
|
<div>{label}</div>
|
||||||
settings?.directConnect?.client.hubs.map(({ value, label }) => (
|
<span className="is-size-7">{value}</span>
|
||||||
<div key={value}>
|
</div>
|
||||||
<div>{label}</div>
|
))}
|
||||||
<span className="is-size-7">{value}</span>
|
</div>
|
||||||
</div>
|
</>
|
||||||
))}
|
) : null}
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,12 +11,14 @@ export const AirDCPPSettingsForm = (): ReactElement => {
|
|||||||
// cherry-picking selectors for:
|
// cherry-picking selectors for:
|
||||||
// 1. initial values for the form
|
// 1. initial values for the form
|
||||||
// 2. If initial values are present, get the socket information to display
|
// 2. If initial values are present, get the socket information to display
|
||||||
|
const { setState } = useStore;
|
||||||
const {
|
const {
|
||||||
airDCPPSocketConnected,
|
airDCPPSocketConnected,
|
||||||
airDCPPDisconnectionInfo,
|
airDCPPDisconnectionInfo,
|
||||||
airDCPPSessionInformation,
|
airDCPPSessionInformation,
|
||||||
airDCPPClientConfiguration,
|
airDCPPClientConfiguration,
|
||||||
airDCPPSocketInstance,
|
airDCPPSocketInstance,
|
||||||
|
setAirDCPPSocketInstance,
|
||||||
} = useStore(
|
} = useStore(
|
||||||
useShallow((state) => ({
|
useShallow((state) => ({
|
||||||
airDCPPSocketConnected: state.airDCPPSocketConnected,
|
airDCPPSocketConnected: state.airDCPPSocketConnected,
|
||||||
@@ -24,6 +26,7 @@ export const AirDCPPSettingsForm = (): ReactElement => {
|
|||||||
airDCPPClientConfiguration: state.airDCPPClientConfiguration,
|
airDCPPClientConfiguration: state.airDCPPClientConfiguration,
|
||||||
airDCPPSessionInformation: state.airDCPPSessionInformation,
|
airDCPPSessionInformation: state.airDCPPSessionInformation,
|
||||||
airDCPPSocketInstance: state.airDCPPSocketInstance,
|
airDCPPSocketInstance: state.airDCPPSocketInstance,
|
||||||
|
setAirDCPPSocketInstance: state.setAirDCPPSocketInstance,
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -38,7 +41,7 @@ export const AirDCPPSettingsForm = (): ReactElement => {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
data: { settingsPayload: values, settingsKey: "directConnect" },
|
data: { settingsPayload: values, settingsKey: "directConnect" },
|
||||||
}),
|
}),
|
||||||
onSuccess: (values) => {
|
onSuccess: async (values) => {
|
||||||
const {
|
const {
|
||||||
data: {
|
data: {
|
||||||
directConnect: {
|
directConnect: {
|
||||||
@@ -46,7 +49,9 @@ export const AirDCPPSettingsForm = (): ReactElement => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
} = values;
|
} = values;
|
||||||
initializeAirDCPPSocket(host);
|
const dcppSocketInstance = await initializeAirDCPPSocket(host);
|
||||||
|
console.log("jogiya", dcppSocketInstance);
|
||||||
|
setState({ airDCPPSocketInstance: dcppSocketInstance });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const deleteSettingsMutation = useMutation(
|
const deleteSettingsMutation = useMutation(
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ const Navbar: React.FunctionComponent = (props) => {
|
|||||||
importJobQueue: state.importJobQueue,
|
importJobQueue: state.importJobQueue,
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
console.log(airDCPPSessionInformation);
|
|
||||||
// const downloadProgressTick = useSelector(
|
// const downloadProgressTick = useSelector(
|
||||||
// (state: RootState) => state.airdcpp.downloadProgressData,
|
// (state: RootState) => state.airdcpp.downloadProgressData,
|
||||||
// );
|
// );
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
import { isEmpty, isNil } from "lodash";
|
import { isEmpty, isNil, isUndefined } from "lodash";
|
||||||
import io from "socket.io-client";
|
import io from "socket.io-client";
|
||||||
import { SOCKET_BASE_URI } from "../constants/endpoints";
|
import { SOCKET_BASE_URI } from "../constants/endpoints";
|
||||||
import { produce } from "immer";
|
import { produce } from "immer";
|
||||||
@@ -151,7 +151,6 @@ export const initializeAirDCPPSocket = async (configuration): Promise<any> => {
|
|||||||
// AirDC++ Socket-related connection and post-connection
|
// AirDC++ Socket-related connection and post-connection
|
||||||
// Attempt connection
|
// Attempt connection
|
||||||
const airDCPPSessionInformation = await initializedAirDCPPSocket.connect();
|
const airDCPPSessionInformation = await initializedAirDCPPSocket.connect();
|
||||||
console.log("zondhale", airDCPPSessionInformation);
|
|
||||||
setState({
|
setState({
|
||||||
airDCPPSessionInformation,
|
airDCPPSessionInformation,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user