From 9f2d18ef6dff0462c6bd76310fa4c1ecfa149c3f Mon Sep 17 00:00:00 2001 From: Brent Salisbury Date: Sat, 22 Jun 2024 21:50:21 -0400 Subject: [PATCH] Login page text updates - Remove residuals from the bot repo. Bot job related and api server hooks. Signed-off-by: Brent Salisbury --- src/app/login/page.tsx | 4 +-- src/common/DisplayColumns.tsx | 16 --------- src/common/HooksApiServer.tsx | 38 -------------------- src/common/HooksPostKnowledgePR.tsx | 54 ----------------------------- src/common/HooksPostSkillPR.tsx | 50 -------------------------- src/common/JobsLayout.tsx | 10 ------ 6 files changed, 2 insertions(+), 170 deletions(-) delete mode 100644 src/common/DisplayColumns.tsx delete mode 100644 src/common/HooksApiServer.tsx delete mode 100644 src/common/HooksPostKnowledgePR.tsx delete mode 100644 src/common/HooksPostSkillPR.tsx delete mode 100644 src/common/JobsLayout.tsx diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index cfd41cc..17fc53c 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -84,7 +84,7 @@ const Login: React.FunctionComponent = () => { isRememberMeChecked={isRememberMeChecked} onChangeRememberMe={onRememberMeClick} onLoginButtonClick={onLoginButtonClick} - loginButtonLabel="Log in" + loginButtonLabel="Login" /> ); @@ -95,7 +95,7 @@ const Login: React.FunctionComponent = () => { brandImgAlt="InstructLab logo" backgroundImgSrc="/login-bg.svg" footerListItems={listItem} - textContent="Instruct Lab Bot Infrastructure" + textContent="InstructLab Taxonomy Submissions" loginTitle="Login Securely with Github OAuth" loginSubtitle="Local Account" socialMediaLoginContent={socialMediaLoginContent} diff --git a/src/common/DisplayColumns.tsx b/src/common/DisplayColumns.tsx deleted file mode 100644 index ece2e7f..0000000 --- a/src/common/DisplayColumns.tsx +++ /dev/null @@ -1,16 +0,0 @@ -// src/common/DisplayColumns.tsx -export const Columns = { - jobID: 'Job ID', - status: 'Status', - duration: 'Duration', - repoOwner: 'Repository Owner', - author: 'Author', - prNumber: 'PR Number', - prSHA: 'PR SHA', - requestTime: 'Request Time', - errors: 'Errors', - repoName: 'Repository Name', - jobType: 'Job Type', - s3URL: 'S3 URL', - modelName: 'Model Name' -}; diff --git a/src/common/HooksApiServer.tsx b/src/common/HooksApiServer.tsx deleted file mode 100644 index 1538e40..0000000 --- a/src/common/HooksApiServer.tsx +++ /dev/null @@ -1,38 +0,0 @@ -// src/common/HooksApiServer.tsx -import { useEffect, useState } from 'react'; - -const API_URL = '/api/jobs'; - -const useFetchJobs = () => { - const [jobs, setJobs] = useState([]); - - useEffect(() => { - const fetchJobs = async () => { - try { - const response = await fetch(API_URL); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - const data = await response.json(); - setJobs(data); - } catch (error) { - console.error('Failed to fetch jobs:', error); - } - }; - - // Fetch the jobs immediately when the component mounts - fetchJobs(); - - // Set up a timer to fetch the jobs periodically (e.g., every 5 seconds) - const interval = setInterval(fetchJobs, 5000); - - // Clean up the interval on component unmount - return () => { - clearInterval(interval); - }; - }, []); - - return jobs; -}; - -export default useFetchJobs; diff --git a/src/common/HooksPostKnowledgePR.tsx b/src/common/HooksPostKnowledgePR.tsx deleted file mode 100644 index 4b05896..0000000 --- a/src/common/HooksPostKnowledgePR.tsx +++ /dev/null @@ -1,54 +0,0 @@ -// src/common/HooksPostKnowledgePR.tsx -import { useState } from 'react'; - -interface KnowledgePRData { - name: string; - email: string; - task_description: string; - task_details: string; - repo: string; - commit: string; - patterns: string; - title_work: string; - link_work: string; - revision: string; - license_work: string; - creators: string; - domain: string; - questions: string[]; - answers: string[]; -} - -export const usePostKnowledgePR = () => { - const [response, setResponse] = useState(null); - const [error, setError] = useState(null); - - const postKnowledgePR = async (data: KnowledgePRData) => { - try { - const res = await fetch('/api/pr/knowledge', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(data) - }); - - const result = await res.json(); - if (res.status !== 201) { - setError(result.error); - console.log('Knowledge submission failed: ' + result.error); - return [null, result.error]; - } - - setResponse(result.msg); - console.log('Knowledge submitted successfully: ' + result.msg); - return [result.msg, null]; - } catch (error) { - console.error('Failed to post Knowledge PR: ', error); - setError('Failed to post Knowledge PR'); - return [null, 'Failed to post Knowledge PR']; - } - }; - - return { response, error, postKnowledgePR }; -}; diff --git a/src/common/HooksPostSkillPR.tsx b/src/common/HooksPostSkillPR.tsx deleted file mode 100644 index a541f45..0000000 --- a/src/common/HooksPostSkillPR.tsx +++ /dev/null @@ -1,50 +0,0 @@ -// src/common/HooksPostSkillPR.tsx -import { useState } from 'react'; - -interface SkillPRData { - name: string; - email: string; - task_description: string; - task_details: string; - title_work: string; - link_work: string; - license_work: string; - creators: string; - questions: string[]; - contexts: string[]; - answers: string[]; -} - -export const usePostSkillPR = () => { - const [response, setResponse] = useState(null); - const [error, setError] = useState(null); - - const postSkillPR = async (data: SkillPRData) => { - try { - const res = await fetch('/api/pr/skill', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(data) - }); - - const result = await res.json(); - if (res.status !== 201) { - setError(result.error); - console.log('Skill submission failed: ' + result.error); - return [null, result.error]; - } - - setResponse(result.msg); - console.log('Skill submitted successfully: ' + result.msg); - return [result.msg, null]; - } catch (error) { - console.error('Failed to post Skill PR: ', error); - setError('Failed to post Skill PR'); - return [null, 'Failed to post Skill PR']; - } - }; - - return { response, error, postSkillPR }; -}; diff --git a/src/common/JobsLayout.tsx b/src/common/JobsLayout.tsx deleted file mode 100644 index 5ff95c0..0000000 --- a/src/common/JobsLayout.tsx +++ /dev/null @@ -1,10 +0,0 @@ -// src/common/JobsLayout.tsx -import React, { ReactNode } from 'react'; - -interface JobsLayoutProps { - children: ReactNode; -} - -const JobsLayout: React.FC = ({ children }) =>
{children}
; - -export default JobsLayout;