Gathering detailed insights and metrics for vnatk-vue
Gathering detailed insights and metrics for vnatk-vue
Gathering detailed insights and metrics for vnatk-vue
Gathering detailed insights and metrics for vnatk-vue
VNATKVUE is Frontend part of VNATK (Vue Node AgileTool Kit). Making app development easy by including some best practices as integral part, yet, giving you total customization options.
npm install vnatk-vue
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Vue (74.67%)
JavaScript (25.33%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
297 Commits
4 Forks
2 Watchers
4 Branches
2 Contributors
Updated on Jan 07, 2022
Latest Version
0.0.57
Package Id
vnatk-vue@0.0.57
Unpacked Size
375.75 kB
Size
78.84 kB
File Count
15
NPM Version
6.14.17
Node Version
14.20.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
27
VNATK is a set of client and server frameworks set to get your work started ASAP. Also we all know how tesdius it is to do maintenance of any project specially when client/company is ever changing their requirements. By looking at those issue I was missing somehting that really is fast, really RAPID APPLICATION DEVELOPMENT (RAD) framework.
So, here we are with two sets of frameworks, this VNATK-VUE and VNATK-EXPRESS-SEQULIZE.
Both repository contains same README file so pls follow proper link to go to respective repository.
Link to [VUEATK-VUE] (https://github.com/gowrav-vishwakarma/vnatk-vue) Official Documentation
Link to [VUEATK-EXPRESS-SEQUELIZE] (https://github.com/gowrav-vishwakarma/vnatk-express-sequelize)
Equipped with a few endpoints that gives you all power with Sequalize-QL developed by this project.
This express middleware will give all the fule required from server to VNATK Frontend Frameworks.
Please setup Express server setup equipped with VNATK-EXPRESS-SEQULIZE first as per information given here https://github.com/gowrav-vishwakarma/vnatk-express-sequelize
VNATKVUE is Frontend part of VNATK (Vue Node AgileTool Kit). Making app development easy by including some best practices as integral part, yet, giving you total customization options.
Dependencies: Vue (2.*), Vuetify(2.*), vue-form-base, lodash, dotenv
Please setup Express server setup equipped with VNATK-EXPRESS-SEQULIZE first as per information given here
VUEATK-EXPRESS-SEQUELIZE https://github.com/gowrav-vishwakarma/vnatk-express-sequelize
For simplicity we have our project folder structure as follows
1Your Project Root Folder 2 - client # Having vue fronetend 3 - server # Having express-sequelize backend
In case you are working with microservice architecture, you can have following structure
1Your Project Root Folder 2 - VueClientAPP1 3 - VueClientAPP2 4 - ExpressBackendService1 5 - ExpressBackendService2 6 - ... 7 - ExpressBackendService..N
Please setup Express server setup equipped with VNATK-EXPRESS-SEQULIZE first as per information given here
VUEATK-EXPRESS-SEQUELIZE https://github.com/gowrav-vishwakarma/vnatk-express-sequelize
This section describes what extra features you can introduce in Sequlize models to get best of VNATK-VUE from frontend, on the other hand, vnatk-express-sequelize will handle all the features describe here.
Create models in models
folder. For more about Models in sequlize please follow sequlize documentations.
Let's have a sample model. Please read Model comments as documentation. Some properties and methods are specific to VNATK.
1'use strict'; 2const { Model } = require('sequelize'); 3 4module.exports = (sequelize, DataTypes) => { 5 class User extends Model { 6 static associate(models) { 7 // define association here 8 // City and State Models must be created in same manner in models folder also 9 User.belongsTo(models.City, { foreignKey: 'city_id' }); 10 User.belongsTo(models.State, { foreignKey: 'state_id' }); 11 12 } 13 // you have to create this STATIC function in your model to tell what type of actions are doable on any model 14 static vnAtkGetActions(models) { 15 return [ 16 { 17 // any identifier of action 18 name: "deactivate", 19 /* type defined at what level a action will be applicable 20 'single'=> for Actions that are executable on any loaded row like activate, or deactivate. 21 'NoRecords => for Actions that are doable at Model level ie sendEventInvitationToAll 22 'MultiRecords' => for Actions that are doable on selected records by selecting checkboxes in data-grids ie submitSelected 23 */ 24 type: 'single', 25 // Your data-grid may have many records but if you want that action to be available only on specific conditions 26 // put your where, make sure you have those columns available in model->attributes if defined ie status in bellow where 27 where: { 28 status: 'Active' 29 }, 30 // actual function in this model to be called, created bellow 31 execute: 'deActivate' 32 }, 33 { 34 name: "activate", 35 type: 'single', 36 // If you want a different caption on DataGrid or Forms for your field 37 caption: 'Activate', 38 where: { 39 // Multiple conditions, Array is considered like OR 40 // Multiple fields will be in AND Condition 41 status: ['InActive', 'Blocked'] 42 }, 43 execute: 'activate' 44 }, 45 { 46 name: "block", 47 type: 'single', 48 caption: 'Block', 49 where: { 50 status: ['InActive', 'Active'] 51 }, 52 execute: 'block', 53 /** 54 * if defined "formschema" the action becoms UI based action and on click 55 * will generate a form with proper validations etc. On Submitting this form 56 * your "execute" value will be executed on model with sending all records of row along with these form values. 57 * "EVERYTHING IS OVERRIDABLE AND CUSTOMIZABLE" 58 * This is important. Even if you define something here, On Frontned you can override formfield, validations etc as per page to page need 59 * and still all things will work like a charm. 60 * For more about Form Schema please read at 61 * 62 * This is important link below 63 * 64 * https://wotamann.github.io/ 65 */ 66 formschema: { 67 reason: { 68 type: "text", 69 label: "reason", 70 }, 71 password: { 72 type: "text", 73 ext: 'password', 74 label: "Your Password to allow blocking", 75 clearable: true, 76 // solo: true, 77 class: "mx-1 mt-1" 78 }, 79 } 80 }, 81 ] 82 } 83 // Actual function that will be called on loaded model 84 // In other way of sequlize you define instance variable as 85 // sequelize.prototype=function () { ... } 86 deActivate() { 87 this.status = 'InActive' 88 return this.save().then(self => { 89 return self; 90 }) 91 } 92 93 activate() { 94 this.status = 'Active' 95 return this.save().then(self => { 96 return self; 97 }) 98 } 99 100 // block action is defined with formschema in above vnAtkGetActions method and will receive that in formdata when submitted with record that is being executed with this method. 101 block(formdata) { 102 this.status = 'Blocked' 103 return this.save().then(self => { 104 return self; 105 }) 106 } 107 108 } 109 110 // This init method is defined by 'define' method in other sequelize ways. technically its same ... 111 112 User.init( 113 { 114 // WHILE SEQULIZE AUTOMATICALLY CONSIDER ID FIELD, FOR VNATK IT IS REQRUIED TO DEFINE AS FIELD 115 id:{ 116 type: DataTypes.INTEGER, 117 primaryKey: true, 118 autoIncrement: true 119 }, 120 name: { 121 type: DataTypes.STRING, 122 // caption is vnatk field property to define its caption at frontend 123 caption: 'Name', 124 }, 125 email: { 126 validate: { isEmail: true }, 127 type: DataTypes.STRING, 128 defaultValue: 'guest@example.com' 129 }, 130 mobile: { 131 type: DataTypes.STRING, 132 validate: { 133 isNumeric: { 134 msg: 'Mobile number can only contains number', 135 args: true 136 }, 137 }, 138 }, 139 password: { 140 type: DataTypes.STRING, 141 ext: 'password' // VNATK Specific, for more ext please look at vue-form-base schemas system 142 }, 143 status: DataTypes.ENUM('Applied', 'Active', 'InActive', 'Blocked'), 144 createdAt: { 145 type: DataTypes.DATE, 146 field: 'created_at' 147 isSystem:true // VNATK- isSystem will not be displayed default in Table or Add/Edit forms unless specified specifically 148 }, 149 updatedAt: { 150 type: DataTypes.DATE, 151 field: 'updated_at', 152 isSystem:true 153 } 154 }, 155 { 156 sequelize, 157 modelName: 'User', 158 } 159 ); 160 return User; 161};
thats it... let's setup Vue frontend now
You can add the system in existing Vue app also as long as you are already using Vuetify
Considering we are in "Your Project Root Folder"
lets create express app (Server/service) from scratch, you are welcome to use any other way or manual if you know what you are doing
1# just be sure you are in root of your project 2$yourProjectRoot> ls 3server 4 5#install vue-cli globally if not installed 6$yourProjectRoot> npm install -g @vue/cli 7$yourProjectRoot> vue create client 8#follow wizard, I preferred default for beginners 9 10$yourProjectRoot> ls 11client server 12 13$yourProjectRoot> cd client 14$yourProjectRoot/client> vue add vuetify 15# I prefer defaults for now 16 17#to make better use of views etc just add router 18$yourProjectRoot/client> vue add router 19 20$yourProjectRoot/client> npm install --save material-design-icons-iconfont axios vuetify-form-base vue-papa-parse vnatk-vue
We are all set to use our system with defined model as in Back
First we need to update plugins/vuetify.js
file as per given code
1import Vue from 'vue'; 2import 'material-design-icons-iconfont/dist/material-design-icons.css' 3import 'vuetify/dist/vuetify.min.css' 4import Vuetify from "vuetify"; 5 6Vue.use(Vuetify, { 7 iconfont: 'md', 8}); 9 10export default new Vuetify({ 11});
Also the default setup does not usage v-app
from vuetify but just a div in src/App.vue
. Lets edit that file also like following
1<template> 2<!-- this below v-app was div in starting --> 3 <v-app id="app"> 4 <div id="nav"> 5 <router-link to="/">Home</router-link> | 6 <router-link to="/about">About</router-link> 7 </div> 8 <router-view /> 9 </v-app> 10</template> 11
To connect our service/server let's create a folder services
in your project src
folder. Considering server/service we created in express setup above, is for customers. Create a file customer.js
in services folder and place the following code there
1import axios from "axios"; 2 3const api = axios.create({ 4 baseURL: process.env.VUE_APP_BASE_URL_CUSTOMER || "http://localhost:3000" 5}); 6 7export default api;
Our system is ready to rock, now we will just create models
and methods
in Sequlize at server side and views/page
in Vue Frontend, The rest logic is well done by itself.
for now open views/Home.vue
file and place the following content to see the magic
1<template> 2 <vnatk-crud :options="crudoptions"> </vnatk-crud> 3</template> 4 5<script> 6import { VnatkCrud } from "vnatk-vue"; 7import customer from "../services/customer"; 8 9export default { 10 name: "SampleCRUD", 11 components: { 12 VnatkCrud, 13 }, 14 data() { 15 return { 16 crudoptions: { 17 service: customer, 18 model: "User", 19 title: "Users", 20 }, 21 }; 22 }, 23}; 24</script>
And your crud will be there with all avilable other actions also like the image below
Notice city_id and state_id is automatically de-refenced to have their respective names from associations and all defined actions are available in drop down menu of each row.
By default system assumes name
as title field that is shown instead of ID, but do not worry if you don't follow these notations, everything is customizable.
This is how edit form and functionality is created.
Too much fields, let's start configuring options, just change the crud options on vue component data as follows
1data() { 2 return { 3 crudoptions: { 4 service: customer, 5 model: "User", 6 title: "Users", 7 // Use response or read, response to work on Array based data crud and read for API based data fetch 8 // response: {idfield:'no', data:[{no:1,name:'x',age:20},{no:2,name:'y',age:20}],headers:[{text:'ID',value:'no',hide:true},{text,value},{}],actions:[{name,cation,type,formschema},{},{}]} // Provide data to skip service calling and managing Array dased data crud 9 10 //read defines all options to define data read ie R IN CRUD 11 read: { 12 // model options are for your sequlize models, all same (for Operators you need to do a small trick here) 13 modeloptions: { 14 attributes: ["name", "email", "state_id", "city_id", "status"], 15 }, 16 }, 17 }, 18 }; 19 },
and result is like
And the configurations are easy to read and maintains. A complete configuration can be as follows.
WE ARE IN PROCESS TO HAVE A COMPLETE DOCUMENTATION AND TESTINGS. THIS IS JUST A WORKING PROTOTYPE. FUNCTIONAL BUT WILL BE REFACTORED FOR CODE QUALITY AND PERFORMANCE SOON.
REMEMBER WE ARE STILL 0.0.x ;)
1<template> 2 <vnatk-crud :options="crudoptions" @before-action-execute="checkValues" @before-action-execute='handleResponse'> 3 <!-- You can override any column and give it your own format --> 4 <template v-slot:item.City.name="{ item }"> 5 City: {{ item.City.name }}<br /> 6 City Status : {{ item.City.status }} 7 </template> 8 </vnatk-crud> 9</template> 10 11<script> 12import { VnatkCrud } from "@/entry"; 13import customer from "./services/customer"; 14 15// Required for import functioanlity, Use VuePapaParse globally, if you use import with most of CRUDS 16import Vue from "vue"; 17import VuePapaParse from "vue-papa-parse"; 18Vue.use(VuePapaParse); 19 20 21export default { 22 name: "ServeDev", 23 components: { 24 VnatkCrud, 25 }, 26 data() { 27 return { 28 crudoptions: { 29 service: customer, 30 model: "User", 31 title: "Users", 32 basepath: "/vnatk", //OPTIONAL, default to '/vnatk 33 quickSearch: ["field1", "field2", "field3"], 34 create: { // OPTIONAL, default to true, set true to add all fields in Model 35 uititle: "Add New User", 36 modeloptions: { // Sequlize model options 37 attributes: ["name", "email", "status", "city_id", "password"], 38 }, 39 defaultvalues: { 40 userType: "employee", 41 mobile: function (item) { 42 console.log("callback function"); 43 console.log(item); 44 return item.firstName.length; 45 }, 46 }, 47 }, 48 read: { // OPTIONAL, default to true, set true to read all fields, headers and actions 49 modeloptions: { // Sequalize model options 50 attributes: [ 51 "name", 52 "email", 53 "status", 54 "state_id", 55 "city_id", 56 "mobile", 57 ], 58 // include: ["City", "State"], // to get all attributes with including 59 include: [ 60 { 61 model: "City", 62 attributes: ["name", "status"], 63 }, 64 { 65 model: "State", 66 attributes: ["name", "status", "gst_code"], 67 }, 68 ], 69 }, 70 modelscope: false, // String for scope name or Boolean true for default scope or false for unscoped 71 autoderef: true, // OPTIONAL, default true 72 headers: true, // OPTIONAL, default true 73 serversidepagination: true, // Skip to fetch all records and do pagination and sorting on client side 74 datatableoptions: { // OPTIONAL, defaults to v-datatable options.sync 75 multiSort: true, 76 mustSort: false, 77 }, 78 }, 79 update: { // OPTIONAL, defaults to true, set true to edit all non primary and system fields in crud 80 uititle: "Edit User - {name}", 81 modeloptions: { // Sequlize options to define what fields you want to allow to edit 82 attributes: [ 83 "name", 84 "email", 85 "status", 86 "city_id", 87 "state_id", 88 "mobile", 89 ], 90 }, 91 }, 92 delete: true, // OPTIONAL, default ture, set false to remove delete action 93 actions: true, // OPTIONAL, default true, st false to hide all actions including add/edit and delete 94 import: { // OPTIONAL, default undefined/false 95 service: catalog, 96 basepath: "/admin/vnatk", 97 model: "Category", 98 execute: "vnatk_import", // Class level function defined in model 99 success: this.reloadPage, //callback with passed response from model function 100 transaction: "file", // defaults to 'file' / or 'row'. In 'file' mode, data will rollback for all rows in case of error in any row, in 'row' mode, rows that are not imported are only rolled back and errored rows are reported back on import dialog. 101 rowformatter: function (item) { 102 // Example is not from actual Model but serves the purpose : TODO clear documentations 103 item.$vnatk_data_handle = "alwaysCreate"; // 'alwaysCreate' [default], 'findOrCreate','findAndUpdateOrCreate', (For Associations, two more options) 'findToAssociate' [Produce error if not found],'associateIfFound' [Ignores if not found] 104 item.$vnatk_find_options = {}; // if not provided, finding will be based on all fields and values defined above 105 item.$vnatk_cache_records = true; // default to true, set false to find each time even if same condition is already found previously 106 item.$vnatk_update_data = {}; // update only fields and their values defined here (if found), if this option is not provided, all fields defined above will be updated. 107 108 item.City = { 109 //Data to create or Update (if not defined vnatk_update_data) 110 name: item.city_name, 111 status: item.city_status, 112 113 $vnatk_data_handle: "alwaysCreate", // 'alwaysCreate' [default], 'findOrCreate','findAndUpdateOrCreate',(For Associations, two more options) 'findToAssociate' [Produce error if not found],'associateIfFound' [Ignores if not found] 114 $vnatk_find_options: { 115 modeloptions: {}, 116 modescope: false, 117 }, // if not provided, finding will be based on all fields and values defined above 118 $vnatk_cache_records: true, // default to true, set false to find each time even if same condition is already found previously 119 $vnatk_update_data: {}, // update only fields and their values defined here (if found), if this option is not provided, all fields defined above will be updated. 120 }; 121 122 item.FavPlaces = [ 123 //hasMany relations: set as Array of Object, Each object defines one hasMany/many2many entry 124 { 125 //Data to create or Update (if not defined vnatk_update_data) 126 name: item.fav_place_name_1, 127 $vnatk_data_handle: "alwaysCreate", // 'alwaysCreate' [default],'findToAssociate' [Produce error if not found],'findOrCreate','findAndUpdateOrCreate','associateIfFound' [Ignores if not found] 128 $vnatk_find_options: {}, 129 $vnatk_cache_records: true, // default to true, set false to find each time even if same condition is already found previously 130 $vnatk_update_data: {}, 131 $set_fresh_relations: false, // default to false, if set true all data with this relation will be removed first 132 }, 133 { 134 //Data to create or Update (if not defined vnatk_update_data) 135 name: item.fav_place_name_2, 136 $vnatk_data_handle: "alwaysCreate", // 'alwaysCreate' [default],'findToAssociate' [Produce error if not found],'findOrCreate','findAndUpdateOrCreate','associateIfFound' [Ignores if not found] 137 $vnatk_find_options: {}, 138 $vnatk_cache_records: true, // default to true, set false to find each time even if same condition is already found previously 139 $vnatk_update_data: {}, 140 }, 141 { 142 //Data to create or Update (if not defined vnatk_update_data) 143 name: item.fav_place_name_3, 144 $vnatk_data_handle: "alwaysCreate", // 'alwaysCreate' [default],'findToAssociate' [Produce error if not found],'findOrCreate','findAndUpdateOrCreate','associateIfFound' [Ignores if not found] 145 $vnatk_find_options: {}, 146 $vnatk_cache_records: true, // default to true, set false to find each time even if same condition is already found previously 147 $vnatk_update_data: {}, 148 }, 149 ]; 150 151 delete item.city_name; 152 delete item.city_status; 153 154 return i; 155 }, 156 }, 157 ui: { // OPTIONAL, 158 defaultActionPlacement: "DropDown", // "DropDown" or "buttonGroup". Where you want your default actions in row dropdown menu or as button in action columns for direct access 159 }, 160 override: { //OPTIONAL 161 actions: [ // Override actions 162 { 163 name: "vnatk_edit", // edit action is given specially this name 164 placeIn: "buttonGroup", // or "DropDown" 165 // use this to merge formschema options 166 formschemaoverrides: { // Override formschema sent from server 167 mobile: { 168 label: "Mobile Number", 169 }, 170 city_id: { 171 // titlefield - only used if field is reference/association type 172 // default titlefield is considered as name 173 titlefield: "City.name", 174 label: "Your City", 175 serviceoptions: { // OPTIONAL: Usefull if you are dealing with microservices 176 service: customer, 177 basepath: "/vnatk", 178 model: "City", 179 modelattributes: ["id", "name"], 180 searchfield: ["name"], 181 limit: 10, 182 }, 183 }, 184 email: { 185 clearable: true, 186 }, 187 // state_id: { 188 // titlefield: "State.name", 189 // no state_id related info is overrided, still working good, in this case: using same service to get details if id,name is required with default limit 190 // }, 191 }, 192 }, 193 { 194 name: "vnatk_add", // add action is given specially this name 195 // use this to merge formschema options 196 formschemaoverrides: { 197 city_id: { 198 label: "Your City ... ", 199 }, 200 }, 201 }, 202 { 203 name: "activate", 204 placeIn: "buttonGroup", // or "DropDown" 205 icon: "mdi-format-align-left", 206 caption: "Activate User", 207 // formschema:{} // use this to override complete formschema 208 // formschemaoverrides:{} // use this to merge formschema options 209 }, 210 { 211 name: "deactivate", 212 placeIn: "buttonGroup", 213 caption: "Deactivate", 214 // icon: "mdi-format-align-left", 215 }, 216 { 217 name: "clientFunction", 218 type: "NoRecord", 219 execute: this.clientFunctionCallBack, // call this function if isClientAction to handle action, row items will be passed to function. 220 isClientAction: true, 221 }, 222 ], 223 headers: { // OPTIONAL, override headers, hide, move position or create new columns 224 city_id: { 225 hide: true, 226 }, 227 state_id: { 228 hide: true, 229 }, 230 mobile: { 231 text: "User Mobile", 232 sortable: false, // OPTIONAL, default to true 233 // moveto: 0, 234 }, 235 City: { 236 // Override DeReferanced Fields (received from server due to autoderef) 237 text: "Primary City", //Overrided header caption/text 238 value: "City.name", // Value does not have effect as alrady overrided column by slot in template above 239 // moveto: 2, 240 }, 241 "State.gst_code": { // ADD a new column showing User.State.gst_code, look at how we included gst_code in read options model's include. 242 text: "State GST Code", 243 value: "State.gst_code", 244 sortable: true, 245 moveto: 4, 246 }, 247 vnatk_actions: { 248 moveto: "last", // Either +INT to move from left to right or -INT to move from right to left or "last" to move column to last 249 }, 250 }, 251 }, 252 }, 253 }; 254 }, 255 256 methods: { 257 // Defined custom local clientaction handler 258 clientFunctionCallBack(item) { 259 console.log("CLIENT FUNCTION CALLED with item", item); 260 }, 261 handleResponse(dataSent,DataReceived){ 262 // Do something here 263 }, 264 265 checkValues(action,item){ 266 // Do something here 267 } 268 }, 269}; 270</script>
Model Designer is an under development tool to define and design your models from front end, Till beta model designer
READS FROM models
folder in express app BUT WRITES CHANGES IN copied files in models/modeldesigner
.
1<template> 2 <model-designer :service="serviceInfo"> </model-designer> 3</template> 4 5<script> 6import { ModelDesigner } from "@/entry"; 7import customer from "./services/customer"; 8 9export default { 10 name: "ModelDesginierExample", 11 components: { 12 ModelDesigner, 13 }, 14 data() { 15 return { 16 serviceInfo: { 17 service: customer, 18 basepath: "/vnatk", 19 }, 20 }; 21 }, 22}; 23</script>
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 4/18 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
license file not detected
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
102 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More