Skip to content

Commit da0f98d

Browse files
committed
suggested changes
Signed-off-by: Isaac Milarsky <imilarsky@gmail.com>
1 parent 3e9274f commit da0f98d

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

js/formDataToJson.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ async function createBranchOnProject(projectURL, token)
159159
else
160160
{
161161
console.error('Error creating new branch: ', newBranchData);
162+
alert("Failed to create branch on project! Error code: ", newBranchResponse.status, ". Please check API Key permissions and try again.")
162163
return false;
163164
}
164165
}
@@ -190,7 +191,7 @@ async function addFileToBranch(projectURL, token, codeJSONObj)
190191
body: JSON.stringify({
191192
message: "Add codejson to project",
192193
committer: {
193-
name: "CodeJSON formsite",
194+
name: "codejson-generator form site",
194195
email: "opensource@cms.hhs.gov"
195196
},
196197
content: encodedContent,
@@ -209,6 +210,7 @@ async function addFileToBranch(projectURL, token, codeJSONObj)
209210
else
210211
{
211212
console.error('Error adding file: ', data);
213+
alert("Failed to add file on project! Error code: ", response.status, ". Please check API Key permissions and try again.")
212214
return false;
213215
}
214216
}
@@ -227,7 +229,7 @@ async function createPR(projectURL, token)
227229
},
228230
body: JSON.stringify({
229231
title: "Add code.json to Project",
230-
body: "Add generated code.json file to project. Code.json was generated via a form.io form site.",
232+
body: "Add generated code.json file to project. Code.json was generated via codejson-generator form site.",
231233
head: NEW_BRANCH,
232234
base: 'main',
233235

@@ -245,6 +247,7 @@ async function createPR(projectURL, token)
245247
else
246248
{
247249
console.error("Error creating PR!: ", data);
250+
alert("Failed to create PR on project! Error code: ", response.status, ". Please check API Key permissions and try again.")
248251
return false;
249252
}
250253
}
@@ -279,18 +282,22 @@ async function createProjectPR(event){
279282
}
280283
}
281284
}
285+
else
286+
{
287+
console.error("Could not create branch on requested repository with the requested API key!")
288+
}
282289
}
283290
else
284291
{
285292
console.error("No URL found!");
286-
alert("No URL given for project!");
293+
alert("No URL given for project! Please provide project URL in repositoryURL text box");
287294
}
288295

289296
}
290297
else
291298
{
292299
console.error("No API key found!");
293-
alert("No Api Key in submitted data!");
300+
alert("No API Key in submitted data! Please provide an API key");
294301
}
295302
//console.log(codeJSONObj)
296303
}

js/generateFormComponents.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,11 @@ async function createFormComponents() {
303303
"tableView": true,
304304
"key": "gh_api_key",
305305
"type": "textfield",
306-
"input": true
306+
"input": true,
307+
"description": "Generate a Github API Key from here: https://github.com/settings/tokens/new .\n\
308+
The token should have these permissions: \n\
309+
- Contents: read &write \n- Workflows: read & write\
310+
- Pull requests: read & write"
307311
});
308312

309313
// Add submit button to form

0 commit comments

Comments
 (0)