Commit 722a05b6 authored by Reza Sahebgharan's avatar Reza Sahebgharan

feat(Clients ui): writing Clients ui and methods and publications

parent 0bb4621e
......@@ -52,6 +52,11 @@ export default {
font-size: 0.5rem;
}
tr.v-data-table__selected {
background-color: #b2ebf2 !important;
border-color: #b2ebf2 !important;
}
@import url(views/css/globalcss.css);
</style>
<style scoped>
......
<template>
<v-container>
<v-snackbar color="primary" v-model="snackbar" top>
Are You Sure?
<v-btn color="pink" @click="deleteClient">yes</v-btn>
<v-btn color="pink" @click="snackbar = false">no</v-btn>
</v-snackbar>
<v-snackbar color="primary" v-model="alertSnackbar" :timeout="2000">{{alertText}}</v-snackbar>
<v-dialog v-model="dialog" max-width="600px">
<v-card>
<v-card-title>
<span class="headline">{{newOrEdit=="new"?"New":"Edit"}} Client</span>
</v-card-title>
<v-card-text>
<v-container>
<div>
<v-progress-linear :active="loading" :indeterminate="loading" color="cyan lighten-2"></v-progress-linear>
</div>
<v-row dense>
<v-col cols="12" md="6">
<v-text-field label="Caption" v-model="ClientForm.Caption"></v-text-field>
</v-col>
<v-col cols="12" md="6">
<v-text-field label="AETitle" type="text" v-model="ClientForm.AETitle"></v-text-field>
</v-col>
<v-col cols="12" md="6">
<v-text-field label="Hostname" type="text" v-model="ClientForm.Hostname"></v-text-field>
</v-col>
<v-col cols="12" md="6">
<v-text-field label="Port" type="text" v-model="ClientForm.Port"></v-text-field>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="blue darken-1"
text
@click="createOrEditClient"
>{{newOrEdit=="new"?"Create":"Edit"}}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-row justify="center" dense class="flex-wrap mb-6">
<v-col md="7" lg="6" cols="12">
<v-card tile>
<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" @click="openNewDialog">
<strong>{{$t("HISLink.newBtn")}}</strong>
</v-btn>
<v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="openEditDialog">
<strong>{{$t("HISLink.editBtn")}}</strong>
</v-btn>
<v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="deleteSnackbar">
<strong>{{$t("HISLink.deleteBtn")}}</strong>
</v-btn>
</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="9" cols="12">
<v-data-table
v-model="selectedItemInTable"
:headers="headerOfTable"
:items="itemsOfTable"
item-key="_id"
class="elevation-1"
style="width:100%"
fixed-header
hide-default-footer
disable-pagination
show-select
single-select
:sort-by.sync="sortByTable"
:sort-desc.sync="sortDescTable"
height="73vh"
@click:row="clickRow"
></v-data-table>
</v-col>
</v-row>
</v-container>
</template>
<script>
import Client from "../../imports/api/collections/clients.js";
import { Meteor } from "meteor/meteor";
export default {
data() {
return {
sortByTable: undefined,
sortDescTable: undefined,
selectedItemInTable: [],
dialog: false,
newOrEdit: "",
ClientForm: {
Caption: "",
AETitle: "",
Hostname: "",
Port: "",
_id: ""
},
snackbar: false,
alertSnackbar: false,
alertText: "",
loading:false
};
},
computed: {
headerOfTable() {
let headers = ["Caption", "AETitle", "Hostname", "Port"];
let headerObjs = [];
for (let header of headers) {
headerObjs.push({
text: header,
value: header,
class: "text-center",
width: 180
});
}
return headerObjs;
},
itemsOfTable() {
this.loading = false;
this.dialog = false;
if (this.clients && this.clients.length > 0) {
return this.clients;
}
return [];
}
},
methods: {
clickRow(item) {
if (
this.selectedItemInTable.length > 0 &&
this.selectedItemInTable[0]._id == item._id
) {
this.selectedItemInTable = [];
} else {
this.selectedItemInTable = [];
this.selectedItemInTable = [item];
}
},
openNewDialog() {
debugger;
for (let prop in this.ClientForm) {
this.$set(this.ClientForm, prop, "");
}
this.$set(this.ClientForm, "_id", "");
this.newOrEdit = "new";
this.dialog = true;
},
openEditDialog() {
if (this.selectedItemInTable.length == 0) {
this.alertSnackbarMethod("please select one of clients");
return;
}
for (let prop in this.ClientForm) {
if (this.selectedItemInTable[0][prop] != undefined) {
this.$set(this.ClientForm, prop, this.selectedItemInTable[0][prop]);
}
}
this.$set(this.ClientForm, "_id", this.selectedItemInTable[0]["_id"]);
this.newOrEdit = "edit";
this.dialog = true;
},
createOrEditClient() {
this.loading = true;
let me = this;
if (this.newOrEdit == "new") {
Meteor.call("createClient", this.ClientForm, function() {
// me.dialog = false;
});
}
if (this.newOrEdit == "edit") {
Meteor.call("editClient", this.ClientForm, function() {
// me.dialog = false;
me.selectedItemInTable = [];
});
}
},
deleteClient() {
let me = this;
this.snackbar = false;
if (this.selectedItemInTable.length == 0) {
me.alertSnackbarMethod("please select one of clients");
return;
}
let deleteHislink = {};
deleteHislink._id = this.selectedItemInTable[0]["_id"];
Meteor.call("deleteClient", deleteHislink, function() {
me.alertSnackbarMethod("Client has been deleted");
});
},
deleteSnackbar() {
this.snackbar = true;
},
alertSnackbarMethod(text) {
this.alertText = text;
this.alertSnackbar = true;
}
},
meteor: {
$subscribe: {
clients: []
},
clients() {
return Client.find({}).fetch();
}
}
};
</script>
<style>
</style>
\ No newline at end of file
......@@ -13,6 +13,9 @@
</v-card-title>
<v-card-text>
<v-container>
<div>
<v-progress-linear :active="loading" :indeterminate="loading" color="cyan lighten-2"></v-progress-linear>
</div>
<v-row dense>
<v-col cols="12" md="6">
<v-text-field label="Name" v-model="HisLinkForm.Name"></v-text-field>
......@@ -30,7 +33,7 @@
<v-text-field label="Address" type="text" v-model="HisLinkForm.Address"></v-text-field>
</v-col>
<v-col cols="12" md="6">
<v-text-field label="Database Name" type="text" v-model="HisLinkForm.DataBaseName"></v-text-field>
<v-text-field label="Database Name" type="text" v-model="HisLinkForm.DatabaseName"></v-text-field>
</v-col>
<v-col cols="12" md="6">
<v-text-field
......@@ -46,7 +49,7 @@
<v-text-field
label="CaseId Expression"
type="text"
v-model="HisLinkForm.CaseIdExpression"
v-model="HisLinkForm.CaseExpression"
>></v-text-field>
</v-col>
<v-col cols="12" md="6">
......@@ -93,23 +96,27 @@
<v-card tile>
<v-card-actions>
<v-row style="margin:auto">
<v-col cols="12" class="d-flex justify-space-around align-center flex-wrap">
<v-btn color="success" @click="openNewDialog">
<v-col cols="12" class="d-flex justify-center align-center flex-wrap">
<v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="openNewDialog">
<strong>{{$t("HISLink.newBtn")}}</strong>
</v-btn>
<v-btn color="success" @click="openEditDialog">
<v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="openEditDialog">
<strong>{{$t("HISLink.editBtn")}}</strong>
</v-btn>
<v-btn color="success" @click="deleteSnackbar">
<v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="deleteSnackbar">
<strong>{{$t("HISLink.deleteBtn")}}</strong>
</v-btn>
<v-btn color="success" @click="activeHislink">
<v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="activeHislink">
<strong>{{$t("HISLink.activeBtn")}}</strong>
</v-btn>
<v-btn color="success" @click="deactiveHislink">
<v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="deactiveHislink">
<strong>{{$t("HISLink.deactiveBtn")}}</strong>
</v-btn>
<v-btn color="success" @click="authenticateHislink">
<v-btn
color="rgb(94, 181, 177,.85)"
class="white--text"
@click="authenticateHislink"
>
<strong>{{$t("HISLink.authenticateBtn")}}</strong>
</v-btn>
</v-col>
......@@ -121,7 +128,6 @@
<v-row justify="center" dense class="flex-wrap mt-6">
<v-col md="9" cols="12">
<v-data-table
ref="patientsDatatable"
v-model="selectedItemInTable"
:headers="headerOfTable"
:items="itemsOfTable"
......@@ -136,6 +142,7 @@
:sort-by.sync="sortByTable"
:sort-desc.sync="sortDescTable"
height="73vh"
@click:row="clickRow"
></v-data-table>
</v-col>
</v-row>
......@@ -159,10 +166,10 @@ export default {
UserName: "",
Password: "",
Address: "",
DataBaseName: "",
DatabaseName: "",
LinkServerName: "",
Schema: "",
CaseIdExpression: "",
CaseExpression: "",
TransformExpression: "",
SourceExpression: "",
Description: "",
......@@ -170,11 +177,11 @@ export default {
},
snackbar: false,
alertSnackbar: false,
alertText: ""
alertText: "",
loading: false
};
},
mounted() {
debugger;
Meteor.call("getBrands");
},
computed: {
......@@ -184,10 +191,10 @@ export default {
"Brand",
"UserName",
"Address",
"DataBaseName",
"DatabaseName",
"LinkServerName",
"Schema",
"CaseIdExpression",
"CaseExpression",
"TransformExpression",
"SourceExpression",
"Active"
......@@ -205,6 +212,7 @@ export default {
},
itemsOfTable() {
this.dialog = false;
this.loading = false;
if (this.hislink && this.hislink.length > 0) {
return this.hislink;
}
......@@ -220,6 +228,17 @@ export default {
}
},
methods: {
clickRow(item) {
if (
this.selectedItemInTable.length > 0 &&
this.selectedItemInTable[0]._id == item._id
) {
this.selectedItemInTable = [];
} else {
this.selectedItemInTable = [];
this.selectedItemInTable = [item];
}
},
openNewDialog() {
for (let prop in this.HisLinkForm) {
this.$set(this.HisLinkForm, prop, "");
......@@ -244,6 +263,7 @@ export default {
},
createOrEditHisLink() {
let me = this;
this.loading = true;
if (this.newOrEdit == "new") {
Meteor.call("createHisLink", this.HisLinkForm, function() {
// me.dialog = false;
......@@ -339,8 +359,7 @@ export default {
err,
result
) {
if (err){
debugger
if (err) {
me.alertSnackbarMethod("authenticate failed");
}
me.alertSnackbarMethod(
......@@ -360,7 +379,6 @@ export default {
return HisLink.find({}).fetch();
},
brands() {
console.log(Brands.find({}).fetch());
return Brands.find({}).fetch();
}
},
......
......@@ -102,6 +102,7 @@ import EditWorkList from '../components/EditWorkList.vue';
import WorkList from '../components/Worklist.vue';
import HisLink from '../components/HisLink.vue';
import DeviceMap from '../components/DeviceMap.vue';
import Client from '../components/Client.vue';
import AppVersion from '../views/AppVersion.vue';
......@@ -148,6 +149,10 @@ const routes = [{
path: "devicemap",
name: "devicemap",
component: DeviceMap
}, {
path: "client",
name: "client",
component: Client
}]
}
];
......
......@@ -93,7 +93,11 @@
<!-- <v-navigation-drawer v-model="left" fixed temporary></v-navigation-drawer> -->
<v-content>
<router-view></router-view>
<transition name="fade" mode="out-in">
<keep-alive>
<router-view></router-view>
</keep-alive>
</transition>
</v-content>
<!-- <v-navigation-drawer v-model="right" fixed right temporary></v-navigation-drawer> -->
......@@ -120,11 +124,25 @@ export default {
left: false,
item: 0,
items: [
{ text: "Worklist",url:"/main/worklist", icon: "mdi-folder" },
{ text: "HISLink", url:"/main/hislink",icon: "mdi-account-multiple" },
{ text: "DeviceMap",url:"/main/devicemap" ,icon: "mdi-star" },
{ text: "Worklist", url: "/main/worklist", icon: "mdi-folder" },
{ text: "HISLink", url: "/main/hislink", icon: "mdi-account-multiple" },
{ text: "DeviceMap", url: "/main/devicemap", icon: "mdi-star" },
{ text: "Client", url: "/main/client" }
]
})
};
</script>
\ No newline at end of file
</script>
<style scoped>
.fade-enter-active,
.fade-leave-active {
transition-duration: 0.3s;
transition-property: opacity;
transition-timing-function: ease;
}
.fade-enter,
.fade-leave-active {
opacity: 0;
}
</style>
\ No newline at end of file
......@@ -7,23 +7,23 @@ services:
image: "karname-app:${TAG_VERSION}"
ports:
- "80:3000"
depends_on:
- mongo
links:
- mongo
# depends_on:
# - mongo
# links:
# - mongo
environment:
ROOT_URL: ${APP_ROOT_URL:-http://localhost}
MONGO_URL: mongodb://mongo:27017/karname
MONGO_URL: mongodb://mongo-windows:27017/karname
PORT: 3000
METEOR_SETTINGS: '{"worklistUrl":"http://karname-broker","databusUrl":"http://databus"}'
mongo:
container_name: mongo-windows
image: repo.marcopacs.com/karname/mongo-windows
volumes:
- C:\data\db:C:\data\db
# mongo:
# container_name: mongo-windows
# image: repo.marcopacs.com/karname/mongo-windows
# volumes:
# - C:\data\db:C:\data\db
volumes:
data:
# volumes:
# data:
networks:
default:
......
import { Mongo } from 'meteor/mongo';
import { Meteor } from 'meteor/meteor';
let Clients;
if (Meteor.isClient || Meteor.isCordova) {
Clients = new Mongo.Collection('Client')
}
if (Meteor.isServer) {
Clients = new Mongo.Collection('Client')
}
export default Clients;
\ No newline at end of file
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { HTTP } from 'meteor/http';
Meteor.methods({
'createClient' (item) {
this.unblock();
if (this.userId) {
try {
let options = {
data: item,
headers: {
'content-type': 'application/json',
'Accept': 'application/json'
}
}
const result = HTTP.call("POST", `${Meteor.settings.databusUrl}/clients/create`, options);
return true
} catch (e) {
// Got a network error, timeout, or HTTP error in the 400 or 500 range.
console.log(e);
return false;
}
}
},
"editClient" (item) {
this.unblock();
if (this.userId) {
try {
let options = {
data: item,
headers: {
'content-type': 'application/json',
'Accept': 'application/json'
}
}
const result = HTTP.call("POST", `${Meteor.settings.databusUrl}/clients/update`, options);
return true
} catch (e) {
// Got a network error, timeout, or HTTP error in the 400 or 500 range.
console.log(e);
return false;
}
}
},
"deleteClient" (item) {
this.unblock();
if (this.userId) {
try {
let options = {
data: item,
headers: {
'content-type': 'application/json',
'Accept': 'application/json'
}
}
const result = HTTP.call("POST", `${Meteor.settings.databusUrl}/clients/delete`, options);
return true
} catch (e) {
// Got a network error, timeout, or HTTP error in the 400 or 500 range.
console.log(e);
return false;
}
}
},
});
\ No newline at end of file
import Clients from '../../collections/clients.js';
import { check } from 'meteor/check';
Meteor.publish("clients", function() {
if (!this.userId) {
return this.ready();
}
return Clients.find({});
});
\ No newline at end of file
......@@ -5405,9 +5405,9 @@
"dev": true
},
"handlebars": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.4.2.tgz",
"integrity": "sha512-cIv17+GhL8pHHnRJzGu2wwcthL5sb8uDKBHvZ2Dtu5s1YNt0ljbzKbamnc+gr69y7bzwQiBdr5+hOpRd5pnOdg==",
"version": "4.5.3",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz",
"integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==",
"dev": true,
"requires": {
"neo-async": "^2.6.0",
......@@ -13833,9 +13833,9 @@
}
},
"terser": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.2.1.tgz",
"integrity": "sha512-cGbc5utAcX4a9+2GGVX4DsenG6v0x3glnDi5hx8816X1McEAwPlPgRtXPJzSBsbpILxZ8MQMT0KvArLuE0HP5A==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.4.3.tgz",
"integrity": "sha512-0ikKraVtRDKGzHrzkCv5rUNDzqlhmhowOBqC0XqUHFpW+vJ45+20/IFBcebwKfiS2Z9fJin6Eo+F1zLZsxi8RA==",
"dev": true,
"requires": {
"commander": "^2.20.0",
......@@ -13844,9 +13844,9 @@
},
"dependencies": {
"commander": {
"version": "2.20.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"source-map": {
......@@ -13858,16 +13858,16 @@
}
},
"terser-webpack-plugin": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz",
"integrity": "sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg==",
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz",
"integrity": "sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA==",
"dev": true,
"requires": {
"cacache": "^12.0.2",
"find-cache-dir": "^2.1.0",
"is-wsl": "^1.1.0",
"schema-utils": "^1.0.0",
"serialize-javascript": "^1.7.0",
"serialize-javascript": "^2.1.2",
"source-map": "^0.6.1",
"terser": "^4.1.2",
"webpack-sources": "^1.4.0",
......@@ -13885,6 +13885,12 @@
"ajv-keywords": "^3.1.0"
}
},
"serialize-javascript": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz",
"integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==",
"dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
......@@ -14544,9 +14550,9 @@
"dev": true
},
"vuetify": {
"version": "2.0.15",
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-2.0.15.tgz",
"integrity": "sha512-3x/YwEaf7nCHDBfAeB1HZZ9ltgX3Bu9zhfCmq3ZGbuylLrKJMR4bp5xY3chVq1DAalXs0eqV69TbEkkSt1Iwkg=="
"version": "2.1.15",
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-2.1.15.tgz",
"integrity": "sha512-M35NJvlzkbCpFfsK08xraNvCpiNCIbYUXI/hkzjWHQV1MFIZnjrDTVtYoiudCyJ52zlrhWezAr4pzFOCLAr6RA=="
},
"vuetify-loader": {
"version": "1.3.0",
......
......@@ -30,7 +30,7 @@
"vue-meteor-tracker": "^2.0.0-beta.5",
"vue-router": "^3.1.2",
"vue-template-compiler": "^2.6.10",
"vuetify": "^2.0.15",
"vuetify": "^2.1.15",
"vuex": "^3.1.1"
},
"devDependencies": {
......
......@@ -5,11 +5,13 @@ import '../imports/api/methods/changePassword.js';
import '../imports/api/methods/devicecode.js';
import '../imports/api/methods/brands.js';
import '../imports/api/methods/hisLink.js';
import '../imports/api/methods/clients.js';
import '../imports/api/server/publications/worklist.js';
import '../imports/api/server/publications/devicecode.js';
import '../imports/api/server/publications/hislink.js';
import '../imports/api/server/publications/brands.js'
import '../imports/api/server/publications/brands.js';
import '../imports/api/server/publications/clients.js';
Meteor.startup(() => {
......
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