Get session database for localstorage explicit, getusername

master
Bel LaPointe 2021-02-28 03:00:30 -06:00
parent 2c0ce69396
commit 3b5ee269f8
2 changed files with 27 additions and 7 deletions

10
TODO.md
View File

@ -1,5 +1,6 @@
# todo
1. assignees
1. choose primary+secondary(ies) in UI
1. host @ Q
1. manual full sync primary->replicas
@ -7,11 +8,14 @@
1. how to map to-from JIRA?
1. how to map to-from Odo?
1. SSO google/jira
1. assignees
* https://developers.google.com/identity/sign-in/web/sign-in
1. auto assign last editor as assignee if none
1. default oneline
1. description panel
# done
# done
1. multi: read from CACHE, write to PRIMARY+CACHE, replicate to REPLICAS
# cancelled
1. default oneline

View File

@ -3334,7 +3334,7 @@
{
pushAllNamespaces(namespace);
$('#page-title').html(namespace);
return new Local().set("namespace", namespace);
return getSessionDatabase().set("namespace", namespace);
}
function popAllNamespaces(namespace)
@ -3358,13 +3358,13 @@
function setAllNamespaces(namespaces)
{
new Local().set("namespaces", JSON.stringify(namespaces));
getSessionDatabase().set("namespaces", JSON.stringify(namespaces));
updateNamespaceIndex();
}
function getAllNamespaces()
{
var namespaces = new Local().get("namespaces");
var namespaces = getSessionDatabase().get("namespaces");
if (! namespaces || namespaces == "[]")
namespaces = "[\"initial\"]";
return JSON.parse(namespaces);
@ -3372,7 +3372,23 @@
function getCurrentNamespace()
{
return new Local().get("namespace") || getAllNamespaces()[0];
return getSessionDatabase().get("namespace") || getAllNamespaces()[0];
}
function getCurrentUsername()
{
var username = getSessionDatabase().get("username");
if (username == null)
{
username = prompt("Who are you?");
getSessionDatabase().set("username", username);
}
return username;
}
function getSessionDatabase()
{
return new NamespacedDatabase("session", new Local());
}
setGlobalStorage(getCurrentNamespace());