acecalisto3 commited on
Commit
50db778
·
verified ·
1 Parent(s): 34528d7

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +191 -36
index.html CHANGED
@@ -1,45 +1,200 @@
1
- <div class="container mx-auto p-4">
2
- <h1 class="text-4xl md:text-5xl font-extrabold text-white text-center mb-8">GitHub Issue Manager</h1>
 
 
 
 
 
 
 
3
 
4
- <div class="card bg-gray-800 p-8 shadow-lg rounded-xl">
5
- <div class="mb-4">
6
- <label class="block text-gray-300 font-bold mb-2" for="github-token">GitHub Token</label>
7
- <input id="github-token" type="password" 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" placeholder="Enter your GitHub Personal Access Token">
8
- </div>
9
- <div class="mb-4">
10
- <label class="block text-gray-300 font-bold mb-2" for="repo-url">Repository URL</label>
11
- <input id="repo-url" type="text" 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" placeholder="Enter the full GitHub repository URL">
 
 
 
 
 
12
  </div>
13
- </div>
14
 
15
- <div class="card bg-gray-800 p-8 shadow-lg rounded-xl">
16
- <div class="flex justify-between mb-4">
17
- <button id="fetch-issues" class="bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">Fetch Issues</button>
18
- <select id="issue-dropdown" 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">
19
- <option selected="" disabled="">Select Issue</option>
20
- </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  </div>
22
- <div class="mb-4">
23
- <label class="block text-gray-300 font-bold mb-2" for="resolution-textarea">Resolution</label>
24
- <textarea id="resolution-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-32 resize-y" placeholder="Enter the resolution details"></textarea>
 
 
25
  </div>
26
- <div class="mb-4">
27
- <label class="block text-gray-300 font-bold mb-2" for="forked-repo-url">Forked Repository URL</label>
28
- <input id="forked-repo-url" type="text" 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" placeholder="URL to your forked repository (Optional)">
 
 
 
 
 
29
  </div>
30
- <button id="resolve-issue" class="bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">Resolve Issue</button>
31
  </div>
32
 
33
- <div class="card bg-gray-800 p-8 shadow-lg rounded-xl mt-4">
34
- <label class="block text-gray-300 font-bold mb-2" for="output-textarea">Output</label>
35
- <textarea id="output-textarea" readonly 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"></textarea>
36
- </div>
 
 
 
 
 
 
 
 
 
37
 
38
- <div class="card bg-gray-800 p-8 shadow-lg rounded-xl mt-4">
39
- <div class="mb-4">
40
- <label class="block text-gray-300 font-bold mb-2" for="url-textbox">URL</label>
41
- <input id="url-textbox" type="text" 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" placeholder="Enter a URL to extract information">
42
- </div>
43
- <button id="extract-info" class="bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">Extract Info</button>
44
- </div>
45
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>GitHub Issue Manager</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ </head>
9
+ <body class="bg-gray-900 text-gray-300">
10
 
11
+ <div class="container mx-auto p-4">
12
+ <h1 class="text-4xl md:text-5xl font-extrabold text-white text-center mb-8">GitHub Issue Manager</h1>
13
+
14
+ <div class="card bg-gray-800 p-8 shadow-lg rounded-xl">
15
+ <div class="mb-4">
16
+ <label for="github-token" class="block text-gray-300 font-bold mb-2">GitHub Token</label>
17
+ <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">
18
+ </div>
19
+ <div class="mb-4">
20
+ <label for="repo-url" class="block text-gray-300 font-bold mb-2">Repository URL</label>
21
+ <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">
22
+ </div>
23
+ <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>
24
  </div>
 
25
 
26
+ <div class="card bg-gray-800 p-8 shadow-lg rounded-xl mt-4">
27
+ <div class="flex justify-between mb-4">
28
+ <div>
29
+ <label for="issue-dropdown" class="block text-gray-300 font-bold mb-2">Issue</label>
30
+ <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">
31
+ <option disabled selected>Select an Issue</option>
32
+ </select>
33
+ </div>
34
+ <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>
35
+ </div>
36
+ <div id="issue-details-container" class="hidden">
37
+ <div class="mb-4">
38
+ <label for="resolution-textarea" class="block text-gray-300 font-bold mb-2">Resolution</label>
39
+ <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>
40
+ </div>
41
+ <div class="mb-4">
42
+ <label for="forked-repo-url" class="block text-gray-300 font-bold mb-2">Forked Repository URL (Optional)</label>
43
+ <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">
44
+ </div>
45
+ <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>
46
+ </div>
47
  </div>
48
+
49
+
50
+ <div class="card bg-gray-800 p-8 shadow-lg rounded-xl mt-4">
51
+ <label for="output-textarea" class="block text-gray-300 font-bold mb-2">Output</label>
52
+ <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>
53
  </div>
54
+
55
+ <div class="card bg-gray-800 p-8 shadow-lg rounded-xl mt-4">
56
+ <div class="mb-4">
57
+ <label for="url-textbox" class="block text-gray-300 font-bold mb-2">URL</label>
58
+ <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">
59
+ </div>
60
+ <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>
61
+
62
  </div>
 
63
  </div>
64
 
65
+ <script>
66
+ const githubTokenInput = document.getElementById('github-token');
67
+ const repoUrlInput = document.getElementById('repo-url');
68
+ const fetchIssuesButton = document.getElementById('fetch-issues');
69
+ const issueDropdown = document.getElementById('issue-dropdown');
70
+ const resolutionTextarea = document.getElementById('resolution-textarea');
71
+ const forkedRepoUrlInput = document.getElementById('forked-repo-url');
72
+ const resolveIssueButton = document.getElementById('resolve-issue');
73
+ const outputTextarea = document.getElementById('output-textarea');
74
+ const urlTextbox = document.getElementById('url-textbox');
75
+ const extractInfoButton = document.getElementById('extract-info');
76
+ const showIssueDetailsButton = document.getElementById('show-issue-details');
77
+ const issueDetailsContainer = document.getElementById('issue-details-container');
78
 
79
+ fetchIssuesButton.addEventListener('click', async () => {
80
+ const githubToken = githubTokenInput.value;
81
+ const repoUrl = repoUrlInput.value;
82
+ if (!githubToken || !repoUrl) {
83
+ outputTextarea.value = 'Please enter GitHub Token and Repository URL.';
84
+ return;
85
+ }
86
+ try {
87
+ const response = await fetch('/fetch_issues', {
88
+ method: 'POST',
89
+ headers: {
90
+ 'Content-Type': 'application/x-www-form-urlencoded',
91
+ },
92
+ body: new URLSearchParams({
93
+ 'github_token': githubToken,
94
+ 'repo_url': repoUrl,
95
+ }),
96
+ });
97
+ if (response.ok) {
98
+ const issues = await response.json();
99
+ outputTextarea.value = '';
100
+ issueDropdown.innerHTML = '<option disabled selected>Select an Issue</option>';
101
+ issues.forEach(issue => {
102
+ const option = document.createElement('option');
103
+ option.value = issue.number;
104
+ option.text = `${issue.title} - #${issue.number}`;
105
+ option.dataset.issueDetails = JSON.stringify(issue); // Store issue details in data attribute
106
+ issueDropdown.add(option);
107
+ });
108
+ outputTextarea.value = 'Issues fetched successfully!';
109
+
110
+ } else {
111
+ const error = await response.json();
112
+ outputTextarea.value = `Error: ${error.error}`;
113
+ }
114
+ } catch (error) {
115
+ outputTextarea.value = `Error: ${error}`;
116
+ }
117
+ });
118
+
119
+
120
+ showIssueDetailsButton.addEventListener('click', () => {
121
+ issueDetailsContainer.classList.remove('hidden');
122
+ const selectedIssue = issueDropdown.selectedOptions[0].dataset.issueDetails;
123
+ if (selectedIssue) {
124
+ try {
125
+ const issue = JSON.parse(selectedIssue);
126
+ outputTextarea.value += `\nIssue Number: ${issue.number}\nTitle: ${issue.title}\nBody: ${issue.body}`;
127
+ } catch (error) {
128
+ outputTextarea.value = `Error processing issue details: ${error}`;
129
+ }
130
+ }
131
+ });
132
+
133
+
134
+ resolveIssueButton.addEventListener('click', async () => {
135
+ const githubToken = githubTokenInput.value;
136
+ const issueNumber = issueDropdown.value;
137
+ const resolution = resolutionTextarea.value;
138
+ const repoUrl = repoUrlInput.value;
139
+ const forkedRepoUrl = forkedRepoUrlInput.value;
140
+ if (!githubToken || !issueNumber || !resolution || !repoUrl) {
141
+ outputTextarea.value = 'Please fill all the required fields.';
142
+ return;
143
+ }
144
+ try {
145
+ const response = await fetch('/resolve_issue', {
146
+ method: 'POST',
147
+ headers: {
148
+ 'Content-Type': 'application/x-www-form-urlencoded',
149
+ },
150
+ body: new URLSearchParams({
151
+ 'github_token': githubToken,
152
+ 'issue_number': issueNumber,
153
+ 'resolution': resolution,
154
+ 'repo_url': repoUrl,
155
+ 'forked_repo_url': forkedRepoUrl,
156
+ }),
157
+ });
158
+ if (response.ok) {
159
+ const result = await response.json();
160
+ outputTextarea.value = result.message;
161
+ } else {
162
+ const error = await response.json();
163
+ outputTextarea.value = `Error: ${error.error}`;
164
+ }
165
+ } catch (error) {
166
+ outputTextarea.value = `Error: ${error}`;
167
+ }
168
+ });
169
+
170
+
171
+ extractInfoButton.addEventListener('click', async () => {
172
+ const url = urlTextbox.value;
173
+ if (!url) {
174
+ outputTextarea.value = 'Please enter a URL.';
175
+ return;
176
+ }
177
+ try {
178
+ const response = await fetch('/extract_info', {
179
+ method: 'POST',
180
+ headers: {
181
+ 'Content-Type': 'application/x-www-form-urlencoded',
182
+ },
183
+ body: new URLSearchParams({
184
+ 'url': url,
185
+ }),
186
+ });
187
+ if (response.ok) {
188
+ const result = await response.json();
189
+ outputTextarea.value = result.response;
190
+ } else {
191
+ const error = await response.json();
192
+ outputTextarea.value = `Error: ${error.error}`;
193
+ }
194
+ } catch (error) {
195
+ outputTextarea.value = `Error: ${error}`;
196
+ }
197
+ });
198
+ </script>
199
+ </body>
200
+ </html>