Commit 60d24088 authored by squeak's avatar squeak
Browse files

Merge branch 'working'

parents 3caf286b 3ff14654
......@@ -3,6 +3,17 @@
> *Only major changes are listed here, there are always minor improvements as well.
> Improvements made to some dependencies are also listed, when those are developed alongside dato.*
## Version 1.6.2
- When editing a type, prefilling view fields from edit keys now also prefills labels
- For basic system types, when creating an entry, a timestamp will automatically be added in meta
- Use a nicer default icon for entries, and made it easier to customize it per database
- Automatically reopen current folder and opened windows, on db reload
- Corrected a bug when removing databases (in dato autosync version, it would show login popup in loop)
- Display the global synchronization status indicator in the navigation panel, for better visibility
- It's now possible to consult the last shown notifications, from the navigation panel
- Improved a lot `anyAttachments` files previewing method
- And other small bug fixes and improvements
## Version 1.6.1
- Added missing monospace font
- When editing a type, made it easy to prefill view fields from previously chosen edit keys
......
......@@ -142,9 +142,9 @@ var autosyncMethods = {
else uify.toast("Removed remote database '"+ dbName +"' successfully.");
},
error: function (err) {
var responseError = err.responseJSON ? err.responseJSON : err;
// if not logged in, propose to log in
var responseError = err.responseJSON;
if (responseError && responseError.status) loginAgain(responseError.status, function () {
// on login success, reask to get settings and callback
autosyncMethods.removeDatabase(dbName);
......
......@@ -59,12 +59,12 @@ function addEditGrapeButton (tablifyConfig) {
// EDIT
if (!grape.edit) grape.edit = {};
if (!grape.edit.buttons) grape.edit.buttons = [];
grape.edit.buttons.push(editTypeButton);
if (!_.findWhere(grape.edit.buttons, { name: "editType", })) grape.edit.buttons.push(editTypeButton);
// VIEW
if (!grape.view) grape.view = {};
if (!grape.view.buttons) grape.view.buttons = [];
grape.view.buttons.push(editTypeButton);
if (!_.findWhere(grape.view.buttons, { name: "editType", })) grape.view.buttons.push(editTypeButton);
});
......
......@@ -97,16 +97,13 @@
}
& > .uify-spaces--switcher {
.global-settings-button {
.global-settings-button, .notifications-history-button, .dato-logout-button {
position: absolute;
top: 0;
left: 0;
}
.dato-logout-button {
position: absolute;
top: 0;
left: 2em;
}
.global-settings-button { left: 0; }
.notifications-history-button { left: 2em; }
.dato-logout-button { left: 4em; }
}
}
......@@ -127,6 +124,7 @@
display: flex;
align-items: center;
padding: 1em;
margin-left: 1em;
cursor: default;
//
......@@ -143,13 +141,9 @@
// INFOS BOX
.infos {
font-size: 0.8em;
font-size: 1em;
padding: 0.5em;
display: none;
}
&:hover {
background-color: @baseTransparentLess;
.infos { display: block; }
text-align: left;
}
//
......@@ -165,6 +159,33 @@
}
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
// NOTIFICATIONS HISTORY
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
.dato-notifications_history {
div {
padding: 1em 1em 1.5em;
margin: 1em;
border-radius: .5em;
i {
float: right;
font-size: .8em;
}
&.notif_type-error { background-color: @error; }
&.notif_type-warning { background-color: @warning; }
&.notif_type-success { background-color: @success; }
&.notif_type-undefined { background-color: @primary; }
}
span {
display: block;
cursor: pointer;
text-align: center;
.front.primaryAndHover();
}
}
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
// PHONEBAR
......
......@@ -5,6 +5,79 @@ var globalSettings = require("./utilities/globalSettings");
var electrodeLogout = require("electrode/lib/logout");
var changeSpace = require("./utilities/changeSpace");
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
// DISPLAY NOTIFICATIONS HISTORY
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
function alertNotificationsHistory () {
// get toasts history
var toastsHistory = uify.toast.history();
// alert toasts history
uify.dialog({
// DIALOG TITLE
title: "Notifications history",
// CANCEL AND CLEAR HISTORY BUTTONS
buttons: [
// clear history button
{
title: "clear history",
click: function () {
uify.confirm({
content: "Sure you want to clear notifications history?",
type: "warning",
ok: function () {
uify.toast.clearHistory();
uify.toast({
message: "Notifications history cleared",
type: "success",
historify: false,
});
},
});
},
},
// cancel button
"ok",
],
// HISTORY CONTENT
contentClass: "dato-notifications_history",
content: function ($container) {
function showToastsHistory (from, amount) {
// calculate target index
var to = from + amount;
// display notifications
var historySlice = toastsHistory.slice(from, to);
_.each(historySlice, function (toastNotif) {
var $toastMessage = $container.div({
class: "notif_type-"+ toastNotif.options.type,
htmlSanitized: toastNotif.message +'<br><i>'+ toastNotif.date +'</i>',
});
});
// display "more history" button
if (toastsHistory.length > to) var $moreHistory = $container.span({
text: "+ show "+ (amount*2) +" more +",
}).click(function () {
$moreHistory.remove();
showToastsHistory(to+1, (amount*2));
});
};
// display last 50 notifications
showToastsHistory(0, 50);
},
});
};
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
// SWITCHER BUTTONS
......@@ -36,6 +109,13 @@ var switcherButtons = [
globalSettings.edit();
},
},
{
icomoon: "history",
title: "check notifications history",
key: "shift + p",
class: "notifications-history-button", // custom class to positionize the button differently in page
click: alertNotificationsHistory,
},
{
icomoon: "exit", // page.authenticatedUser ? page.authenticatedUser.icon : "",
title: "logout from dato",
......
......@@ -102,8 +102,14 @@ function changeSpace (spacified, askedDatabase, callback, doNotVisitCreatedSpace
else doReload();
function doReload () {
// save hash before reloading
var currentHash = $$.url.hash.getAsString();
// remove db space
datobject.spaceObject.remove();
// recreate db space from scratch
changeSpace(spacified, askedDatabase, reloadCallback, doNotVisit);
// reset hash to value saved before reloading
$$.url.hash.set(currentHash);
};
};
......
......@@ -2,7 +2,7 @@
// The gss (Global Sync Status) is a spinner displayed in any space when a sync is onging in any space
module.exports = function (spacified) {
var $globalSyncStatusContainer = $app.div({ class: "dato-gss ", });
var $globalSyncStatusContainer = spacified.switcher.$switcher.div({ class: "dato-gss ", });
var gss = {
$container: $globalSyncStatusContainer,
$spinner: $globalSyncStatusContainer.div({ class: "spinner icon-spinner", }),
......
......@@ -124,36 +124,29 @@ function setupDatabasePermissionsAndAnswer (req, res, dbToCreate) {
*/
function removeDatabaseAndAnswer (req, res, dbToRemove) {
request.delete(couchAdminUrl() + dbToRemove, function (err, requestRes, body) {
//
// REQUEST ERROR
if (err) {
fetch(couchAdminUrl() + dbToRemove, { method: "DELETE", })
// PARSE COUCHDB RESPONSE
.then((fetchResponse) => fetchResponse.json())
// FIGURE OUT wHAT HAPPENED, IF WORKED/FAILED/UNNECESSARY
.then((couchResponse) => {
if (couchResponse.ok) {
$$log.info("Successfully removed database '"+ dbToRemove +"' in couch");
return res.status(200).send({ ok: true, })
}
else if (couchResponse.error == "not_found") {
return res.status(200).send({ ok: true, status: "not_found", message: "Database doesn't exist.", });
}
else {
$$log.error("Failed to remove database '"+ dbToRemove +"' in couch, maybe it doesn't exist", couchResponse);
return res.status(400).send({ ok: false, error: "couch-error", });
};
})
// ERROR SENDING DELETE REQUEST
.catch((err) => {
$$log.error("Request error trying to remove database '"+ dbToRemove +"' in couch", err);
return res.status(400).send({ ok: false, error: "request-error", });
};
//
// REQUEST SUCCESS REMOVED DATABASE OR COUCH ERROR
var couchResponse = JSON.parse(body);
if (couchResponse.ok) {
$$log.info("Successfully removed database '"+ dbToRemove +"' in couch");
return res.status(200).send({ ok: true, })
}
else if (couchResponse.error == "not_found") {
return res.status(200).send({ ok: true, status: "not_found", message: "Database doesn't exist.", });
}
else {
$$log.error("Failed to remove database '"+ dbToRemove +"' in couch, maybe it doesn't exist", couchResponse);
return res.status(400).send({ ok: false, error: "couch-error", });
};
// ¬
//
});
res.status(400).send({ ok: false, error: "request-error", });
})
;
};
......
# Demos, tutorials, resources
![](https://squeak.eauchat.org/share/screenshots/dato.png)
## In app tutorial
You can test dato from it's public instance [here](https://publicdato.eauchat.org/).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment