Merge branch 'master' of git.toking.de:toking/billibox-vue
This commit is contained in:
commit
5bf5137661
|
@ -5,6 +5,7 @@
|
|||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "billibox-vue",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@dsb-norge/vue-keycloak-js": "*",
|
||||
|
@ -3463,8 +3464,6 @@
|
|||
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.11.0.tgz",
|
||||
"integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"json-schema-traverse": "^1.0.0",
|
||||
|
@ -3476,9 +3475,7 @@
|
|||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
|
||||
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/ajv-keywords": {
|
||||
"version": "3.5.2",
|
||||
|
@ -13473,6 +13470,7 @@
|
|||
"integrity": "sha512-vf4KqrmuOSnoEYGUiHPeMoxhh6wpiucLWXISn7xYFU80pK1lqcuhbl6tpurAanUIyRO/ENDUQBH7RAdbLNq1bA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/core": "^7.12.16",
|
||||
"@babel/helper-compilation-targets": "^7.12.16",
|
||||
"@babel/helper-module-imports": "^7.12.13",
|
||||
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
||||
|
@ -13485,6 +13483,7 @@
|
|||
"@vue/babel-plugin-jsx": "^1.0.3",
|
||||
"@vue/babel-preset-jsx": "^1.1.2",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
"core-js": "^3.8.3",
|
||||
"core-js-compat": "^3.8.3",
|
||||
"semver": "^7.3.4"
|
||||
},
|
||||
|
@ -14253,14 +14252,15 @@
|
|||
"resolved": "https://registry.npmmirror.com/ajv-formats/-/ajv-formats-2.1.1.tgz",
|
||||
"integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",
|
||||
"dev": true,
|
||||
"requires": {},
|
||||
"requires": {
|
||||
"ajv": "^8.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ajv": {
|
||||
"version": "https://registry.npmmirror.com/ajv/-/ajv-8.11.0.tgz",
|
||||
"version": "8.11.0",
|
||||
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.11.0.tgz",
|
||||
"integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"json-schema-traverse": "^1.0.0",
|
||||
|
@ -14272,9 +14272,7 @@
|
|||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
|
||||
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
|
||||
<div class="col-9">
|
||||
<Field name="brand" class="form-select" v-model="brand" id="brand" as="select">
|
||||
<Field name="brand" class="form-select" v-model="activeCamera.brand_key" id="brand" as="select">
|
||||
<option v-for="brand in brands" :key="brand.schluessel" :value="brand.schluessel" >{{brand.name}}</option>
|
||||
<small class="text-danger" v-if="errors.brand">{{errors.brand}}</small>
|
||||
</Field>
|
||||
|
@ -51,7 +51,7 @@
|
|||
<label for="condition">Zustand</label>
|
||||
</div>
|
||||
<div class="col-9">
|
||||
<Field name="condition" class="form-select" v-model="condition" id="condition" as="select">
|
||||
<Field name="condition" class="form-select" v-model="activCamer.condition_key" id="condition" as="select">
|
||||
<option v-for="condition in conditions" :key="condition.schluessel" :value="condition.schluessel" >{{condition.name}}</option>
|
||||
<small class="text-danger" v-if="errors.condition">{{errors.condition}}</small>
|
||||
</Field>
|
||||
|
@ -63,7 +63,7 @@
|
|||
<label for="buildtype">Bauform</label>
|
||||
</div>
|
||||
<div class="col-9">
|
||||
<Field name="buildtype" class=" form-select" v-model="buildtype" id="buildtype" as="select">
|
||||
<Field name="buildtype" class=" form-select" v-model="activeCamer.buildtype_key" id="buildtype" as="select">
|
||||
<option v-for="buildtype in buildtypes" :key="buildtype.schluessel" :value="buildtype.schluessel" >{{buildtype.name}}</option>
|
||||
<small class="text-danger" v-if="errors.buildtype">{{errors.buildtype}}</small>
|
||||
</Field>
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
export default class BilliDB {
|
||||
DB_VERSION;
|
||||
DB_NAME;
|
||||
constructor(dbName, dbVersion) {
|
||||
this.DB_NAME = dbName;
|
||||
this.DB_VERSION = dbVersion;
|
||||
}
|
||||
async getDb() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = window.indexedDB.open(this.DB_NAME, this.DB_VERSION);
|
||||
request.onerror = e => {
|
||||
console.log("Error opening db", e);
|
||||
reject("Error");
|
||||
};
|
||||
request.onsuccess = e => {
|
||||
console.log("connect erfolgreich");
|
||||
// @ts-ignore
|
||||
resolve(e.target.result);
|
||||
};
|
||||
request.onupgradeneeded = e => {
|
||||
console.log("onupgradeneeded");
|
||||
// @ts-ignore
|
||||
const db = e.target.result;
|
||||
db.createObjectStore("cameras", { autoIncrement: false, keyPath: 'id' });
|
||||
db.createObjectStore("brands", { autoIncrement: false, keyPath: 'schluessel' });
|
||||
db.createObjectStore("conditions", { autoIncrement: false, keyPath: 'schluessel' });
|
||||
db.createObjectStore("buildtypes", { autoIncrement: false, keyPath: 'schluessel' });
|
||||
};
|
||||
});
|
||||
}
|
||||
async saveItem(item, storeId) {
|
||||
const db = await this.getDb();
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log("Starting Add Transaction");
|
||||
// @ts-ignore
|
||||
const trans = db.transaction([storeId], 'readwrite');
|
||||
trans.oncomplete = (e) => {
|
||||
resolve(e);
|
||||
};
|
||||
trans.onerror = (e) => {
|
||||
console.log("on Error", e);
|
||||
reject(e);
|
||||
};
|
||||
const store = trans.objectStore(storeId);
|
||||
store.add(item);
|
||||
store.onerror = (e) => {
|
||||
console.log("Error on Store", e);
|
||||
};
|
||||
store.oncomplete = (e) => {
|
||||
console.log("oncomplete on Store", e);
|
||||
};
|
||||
store.onsuccess = (e) => {
|
||||
console.log("onsuccess on Store", e);
|
||||
};
|
||||
});
|
||||
}
|
||||
async saveItems(items, storeId) {
|
||||
const db = await this.getDb();
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log("Starting Add Transaction");
|
||||
// @ts-ignore
|
||||
const trans = db.transaction([storeId], 'readwrite');
|
||||
trans.oncomplete = (e) => {
|
||||
resolve(e);
|
||||
};
|
||||
trans.onerror = (e) => {
|
||||
console.log("on Error", e);
|
||||
reject(e);
|
||||
};
|
||||
const store = trans.objectStore(storeId);
|
||||
items.forEach((item) => {
|
||||
store.add(item);
|
||||
});
|
||||
store.onerror = (e) => {
|
||||
console.log("Error on Store", e);
|
||||
};
|
||||
store.oncomplete = (e) => {
|
||||
console.log("oncomplete on Store", e);
|
||||
};
|
||||
store.onsuccess = (e) => {
|
||||
console.log("onsuccess on Store", e);
|
||||
};
|
||||
});
|
||||
}
|
||||
async getItems(storeId) {
|
||||
console.log("DB-getItems", storeId);
|
||||
const db = await this.getDb();
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log("DB-getItems: Starting Get Transaction");
|
||||
const items = [];
|
||||
// @ts-ignore
|
||||
const trans = db.transaction([storeId], 'readonly');
|
||||
trans.oncomplete = (e) => {
|
||||
resolve(items);
|
||||
};
|
||||
trans.onerror = (e) => {
|
||||
console.log("on Error", e);
|
||||
reject(e);
|
||||
};
|
||||
const store = trans.objectStore(storeId);
|
||||
console.log("--> We have try to get a cursor");
|
||||
store.openCursor().onsuccess = (e) => {
|
||||
console.log("--> We have a cursor", e.target.result);
|
||||
const cursor = e.target.result;
|
||||
if (cursor) {
|
||||
items.push(cursor.value);
|
||||
cursor.continue();
|
||||
}
|
||||
console.log("onsuccess on getAll", items);
|
||||
// resolve(e.target.result);
|
||||
};
|
||||
store.onerror = (e) => {
|
||||
console.log("Error on getAll", e);
|
||||
};
|
||||
store.oncomplete = (e) => {
|
||||
console.log("oncomplete on getAll", e);
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,OAAO;IAChB,UAAU,CAAS;IACnB,OAAO,CAAS;IACxB,YAAY,MAAa,EAAE,SAAgB;QACvC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IAID,KAAK,CAAC,KAAK;QACP,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAEnC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAErE,OAAO,CAAC,OAAO,GAAG,CAAC,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CAAA;QACL,CAAC,CAAC,CAAA;IACN,CAAC;CAEJ"}
|
109
src/main.js
109
src/main.js
|
@ -1,37 +1,80 @@
|
|||
import Vue from 'vue';
|
||||
import { createApp } from 'vue';
|
||||
import App from './App.vue';
|
||||
import Keycloak from "keycloak-js";
|
||||
const initOptions = {
|
||||
url: 'http://auth.toking.de/', realm: 'toking', clientId: 'billibox', onLoad: 'login-required',
|
||||
redirectUri: 'http://127.0.0.1:8080/'
|
||||
};
|
||||
//const app = createApp(App);
|
||||
const keycloak = Keycloak(initOptions);
|
||||
keycloak.init({ onLoad: initOptions.onLoad }).then((auth) => {
|
||||
if (!auth) {
|
||||
window.location.reload();
|
||||
}
|
||||
else {
|
||||
Vue.$log.info("Authenticated");
|
||||
new Vue({
|
||||
el: '#app',
|
||||
render: h => h(App, { props: { keycloak: keycloak } })
|
||||
import store from './store';
|
||||
import router from './router';
|
||||
import VueKeyCloak from '@dsb-norge/vue-keycloak-js';
|
||||
const app = createApp(App);
|
||||
app.use(store);
|
||||
app.use(router);
|
||||
app.use(VueKeyCloak, {
|
||||
config: {
|
||||
url: 'https://auth.toking.de/',
|
||||
realm: 'toking',
|
||||
clientId: 'billibox',
|
||||
redirectUri: 'http://127.0.0.1:8080/',
|
||||
onLoad: 'login-required',
|
||||
enableLogging: true,
|
||||
scope: 'open-id'
|
||||
},
|
||||
init: {
|
||||
onLoad: 'login-required'
|
||||
},
|
||||
onReady(keycloak) {
|
||||
store.dispatch("storeKeycloak", keycloak).then((res) => {
|
||||
keycloak.loadUserProfile().then((res) => {
|
||||
store.dispatch("storeUserProfile", res);
|
||||
console.log("res", res);
|
||||
});
|
||||
});
|
||||
}
|
||||
//Token Refresh
|
||||
setInterval(() => {
|
||||
keycloak.updateToken(70).then((refreshed) => {
|
||||
if (refreshed) {
|
||||
Vue.$log.info('Token refreshed' + refreshed);
|
||||
}
|
||||
else {
|
||||
Vue.$log.warn('Token not refreshed, valid for '
|
||||
+ Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds');
|
||||
}
|
||||
}).catch(() => {
|
||||
Vue.$log.error('Failed to refresh token');
|
||||
});
|
||||
}, 6000);
|
||||
}).catch(() => {
|
||||
Vue.$log.error("Authenticated Failed");
|
||||
});
|
||||
app.mount('#app');
|
||||
// import Vue from 'vue';
|
||||
// import App from './App.vue';
|
||||
// import Keycloak from "keycloak-js";
|
||||
// const initOptions = {
|
||||
// url: 'https://auth.toking.de/', realm: 'toking', clientId: 'billibox', onLoad: 'login-required',
|
||||
// redirectUri: 'http://127.0.0.1:8080/'
|
||||
// };
|
||||
// //const app = createApp(App);
|
||||
// const keycloak = Keycloak(initOptions);
|
||||
// keycloak.init({ onLoad: 'login-required', redirectUri: 'http://127.0.0.1:8080/' }).then((auth) => {
|
||||
// if (!auth) {
|
||||
// window.location.reload();
|
||||
// }
|
||||
// else {
|
||||
// // @ts-ignore
|
||||
// console.info("Authenticated", auth);
|
||||
// // @ts-ignore
|
||||
//
|
||||
// new Vue({
|
||||
// el: '#app',
|
||||
// render: h => h(App, { props: { keycloak: keycloak } })
|
||||
// });
|
||||
// }
|
||||
// //Token Refresh
|
||||
// // setInterval(() => {
|
||||
// // keycloak.updateToken(70).then((refreshed) => {
|
||||
// // if (refreshed) {
|
||||
// // // @ts-ignore
|
||||
// //
|
||||
// // console.info('Token refreshed' + refreshed);
|
||||
// // }
|
||||
// // else {
|
||||
// // // @ts-ignore
|
||||
// //
|
||||
// // console.warn('Token not refreshed, valid for '
|
||||
// // + Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds');
|
||||
// // }
|
||||
// // }).catch(() => {
|
||||
// // // @ts-ignore
|
||||
// //
|
||||
// // console.error('Failed to refresh token');
|
||||
// // });
|
||||
// // }, 6000);
|
||||
// }).catch(() => {
|
||||
// // @ts-ignore
|
||||
//
|
||||
// console.error("Authenticated Failed");
|
||||
// });
|
||||
//# sourceMappingURL=main.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,GAAG,MAAM,WAAW,CAAA;AAC3B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,MAAM,MAAM,UAAU,CAAA;AAG7B,SAAS,CAAC,GAAG,CAAC;KACT,GAAG,CAAC,KAAK,CAAC;KACV,GAAG,CAAC,MAAM,CAAC;KACX,KAAK,CAAC,MAAM,CAAC,CAAA"}
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,GAAG,MAAM,WAAW,CAAA;AAC3B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,OAAO,WAAW,MAAM,4BAA4B,CAAA;AAIpD,MAAM,GAAG,GACT,SAAS,CAAC,GAAG,CAAC,CAAC;AAIf,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACd,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACf,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE;IACb,MAAM,EAAE;QACJ,GAAG,EAAE,yBAAyB;QAC9B,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,wBAAwB;QACrC,MAAM,EAAE,gBAAgB;QACxB,aAAa,EAAE,IAAI;QACnB,KAAK,EAAE,SAAS;KACnB;IACD,IAAI,EAAE;QACF,MAAM,EAAE,gBAAgB;KAC3B;IACD,OAAO,CAAE,QAA0B;QAChC,KAAK,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAE,CAAC,GAAG,EAAE,EAAE;YAEhD,QAAQ,CAAC,eAAe,EAAE,CAAC,IAAI,CAAE,CAAC,GAAG,EAAE,EAAE;gBACrC,KAAK,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;gBACxC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;QAEX,CAAC,CACA,CAAA;IACJ,CAAC;CACJ,CAAC,CAAA;AAEN,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;AASjB,yBAAyB;AACzB,+BAA+B;AAC/B,sCAAsC;AACtC,wBAAwB;AACxB,uGAAuG;AACvG,4CAA4C;AAC5C,KAAK;AACL,iCAAiC;AACjC,0CAA0C;AAC1C,uGAAuG;AACvG,mBAAmB;AACnB,oCAAoC;AACpC,QAAQ;AACR,aAAa;AACb,wBAAwB;AACxB,+CAA+C;AAC/C,wBAAwB;AACxB,EAAE;AACF,oBAAoB;AACpB,0BAA0B;AAC1B,qEAAqE;AACrE,cAAc;AACd,QAAQ;AACR,sBAAsB;AACtB,6BAA6B;AAC7B,4DAA4D;AAC5D,kCAAkC;AAClC,mCAAmC;AACnC,SAAS;AACT,kEAAkE;AAClE,mBAAmB;AACnB,wBAAwB;AACxB,mCAAmC;AACnC,SAAS;AACT,oEAAoE;AACpE,iIAAiI;AACjI,mBAAmB;AACnB,8BAA8B;AAC9B,+BAA+B;AAC/B,SAAS;AACT,2DAA2D;AAC3D,iBAAiB;AACjB,mBAAmB;AACnB,mBAAmB;AACnB,oBAAoB;AACpB,EAAE;AACF,6CAA6C;AAC7C,MAAM"}
|
|
@ -14,9 +14,24 @@ const router = createRouter({
|
|||
}
|
||||
]
|
||||
});
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.meta.requiresAuth && !store.getters.isAuthenticated) {
|
||||
next("/");
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
if (to.meta.requiresAuth) {
|
||||
// @ts-ignore
|
||||
const kc = store.getters.keycloak;
|
||||
console.log(kc);
|
||||
while (typeof kc == "undefined" || kc.createLoginUrl === null) {
|
||||
await sleep(100);
|
||||
}
|
||||
if (kc.authenticated) {
|
||||
next();
|
||||
}
|
||||
else {
|
||||
const loginUrl = kc.createLoginUrl();
|
||||
window.location.replace(loginUrl);
|
||||
}
|
||||
}
|
||||
else {
|
||||
next();
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,MAAM,MAAM,GAAG,YAAY,CAAE;IACzB,UAAU;IACV,OAAO,EAAE,gBAAgB,EAAE;IAC3B,MAAM,EAAE,CAAE,GAAG,MAAM;QACf;YACI,IAAI,EAAE,kBAAkB;YACxB,SAAS,EAAE,YAAY;YACvB,mCAAmC;YAC/C,2BAA2B;SAClB;KACJ;CAEJ,CAAC,CAAC;AAGH,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IACjC,IAAG,EAAE,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE;QACvD,IAAI,CAAC,GAAG,CAAC,CAAA;KACZ;SAAM;QACH,IAAI,EAAE,CAAC;KACV;AACL,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,MAAM,MAAM,GAAG,YAAY,CAAE;IACzB,UAAU;IACV,OAAO,EAAE,gBAAgB,EAAE;IAC3B,MAAM,EAAE,CAAE,GAAG,MAAM;QACf;YACI,IAAI,EAAE,kBAAkB;YACxB,SAAS,EAAE,YAAY;YACvB,mCAAmC;YAC/C,2BAA2B;SAClB;KACJ;CAEJ,CAAC,CAAC;AAGH,SAAS,KAAK,CAAC,EAAE;IACb,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC;AAED,MAAM,CAAC,UAAU,CAAC,KAAK,EAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IACtC,IAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE;QACrB,aAAa;QACb,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAEhB,OAAM,OAAO,EAAE,IAAI,WAAW,IAAI,EAAE,CAAC,cAAc,KAAM,IAAI,EAAE;YAC3D,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;QACD,IAAG,EAAE,CAAC,aAAa,EAAE;YACjB,IAAI,EAAE,CAAA;SACT;aACI;YACD,MAAM,QAAQ,GAAG,EAAE,CAAC,cAAc,EAAE,CAAA;YACpC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;SACpC;KACJ;SAAM;QACH,IAAI,EAAE,CAAC;KACV;AACL,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
|
@ -1,20 +1,19 @@
|
|||
import store from "@/store";
|
||||
import ReadCameraPage from "@/pages/ReadCameraPage.vue";
|
||||
import ReadListPage from "@/pages/ReadListPage.vue";
|
||||
import AuthRedirect from '@/components/auth/AuthRedirect.vue';
|
||||
const appRoutes = [
|
||||
{
|
||||
path: "/",
|
||||
alias: "/home",
|
||||
name: "home",
|
||||
component: () => import('@/pages/HomePage.vue'),
|
||||
beforeEnter: (to, from, next) => {
|
||||
if (store.getters.isAuthenticated) {
|
||||
next("/shop");
|
||||
}
|
||||
else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
// beforeEnter: (to:any, from:any, next:any) => {
|
||||
// if (store.getters.isAuthenticated) {
|
||||
// next("/list");
|
||||
// } else {
|
||||
// next();
|
||||
// }
|
||||
// }
|
||||
},
|
||||
{
|
||||
path: "/read/cameara/:id",
|
||||
|
@ -35,6 +34,24 @@ const appRoutes = [
|
|||
// enterTransition: "rubberBand"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/auth",
|
||||
component: AuthRedirect,
|
||||
props: true,
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
// enterTransition: "rubberBand"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/profile",
|
||||
component: AuthRedirect,
|
||||
props: true,
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
// enterTransition: "rubberBand"
|
||||
}
|
||||
},
|
||||
];
|
||||
export default appRoutes;
|
||||
//# sourceMappingURL=app-routes.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"app-routes.js","sourceRoot":"","sources":["app-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,cAAc,MAAM,4BAA4B,CAAC;AACxD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAGpD,MAAM,SAAS,GAAG;IACd;QACI,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC;QAC/C,WAAW,EAAE,CAAC,EAAM,EAAE,IAAQ,EAAE,IAAQ,EAAE,EAAE;YACxC,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE;gBAC/B,IAAI,CAAC,OAAO,CAAC,CAAC;aACjB;iBAAM;gBACH,IAAI,EAAE,CAAC;aACV;QACL,CAAC;KACJ;IACD;QACI,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,cAAc;QACzB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE;YACF,YAAY,EAAE,KAAK;YACpB,gCAAgC;SAClC;KAEJ;IAED;QACI,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE;YACF,YAAY,EAAE,KAAK;YACnB,gCAAgC;SACnC;KAEJ;CACJ,CAAA;AAED,eAAe,SAAS,CAAC"}
|
||||
{"version":3,"file":"app-routes.js","sourceRoot":"","sources":["app-routes.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,4BAA4B,CAAC;AACxD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,YAAY,MAAM,oCAAoC,CAAA;AAG7D,MAAM,SAAS,GAAG;IACd;QACI,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC;QAC/C,iDAAiD;QACjD,2CAA2C;QAC3C,yBAAyB;QACzB,eAAe;QACf,kBAAkB;QAClB,QAAQ;QACR,IAAI;KACP;IACD;QACI,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,cAAc;QACzB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE;YACF,YAAY,EAAE,KAAK;YACpB,gCAAgC;SAClC;KAEJ;IAED;QACI,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE;YACF,YAAY,EAAE,KAAK;YACnB,gCAAgC;SACnC;KACJ;IACD;QACI,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE;YACF,YAAY,EAAE,IAAI;YAClB,gCAAgC;SACnC;KACJ;IACD;QACI,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE;YACF,YAAY,EAAE,IAAI;YAClB,gCAAgC;SACnC;KACJ;CACJ,CAAA;AAED,eAAe,SAAS,CAAC"}
|
34
src/seed.js
34
src/seed.js
|
@ -1,5 +1,5 @@
|
|||
|
||||
export const shape = [
|
||||
export const SEED_VERSION = 1;
|
||||
export const conditions = [
|
||||
{ schluessel: "neu", name: "neu", beschreibung: '' },
|
||||
{ schluessel: "neuwertig", name: "neuwertig", beschreibung: '' },
|
||||
{ schluessel: "lg", name: "leichte Gebrauchsspuren", beschreibung: '' },
|
||||
|
@ -240,6 +240,36 @@ export const cameras = [
|
|||
description: "Langer Text",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 1980,
|
||||
},
|
||||
{
|
||||
id: "agfa_03",
|
||||
brand_key: "agfa",
|
||||
shape_key: "neuwertig",
|
||||
name: "Agfa Click",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 2000,
|
||||
},
|
||||
{
|
||||
id: "agfa_05",
|
||||
brand_key: "agfa",
|
||||
shape_key: "neuwertig",
|
||||
name: "Agfa Box",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 1980,
|
||||
},
|
||||
{
|
||||
id: "cancon_07",
|
||||
brand_key: "canon",
|
||||
shape_key: "neuwertig",
|
||||
name: "Canon EOS",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 1980,
|
||||
}
|
||||
];
|
||||
//# sourceMappingURL=seed.js.map
|
File diff suppressed because one or more lines are too long
125
src/seed.ts
125
src/seed.ts
|
@ -49,6 +49,7 @@ export const buildtype= [
|
|||
{schluessel: "sof", name: "Sofortbild", beschreibung: ''},
|
||||
|
||||
];
|
||||
|
||||
export const brands= [
|
||||
{schluessel: 'agfa', name: 'Agfa', beschreibung: 'Filme aller Art sowie analoge Kameras'},
|
||||
{schluessel: 'alpa', name: 'Alpa', beschreibung: 'Mittelformat analog/digital (früher Kleinbild).'},
|
||||
|
@ -207,98 +208,204 @@ export const brands= [
|
|||
{schluessel: 'zorki', name: 'Zorki', beschreibung: 'Kleinbildkameras.'},
|
||||
]
|
||||
|
||||
export const lenses = [
|
||||
{
|
||||
id: "pentax-zoom",
|
||||
name: "name",
|
||||
lensmount_key:"",
|
||||
aperture_max: "0.0",
|
||||
focal_length_min: "50",
|
||||
focal_length_max: null,
|
||||
autofocus: false,
|
||||
manufacturer_key: "",
|
||||
brand_key:"",
|
||||
description: "Langer Text",
|
||||
year_manufactured_from: "",
|
||||
year_manufactured_to: "",
|
||||
price_purchased: 0.0,
|
||||
price_hisotric: 0.0,
|
||||
price_current: 0.0,
|
||||
work_done: "",
|
||||
ligthMesure: "",
|
||||
special:"",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 1980
|
||||
}
|
||||
];
|
||||
|
||||
export const cameras = [
|
||||
{
|
||||
id: "pentax_19",
|
||||
brand_key: "pentax",
|
||||
shape_key: "neuwertig",
|
||||
condition_key: "neuwertig",
|
||||
name:"Pentax K30",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_manufactured_from: "",
|
||||
year_manufactured_to: "",
|
||||
manufacturer_key: "",
|
||||
price_purchased: 0.0,
|
||||
price_hisotric: 0.0,
|
||||
price_current: 0.0,
|
||||
work_done: "",
|
||||
ligthMesure: "",
|
||||
special:"",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 2022,
|
||||
},
|
||||
{
|
||||
id: "pentax_20",
|
||||
brand_key: "pentax",
|
||||
shape_key: "neuwertig",
|
||||
condition_key: "neuwertig",
|
||||
name:"Pentax K50",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_manufactured_from: "",
|
||||
year_manufactured_to: "",
|
||||
manufacturer_key: "",
|
||||
price_purchased: 0.0,
|
||||
price_hisotric: 0.0,
|
||||
price_current: 0.0,
|
||||
work_done: "",
|
||||
ligthMesure: "",
|
||||
special:"",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 2022,
|
||||
},
|
||||
{
|
||||
id: "pentax_21",
|
||||
brand_key: "pentax",
|
||||
shape_key: "neuwertig",
|
||||
condition_key: "neuwertig",
|
||||
name:"Pentax K3",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_manufactured_from: "",
|
||||
year_manufactured_to: "",
|
||||
manufacturer_key: "",
|
||||
price_purchased: 0.0,
|
||||
price_hisotric: 0.0,
|
||||
price_current: 0.0,
|
||||
work_done: "",
|
||||
ligthMesure: "",
|
||||
special:"",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 2022,
|
||||
},
|
||||
{
|
||||
id: "agfa_01",
|
||||
brand_key: "agfa",
|
||||
shape_key: "neuwertig",
|
||||
condition_key: "neuwertig",
|
||||
name: "Agfa Click",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_manufactured_from: "",
|
||||
year_manufactured_to: "",
|
||||
manufacturer_key: "",
|
||||
price_purchased: 0.0,
|
||||
price_hisotric: 0.0,
|
||||
price_current: 0.0,
|
||||
work_done: "",
|
||||
ligthMesure: "",
|
||||
special:"",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 2000,
|
||||
},
|
||||
{
|
||||
id: "agfa_02",
|
||||
brand_key: "agfa",
|
||||
shape_key: "neuwertig",
|
||||
condition_key: "neuwertig",
|
||||
name: "Agfa Box",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_manufactured_from: "",
|
||||
year_manufactured_to: "",
|
||||
manufacturer_key: "",
|
||||
price_purchased: 0.0,
|
||||
price_hisotric: 0.0,
|
||||
price_current: 0.0,
|
||||
work_done: "",
|
||||
ligthMesure: "",
|
||||
special:"",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 1980,
|
||||
},
|
||||
{
|
||||
id: "cancon_02",
|
||||
brand_key: "canon",
|
||||
shape_key: "neuwertig",
|
||||
condition_key: "neuwertig",
|
||||
name: "Canon EOS",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_manufactured_from: "",
|
||||
year_manufactured_to: "",
|
||||
manufacturer_key: "",
|
||||
price_purchased: 0.0,
|
||||
price_hisotric: 0.0,
|
||||
price_current: 0.0,
|
||||
work_done: "",
|
||||
ligthMesure: "",
|
||||
special:"",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 1980,
|
||||
},
|
||||
{
|
||||
id: "agfa_03",
|
||||
brand_key: "agfa",
|
||||
shape_key: "neuwertig",
|
||||
condition_key: "neuwertig",
|
||||
name: "Agfa Click",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_manufactured_from: "",
|
||||
year_manufactured_to: "",
|
||||
manufacturer_key: "",
|
||||
price_purchased: 0.0,
|
||||
price_hisotric: 0.0,
|
||||
price_current: 0.0,
|
||||
work_done: "",
|
||||
ligthMesure: "",
|
||||
special:"",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 2000,
|
||||
},
|
||||
{
|
||||
id: "agfa_05",
|
||||
brand_key: "agfa",
|
||||
shape_key: "neuwertig",
|
||||
condition_key: "neuwertig",
|
||||
name: "Agfa Box",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_manufactured_from: "",
|
||||
year_manufactured_to: "",
|
||||
manufacturer_key: "",
|
||||
price_purchased: 0.0,
|
||||
price_hisotric: 0.0,
|
||||
price_current: 0.0,
|
||||
work_done: "",
|
||||
ligthMesure: "",
|
||||
special:"",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 1980,
|
||||
},
|
||||
{
|
||||
id: "cancon_07",
|
||||
brand_key: "canon",
|
||||
shape_key: "neuwertig",
|
||||
condition_key: "neuwertig",
|
||||
name: "Canon EOS",
|
||||
buildtype: "slr",
|
||||
description: "Langer Text",
|
||||
year_manufactured_from: "",
|
||||
year_manufactured_to: "",
|
||||
manufacturer_key: "",
|
||||
price_purchased: 0.0,
|
||||
price_hisotric: 0.0,
|
||||
price_current: 0.0,
|
||||
work_done: "",
|
||||
ligthMesure: "",
|
||||
special:"",
|
||||
year_of_production: 2000,
|
||||
year_of_purchase: 1980,
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -1,21 +1,51 @@
|
|||
const keyInitOptions = {
|
||||
url: 'https://auth.toking.de/',
|
||||
realm: 'toking',
|
||||
clientId: 'billibox',
|
||||
redirectUri: 'http://127.0.0.1:8080/',
|
||||
onLoad: 'login-required',
|
||||
enableLogging: true,
|
||||
scope: 'open-id'
|
||||
};
|
||||
const state = {
|
||||
userId: null,
|
||||
token: null
|
||||
keycloak: null,
|
||||
userProfile: null,
|
||||
};
|
||||
const getters = {
|
||||
isAuthenticated(state) {
|
||||
return state.token;
|
||||
return state.keycloak.authenticated;
|
||||
},
|
||||
token: (state) => state.token
|
||||
token: (state) => state.token,
|
||||
keycloak: (state) => state.keycloak,
|
||||
userProfile: (state) => state.userProfile
|
||||
};
|
||||
const mutations = {
|
||||
setUser(context, payload) {
|
||||
console.log("mutations.setUser", payload);
|
||||
state.userId = payload.userId;
|
||||
state.token = payload.token;
|
||||
storeKeycloak(context, payload) {
|
||||
console.log("mutations.storeKeycloak");
|
||||
state.keycloak = payload;
|
||||
},
|
||||
storeUserProfile(context, payload) {
|
||||
state.userProfile = payload;
|
||||
}
|
||||
};
|
||||
const actions = {
|
||||
storeKeycloak(context, payload) {
|
||||
console.log("action.storeKeycloak");
|
||||
context.commit("storeKeycloak", payload);
|
||||
},
|
||||
getToken(context, payload) {
|
||||
console.log("actions.getToken");
|
||||
console.log("Authenticated", context.state.keycloak);
|
||||
context.state.keycloak.updateToken(70).then((refreshed) => {
|
||||
console.log("Refresehd Token", refreshed);
|
||||
}).catch((err) => {
|
||||
console.log("Error", err);
|
||||
});
|
||||
},
|
||||
storeUserProfile(context, payload) {
|
||||
context.commit("storeUserProfile", payload);
|
||||
}
|
||||
};
|
||||
const actions = {};
|
||||
const modules = {};
|
||||
const authModule = {
|
||||
state,
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAGA,MAAM,KAAK,GAAG;IACV,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;CACd,CAAC;AAEF,MAAM,OAAO,GAAG;IACZ,eAAe,CAAC,KAAS;QACrB,OAAO,KAAK,CAAC,KAAK,CAAA;IACtB,CAAC;IACD,KAAK,EAAE,CAAC,KAAS,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK;CAEpC,CAAC;AAEF,MAAM,SAAS,GAAG;IACd,OAAO,CAAC,OAA+B,EAAE,OAAW;QAChD,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QAC1C,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC9B,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAChC,CAAC;CACJ,CAAC;AAEF,MAAM,OAAO,GAAG,EAAE,CAAC;AACnB,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB,MAAM,UAAU,GAAG;IACf,KAAK;IACL,OAAO;IACP,SAAS;IACT,OAAO;IACP,OAAO;CACV,CAAA;AAED,eAAe,UAAU,CAAA"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAGA,MAAM,cAAc,GAAG;IACnB,GAAG,EAAE,yBAAyB;IAC9B,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,wBAAwB;IACrC,MAAM,EAAE,gBAAgB;IACxB,aAAa,EAAE,IAAI;IACnB,KAAK,EAAE,SAAS;CAEnB,CA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AC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAC,EAAE;YACZ,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAA;IACN,CAAC;IACD,gBAAgB,CAAC,OAA+B,EAAE,OAAW;QACzD,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAA;IAC/C,CAAC;CAEA,CAAC;AACN,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB,MAAM,UAAU,GAAG;IACf,KAAK;IACL,OAAO;IACP,SAAS;IACT,OAAO;IACP,OAAO;CACV,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@ -1,19 +1,25 @@
|
|||
import * as seed from "@/seed";
|
||||
import BilliDB from "@/indexdDB";
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { SEED_VERSION } from "@/seed";
|
||||
const db = new BilliDB("billibox", 3);
|
||||
const state = {
|
||||
isInitialized: false,
|
||||
cameras: [],
|
||||
brands: [],
|
||||
shapes: [],
|
||||
conditions: [],
|
||||
buildtypes: []
|
||||
};
|
||||
const getters = {
|
||||
cameras: (state) => state.cameras,
|
||||
cameras: (state) => {
|
||||
return state.cameras.sort();
|
||||
},
|
||||
camera: (state) => (id) => state.cameras.find((camera) => camera.id === id),
|
||||
activeCamera: (state) => state.cameras.find((camera) => camera.active),
|
||||
brands: (state) => state.brands,
|
||||
brand: (state) => (id) => state.brands.find((brand) => brand.schluessel === id),
|
||||
shapes: (state) => state.shapes,
|
||||
shape: (state) => (id) => state.shapes.find((shape) => shape.schluessel === id),
|
||||
conditions: (state) => state.conditions,
|
||||
condition: (state) => (id) => state.conditions.find((condition) => condition.schluessel === id),
|
||||
buildtypes: (state) => state.buildtypes,
|
||||
buildtype: (state) => (id) => state.buildtypes.find((buildtype) => buildtype.schluessel === id),
|
||||
isInitialized: (state) => state.isInitialized,
|
||||
|
@ -31,25 +37,46 @@ const mutations = {
|
|||
});
|
||||
console.log("STORE", state.cameras);
|
||||
},
|
||||
storeCamera(sate, payload) {
|
||||
// console.log("mutation.storeCamera", payload)
|
||||
const objCamera = state.cameras.find((camera) => camera.id === payload.id);
|
||||
if (objCamera) {
|
||||
// console.log("found existing Camera", objCamera.id);
|
||||
payload.edit = false;
|
||||
objCamera.name = payload.name;
|
||||
}
|
||||
else {
|
||||
// console.log("creating new Camera");
|
||||
payload.edit = false;
|
||||
state.cameras.push(payload);
|
||||
}
|
||||
return payload.id;
|
||||
},
|
||||
setCameraActiveState(state, payload) {
|
||||
// console.log("setCameraActiveState", payload);
|
||||
state.cameras.map((camera) => camera.active = false);
|
||||
const objCamera = state.cameras.find((camera) => camera.id === payload.id);
|
||||
objCamera.active = payload.active;
|
||||
},
|
||||
setBrands(state, payload) {
|
||||
console.log("mutation.setBrands");
|
||||
state.brands = payload;
|
||||
console.log("STORE", state.brands);
|
||||
setCameraEditState(state, payload) {
|
||||
state.cameras.map((camera) => camera.edit = false);
|
||||
const objCamera = state.cameras.find((camera) => camera.id === payload.id);
|
||||
objCamera.edit = payload.edit;
|
||||
},
|
||||
setShapes(state, payload) {
|
||||
console.log("mutation.setShapes");
|
||||
state.shapes = payload;
|
||||
console.log("STORE", state.shapes);
|
||||
setBrands(state, payload) {
|
||||
// console.log("mutation.setBrands");
|
||||
state.brands = payload;
|
||||
// console.log("STORE", state.brands);
|
||||
},
|
||||
setConditions(state, payload) {
|
||||
//console.log("mutation.setConditions");
|
||||
state.conditions = payload;
|
||||
//console.log("STORE", state.conditions);
|
||||
},
|
||||
setBuildtypes(state, payload) {
|
||||
console.log("mutation.setBuildtypes");
|
||||
//console.log("mutation.setBuildtypes");
|
||||
state.buildtypes = payload;
|
||||
console.log("STORE", state.buildtypes);
|
||||
//console.log("STORE", state.buildtypes);
|
||||
},
|
||||
setInitialized(state, payload) {
|
||||
state.isInitialized = payload;
|
||||
|
@ -57,7 +84,11 @@ const mutations = {
|
|||
};
|
||||
const actions = {
|
||||
fetchCameras(context) {
|
||||
context.commit("setCameras", seed.cameras);
|
||||
console.log("action.fetchCameras");
|
||||
db.getItems("cameras").then((cameras) => {
|
||||
console.log("From DB", cameras);
|
||||
context.commit("setCameras", cameras);
|
||||
});
|
||||
},
|
||||
fetchBrands(context) {
|
||||
context.commit("setBrands", seed.brands);
|
||||
|
@ -65,19 +96,53 @@ const actions = {
|
|||
fetchBuildTypes(context) {
|
||||
context.commit("setBuildtypes", seed.buildtype);
|
||||
},
|
||||
fetchShape(context) {
|
||||
context.commit("setShapes", seed.shape);
|
||||
fetchCondition(context) {
|
||||
context.commit("setConditions", seed.conditions);
|
||||
},
|
||||
setCameraActiveState(context, payload) {
|
||||
console.log("action.setCameraActiveState", payload);
|
||||
const cameraObj = state.cameras.find((camera) => camera.id === payload.cameraId);
|
||||
context.commit("setCameraActiveState", { id: payload.cameraId, active: payload.active });
|
||||
},
|
||||
initialize(context) {
|
||||
setCameraEditState(context, payload) {
|
||||
console.log("action.setCameraEditState", payload);
|
||||
const cameraObj = state.cameras.find((camera) => camera.id === payload.cameraId);
|
||||
context.commit("setCameraEditState", { id: payload.cameraId, edit: payload.edit });
|
||||
},
|
||||
storeCamera(context, payload) {
|
||||
// console.log("action.storeCamera", payload)
|
||||
if (!payload.id)
|
||||
payload.id = uuidv4();
|
||||
//console.log(" ... with id ", payload.id);
|
||||
//console.log("Try to save to indexDB");
|
||||
db.saveItem(payload, "cameras").then((res) => {
|
||||
console.log("DB-Save resolved", res);
|
||||
});
|
||||
context.commit("storeCamera", payload);
|
||||
context.commit("setCameraActiveState", { cameraId: payload.id, active: true });
|
||||
},
|
||||
initialize(context, payload) {
|
||||
db.getDb();
|
||||
const promises = [];
|
||||
const seedVersion = localStorage.getItem("SEED_VERSION") || 0;
|
||||
if (payload.seed && seedVersion < SEED_VERSION) {
|
||||
console.log("SEEDING database");
|
||||
promises.push(db.saveItems(seed.brands, "brands"));
|
||||
promises.push(db.saveItems(seed.conditions, "conditions"));
|
||||
promises.push(db.saveItems(seed.buildtype, "buildtypes"));
|
||||
promises.push(db.saveItems(seed.cameras, "cameras"));
|
||||
localStorage.setItem("SEED_VERSION", seed.SEED_VERSION.toString());
|
||||
}
|
||||
else {
|
||||
console.log("SEEDING skipped");
|
||||
}
|
||||
Promise.all(promises).then((e) => {
|
||||
console.log("All written to store");
|
||||
});
|
||||
context.dispatch("fetchCameras");
|
||||
context.dispatch("fetchBrands");
|
||||
context.dispatch("fetchBuildTypes");
|
||||
context.dispatch("fetchShape");
|
||||
context.dispatch("fetchCondition");
|
||||
context.commit("setInitialized", true);
|
||||
}
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue