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

Cleanup setup page #776

Merged
merged 12 commits into from
Oct 28, 2024
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ hs_err_pid*

# End of https://www.toptal.com/developers/gitignore/api/java,intellij

config.json

.DS_Store

frontend/package-lock.json
Expand Down
8 changes: 0 additions & 8 deletions frontend/CommitHash.js

This file was deleted.

13 changes: 6 additions & 7 deletions frontend/components/Admin/Explorer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import axios from 'axios';
import getConfig from 'next/config';
import styles from '../../styles/admin.module.css';
import { useState, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import useSWR from 'swr';
import ActionButton from './Reusable/ActionButton';
const { publicRuntimeConfig } = getConfig();
import feConfig from "../../config.json";

export default function Explorer() {
const token = useSelector(state => state.user.token);
Expand Down Expand Up @@ -39,7 +38,7 @@ export default function Explorer() {
//Update SBOLExplorer Index
const handleUpdateIndex = async () => {
const params = new URLSearchParams();
const url = `${publicRuntimeConfig.backend}/admin/explorerUpdateIndex`;
const url = `${feConfig.backend}/admin/explorerUpdateIndex`;
const response = await axios
.post(url, params, {
headers: {
Expand All @@ -56,7 +55,7 @@ export default function Explorer() {

//View SBOLExplorer Log
const handleDownloadGeneralLog = async () => {
const url = `${publicRuntimeConfig.backend}/admin/explorerlog`;
const url = `${feConfig.backend}/admin/explorerlog`;
const res = await axios
.get(url, {
headers: {
Expand Down Expand Up @@ -84,7 +83,7 @@ export default function Explorer() {

//admin/explorerIndexingLog
const handleDownloadIndexLog = async () => {
const url = `${publicRuntimeConfig.backend}/admin/explorerIndexingLog`;
const url = `${feConfig.backend}/admin/explorerIndexingLog`;
const res = await axios
.get(url, {
headers: {
Expand Down Expand Up @@ -137,7 +136,7 @@ export default function Explorer() {
'whichSearch': USchecked ? 'usearch' : 'vsearch'
};

const url = `${publicRuntimeConfig.backend}/admin/explorer`;
const url = `${feConfig.backend}/admin/explorer`;
let res = await axios
.post(url, params, {
headers: {
Expand Down Expand Up @@ -406,7 +405,7 @@ export default function Explorer() {
// if SBOLExplorer is on
const useConfig = (token, dispatch) => {
const { data, error } = useSWR(
[`${publicRuntimeConfig.backend}/admin/explorer`, token, dispatch],
[`${feConfig.backend}/admin/explorer`, token, dispatch],
fetcher
);
return {
Expand Down
5 changes: 2 additions & 3 deletions frontend/components/Admin/Graphs.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import axios from 'axios';
import getConfig from 'next/config';
import { useDispatch, useSelector } from 'react-redux';
import useSWR from 'swr';
const { publicRuntimeConfig } = getConfig();
import feConfig from "../../config.json";

import Table from '../Reusable/Table/Table';
import { addError } from '../../redux/actions';
Expand Down Expand Up @@ -49,7 +48,7 @@ const sortMethods = {

const useGraphs = (token, dispatch) => {
const { data, error } = useSWR(
[`${publicRuntimeConfig.backend}/admin/graphs`, token, dispatch],
[`${feConfig.backend}/admin/graphs`, token, dispatch],
fetcher
);
return {
Expand Down
5 changes: 2 additions & 3 deletions frontend/components/Admin/Log.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import axios from 'axios';
import he from 'he';
import getConfig from 'next/config';
import { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import useSWR from 'swr';
const { publicRuntimeConfig } = getConfig();
import feConfig from "../../config.json";

import styles from '../../styles/admin.module.css';
import Loading from '../Reusable/Loading';
Expand Down Expand Up @@ -72,7 +71,7 @@ const decodeHtml = (line, index) => {

const useLog = (token, dispatch) => {
const { data, error } = useSWR(
[`${publicRuntimeConfig.backend}/admin/log`, token, dispatch],
[`${feConfig.backend}/admin/log`, token, dispatch],
fetcher
);
return {
Expand Down
9 changes: 4 additions & 5 deletions frontend/components/Admin/Mail.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { faEnvelope, faKey } from '@fortawesome/free-solid-svg-icons';
import axios from 'axios';
import getConfig from 'next/config';
import { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import useSWR, { mutate } from 'swr';
const { publicRuntimeConfig } = getConfig();
import feConfig from "../../config.json";

import styles from '../../styles/admin.module.css';
import InputField from '../Login/InputField';
Expand Down Expand Up @@ -97,7 +96,7 @@ export default function Mail() {

const useEmail = (token, dispatch) => {
const { data, error } = useSWR(
[`${publicRuntimeConfig.backend}/admin/mail`, token, dispatch],
[`${feConfig.backend}/admin/mail`, token, dispatch],
fetcher
);
return {
Expand Down Expand Up @@ -134,7 +133,7 @@ const updateEmail = async (
actualSendGridEmail,
dispatch
) => {
const url = `${publicRuntimeConfig.backend}/admin/mail`;
const url = `${feConfig.backend}/admin/mail`;
const headers = {
Accept: 'text/plain',
'X-authorization': token
Expand All @@ -161,6 +160,6 @@ const updateEmail = async (
setSendGridEmail(actualSendGridEmail);
} else {
setError('');
mutate([`${publicRuntimeConfig.backend}/admin/mail`, token, dispatch]);
mutate([`${feConfig.backend}/admin/mail`, token, dispatch]);
}
};
15 changes: 7 additions & 8 deletions frontend/components/Admin/Plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ const authorizationType = 'authorization';
const searchable = ['index', 'name', 'url'];
const headers = ['ID', 'Name', 'URL', ''];

import getConfig from 'next/config';
import { addError } from '../../redux/actions';
const { publicRuntimeConfig } = getConfig();
import feConfig from "../../config.json";

/* eslint sonarjs/no-duplicate-string: "off" */

Expand Down Expand Up @@ -296,7 +295,7 @@ function PluginDisplay(properties) {
}

const deletePlugin = async (id, type, token, dispatch) => {
const url = `${publicRuntimeConfig.backend}/admin/deletePlugin`;
const url = `${feConfig.backend}/admin/deletePlugin`;
const headers = {
Accept: 'text/plain',
'X-authorization': token
Expand All @@ -317,12 +316,12 @@ const deletePlugin = async (id, type, token, dispatch) => {
}

if (response.status === 200) {
mutate([`${publicRuntimeConfig.backend}/admin/plugins`, token, dispatch]);
mutate([`${feConfig.backend}/admin/plugins`, token, dispatch]);
}
};

const savePlugin = async (id, type, name, pluginUrl, token, dispatch) => {
const url = `${publicRuntimeConfig.backend}/admin/savePlugin`;
const url = `${feConfig.backend}/admin/savePlugin`;
const headers = {
Accept: 'text/plain',
'X-authorization': token
Expand All @@ -345,7 +344,7 @@ const savePlugin = async (id, type, name, pluginUrl, token, dispatch) => {
}

if (response.status === 200) {
mutate([`${publicRuntimeConfig.backend}/admin/plugins`, token, dispatch]);
mutate([`${feConfig.backend}/admin/plugins`, token, dispatch]);
}
};

Expand Down Expand Up @@ -376,7 +375,7 @@ const sortMethods = {

const usePlugins = (token, dispatch) => {
const { data, error } = useSWR(
[`${publicRuntimeConfig.backend}/admin/plugins`, token, dispatch],
[`${feConfig.backend}/admin/plugins`, token, dispatch],
fetcher
);
return {
Expand All @@ -390,7 +389,7 @@ const usePlugins = (token, dispatch) => {
async function fetchStatus(plugin, type) {
return await axios({
method: 'POST',
url: `${publicRuntimeConfig.backend}/call`,
url: `${feConfig.backend}/call`,
params: {
name: plugin.name,
endpoint: 'status',
Expand Down
19 changes: 9 additions & 10 deletions frontend/components/Admin/Registries.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
faTrashAlt
} from '@fortawesome/free-solid-svg-icons';
import axios from 'axios';
import getConfig from 'next/config';
import { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import useSWR, { mutate } from 'swr';
Expand All @@ -16,7 +15,7 @@ import Table from '../Reusable/Table/Table';
import ActionButton from './Reusable/ActionButton';
import TableInput from './Reusable/TableInput';
import { addError } from '../../redux/actions';
const { publicRuntimeConfig } = getConfig();
import feConfig from "../../config.json";

/* eslint sonarjs/cognitive-complexity: "off" */

Expand Down Expand Up @@ -208,11 +207,11 @@ function RegistryActions() {
const token = useSelector(state => state.user.token);
const dispatch = useDispatch();

const url = `${publicRuntimeConfig.backend}/admin/deleteRegistry`;
const url = `${feConfig.backend}/admin/deleteRegistry`;

const handleFederate = async () => {
try {
await axios.post(`${publicRuntimeConfig.backend}/admin/federate`, {
await axios.post(`${feConfig.backend}/admin/federate`, {
administratorEmail: inputTwo,
webOfRegistries: inputOne
}, {
Expand All @@ -230,7 +229,7 @@ function RegistryActions() {

const handleRetrieve = async () => {
try {
const response = await axios.post(`${publicRuntimeConfig.backend}/admin/retrieveFromWebOfRegistries`, {}, {
const response = await axios.post(`${feConfig.backend}/admin/retrieveFromWebOfRegistries`, {}, {
headers: {
'Accept': 'application/json',
'X-authorization': token
Expand All @@ -240,7 +239,7 @@ function RegistryActions() {
if (response.data && Array.isArray(response.data.registries)) {
// Assuming 'registries' is the correct key in response and it's an array of registry objects
mutate([
`${publicRuntimeConfig.backend}/admin/registries`,
`${feConfig.backend}/admin/registries`,
token,
dispatch
]);
Expand Down Expand Up @@ -272,7 +271,7 @@ function RegistryActions() {
}

const deleteRegistry = async (uri, token, dispatch) => {
const url = `${publicRuntimeConfig.backend}/admin/deleteRegistry`;
const url = `${feConfig.backend}/admin/deleteRegistry`;
const headers = {
Accept: 'text/plain',
'X-authorization': token
Expand All @@ -293,15 +292,15 @@ const deleteRegistry = async (uri, token, dispatch) => {

if (response.status === 200) {
mutate([
`${publicRuntimeConfig.backend}/admin/registries`,
`${feConfig.backend}/admin/registries`,
token,
dispatch
]);
}
};

const saveRegistry = async (uri, sbhUrl, token, dispatch) => {
const url = `${publicRuntimeConfig.backend}/admin/saveRegistry`;
const url = `${feConfig.backend}/admin/saveRegistry`;
const headers = {
Accept: 'text/plain',
'X-authorization': token
Expand All @@ -323,7 +322,7 @@ const saveRegistry = async (uri, sbhUrl, token, dispatch) => {

if (response.status === 200) {
mutate([
`${publicRuntimeConfig.backend}/admin/registries`,
`${feConfig.backend}/admin/registries`,
token,
dispatch
]);
Expand Down
5 changes: 2 additions & 3 deletions frontend/components/Admin/Remotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
faTrashAlt
} from '@fortawesome/free-solid-svg-icons';
import axios from 'axios';
import getConfig from 'next/config';
import { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import useSWR, { mutate } from 'swr';
Expand All @@ -16,7 +15,7 @@ import Table from '../Reusable/Table/Table';
import ActionButton from './Reusable/ActionButton';
import TableInput from './Reusable/TableInput';
import { addError } from '../../redux/actions';
const { publicRuntimeConfig } = getConfig();
import feConfig from "../../config.json";

/* eslint sonarjs/cognitive-complexity: "off" */

Expand Down Expand Up @@ -230,7 +229,7 @@ function Dropdown() {

const useRegistries = (token, dispatch) => {
const { data, error } = useSWR(
[`${publicRuntimeConfig.backend}/admin/remotes`, token, dispatch],
[`${feConfig.backend}/admin/remotes`, token, dispatch],
fetcher
);
return {
Expand Down
5 changes: 2 additions & 3 deletions frontend/components/Admin/Sparql.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { faDatabase } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import getConfig from 'next/config';
import dynamic from 'next/dynamic';
import { useState } from 'react';
import { useSelector } from 'react-redux';
import Select from 'react-select';

import styles from '../../styles/sparql.module.css';
import Table from '../Reusable/Table/Table';
const { publicRuntimeConfig } = getConfig();
import feConfig from "../../config.json";

const CodeMirror = dynamic(
() => {
Expand Down Expand Up @@ -121,7 +120,7 @@ const submitQuery = async (
setError();
setLoading(true);
const url = `${
publicRuntimeConfig.backend
feConfig.backend
}/admin/sparql?query=${encodeURIComponent(query)}`;

const headers = {
Expand Down
5 changes: 2 additions & 3 deletions frontend/components/Admin/Status.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import axios from 'axios';
import getConfig from 'next/config';
import Loader from 'react-loader-spinner';
import { useDispatch, useSelector } from 'react-redux';
import useSWR from 'swr';
const { publicRuntimeConfig } = getConfig();
import feConfig from "../../config.json";

import styles from '../../styles/defaulttable.module.css';
import { addError } from '../../redux/actions';
Expand Down Expand Up @@ -94,7 +93,7 @@ export default function Status() {

export const useStatus = (token, dispatch) => {
const { data, error } = useSWR(
[`${publicRuntimeConfig.backend}/admin`, token, dispatch],
[`${feConfig.backend}/admin`, token, dispatch],
fetcher
);
return {
Expand Down
Loading
Loading