GitBot / index.html
acecalisto3's picture
Update index.html
b212d6f verified
raw
history blame
11.8 kB
v<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GitHub Issue Manager</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
background: linear-gradient(to bottom right, #121212, #303030);
color: #e0e0e0;
font-family: 'Roboto', sans-serif;
overflow-x: hidden;
}
.card {
border-radius: 1.5rem;
box-shadow: 0 15px 25px rgba(0, 0, 0, 0.2);
margin-bottom: 20px;
}
.input, .select, .textarea {
border: 2px solid #4a4a4a;
border-radius: 0.75rem;
padding-inline: 1.5rem;
padding-block: 0.75rem;
}
h1, h2, h3 {
color: #e0e0e0;
}
.output-area {
padding: 1.5rem;
border-radius: 0.75rem;
}
.btn {
border-radius: 0.75rem;
padding-block: 0.75rem;
padding-inline: 1.5rem;
}
.btn-primary {
background-color: #7928CA;
color: white;
border: 2px solid #7928CA;
}
.btn-primary:hover {
background-color: #5e22a1;
}
.btn-success {
background-color: #22c55e;
color: white;
border: 2px solid #22c55e;
}
.btn-success:hover {
background-color: #1a9a46;
}
</style>
</head>
<body class="bg-gray-900 text-gray-300">
<div class="container mx-auto p-4">
<h1 class="text-4xl md:text-5xl font-extrabold text-white text-center mb-8">GitHub Issue Manager</h1>
<div class="card bg-gray-800 p-8 shadow-lg rounded-xl">
<div class="mb-4">
<label for="github-token" class="block text-gray-300 font-bold mb-2">GitHub Token</label>
<input placeholder="Enter your GitHub Personal Access Token" class="w-full bg-gray-700 text-white border border-gray-600 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500" type="password" id="github-token">
</div>
<div class="mb-4">
<label for="repo-url" class="block text-gray-300 font-bold mb-2">Repository URL</label>
<input placeholder="Enter the full GitHub repository URL" class="w-full bg-gray-700 text-white border border-gray-600 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500" type="text" id="repo-url">
</div>
<button class="bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline" id="fetch-issues">Fetch Issues</button>
</div>
<div class="card bg-gray-800 p-8 shadow-lg rounded-xl mt-4">
<div class="flex justify-between mb-4">
<div>
<label for="issue-dropdown" class="block text-gray-300 font-bold mb-2">Issue</label>
<select class="select select-bordered w-full max-w-xs bg-gray-700 text-white border border-gray-600 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500" id="issue-dropdown">
<option disabled selected>Select an Issue</option>
</select>
</div>
<button class="bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline" id="show-issue-details">Show Issue Details</button>
</div>
<div id="issue-details-container" class="hidden">
<div class="mb-4">
<label for="resolution-textarea" class="block text-gray-300 font-bold mb-2">Resolution</label>
<textarea placeholder="Enter the resolution details" class="w-full bg-gray-700 text-white border border-gray-600 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500 h-32 resize-y" id="resolution-textarea"></textarea>
</div>
<div class="mb-4">
<label for="forked-repo-url" class="block text-gray-300 font-bold mb-2">Forked Repository URL (Optional)</label>
<input placeholder="URL to your forked repository" class="w-full bg-gray-700 text-white border border-gray-600 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500" type="text" id="forked-repo-url">
</div>
<button class="bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline" id="resolve-issue">Resolve Issue</button>
</div>
</div>
<div class="card bg-gray-800 p-8 shadow-lg rounded-xl mt-4">
<label for="output-textarea" class="block text-gray-300 font-bold mb-2">Output</label>
<textarea class="w-full bg-gray-700 text-white border border-gray-600 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500 h-48 resize-y" readonly="" id="output-textarea"></textarea>
</div>
<div class="card bg-gray-800 p-8 shadow-lg rounded-xl mt-4">
<div class="mb-4">
<label for="url-textbox" class="block text-gray-300 font-bold mb-2">URL</label>
<input placeholder="Enter a URL to extract information" class="w-full bg-gray-700 text-white border border-gray-600 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500" type="text" id="url-textbox">
</div>
<button class="bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline" id="extract-info">Extract Info</button>
</div>
</div>
<script>
const githubTokenInput = document.getElementById('github-token');
const repoUrlInput = document.getElementById('repo-url');
const fetchIssuesButton = document.getElementById('fetch-issues');
const issueDropdown = document.getElementById('issue-dropdown');
const resolutionTextarea = document.getElementById('resolution-textarea');
const forkedRepoUrlInput = document.getElementById('forked-repo-url');
const resolveIssueButton = document.getElementById('resolve-issue');
const outputTextarea = document.getElementById('output-textarea');
const urlTextbox = document.getElementById('url-textbox');
const extractInfoButton = document.getElementById('extract-info');
const showIssueDetailsButton = document.getElementById('show-issue-details');
const issueDetailsContainer = document.getElementById('issue-details-container');
fetchIssuesButton.addEventListener('click', async () => {
const githubToken = githubTokenInput.value;
const repoUrl = repoUrlInput.value;
if (!githubToken || !repoUrl) {
outputTextarea.value = 'Please enter GitHub Token and Repository URL.';
return;
}
try {
const response = await fetch('/fetch_issues', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
'github_token': githubToken,
'repo_url': repoUrl,
}),
});
if (response.ok) {
const issues = await response.json();
outputTextarea.value = '';
issueDropdown.innerHTML = '<option disabled selected>Select an Issue</option>';
issues.forEach(issue => {
const option = document.createElement('option');
option.value = issue.number;
option.text = `${issue.title} - #${issue.number}`;
option.dataset.issueDetails = JSON.stringify(issue); // Store issue details in data attribute
issueDropdown.add(option);
});
outputTextarea.value = 'Issues fetched successfully!';
} else {
const error = await response.json();
outputTextarea.value = `Error: ${error.error}`;
}
} catch (error) {
outputTextarea.value = `Error: ${error}`;
}
});
showIssueDetailsButton.addEventListener('click', () => {
issueDetailsContainer.classList.remove('hidden');
const selectedIssue = issueDropdown.selectedOptions[0].dataset.issueDetails;
if (selectedIssue) {
try {
const issue = JSON.parse(selectedIssue);
outputTextarea.value += `\nIssue Number: ${issue.number}\nTitle: ${issue.title}\nBody: ${issue.body}`;
} catch (error) {
outputTextarea.value = `Error processing issue details: ${error}`;
}
}
});
resolveIssueButton.addEventListener('click', async () => {
const githubToken = githubTokenInput.value;
const issueNumber = issueDropdown.value;
const resolution = resolutionTextarea.value;
const repoUrl = repoUrlInput.value;
const forkedRepoUrl = forkedRepoUrlInput.value;
if (!githubToken || !issueNumber || !resolution || !repoUrl) {
outputTextarea.value = 'Please fill all the required fields.';
return;
}
try {
const response = await fetch('/resolve_issue', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
'github_token': githubToken,
'issue_number': issueNumber,
'resolution': resolution,
'repo_url': repoUrl,
'forked_repo_url': forkedRepoUrl,
}),
});
if (response.ok) {
const result = await response.json();
outputTextarea.value = result.message;
} else {
const error = await response.json();
outputTextarea.value = `Error: ${error.error}`;
}
} catch (error) {
outputTextarea.value = `Error: ${error}`;
}
});
extractInfoButton.addEventListener('click', async () => {
const url = urlTextbox.value;
if (!url) {
outputTextarea.value = 'Please enter a URL.';
return;
}
try {
const response = await fetch('/extract_info', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
'url': url,
}),
});
if (response.ok) {
const result = await response.json();
outputTextarea.value = result.response;
} else {
const error = await response.json();
outputTextarea.value = `Error: ${error.error}`;
}
} catch (error) {
outputTextarea.value = `Error: ${error}`;
}
});
</script>
</body>
</html>