Skip to content

Commit

Permalink
Merge pull request #9 from h2020charisma/rcapi
Browse files Browse the repository at this point in the history
backend change
  • Loading branch information
sergesoroka authored Sep 15, 2024
2 parents e52434e + f5b38be commit bd4cdec
Show file tree
Hide file tree
Showing 11 changed files with 4,601 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VITE_BaseURL="https://api.charisma.ideaconsult.net/"
VITE_BaseURL="https://api-dev.ramanchada.ideaconsult.net/"
#VITE_BaseURL="http://127.0.0.1:8000/"
2 changes: 1 addition & 1 deletion components/Chart/Chart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function Chart({ imageSelected, setDomain, isNexusFile }) {
const navigate = useNavigate();

const datasetQuery = !isNexusFile ? `${import.meta.env.VITE_BaseURL
}dataset?domain=${imageSelected}&values=True` : '';
}db/dataset?domain=${encodeURIComponent(imageSelected)}&values=True` : '';

const { data } = useSWR(imageSelected && datasetQuery, fetcher, {
revalidateIfStale: false,
Expand Down
2 changes: 1 addition & 1 deletion components/DataProvider/DataProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function DataProvider({
}) {
const providerURL = `${
import.meta.env.VITE_BaseURL
}query/field?name=reference_owner_s`;
}db/query/field?name=reference_owner_s`;

const { data } = useSWR(providerURL, fetcher, {
revalidateIfStale: false,
Expand Down
2 changes: 1 addition & 1 deletion components/Instrument/Instrument.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Instrument({
}) {
const providerURL = `${
import.meta.env.VITE_BaseURL
}query/field?name=instrument_s`;
}db/query/field?name=instrument_s`;

const { data } = useSWR(providerURL, fetcher, {
revalidateIfStale: false,
Expand Down
2 changes: 1 addition & 1 deletion components/Investigations/Investigations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Investigations({
}) {
const providerURL = `${
import.meta.env.VITE_BaseURL
}query/field?name=reference_s`;
}db/query/field?name=reference_s`;

const { data } = useSWR(providerURL, fetcher, {
revalidateIfStale: false,
Expand Down
2 changes: 1 addition & 1 deletion components/Sample/Sample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const fetcher = (url) => fetch(url).then((res) => res.json());
export default function Sample({ qQuery, setqQuery, setImageSelected }) {
const providerURL = `${
import.meta.env.VITE_BaseURL
}query/field?name=publicname_s`;
}db/query/field?name=publicname_s`;

const { data } = useSWR(providerURL, fetcher, {
revalidateIfStale: false,
Expand Down
6 changes: 3 additions & 3 deletions components/SearchComp/SearchComp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function SearchComp({ setDomain }) {
domainParams ? domainParams : ""
);

let isNexusFile = imageSelected.includes(".nxs");
let isNexusFile = false;

let [reference, setReference] = useState("*");
let [provider, setProvider] = useState("*");
Expand All @@ -41,10 +41,10 @@ export default function SearchComp({ setDomain }) {
const [file, setFile] = useState(null);

const searchQuery = `${import.meta.env.VITE_BaseURL
}query?q=${qQuery}&img=thumbnail&query_type=text&q_reference=${reference}&q_provider=${provider}&q_instrument=${instrument}&q_wavelength=${wavelengths}&page=${pages}&pagesize=${pagesize}`;
}db/query?q=${qQuery}&img=thumbnail&query_type=text&q_reference=${reference}&q_provider=${provider}&q_instrument=${instrument}&q_wavelength=${wavelengths}&page=${pages}&pagesize=${pagesize}`;

const fileSearchQuery = `${import.meta.env.VITE_BaseURL
}query?q=${qQuery}&img=thumbnail&query_type=${type}&q_reference=${reference}&q_provider=${provider}&q_instrument=${instrument}&q_wavelength=${wavelengths}&page=${pages}&pagesize=${pagesize}&ann=${imageData?.cdf
}db/query?q=${qQuery}&img=thumbnail&query_type=${type}&q_reference=${reference}&q_provider=${provider}&q_instrument=${instrument}&q_wavelength=${wavelengths}&page=${pages}&pagesize=${pagesize}&ann=${imageData?.cdf
}`;

const { data } = useSWR(
Expand Down
4 changes: 2 additions & 2 deletions components/UploadFile/UploadFile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import Spinner from "../Icons/Spinner";

// eslint-disable-next-line react/prop-types
export default function UploadFile({ setImageData, setType, file, setFile }) {
const fileQuery = `${import.meta.env.VITE_BaseURL}download?what=knnquery`;
const fileQuery = `${import.meta.env.VITE_BaseURL}db/download?what=knnquery`;

const [isNotRightFile, setIsNotRightFile] = useState(false);
const [isLoading, setIsLoading] = useState(false);

useEffect(() => {
async function fetchDate() {
const formData = new FormData();
formData.append("file[]", file);
formData.append("files", file);
const response = await fetch(fileQuery, {
method: "POST",
body: formData,
Expand Down
2 changes: 1 addition & 1 deletion components/Wavelengths/Wavelengths.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Wavelengths({
}) {
const providerURL = `${
import.meta.env.VITE_BaseURL
}query/field?name=wavelength_s`;
}db/query/field?name=wavelength_s`;

const { data } = useSWR(providerURL, fetcher, {
revalidateIfStale: false,
Expand Down
2 changes: 1 addition & 1 deletion components/h5web/h5web.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function H5web({ domain }) {
hash ? hash : '/'

const downloadFile = () => {
fetch(`${import.meta.env.VITE_BaseURL}download?what=h5&domain=${domain ? domain : h5webParams}`)
fetch(`${import.meta.env.VITE_BaseURL}db/download?what=h5&domain=${domain ? domain : h5webParams}`)
.then(resp => resp.blob())
.then(blob => {
const url = window.URL.createObjectURL(blob);
Expand Down
Loading

0 comments on commit bd4cdec

Please sign in to comment.