mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-06-12 03:29:31 +00:00
added "Delete Local Repo" option
This commit is contained in:
parent
3e2a3ddee7
commit
61ffe2ae79
|
@ -147,7 +147,6 @@ TODO:
|
||||||
- test edge/failure cases
|
- test edge/failure cases
|
||||||
- what to do about included files?
|
- what to do about included files?
|
||||||
- what if files already open in editor
|
- what if files already open in editor
|
||||||
- un-bind from repo? delete repo?
|
|
||||||
- can published files retain path?
|
- can published files retain path?
|
||||||
- what if import interrupted and partial files?
|
- what if import interrupted and partial files?
|
||||||
- CORS for some blobs?
|
- CORS for some blobs?
|
||||||
|
|
|
@ -69,6 +69,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item" href="#" id="item_github_import">Import Project from GitHub...</a></li>
|
<li><a class="dropdown-item" href="#" id="item_github_import">Import Project from GitHub...</a></li>
|
||||||
<li><a class="dropdown-item" href="#" id="item_github_publish">Publish Project on GitHub...</a></li>
|
<li><a class="dropdown-item" href="#" id="item_github_publish">Publish Project on GitHub...</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#" id="item_repo_delete">Delete Local Repository...</a></li>
|
||||||
<hr>
|
<hr>
|
||||||
<li><a class="dropdown-item" href="#" id="item_github_push">Push Changes to Repository...</a></li>
|
<li><a class="dropdown-item" href="#" id="item_github_push">Push Changes to Repository...</a></li>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
|
@ -10,8 +10,8 @@ declare var jsnes : any;
|
||||||
|
|
||||||
const JSNES_PRESETS = [
|
const JSNES_PRESETS = [
|
||||||
{id:'hello.c', name:'Hello World'},
|
{id:'hello.c', name:'Hello World'},
|
||||||
{id:'scroll.c', name:'Scrolling'},
|
|
||||||
{id:'attributes.c', name:'Attribute Table'},
|
{id:'attributes.c', name:'Attribute Table'},
|
||||||
|
{id:'scroll.c', name:'Scrolling'},
|
||||||
{id:'vrambuffer.c', name:'VRAM Buffer'},
|
{id:'vrambuffer.c', name:'VRAM Buffer'},
|
||||||
{id:'sprites.c', name:'Sprites'},
|
{id:'sprites.c', name:'Sprites'},
|
||||||
{id:'metasprites.c', name:'Metasprites'},
|
{id:'metasprites.c', name:'Metasprites'},
|
||||||
|
|
38
src/ui.ts
38
src/ui.ts
|
@ -410,7 +410,7 @@ function getGithubService() {
|
||||||
function getBoundGithubURL() : string {
|
function getBoundGithubURL() : string {
|
||||||
var toks = (repo_id||'').split('/');
|
var toks = (repo_id||'').split('/');
|
||||||
if (toks.length != 2) {
|
if (toks.length != 2) {
|
||||||
alertError("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one.");
|
alertError("<p>You are not in a GitHub repository.</p><p>Choose one from the pulldown, or Import or Publish one.</p>");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return 'https://github.com/' + toks[0] + '/' + toks[1];
|
return 'https://github.com/' + toks[0] + '/' + toks[1];
|
||||||
|
@ -532,7 +532,7 @@ function confirmCommit(sess) : Promise<GHSession> {
|
||||||
msg += f.filename + ": " + f.status;
|
msg += f.filename + ": " + f.status;
|
||||||
if (f.additions || f.deletions || f.changes) {
|
if (f.additions || f.deletions || f.changes) {
|
||||||
msg += " (" + f.additions + " additions, " + f.deletions + " deletions, " + f.changes + " changes)";
|
msg += " (" + f.additions + " additions, " + f.deletions + " deletions, " + f.changes + " changes)";
|
||||||
}
|
};
|
||||||
msg += "<br/>";
|
msg += "<br/>";
|
||||||
}
|
}
|
||||||
// show dialog, continue when yes
|
// show dialog, continue when yes
|
||||||
|
@ -578,6 +578,39 @@ function pushChangesToGithub(message:string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _deleteRepository() {
|
||||||
|
var ghurl = getBoundGithubURL();
|
||||||
|
if (!ghurl) return;
|
||||||
|
bootbox.prompt("<p>Are you sure you want to delete this repository (" + ghurl + ") from browser storage?</p><p>All changes since last commit will be lost.</p><p>Type YES to proceed.<p>", (yes) => {
|
||||||
|
if (yes.trim().toUpperCase() == "YES") {
|
||||||
|
deleteRepository();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteRepository() {
|
||||||
|
var ghurl = getBoundGithubURL();
|
||||||
|
var gh;
|
||||||
|
setWaitDialog(true);
|
||||||
|
// delete all keys in storage
|
||||||
|
store.keys().then((keys:string[]) => {
|
||||||
|
return Promise.all(keys.map((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);
|
||||||
|
// leave repository
|
||||||
|
qs = {repo:'/'};
|
||||||
|
gotoNewLocation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function _shareEmbedLink(e) {
|
function _shareEmbedLink(e) {
|
||||||
if (current_output == null) { // TODO
|
if (current_output == null) { // TODO
|
||||||
alertError("Please fix errors before sharing.");
|
alertError("Please fix errors before sharing.");
|
||||||
|
@ -1372,6 +1405,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_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