mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-06-12 18:42:14 +00:00
github: fixed delete repository
This commit is contained in:
parent
e724ccb7d2
commit
2f8a5bee84
|
@ -219,12 +219,13 @@ export class GithubService {
|
||||||
}
|
}
|
||||||
// check README for proper platform
|
// check README for proper platform
|
||||||
// unless we use githubURL=
|
// unless we use githubURL=
|
||||||
|
// TODO: cannot handle multiple URLs in README
|
||||||
const re8plat = /8bitworkshop.com[^)]+platform=([A-Za-z0-9._\-]+)/;
|
const re8plat = /8bitworkshop.com[^)]+platform=([A-Za-z0-9._\-]+)/;
|
||||||
m = re8plat.exec(readme);
|
m = re8plat.exec(readme);
|
||||||
if (m) {
|
if (m) {
|
||||||
console.log("platform id: '" + m[1] + "'");
|
console.log("platform id: '" + m[1] + "'");
|
||||||
if (sess.platform_id && !sess.platform_id.startsWith(m[1]))
|
if (sess.platform_id && !sess.platform_id.startsWith(m[1]))
|
||||||
throw Error("Platform mismatch: Repository is " + m[1] + ", you have " + this.project.platform_id + " selected.");
|
throw Error("Platform mismatch: Repository is " + m[1] + ", you have " + sess.platform_id + " selected.");
|
||||||
sess.platform_id = m[1];
|
sess.platform_id = m[1];
|
||||||
}
|
}
|
||||||
// bind to repository
|
// bind to repository
|
||||||
|
|
|
@ -882,37 +882,32 @@ async function pushChangesToGithub(message:string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function _deleteRepository() {
|
function _removeRepository() {
|
||||||
var ghurl = getBoundGithubURL();
|
var ghurl = getBoundGithubURL();
|
||||||
if (!ghurl) return;
|
if (!ghurl) return;
|
||||||
bootbox.prompt("<p>Are you sure you want to delete this repository (" + DOMPurify.sanitize(ghurl) + ") from browser storage?</p><p>All changes since last commit will be lost.</p><p>Type DELETE to proceed.<p>", (yes) => {
|
bootbox.prompt("<p>Are you sure you want to delete this repository (" + DOMPurify.sanitize(ghurl) + ") from browser storage?</p><p>All changes since last commit will be lost.</p><p>Type DELETE to proceed.<p>", (yes) => {
|
||||||
if (yes.trim().toUpperCase() == "DELETE") {
|
if (yes.trim().toUpperCase() == "DELETE") {
|
||||||
deleteRepository();
|
removeRepository();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteRepository() {
|
async function removeRepository() {
|
||||||
var ghurl = getBoundGithubURL();
|
var ghurl = getBoundGithubURL();
|
||||||
var gh;
|
|
||||||
setWaitDialog(true);
|
setWaitDialog(true);
|
||||||
// delete all keys in storage
|
let gh = await getGithubService();
|
||||||
store.keys().then((keys:string[]) => {
|
let sess = await gh.getGithubSession(ghurl);
|
||||||
|
gh.bind(sess, false);
|
||||||
|
// delete all keys in (repo) storage
|
||||||
|
await store.keys().then((keys:string[]) => {
|
||||||
return Promise.all(keys.map((key) => {
|
return Promise.all(keys.map((key) => {
|
||||||
return store.removeItem(key);
|
return store.removeItem(key);
|
||||||
}));
|
}));
|
||||||
}).then(() => {
|
});
|
||||||
gh = getGithubService();
|
|
||||||
return gh.getGithubSession(ghurl);
|
|
||||||
}).then((sess) => {
|
|
||||||
// un-bind repo from list
|
|
||||||
gh.bind(sess, false);
|
|
||||||
}).then(() => {
|
|
||||||
setWaitDialog(false);
|
setWaitDialog(false);
|
||||||
// leave repository
|
// leave repository
|
||||||
qs = {repo:'/'};
|
qs = {repo:'/'};
|
||||||
gotoNewLocation();
|
gotoNewLocation();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _shareEmbedLink(e) {
|
function _shareEmbedLink(e) {
|
||||||
|
@ -1929,7 +1924,7 @@ function setupDebugControls() {
|
||||||
$("#item_github_publish").click(_publishProjectToGithub);
|
$("#item_github_publish").click(_publishProjectToGithub);
|
||||||
$("#item_github_push").click(_pushProjectToGithub);
|
$("#item_github_push").click(_pushProjectToGithub);
|
||||||
$("#item_github_pull").click(_pullProjectFromGithub);
|
$("#item_github_pull").click(_pullProjectFromGithub);
|
||||||
$("#item_repo_delete").click(_deleteRepository);
|
$("#item_repo_delete").click(_removeRepository);
|
||||||
$("#item_share_file").click(_shareEmbedLink);
|
$("#item_share_file").click(_shareEmbedLink);
|
||||||
$("#item_reset_file").click(_revertFile);
|
$("#item_reset_file").click(_revertFile);
|
||||||
$("#item_rename_file").click(_renameFile);
|
$("#item_rename_file").click(_renameFile);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user