implemented service workers and indexdb to handle data on the front end, still needs to be cleaned up but it works
parent
1f52df297a
commit
bc1b4fa3e8
@ -0,0 +1,33 @@
|
|||||||
|
module.exports = function (sequelize, DataTypes) {
|
||||||
|
var FreshPost = sequelize.define('FreshPost', {
|
||||||
|
post: {
|
||||||
|
type: DataTypes.JSONB
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
timestamps: false,
|
||||||
|
|
||||||
|
// don't delete database entries but set the newly added attribute deletedAt
|
||||||
|
// to the current date (when deletion was done). paranoid will only work if
|
||||||
|
// timestamps are enabled
|
||||||
|
paranoid: false,
|
||||||
|
|
||||||
|
// don't use camelcase for automatically added attributes but underscore style
|
||||||
|
// so updatedAt will be updated_at
|
||||||
|
underscored: true,
|
||||||
|
|
||||||
|
// disable the modification of table names; By default, sequelize will automatically
|
||||||
|
// transform all passed model names (first parameter of define) into plural.
|
||||||
|
// if you don't want that, set the following
|
||||||
|
freezeTableName: false,
|
||||||
|
|
||||||
|
// define the table's name
|
||||||
|
tableName: 'FreshPosts',
|
||||||
|
|
||||||
|
// Enable optimistic locking. When enabled, sequelize will add a version count attriubte
|
||||||
|
// to the model and throw an OptimisticLockingError error when stale instances are saved.
|
||||||
|
// Set to true or a string with the attribute name you want to use to enable.
|
||||||
|
version: false
|
||||||
|
});
|
||||||
|
|
||||||
|
return FreshPost;
|
||||||
|
};
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,40 @@
|
|||||||
|
import PostEditor from './PostEditor';
|
||||||
|
import Animate from '../../../../../brain/tools/effects/Animate';
|
||||||
|
import PostIndex from './PostIndex';
|
||||||
|
|
||||||
|
export default class DashManager {
|
||||||
|
//--------------------------
|
||||||
|
// constructor
|
||||||
|
//--------------------------
|
||||||
|
constructor() {
|
||||||
|
this.currentDisplay = '';
|
||||||
|
this.urlPieces = document.URL.split("/");
|
||||||
|
this.chooseDisplay(this.urlPieces[5], this.urlPieces[6]);
|
||||||
|
}
|
||||||
|
//--------------------------
|
||||||
|
// methods
|
||||||
|
//--------------------------
|
||||||
|
start() {
|
||||||
|
let self = this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
chooseDisplay(section, page) {
|
||||||
|
this.currentDisplay = '';
|
||||||
|
switch (section) {
|
||||||
|
case 'posts':
|
||||||
|
this.currentDisplay = new PostIndex(page);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// just chill
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.start();
|
||||||
|
|
||||||
|
}
|
||||||
|
//--------------------------
|
||||||
|
// event handlers
|
||||||
|
//--------------------------
|
||||||
|
|
||||||
|
}
|
@ -1,74 +0,0 @@
|
|||||||
//TOOLS
|
|
||||||
import DataUtils, {
|
|
||||||
REQUEST_TYPE_GET,
|
|
||||||
REQUEST_TYPE_PUT,
|
|
||||||
REQUEST_TYPE_POST,
|
|
||||||
REQUEST_TYPE_DELETE,
|
|
||||||
CONTENT_TYPE_JSON,
|
|
||||||
CONTENT_TYPE_FORM
|
|
||||||
} from '../../../../../brain/tools/utilities/DataUtils';
|
|
||||||
import PostEditor from './PostEditor';
|
|
||||||
import Animate from '../../../../../brain/tools/effects/Animate';
|
|
||||||
|
|
||||||
class DisplayManager {
|
|
||||||
//--------------------------
|
|
||||||
// constructor
|
|
||||||
//--------------------------
|
|
||||||
constructor() {
|
|
||||||
this.dataUtils = new DataUtils();
|
|
||||||
this.currentDisplay = '';
|
|
||||||
this.urlPieces = document.URL.split("/");
|
|
||||||
//grab url so system knows what to display
|
|
||||||
this.chooseDisplay(this.urlPieces[5], this.urlPieces[6]);
|
|
||||||
}
|
|
||||||
//--------------------------
|
|
||||||
// methods
|
|
||||||
//--------------------------
|
|
||||||
start() {
|
|
||||||
let self = this;
|
|
||||||
// new stuff
|
|
||||||
new Animate().object({
|
|
||||||
targets: document.getElementById('loader'),
|
|
||||||
duration: 300,
|
|
||||||
opacity: 0,
|
|
||||||
easing: 'easeInOutQuad',
|
|
||||||
complete: function () {
|
|
||||||
document.getElementById('loader').style.display = 'none';
|
|
||||||
document.getElementById('loader').style.visibility = 'hidden';
|
|
||||||
new Animate().object({
|
|
||||||
targets: document.getElementById('header'),
|
|
||||||
duration: 10,
|
|
||||||
opacity: 1,
|
|
||||||
easing: 'easeInOutQuad',
|
|
||||||
complete: function () {
|
|
||||||
document.getElementById('loader').style.display = 'none';
|
|
||||||
document.getElementById('loader').style.visibility = 'hidden';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
chooseDisplay(section, page) {
|
|
||||||
this.currentDisplay = '';
|
|
||||||
switch (section) {
|
|
||||||
case 'posts':
|
|
||||||
this.currentDisplay = new PostEditor();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// just chill
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
this.start();
|
|
||||||
|
|
||||||
}
|
|
||||||
//--------------------------
|
|
||||||
// event handlers
|
|
||||||
//--------------------------
|
|
||||||
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
DisplayManager as
|
|
||||||
default
|
|
||||||
}
|
|
@ -1,58 +1,38 @@
|
|||||||
import DataUtils, {
|
import Animate from '../../../../../brain/tools/effects/Animate';
|
||||||
REQUEST_TYPE_GET,
|
import PostEditor from './PostEditor';
|
||||||
REQUEST_TYPE_PUT,
|
export default class PostIndex
|
||||||
REQUEST_TYPE_POST,
|
{
|
||||||
REQUEST_TYPE_DELETE,
|
|
||||||
CONTENT_TYPE_JSON,
|
|
||||||
CONTENT_TYPE_FORM
|
|
||||||
} from '../tools/utilities/DataUtils';
|
|
||||||
import * as DataEvent from '../tools/events/DataEvent';
|
|
||||||
import ProjectFolio from '../tasks/ProjectFolio';
|
|
||||||
import TextEffects from '../tools/effects/TextEffects';
|
|
||||||
import Animate from '../tools/effects/Animate';
|
|
||||||
import * as Ease from '../tools/effects/Animate';
|
|
||||||
import DisplayAdminBlog from './PostEditor'
|
|
||||||
import DisplayAdminFipamo from './DisplayAdminFipamo';
|
|
||||||
|
|
||||||
export default class DisplayAdmin {
|
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// constructor
|
// constructor
|
||||||
//--------------------------
|
//--------------------------
|
||||||
constructor(section, page) {
|
constructor(page)
|
||||||
this.section = section;
|
{
|
||||||
this.page = page;
|
this.currentPage = null;
|
||||||
this.current = null;
|
this.choosePage(page);
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// methods
|
// methods
|
||||||
//--------------------------
|
//--------------------------
|
||||||
start() {
|
start()
|
||||||
|
{
|
||||||
let self = this;
|
let self = this;
|
||||||
new Animate().object({
|
}
|
||||||
targets: document.getElementById('loader'),
|
choosePage(page)
|
||||||
duration: 300,
|
{
|
||||||
opacity: 0,
|
this.currentPage = '';
|
||||||
easing: 'easeInOutQuad',
|
switch (page)
|
||||||
complete: function () {
|
{
|
||||||
document.getElementById('loader').style.display = 'none';
|
case "edit":
|
||||||
document.getElementById('loader').style.visibility = 'hidden';
|
case "add":
|
||||||
new Animate().object({
|
this.currentPage = new PostEditor();
|
||||||
targets: document.getElementById('header'),
|
break;
|
||||||
duration: 10,
|
default:
|
||||||
opacity: 1,
|
//just chill
|
||||||
easing: 'easeInOutQuad',
|
break;
|
||||||
complete: function () {
|
}
|
||||||
document.getElementById('loader').style.display = 'none';
|
|
||||||
document.getElementById('loader').style.visibility = 'hidden';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// event handlers
|
// event handlers
|
||||||
//--------------------------
|
//--------------------------
|
||||||
|
}
|
||||||
}
|
|
||||||
DisplayAdmin.uploadFiles = [];
|
|
@ -0,0 +1,35 @@
|
|||||||
|
importScripts('./workbox-sw.js');
|
||||||
|
|
||||||
|
if (workbox) {
|
||||||
|
//console.log(`Yay! Workbox is loaded 🎉`);
|
||||||
|
} else {
|
||||||
|
//console.log(`Boo! Workbox didn't load 😬`);
|
||||||
|
}
|
||||||
|
|
||||||
|
workbox.routing.registerRoute(
|
||||||
|
new RegExp('.*\.js'),
|
||||||
|
workbox.strategies.networkFirst({
|
||||||
|
cacheName: 'script'
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
workbox.routing.registerRoute(
|
||||||
|
new RegExp('.*\.css'),
|
||||||
|
workbox.strategies.networkFirst({
|
||||||
|
cacheName: 'style'
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
workbox.routing.registerRoute(
|
||||||
|
new RegExp('.*\.(?:png|jpg|jpeg|svg|gif)'),
|
||||||
|
workbox.strategies.networkFirst({
|
||||||
|
cacheName: 'images'
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
workbox.routing.registerRoute(
|
||||||
|
new RegExp('/@/dashboard'),
|
||||||
|
workbox.strategies.networkFirst({
|
||||||
|
cacheName: 'pages'
|
||||||
|
}));
|
||||||
|
|
@ -0,0 +1,3 @@
|
|||||||
|
var workbox=function(){"use strict";try{self.workbox.v["workbox:sw:3.6.3"]=1}catch(t){}const t="https://storage.googleapis.com/workbox-cdn/releases/3.6.3",e={backgroundSync:"background-sync",broadcastUpdate:"broadcast-cache-update",cacheableResponse:"cacheable-response",core:"core",expiration:"cache-expiration",googleAnalytics:"google-analytics",navigationPreload:"navigation-preload",precaching:"precaching",rangeRequests:"range-requests",routing:"routing",strategies:"strategies",streams:"streams"};return new class{constructor(){return this.v={},this.t={debug:"localhost"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?"dev":"prod",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error("Config must be set before accessing workbox.* modules");Object.assign(this.t,t),this.e=this.t.debug?"dev":"prod"}skipWaiting(){self.addEventListener("install",()=>self.skipWaiting())}clientsClaim(){self.addEventListener("activate",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&""===(s=r.split("/"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join("/")}}}();
|
||||||
|
|
||||||
|
//# sourceMappingURL=workbox-sw.js.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":[],"mappings":"","sources":["packages/workbox-sw/browser.mjs"],"sourcesContent":["var workbox=function(){\"use strict\";try{self.workbox.v[\"workbox:sw:3.6.3\"]=1}catch(t){}const t=\"https://storage.googleapis.com/workbox-cdn/releases/3.6.3\",e={backgroundSync:\"background-sync\",broadcastUpdate:\"broadcast-cache-update\",cacheableResponse:\"cacheable-response\",core:\"core\",expiration:\"cache-expiration\",googleAnalytics:\"google-analytics\",navigationPreload:\"navigation-preload\",precaching:\"precaching\",rangeRequests:\"range-requests\",routing:\"routing\",strategies:\"strategies\",streams:\"streams\"};return new class{constructor(){return this.v={},this.t={debug:\"localhost\"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?\"dev\":\"prod\",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error(\"Config must be set before accessing workbox.* modules\");Object.assign(this.t,t),this.e=this.t.debug?\"dev\":\"prod\"}skipWaiting(){self.addEventListener(\"install\",()=>self.skipWaiting())}clientsClaim(){self.addEventListener(\"activate\",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&\"\"===(s=r.split(\"/\"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join(\"/\")}}}();\n"],"file":"workbox-sw.js"}
|
Loading…
Reference in New Issue