Commit 495f990b authored by Reza Sahebgharan's avatar Reza Sahebgharan

feat(client side debug): write client side debug for methods

parent a538536f
Pipeline #1167 passed with stage
in 45 minutes and 56 seconds
......@@ -41,7 +41,11 @@
></v-text-field>
</v-col>
<v-col cols="12" md="6">
<v-checkbox v-model="ClientForm.AutoComplete" class="mx-2" :label="$t('Client.AutoCompleteLabel')"></v-checkbox>
<v-checkbox
v-model="ClientForm.AutoComplete"
class="mx-2"
:label="$t('Client.AutoCompleteLabel')"
></v-checkbox>
</v-col>
</v-row>
</v-container>
......@@ -133,8 +137,8 @@
<script>
import Client from "../../imports/api/collections/clients.js";
import { Meteor } from "meteor/meteor";
// import { log_init, logClient } from "../../imports/plugins/logger";
// log_init();
import { log_init, logClient } from "../../imports/plugins/logger";
log_init();
export default {
data() {
......@@ -163,12 +167,8 @@ export default {
minLength: 0,
numberRules: [
// v => !!v || "Input is required!",
v =>
v < this.maxLength ||
this.$t("Client.lessThan25"),
v =>
v > this.minLength ||
this.$t("Client.greaterThanZero")
v => v < this.maxLength || this.$t("Client.lessThan25"),
v => v > this.minLength || this.$t("Client.greaterThanZero")
]
};
},
......@@ -215,13 +215,6 @@ export default {
}
},
openNewDialog() {
// logClient(
// "debug",
// `openNewDialog() => newDialog `,
// this.ClientForm,
// Meteor.user().username
// );
for (let prop in this.ClientForm) {
this.$set(this.ClientForm, prop, "");
}
......@@ -269,12 +262,49 @@ export default {
this.loading = true;
let me = this;
if (this.newOrEdit == "new") {
debugger
Meteor.settings.public.enableDebug
? logClient(
"debug",
`createClient Method Called from Client `,
this.ClientForm,
Meteor.user().username
)
: "";
Meteor.call("createClient", this.ClientForm, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`createClient Method error`,
error,
Meteor.user().username
)
: "";
}
});
}
if (this.newOrEdit == "edit") {
Meteor.settings.public.enableDebug
? logClient(
"debug",
`editClient Method Called from Client `,
this.ClientForm,
Meteor.user().username
)
: "";
Meteor.call("editClient", this.ClientForm, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`editClient Method error`,
error,
Meteor.user().username
)
: "";
}
// me.dialog = false;
me.selectedItemInTable = [];
});
......@@ -290,7 +320,27 @@ export default {
let deleteHislink = {};
deleteHislink._id = this.selectedItemInTable[0]["_id"];
Meteor.settings.public.enableDebug
? logClient(
"debug",
`deleteClient Method Called from Client `,
deleteHislink,
Meteor.user().username
)
: "";
Meteor.call("deleteClient", deleteHislink, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`deleteClient Method error `,
error,
Meteor.user().username
)
: "";
}
if (error.reason == "relationShipError") {
me.alertColor = "error";
me.alertSnackbar = true;
......
......@@ -141,9 +141,9 @@ import Devicemap from "../../imports/api/collections/devicemap.js";
import HisLink from "../../imports/api/collections/hislink.js";
import Client from "../../imports/api/collections/clients.js";
import { Meteor } from "meteor/meteor";
// import { log_init, logClient } from "../../imports/plugins/logger";
// log_init();
debugger
import { log_init, logClient } from "../../imports/plugins/logger";
log_init();
export default {
data() {
return {
......@@ -197,36 +197,37 @@ export default {
this.dialog = false;
if (this.devicemaps && this.devicemaps.length > 0) {
let currentDevicemap = [];
for (let devicemap of this.devicemaps) {
let hislink = HisLink.find(
{ _id: devicemap.HisLinkId },
{ fields: { Name: 1 } }
).fetch();
for (let devicemap of this.devicemaps) {
let hislink = HisLink.find(
{ _id: devicemap.HisLinkId },
{ fields: { Name: 1 } }
).fetch();
if (
hislink != undefined &&
hislink != null &&
// hislink.length > 0 &&
hislink[0].Name != undefined
)
devicemap = { ...devicemap, HisName: hislink[0].Name };
if (
hislink != undefined &&
hislink != null &&
// hislink.length > 0 &&
hislink[0].Name != undefined
)
devicemap = { ...devicemap, HisName: hislink[0].Name };
let client = Client.find(
{ _id: devicemap.ClientId },
{ fields: { Caption: 1 } }
).fetch();
let client = Client.find(
{ _id: devicemap.ClientId },
{ fields: { Caption: 1 } }
).fetch();
if (
client != undefined &&
client != null &&
// hislink.length > 0 &&
client[0].Caption != undefined
)
devicemap = { ...devicemap, Client: client[0].Caption };
currentDevicemap.push({ ...devicemap });
}
if (
client != undefined &&
client != null &&
// hislink.length > 0 &&
client[0].Caption != undefined
)
devicemap = { ...devicemap, Client: client[0].Caption };
currentDevicemap.push({ ...devicemap });
}
return currentDevicemap;
}
return [];
......@@ -318,7 +319,30 @@ export default {
this.DevicemapForm.HisLinkId = this.selectedHisLink._id;
}
Meteor.call("createDevicemap", this.DevicemapForm, function() {});
Meteor.settings.public.enableDebug
? logClient(
"debug",
`createDevicemap Method Called from Client `,
this.DevicemapForm,
Meteor.user().username
)
: "";
Meteor.call("createDevicemap", this.DevicemapForm, function(
error,
result
) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`createDevicemap Method error`,
error,
Meteor.user().username
)
: "";
}
});
}
if (this.newOrEdit == "edit") {
if (this.selectedClient != undefined && this.selectedClient != null)
......@@ -328,8 +352,32 @@ export default {
this.DevicemapForm.HisLinkId = this.selectedHisLink._id;
}
Meteor.call("editDevicemap", this.DevicemapForm, function() {
Meteor.settings.public.enableDebug
? logClient(
"debug",
`editDevicemap Method Called from Client `,
this.DevicemapForm,
Meteor.user().username
)
: "";
Meteor.call("editDevicemap", this.DevicemapForm, function(
error,
result
) {
// me.dialog = false;
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`editDevicemap Method error`,
error,
Meteor.user().username
)
: "";
}
me.selectedItemInTable = [];
});
}
......@@ -344,7 +392,27 @@ export default {
let deleteHislink = {};
deleteHislink._id = this.selectedItemInTable[0]["_id"];
Meteor.call("deleteDevicemap", deleteHislink, function() {
Meteor.settings.public.enableDebug
? logClient(
"debug",
`deleteDevicemap Method Called from Client `,
deleteHislink,
Meteor.user().username
)
: "";
Meteor.call("deleteDevicemap", deleteHislink, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`deleteDevicemap Method error `,
error,
Meteor.user().username
)
: "";
}
me.alertSnackbarMethod(me.$t("DeviceMap.devicemapDeleteStatement"));
});
},
......
......@@ -206,6 +206,9 @@ import HisLink from "../../imports/api/collections/hislink.js";
import Brands from "../../imports/api/collections/brands.js";
import { Meteor } from "meteor/meteor";
// import HisWorklist from "./HisWorklist.vue";
import { log_init, logClient } from "../../imports/plugins/logger";
log_init();
export default {
// components: {
// HisWorklist
......@@ -331,12 +334,32 @@ export default {
this.loading = true;
if (this.newOrEdit == "new") {
Meteor.call("createHisLink", this.HisLinkForm, function(error, result) {
// me.dialog = false;
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`createHisLink Method error`,
error,
Meteor.user().username
)
: "";
}
});
}
if (this.newOrEdit == "edit") {
Meteor.call("editHisLink", this.HisLinkForm, function() {
// me.dialog = false;
Meteor.call("editHisLink", this.HisLinkForm, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`editHisLink Method error`,
error,
Meteor.user().username
)
: "";
}
me.selectedItemInTable = [];
});
}
......@@ -352,7 +375,17 @@ export default {
deleteHislink._id = this.selectedItemInTable[0]["_id"];
Meteor.call("deleteHisLink", deleteHislink, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`deleteHisLink Method error`,
error,
Meteor.user().username
)
: "";
}
if (error) {
if (error.reason == "relationShipError") {
me.alertColor = "error";
......@@ -368,7 +401,7 @@ export default {
this.snackbar = true;
},
alertSnackbarMethod(text) {
me.alertColor = "primary";
this.alertColor = "primary";
this.alertText = text;
this.alertSnackbar = true;
},
......@@ -381,7 +414,17 @@ export default {
let activeHislink = {};
activeHislink._id = this.selectedItemInTable[0]["_id"];
Meteor.call("activeHisLink", activeHislink, function() {
Meteor.call("activeHisLink", activeHislink, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`activeHisLink Method error`,
error,
Meteor.user().username
)
: "";
}
me.alertSnackbarMethod(me.$t("HISLink.hislinkActiveStatement"));
});
},
......@@ -394,7 +437,17 @@ export default {
let deactiveHislink = {};
deactiveHislink._id = this.selectedItemInTable[0]["_id"];
Meteor.call("deactiveHisLink", deactiveHislink, function() {
Meteor.call("deactiveHisLink", deactiveHislink, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`deactiveHisLink Method error`,
error,
Meteor.user().username
)
: "";
}
me.alertSnackbarMethod(me.$t("HISLink.hislinkDeactiveStatement"));
});
},
......@@ -431,10 +484,21 @@ export default {
// }
// };
Meteor.call("authenticateHisLink", authenticateHislink, function(
err,
error,
result
) {
if (err) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`authenticateHisLink Method error`,
error,
Meteor.user().username
)
: "";
}
if (error) {
me.alertSnackbarMethod(me.$t("HISLink.hislinkAuthenticateFailed"));
}
me.alertSnackbarMethod(
......
......@@ -114,6 +114,9 @@
</template>
<script>
import Devicemap from "../../imports/api/collections/devicemap.js";
import { log_init, logClient } from "../../imports/plugins/logger";
log_init();
export default {
data() {
return {
......@@ -150,10 +153,20 @@ export default {
if (this.selectedDeviceMap) {
registerPatient.CodeInHis = this.selectedDeviceMap.CodeInHIS;
}
Meteor.call("Register", registerPatient, function(err, result) {
Meteor.call("Register", registerPatient, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`Register Method error`,
error,
Meteor.user().username
)
: "";
}
me.registerLoading = false;
me.registerPatient = {
FarsiFirstName: "",
......
......@@ -69,6 +69,8 @@ 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";
import { log_init, logClient } from "../../imports/plugins/logger";
log_init();
export default {
data() {
return {
......@@ -83,7 +85,7 @@ export default {
alertSnackbar: false,
alertText: ""
};
},
},
computed: {
links() {
let links = [];
......@@ -166,9 +168,19 @@ export default {
}, 500);
Meteor.call("sqlite2mongo", fileObj.versions.original.path, function(
err,
error,
result
) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`sqlite2mongo Method error`,
error,
Meteor.user().username
)
: "";
}
if (result == true) {
me.uploadMessage = me.$t("TransliterationRoute.dbUpdateDone");
Meteor.setTimeout(() => {
......@@ -196,7 +208,6 @@ export default {
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;
......@@ -223,9 +234,7 @@ export default {
transliterationdb: function() {
// this.TransliterationLoading = true;
return [
{ limit: this.limit }
];
return [{ limit: this.limit }];
},
transliterationdbCount: []
},
......@@ -233,7 +242,6 @@ export default {
return TranslitDbUploads.find({});
},
transliterationdb() {
return TransliterationDb.find({}, { sort: { ID: 1 } });
}
}
......
......@@ -12,14 +12,14 @@
<v-img v-if="!temp" :src="src"></v-img>
<v-img v-else :src="newSrc"></v-img>
<v-btn
@click="$refs.inputUpload.click()"
fab
style="position:absolute;bottom:5px;right:5px"
>
<v-icon>add_a_photo</v-icon>
</v-btn>
@click="$refs.inputUpload.click()"
fab
style="position:absolute;bottom:5px;right:5px"
>
<v-icon>add_a_photo</v-icon>
</v-btn>
</v-avatar>
<input
v-show="false"
ref="inputUpload"
......@@ -78,6 +78,8 @@
</template>
<script>
import { mapActions } from "vuex";
import { log_init, logClient } from "../../imports/plugins/logger";
log_init();
export default {
data() {
return {
......@@ -116,7 +118,17 @@ export default {
"profile.picture": this.newSrc
};
let me = this;
Meteor.call("editUserProfile", profile, function(err, result) {
Meteor.call("editUserProfile", profile, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`editUserProfile Method error`,
error,
Meteor.user().username
)
: "";
}
if (result) {
me.alertSnackbarMethod(me.$t("UserSetting.successfullSave"));
}
......@@ -202,7 +214,7 @@ export default {
};
</script>
<style scoped>
.v-avatar{
.v-avatar {
overflow: initial;
}
</style>
\ No newline at end of file
......@@ -91,16 +91,35 @@
<v-card-actions>
<v-row style="margin:auto">
<v-col cols="12" class="d-flex justify-center align-center flex-wrap">
<v-btn color="rgb(94, 181, 177,.85)" class="white--text ma-1" @click="openNewDialog">
<v-btn
color="rgb(94, 181, 177,.85)"
class="white--text ma-1"
@click="openNewDialog"
>
<strong>{{$t("HISLink.newBtn")}}</strong>
</v-btn>
<v-btn color="rgb(94, 181, 177,.85)" class="white--text ma-1" @click="openEditDialog" :disabled="this.selectedItemInTable.length == 0">
<v-btn
color="rgb(94, 181, 177,.85)"
class="white--text ma-1"
@click="openEditDialog"
:disabled="this.selectedItemInTable.length == 0"
>
<strong>{{$t("HISLink.editBtn")}}</strong>
</v-btn>
<v-btn color="rgb(94, 181, 177,.85)" class="white--text ma-1" @click="openResetDialog" :disabled="this.selectedItemInTable.length == 0">
<v-btn
color="rgb(94, 181, 177,.85)"
class="white--text ma-1"
@click="openResetDialog"
:disabled="this.selectedItemInTable.length == 0"
>
<strong>{{$t("Users.ResetPasswordBtn")}}</strong>
</v-btn>
<v-btn color="rgb(94, 181, 177,.85)" class="white--text ma-1" @click="deleteSnackbar" :disabled="this.selectedItemInTable.length == 0">
<v-btn
color="rgb(94, 181, 177,.85)"
class="white--text ma-1"
@click="deleteSnackbar"
:disabled="this.selectedItemInTable.length == 0"
>
<strong>{{$t("HISLink.deleteBtn")}}</strong>
</v-btn>
</v-col>
......@@ -148,7 +167,8 @@
</v-container>
</template>
<script>
import { Meteor } from "meteor/meteor";
import { log_init, logClient } from "../../imports/plugins/logger";
log_init();
export default {
data() {
return {
......@@ -277,7 +297,7 @@ export default {
createOrEditUser() {
this.loading = true;
let me = this;
if (this.newOrEdit == "new") {
const username = this.UserForm.username;
const password = this.UserForm.password;
......@@ -330,7 +350,17 @@ export default {
}
};
Meteor.call("createUser1", item, function() {
Meteor.call("createUser1", item, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`createUser1 Method error`,
error,
Meteor.user().username
)
: "";
}
me.loading = false;
// me.dialog = false;
});
......@@ -341,8 +371,17 @@ export default {
_id: this.UserForm._id,
fullName: this.UserForm.fullName
};
Meteor.call("editUser1", item, function() {
// me.dialog = false;
Meteor.call("editUser1", item, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`editUser1 Method error`,
error,
Meteor.user().username
)
: "";
}
me.selectedItemInTable = [];
me.loading = false;
});
......@@ -382,7 +421,17 @@ export default {
_id: this.UserForm._id,
password: this.UserForm.password
};
Meteor.call("setPassword", item, function() {
Meteor.call("setPassword", item, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`setPassword Method error`,
error,
Meteor.user().username
)
: "";
}
me.loading = false;
me.dialog = false;
// me.selectedItemInTable = [];
......@@ -390,7 +439,6 @@ export default {
}
},
deleteUser() {
let me = this;
this.snackbar = false;
if (this.selectedItemInTable.length == 0) {
......@@ -401,7 +449,17 @@ export default {
let deleteUser = {};
deleteUser._id = this.selectedItemInTable[0]["_id"];
Meteor.call("deleteUser1", deleteUser, function() {
Meteor.call("deleteUser1", deleteUser, function(error, result) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`deleteUser1 Method error`,
error,
Meteor.user().username
)
: "";
}
me.alertSnackbarMethod(this.$t("Users.userDeleteStatement"));
});
},
......
......@@ -525,6 +525,9 @@ import Worklist from "../../imports/api/collections/worklist.js";
import Clients from "../../imports/api/collections/clients.js";
// import HisWorklist from "./HisWorklist.vue";
import { log_init, logClient } from "../../imports/plugins/logger";
log_init();
export default {
methods: {
activerow: function(item) {
......@@ -557,13 +560,25 @@ export default {
// this.$set(item, "selected", true);
},
searchPatients() {
if (
this.selectedDevice &&
this.devicemap != this.selectedDevice.Caption
) {
let self = this;
Meteor.call("Fetchworklist", this.selectedDevice.Caption, function() {
Meteor.call("Fetchworklist", this.selectedDevice.Caption, function(
error,
result
) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`Fetchworklist Method error`,
error,
Meteor.user().username
)
: "";
}
self.devicemap = self.selectedDevice.Caption;
});
}
......@@ -660,7 +675,6 @@ export default {
this.activerow(this.sortedItems[index - 1]);
},
savePatient() {
this.selectedItem.EnglishFirstNameParts = [
this.editedItemParts.EnglishFirstNameParts0,
this.editedItemParts.EnglishFirstNameParts1,
......@@ -694,13 +708,23 @@ export default {
});
let { selected, ...selectedItemClone } = this.selectedItem;
this.editLoading = true;
let self = this;
Meteor.call("EditworklistItem", selectedItemClone, function(
error,
result
) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`EditworklistItem Method error`,
error,
Meteor.user().username
)
: "";
}
self.editLoading = false;
});
}
......@@ -816,7 +840,20 @@ export default {
if (this.selectedDevice && this.selectedDevice.Caption) {
let self = this;
this.fetchWorklistLoading = true;
Meteor.call("Fetchworklist", this.selectedDevice.Caption, function() {
Meteor.call("Fetchworklist", this.selectedDevice.Caption, function(
error,
result
) {
if (error) {
Meteor.settings.public.enableDebug
? logClient(
"error",
`Fetchworklist Method error`,
error,
Meteor.user().username
)
: "";
}
self.devicemap = self.selectedDevice.Caption;
self.fetchWorklistLoading = false;
});
......
......@@ -4,6 +4,7 @@ import { LoggerFile } from 'meteor/ostrio:loggerfile';
let mylog = {};
export function log_init() {
mylog = new Logger();
(new LoggerFile(mylog)).enable();
}
......
......@@ -8868,9 +8868,9 @@
}
},
"kind-of": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
"dev": true
},
"kleur": {
......
......@@ -3,7 +3,7 @@
"private": true,
"version": "0.0.9",
"scripts": {
"start": "SET MONGO_URL=mongodb://karnameh.marcopacs.com:27018/karname&& meteor run --inspect --settings settings.json",
"start": "SET MONGO_URL=mongodb://staging.karname.ir:27018/karname&& meteor run --inspect --settings settings.json",
"test": "meteor test --once --driver-package meteortesting:mocha",
"test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
"test-jest": "jest",
......
......@@ -3,6 +3,6 @@
"databusUrl": "http://localhost:8090",
"enableDebug": false,
"public": {
"enableDebug": false
"enableDebug": true
}
}
\ No newline at end of file
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