Commit d791926f authored by Reza Sahebgharan's avatar Reza Sahebgharan

feat(upload db): upload sqlite db into meteor app and mongodb

parent 35b463a8
Pipeline #1064 passed with stage
in 4 minutes and 5 seconds
...@@ -17,3 +17,5 @@ ardatan:webpack ...@@ -17,3 +17,5 @@ ardatan:webpack
ardatan:webpack-dev-middleware ardatan:webpack-dev-middleware
tmeasday:publish-counts tmeasday:publish-counts
ostrio:meteor-root
ostrio:files
...@@ -50,6 +50,9 @@ mongo-id@1.0.7 ...@@ -50,6 +50,9 @@ mongo-id@1.0.7
npm-bcrypt@0.9.3 npm-bcrypt@0.9.3
npm-mongo@3.3.0-rc190.1 npm-mongo@3.3.0-rc190.1
ordered-dict@1.1.0 ordered-dict@1.1.0
ostrio:cookies@2.5.0
ostrio:files@1.13.0
ostrio:meteor-root@1.0.8
promise@0.11.2 promise@0.11.2
random@1.1.0 random@1.1.0
rate-limit@1.0.9 rate-limit@1.0.9
......
<template>
<v-dialog v-model="HisWorklistDialog" max-width="900px">
<v-card>
<v-progress-linear
:active="HisWorklistLoading"
:indeterminate="HisWorklistLoading"
absolute
top
color="cyan lighten-2"
></v-progress-linear>
<v-card-title>
<v-icon class="mr-1" @click="internalCloseDialog">close</v-icon>
<span>{{$t("HisWorklist.title")}}</span>
</v-card-title>
<v-card-text class="ma-0 pa-0" v-if="$vuetify.breakpoint.mdAndUp">
<v-container class="cyan lighten-2" style="border-radius: 5px;">
<v-card class="pa-3 pr-6 ma-4">
<!-- <v-row dense>
<v-col cols="9">
<v-autocomplete :items="itemsOfBrands" label="Brand" v-model="selectedBrand"></v-autocomplete>
</v-col>
</v-row>-->
<v-row dense>
<v-data-table
ref="patientsDatatable"
:headers="headerOfTable"
:items="itemsOfTable"
item-key="_id"
class="elevation-1"
style="width:100%"
fixed-header
disable-sort
height="600px"
disable-pagination
hide-default-footer
></v-data-table>
</v-row>
</v-card>
</v-container>
</v-card-text>
</v-card>
</v-dialog>
</template>
<script>
import Brands from "../../imports/api/collections/brands.js";
import BrandCollections from "../../imports/api/collections/worklist4hislink.js";
import { Mongo } from "meteor/mongo";
export default {
props: ["HisWorklistDialogProp", "closeDialog", "selectedBrand"],
data: () => ({
HisWorklistLoading: false,
HisWorklistDialog: false,
limit: 15
// selectedBrand: null
}),
mounted() {},
computed: {
itemsOfBrands() {
if (this.brands && this.brands.length > 0) {
return this.brands.map(brand => {
return brand.Name;
});
}
return [];
},
itemsOfTable() {
if (this.worklist4hislink && this.worklist4hislink.length > 0) {
let worklistArray = [];
for (let worklist of this.worklist4hislink) {
let tempWorklist = {};
for (let prop in worklist) {
tempWorklist[prop] = JSON.stringify(worklist[prop]);
}
worklistArray.push(tempWorklist);
}
return worklistArray;
}
return [];
},
headerOfTable() {
if (this.worklist4hislink && this.worklist4hislink.length > 0) {
let headerNames = [];
let worklist = this.worklist4hislink[0];
for (let prop in worklist) {
headerNames.push({
text: prop,
value: prop,
class: "text-center",
width: 180
});
}
return headerNames;
}
return [];
}
},
watch: {
"$subReady.worklist4hislink"(ready) {
this.HisWorklistLoading = false;
if (this.$refs.patientsDatatable) {
this.$refs.patientsDatatable.$el
.querySelector(".v-data-table__wrapper")
.removeEventListener("scroll", this.onScroll);
this.$refs.patientsDatatable.$el
.querySelector(".v-data-table__wrapper")
.addEventListener("scroll", this.onScroll);
}
},
HisWorklistDialog(newvalue, oldvalue) {
if (newvalue == false) {
this.closeDialog();
} else {
this.HisWorklistLoading = true;
}
},
HisWorklistDialogProp(newvalue, oldvalue) {
this.HisWorklistDialog = newvalue;
}
},
methods: {
internalCloseDialog() {
this.HisWorklistDialog = false;
},
onScroll(e) {
this.offsetTop = e.target.scrollTop;
let element = this.$refs.patientsDatatable.$el.querySelector(
".v-data-table__wrapper"
);
var scrollHeight = element.scrollHeight;
var divHeight = element.clientHeight;
var scrollerEndPoint = scrollHeight - divHeight;
var divScrollerTop = e.target.scrollTop;
if (divScrollerTop === scrollerEndPoint) {
this.limit += 10;
}
}
},
meteor: {
$subscribe: {
// brands: [],
worklist4hislink: function() {
console.log(true);
this.HisWorklistLoading = true;
return [{ brand: this.selectedBrand, limit: this.limit }];
}
},
// brands() {
// return Brands.find({}).fetch();
// },
worklist4hislink() {
if (this.selectedBrand == null) return [];
return BrandCollections[this.selectedBrand].find({}).fetch();
}
}
};
</script>
<style scoped>
</style>
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<v-snackbar color="error" v-model="alertSnackbar" :timeout="2000">{{alertText}}</v-snackbar> <v-snackbar color="error" v-model="alertSnackbar" :timeout="2000">{{alertText}}</v-snackbar>
<v-row justify="center" align="center" dense class="flex-wrap mb-6"> <v-row justify="center" align="center" dense class="flex-wrap mb-6">
<v-col md="5" lg="5" style="height:100%"> <v-col md="3" lg="3" style="height:100%">
<v-card tile height="100%"> <v-card tile height="100%">
<v-card-actions> <v-card-actions>
<v-row style="margin:auto" class="justify-center align-center flex-wrap"> <v-row style="margin:auto" class="justify-center align-center flex-wrap">
...@@ -233,22 +233,23 @@ ...@@ -233,22 +233,23 @@
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-col> </v-col>
<v-col md="5" lg="5"> <v-col md="7" lg="7">
<v-card> <v-card>
<v-card-actions> <v-card-actions>
<v-col cols="9"> <v-col cols="10">
<v-text-field <v-text-field
:label="$t('RegisterRoute.advancedSearchLabel')" :label="$t('RegisterRoute.advancedSearchLabel')"
v-model="queryText" v-model="queryText"
style="direction:ltr" style="direction:ltr"
></v-text-field> ></v-text-field>
</v-col> </v-col>
<v-col cols="3" class="d-flex align-center justify-center"> <v-col cols="2" class="d-flex align-center justify-center">
<v-btn class="primary" @click="searchServerSide">{{$t("RegisterRoute.searchBtn")}}</v-btn> <v-btn icon @click="searchServerSide" class="ma-1"><v-icon color="success">search</v-icon></v-btn>
<v-btn <v-btn
icon icon
href="https://kb.marcopacs.com/pages/viewpage.action?pageId=69796098" href="https://kb.marcopacs.com/pages/viewpage.action?pageId=69796098"
target="_blank" target="_blank"
class="ma-1"
> >
<v-icon color="success">live_help</v-icon> <v-icon color="success">live_help</v-icon>
</v-btn> </v-btn>
...@@ -426,7 +427,7 @@ export default { ...@@ -426,7 +427,7 @@ export default {
}, },
watch: { watch: {
"$subReady.worklist4hislink"(ready) { "$subReady.worklist4hislink"(ready) {
this.HisWorklistLoading = false; this.HisWorklistLoading = !ready;
if (this.$refs.patientsDatatable) { if (this.$refs.patientsDatatable) {
this.$refs.patientsDatatable.$el this.$refs.patientsDatatable.$el
.querySelector(".v-data-table__wrapper") .querySelector(".v-data-table__wrapper")
......
<template>
<v-container>
<v-snackbar color="error" v-model="alertSnackbar" :timeout="2000">{{alertText}}</v-snackbar>
<v-row justify="center" align="center" dense class="flex-wrap mb-6">
<v-col md="3" lg="3">
<v-card tile>
<v-card-actions>
<v-row style="margin:auto" class="justify-center align-center flex-wrap">
<v-col>
<v-file-input
:messages="uploadMessage"
:loading="uploadLoading"
@change="fileUploadFunc"
type="file"
:label="$t('TransliterationRoute.uploadLabel')"
accept="application/x-sqlite3"
></v-file-input>
</v-col>
</v-row>
</v-card-actions>
</v-card>
</v-col>
</v-row>
<v-row justify="center" dense class="flex-wrap mt-6">
<v-col md="10" cols="12">
<v-card class="justify-center">
<v-progress-linear
:active="TransliterationLoading"
:indeterminate="TransliterationLoading"
absolute
top
color="cyan lighten-2"
></v-progress-linear>
<v-card-title>
<strong>{{transliterationdb!=undefined?transliterationdb.length:0}}/{{count}}</strong>
<v-spacer></v-spacer>
<v-text-field
v-model="search"
append-icon="search"
:label="$t('DataTableSearch')"
single-line
hide-details
style="width:400px"
class="flex-grow-0"
></v-text-field>
</v-card-title>
<v-data-table
ref="TransliterationTable"
:headers="headerOfTable"
:items="itemsOfTable"
item-key="_id"
class="elevation-1"
style="width:100%"
fixed-header
disable-sort
:height="tableHeight"
disable-pagination
hide-default-footer
:search="search"
></v-data-table>
</v-card>
</v-col>
</v-row>
</v-container>
</template>
<script>
import { FilesCollection } from "meteor/ostrio:files";
import TranslitDbUploads from "../../imports/api/collections/translitdbuploads.js";
import TransliterationDb from "../../imports/api/collections/transliterationdb.js";
import { Counts } from "meteor/tmeasday:publish-counts";
export default {
data() {
return {
TransliterationLoading: false,
limit: 40,
count: 0,
search: "",
tableHeight: "62vh",
prevLeft: 0,
uploadLoading: false,
uploadMessage: "",
alertSnackbar: false,
alertText: ""
};
},
computed: {
links() {
let links = [];
this.translitdbuploads.forEach(function(fileRef) {
links.push(TranslitDbUploads.link(fileRef));
});
return links;
},
itemsOfTable() {
if (this.transliterationdb && this.transliterationdb.length > 0) {
let transliterationdbArray = [];
for (let worklist of this.transliterationdb) {
let tempWorklist = {};
for (let prop in worklist) {
tempWorklist[prop] = JSON.stringify(worklist[prop]);
}
transliterationdbArray.push(tempWorklist);
}
return transliterationdbArray;
}
return [];
},
headerOfTable() {
if (this.transliterationdb && this.transliterationdb.length > 0) {
let headerNames = [];
let worklist = this.transliterationdb[0];
for (let prop in worklist) {
headerNames.push({
text: prop,
value: prop,
class: "text-center",
width: 180
});
}
return headerNames;
}
return [];
}
},
methods: {
fileUploadFunc(file) {
if (file == undefined) {
this.uploadLoading = false;
this.uploadMessage = "";
this.alertText = this.$t("TransliterationRoute.errorInUploading");
this.alertSnackbar = true;
return;
}
this.uploadLoading = true;
this.uploadMessage = this.$t("TransliterationRoute.uploadingText");
let me = this;
const upload = TranslitDbUploads.insert(
{
file: file,
streams: "dynamic",
chunkSize: "dynamic"
},
false
);
upload.on("end", function(error, fileObj) {
if (error) {
me.uploadLoading = false;
me.uploadMessage = "";
me.alertText = me.$t("TransliterationRoute.wrongFormat");
me.alertSnackbar = true;
} else {
if (fileObj.type != "application/x-sqlite3") {
me.uploadLoading = false;
me.uploadMessage = "";
me.alertText = me.$t("TransliterationRoute.wrongFormat");
me.alertSnackbar = true;
return;
}
me.limit = 40;
me.uploadMessage = me.$t("TransliterationRoute.finishUpload");
Meteor.setTimeout(() => {
me.uploadMessage = me.$t("TransliterationRoute.dbUpdate");
}, 500);
Meteor.call("sqlite2mongo", fileObj.versions.original.path, function(
err,
result
) {
if (result == true) {
me.uploadMessage = me.$t("TransliterationRoute.dbUpdateDone");
Meteor.setTimeout(() => {
me.uploadMessage = "";
}, 500);
me.uploadLoading = false;
}
});
}
});
upload.start();
},
onScroll(e) {
let currentLeft = e.target.scrollLeft;
if (this.prevLeft != currentLeft) {
this.prevLeft = currentLeft;
return;
}
let element = this.$refs.TransliterationTable.$el.querySelector(
".v-data-table__wrapper"
);
let scrollHeight = element.scrollHeight;
let divHeight = element.clientHeight;
let scrollerEndPoint = scrollHeight - divHeight;
let divScrollerTop = e.target.scrollTop;
if (divScrollerTop === scrollerEndPoint) {
this.count = Counts.get("transliterationCount");
if (this.transliterationdb.length < this.count) {
this.limit += 5;
}
}
}
},
watch: {
"$subReady.transliterationdb"(ready) {
this.TransliterationLoading = !ready;
if (this.$refs.TransliterationTable) {
this.$refs.TransliterationTable.$el
.querySelector(".v-data-table__wrapper")
.removeEventListener("scroll", this.onScroll);
this.$refs.TransliterationTable.$el
.querySelector(".v-data-table__wrapper")
.addEventListener("scroll", this.onScroll);
}
}
},
meteor: {
$subscribe: {
translitdbuploads: [],
transliterationdb: function() {
this.TransliterationLoading = true;
return [
{ limit: this.limit },
{
onStop: error => {
this.TransliterationLoading = false;
}
}
];
},
transliterationdbCount: []
},
translitdbuploads() {
return TranslitDbUploads.find({});
},
transliterationdb() {
return TransliterationDb.find({}, { limit: this.limit });
}
}
};
</script>
\ No newline at end of file
...@@ -161,7 +161,8 @@ const messages = { ...@@ -161,7 +161,8 @@ const messages = {
Users: "Users", Users: "Users",
Setting: "Setting", Setting: "Setting",
Signout: "Signout", Signout: "Signout",
Register: "Register" Register: "Register",
Transliteration: "Transliteration"
}, },
RegisterRoute: { RegisterRoute: {
HISLinkCombo: "HISLink", HISLinkCombo: "HISLink",
...@@ -170,6 +171,16 @@ const messages = { ...@@ -170,6 +171,16 @@ const messages = {
jsonParseError: "error in parse of given json", jsonParseError: "error in parse of given json",
dbError: "error in query, please edit query" dbError: "error in query, please edit query"
}, },
TransliterationRoute: {
uploadLabel: "Upload DB",
uploadingText: "Uploading...",
errorInUploading: "Error In Uploading",
wrongFormat: "Wrong Format",
finishUpload: "Upload finished",
dbUpdate: "updating db",
dbUpdateDone: "db updating have been done"
},
DataTableSearch: "search" DataTableSearch: "search"
}, },
...@@ -331,7 +342,8 @@ const messages = { ...@@ -331,7 +342,8 @@ const messages = {
Users: "کاربران", Users: "کاربران",
Setting: "تنظیمات", Setting: "تنظیمات",
Signout: "خروج", Signout: "خروج",
Register: "فهرست" Register: "فهرست",
Transliteration: "نویسه"
}, },
RegisterRoute: { RegisterRoute: {
HISLinkCombo: "درگاه HIS", HISLinkCombo: "درگاه HIS",
...@@ -340,6 +352,15 @@ const messages = { ...@@ -340,6 +352,15 @@ const messages = {
jsonParseError: "خطا در Parse عبارت وارد شده", jsonParseError: "خطا در Parse عبارت وارد شده",
dbError: "خطا در query، لطفا query را اصلاح نمایید" dbError: "خطا در query، لطفا query را اصلاح نمایید"
}, },
TransliterationRoute: {
uploadLabel: "بارگزاری دیتابیس",
uploadingText: "در حال بارگزاری...",
errorInUploading: "خطا در بارگزاری",
wrongFormat: "فرمت اشتباه",
finishUpload: "بارگذاری به اتمام رسید",
dbUpdate: "در حال بروزرسانی دیتابیس",
dbUpdateDone: "بروزرسانی دیتابیس به اتمام رسید"
},
DataTableSearch: "جستجو" DataTableSearch: "جستجو"
} }
......
...@@ -14,6 +14,7 @@ import Client from '../components/Client.vue'; ...@@ -14,6 +14,7 @@ import Client from '../components/Client.vue';
import Users from '../components/Users.vue'; import Users from '../components/Users.vue';
import UserSetting from '../components/UserSetting.vue'; import UserSetting from '../components/UserSetting.vue';
import RegisterRoute from '../components/RegisterRoute.vue'; import RegisterRoute from '../components/RegisterRoute.vue';
import TransliterationRoute from '../components/TransliterationRoute.vue';
import AppVersion from '../views/AppVersion.vue'; import AppVersion from '../views/AppVersion.vue';
...@@ -81,9 +82,10 @@ const routes = [{ ...@@ -81,9 +82,10 @@ const routes = [{
path: "register", path: "register",
name: "register", name: "register",
component: RegisterRoute component: RegisterRoute
// component: () => }, {
// import ('../components/RegisterRoute.vue') path: "transliteration",
name: "transliteration",
component: TransliterationRoute
}] }]
} }
]; ];
......
...@@ -152,7 +152,6 @@ import RegisterPatient from "../components/RegisterPatient.vue"; ...@@ -152,7 +152,6 @@ import RegisterPatient from "../components/RegisterPatient.vue";
import { mapActions } from "vuex"; import { mapActions } from "vuex";
export default { export default {
mounted() { mounted() {
this.items.push({ this.items.push({
text: this.$t("NavigationBar.Worklist"), text: this.$t("NavigationBar.Worklist"),
url: "/main/worklist" url: "/main/worklist"
...@@ -169,10 +168,10 @@ export default { ...@@ -169,10 +168,10 @@ export default {
text: this.$t("NavigationBar.Client"), text: this.$t("NavigationBar.Client"),
url: "/main/client" url: "/main/client"
}); });
this.items.push({ // this.items.push({
text: this.$t("NavigationBar.Register"), // text: this.$t("NavigationBar.Register"),
url: "/main/register" // url: "/main/register"
}); // });
}, },
components: { components: {
"app-footer": AppFooter, "app-footer": AppFooter,
...@@ -191,29 +190,51 @@ export default { ...@@ -191,29 +190,51 @@ export default {
} }
}, },
computed: { computed: {
// getCurrentRoute(){
// return this.$router.currentRoute.name == "worklist"
// },
updatedItems() { updatedItems() {
if ( if (
Meteor.userId() && Meteor.userId() &&
this.users.length > 0 && this.users.length > 0 &&
Meteor.users.findOne({ _id: Meteor.userId() }).username == "marcoadmin" Meteor.users.findOne({ _id: Meteor.userId() }).username == "marcoadmin"
) { ) {
if (
this.items.findIndex(
item => item.text == this.$t("NavigationBar.Register")
) < 0
)
this.items.push({
text: this.$t("NavigationBar.Register"),
url: "/main/register"
});
if ( if (
this.items.findIndex( this.items.findIndex(
item => item.text == this.$t("NavigationBar.Users") item => item.text == this.$t("NavigationBar.Users")
) < 0 ) < 0
) )
// this.items.push({ text: "Users", url: "/main/users" });
this.items.push({ this.items.push({
text: this.$t("NavigationBar.Users"), text: this.$t("NavigationBar.Users"),
url: "/main/users" url: "/main/users"
}); });
if (
this.items.findIndex(
item => item.text == this.$t("NavigationBar.Transliteration")
) < 0
)
this.items.push({
text: this.$t("NavigationBar.Transliteration"),
url: "/main/transliteration"
});
} else { } else {
const index = this.items.indexOf(this.$t("NavigationBar.Users")); let index = this.items.indexOf(this.$t("NavigationBar.Users"));
if (index > -1) {
this.items.splice(index, 1);
}
index = this.items.indexOf(this.$t("NavigationBar.Register"));
if (index > -1) {
this.items.splice(index, 1);
}
index = this.items.indexOf(this.$t("NavigationBar.Transliteration"));
if (index > -1) { if (index > -1) {
this.items.splice(index, 1); this.items.splice(index, 1);
} }
...@@ -248,7 +269,6 @@ export default { ...@@ -248,7 +269,6 @@ export default {
}, },
selectedLang: { selectedLang: {
get() { get() {
if (this.users && this.users.length > 0) { if (this.users && this.users.length > 0) {
return this.users[0].profile.language; return this.users[0].profile.language;
} else { } else {
...@@ -297,10 +317,10 @@ export default { ...@@ -297,10 +317,10 @@ export default {
text: this.$t("NavigationBar.Client"), text: this.$t("NavigationBar.Client"),
url: "/main/client" url: "/main/client"
}); });
this.items.push({ // this.items.push({
text: this.$t("NavigationBar.Register"), // text: this.$t("NavigationBar.Register"),
url: "/main/register" // url: "/main/register"
}); // });
} }
}, },
meteor: { meteor: {
......
import { Meteor } from 'meteor/meteor';
import { FilesCollection } from 'meteor/ostrio:files';
const TranslitDbUploads = new FilesCollection({
storagePath: "assets/app/translitdb",
collectionName: 'translitUploads',
allowClientCode: false, // Disallow remove files from Client
onBeforeUpload(file) {
// Allow upload files under 10MB, and only in png/jpg/jpeg formats
// if (file.size <= 10485760 && /png|jpg|jpeg/i.test(file.extension)) {
// return true;
// }
if (file.type == "") {
TranslitDbUploads.remove({});
return true;
}
return 'error';
}
});
export default TranslitDbUploads;
\ No newline at end of file
import { Mongo } from 'meteor/mongo';
import { Meteor } from 'meteor/meteor';
let TransliterationDb;
if (Meteor.isClient || Meteor.isCordova) {
TransliterationDb = new Mongo.Collection('TransliterationDb')
}
if (Meteor.isServer) {
TransliterationDb = new Mongo.Collection('TransliterationDb')
}
export default TransliterationDb;
\ No newline at end of file
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { Mongo } from 'meteor/mongo';
const sqlite3 = require('sqlite3').verbose();
import TransliterationDb from '../collections/transliterationdb.js';
Meteor.methods({
'sqlite2mongo' (sqliteAddress) {
this.unblock();
check(sqliteAddress, String);
if (this.userId) {
TransliterationDb.remove({});
let dbFullAddress = Meteor.rootPath + "/" + sqliteAddress;
const promise = select(dbFullAddress, "transliteration_1")
.then((documentArray) => {
let bulkOp = TransliterationDb.rawCollection().initializeUnorderedBulkOp(),
counter = 0;
for (let data of documentArray) {
bulkOp.insert(data);
counter++;
// Send to server in batch of 1000 insert operations
if (counter % 10000 == 0) {
// Execute per 1000 operations and re-initialize every 1000 update statements
bulkOp.execute(function(e, rresult) {
// do something with result
});
bulkOp = TransliterationDb.rawCollection().initializeUnorderedBulkOp();
}
}
// Clean up queues
if (counter % 10000 != 0) {
bulkOp.execute(function(e, result) {
// do something with result
});
}
return true;
}).catch((e) => {
throw new Meteor.Error('500', e);
});
return promise.await();
}
}
});
function select(database, table) {
return new Promise((resolve, reject) => {
const db = new sqlite3.Database(database);
const queries = [];
db.each(`SELECT * FROM ${table}`, (err, row) => {
if (err) {
reject(err); // optional: you might choose to swallow errors.
} else {
queries.push(row); // accumulate the data
}
}, (err, n) => {
if (err) {
reject(err); // optional: again, you might choose to swallow this error.
} else {
resolve(queries); // resolve the promise
}
});
});
}
\ No newline at end of file
import TranslitDbUploads from '../../collections/translitdbuploads.js';
import { Meteor } from 'meteor/meteor';
Meteor.publish('translitdbuploads', function() {
if (!this.userId)
return [];
return TranslitDbUploads.find({ userId: this.userId }).cursor;
});
\ No newline at end of file
import { check } from 'meteor/check';
import { Mongo } from 'meteor/mongo'
import TransliterationDb from '../../collections/transliterationdb';
import { Counts } from 'meteor/tmeasday:publish-counts';
Meteor.publish("transliterationdb", function({ limit }) {
if (!this.userId) {
return this.ready();
}
check(limit, Number);
return TransliterationDb.find({}, {
disableOplog: true,
pollingIntervalMs: 1000,
limit: limit
});
});
Meteor.publish("transliterationdbCount", function() {
if (!this.userId) {
return this.ready();
}
Counts.publish(this, 'transliterationCount', TransliterationDb.find({}), { fastCount: true });
});
\ No newline at end of file
...@@ -19,8 +19,6 @@ Meteor.publish("worklist4hislink", function({ brand, limit, query }) { ...@@ -19,8 +19,6 @@ Meteor.publish("worklist4hislink", function({ brand, limit, query }) {
if (query == null) if (query == null)
query = {}; query = {};
try { try {
// Counts.publish(this, 'brandCount', Collections[brand].find(query), { noReady: true, fastCount: true }); // Counts.publish(this, 'brandCount', Collections[brand].find(query), { noReady: true, fastCount: true });
// else // else
// Counts.publish(this, 'brandCount', Collections[brand].find(), { noReady: true, fastCount: true }); // Counts.publish(this, 'brandCount', Collections[brand].find(), { noReady: true, fastCount: true });
...@@ -50,6 +48,9 @@ Meteor.publish("worklist4hislink", function({ brand, limit, query }) { ...@@ -50,6 +48,9 @@ Meteor.publish("worklist4hislink", function({ brand, limit, query }) {
}); });
Meteor.publish("brandCount", function({ brand, query }) { Meteor.publish("brandCount", function({ brand, query }) {
if (!this.userId) {
return this.ready();
}
if (query == null) if (query == null)
query = {} query = {}
if (brand == null) { if (brand == null) {
...@@ -60,5 +61,4 @@ Meteor.publish("brandCount", function({ brand, query }) { ...@@ -60,5 +61,4 @@ Meteor.publish("brandCount", function({ brand, query }) {
} catch { } catch {
Counts.publish(this, 'brandCount', Collections[brand].find({}), { fastCount: true }); Counts.publish(this, 'brandCount', Collections[brand].find({}), { fastCount: true });
} }
}) })
\ No newline at end of file
...@@ -12497,6 +12497,37 @@ ...@@ -12497,6 +12497,37 @@
"through2": "^2.0.2" "through2": "^2.0.2"
} }
}, },
"sqlite3": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-4.1.1.tgz",
"integrity": "sha512-CvT5XY+MWnn0HkbwVKJAyWEMfzpAPwnTiB3TobA5Mri44SrTovmmh499NPQP+gatkeOipqPlBLel7rn4E/PCQg==",
"dev": true,
"requires": {
"nan": "^2.12.1",
"node-pre-gyp": "^0.11.0",
"request": "^2.87.0"
},
"dependencies": {
"node-pre-gyp": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz",
"integrity": "sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q==",
"dev": true,
"requires": {
"detect-libc": "^1.0.2",
"mkdirp": "^0.5.1",
"needle": "^2.2.1",
"nopt": "^4.0.1",
"npm-packlist": "^1.1.6",
"npmlog": "^4.0.2",
"rc": "^1.2.7",
"rimraf": "^2.6.1",
"semver": "^5.3.0",
"tar": "^4"
}
}
}
},
"sshpk": { "sshpk": {
"version": "1.16.1", "version": "1.16.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
"meteor-jest-stubs": "^2.0.0", "meteor-jest-stubs": "^2.0.0",
"sass": "^1.22.9", "sass": "^1.22.9",
"sass-loader": "^7.2.0", "sass-loader": "^7.2.0",
"sqlite3": "^4.1.1",
"standard-version": "^7.0.0", "standard-version": "^7.0.0",
"uglifyjs-webpack-plugin": "^2.2.0", "uglifyjs-webpack-plugin": "^2.2.0",
"vue-jest": "^3.0.5", "vue-jest": "^3.0.5",
......
...@@ -7,7 +7,8 @@ import '../imports/api/methods/brands.js'; ...@@ -7,7 +7,8 @@ import '../imports/api/methods/brands.js';
import '../imports/api/methods/hisLink.js'; import '../imports/api/methods/hisLink.js';
import '../imports/api/methods/clients.js'; import '../imports/api/methods/clients.js';
import '../imports/api/methods/devicemap.js'; import '../imports/api/methods/devicemap.js';
import '../imports/api/methods/users.js' import '../imports/api/methods/users.js';
import '../imports/api/methods/translitdb.js';
import '../imports/api/server/publications/worklist.js'; import '../imports/api/server/publications/worklist.js';
...@@ -17,12 +18,21 @@ import '../imports/api/server/publications/brands.js'; ...@@ -17,12 +18,21 @@ import '../imports/api/server/publications/brands.js';
import '../imports/api/server/publications/clients.js'; import '../imports/api/server/publications/clients.js';
import '../imports/api/server/publications/devicemap.js'; import '../imports/api/server/publications/devicemap.js';
import '../imports/api/server/publications/users.js'; import '../imports/api/server/publications/users.js';
import '../imports/api/server/publications/worklist4hislink.js' import '../imports/api/server/publications/worklist4hislink.js';
import '../imports/api/server/publications/translitdbuploads.js';
import '../imports/api/server/publications/transliterationdb.js';
import { Accounts } from "meteor/accounts-base"; import { Accounts } from "meteor/accounts-base";
Meteor.startup(() => { Meteor.startup(() => {
let marcoUser = Meteor.users.findOne({ username: "marcoadmin" }); let marcoUser = Meteor.users.findOne({ username: "marcoadmin" });
if (marcoUser == undefined || marcoUser == null) if (marcoUser == undefined || marcoUser == null)
Accounts.createUser({ Accounts.createUser({
......
...@@ -201,7 +201,7 @@ const clientConfig = { ...@@ -201,7 +201,7 @@ const clientConfig = {
const serverConfig = { const serverConfig = {
entry: './server/main.js', entry: './server/main.js',
target: 'node', target: 'node',
externals: [meteorExternals()], externals: [meteorExternals(), { sqlite3: 'commonjs sqlite3' }],
devServer: { devServer: {
hot: true, hot: true,
open: true open: true
......
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