Giter Club home page Giter Club logo

basel's Introduction

Framework for Bootstrap, AngularJS, SQLite, Electron

## [Documentation](http://baseljs.github.io/#/)

Usage

Install

npm install -g basel

Create App

basel-init myApp

Install dependencies

cd myApp && npm install

Run

npm start

Database

To create a new table in the database of your BASEL app.

basel-database --table USERS --columns "id:INTEGER, name:TEXT" --pk id

And manipulate the database.

Options

    -h, --help                        output usage information
    -p, --password <password>         Data base encripted passowrd
    -a, --algorithm <algorithm>       Data base encripted algorithm
    -s, --sql <sql>                   Sql to run
    -t, --table <table>               Create database table
    -c, --columns <columns>           Database table columns. Ex: "id:INTEGER, name:TEXT"
    -p, --pk <primary>                Database table primary key
    -r, --references <references>     Refences. Ex: "id":"table.id_table"
    -i, --incremental <incremental>   incremental columns. Ex: id or "id, number, ..."

Example:

basel-database --table USERS --columns "id:INTEGER, name:CHAR(100), email:TEXT, profile:INTEGER" --pk id --incremental id --references "profile:profiles.id"

Mean:

CREATE table USERS(
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  name CHAR (100),
  email TEXT,
  profile INTEGER REFERENCES profiles(id)
);

CRUD - Creating

To create CRUD from database tables.

basel-crud users --table USERS

Options

    -h, --help                       output usage information
    -t, --table <table>              Database Table
    -n, --columns <columns>          For new tables. Table columns. Ex: "id:INTEGER, name:TEXT"
    -p, --pk <primary>               Primary key of new table
    -f, --references <references>    Refences of new table. Ex: "profile:profiles.id"
    -i, --incremental <incremental>  incremental columns. Ex: id or "id, number, ..."
    -b, --database <database>        Database
    -c, --controller <controller>    Controller name
    -v, --view <view>                View name (.html)
    -r, --route <route>              Route (Ex.: persons)
    -m, --menu <menu>                Show in main menu (1 - Yes, 0 - No) Default 1
    -d, --delete <id>                To delete CRUD by ID
    -l, --list                       To list CRUDS

Examples

basel-crud users --table USERS -c userController -v user -r users

Create a CRUD on Controller and view based in table USERS.

Create CRUD and Table

you can create the CRUD and at the same time the table. Inform the table columns using the short -n or --columns "id:INTEGER, name:TEXT, ... ".

basel-crud users --table USERS -n "id:INTEGER, name:TEXT" 

Help

Init

basel-init --help

Database

basel-database --help

CRUD

basel-crud --help

basel's People

Contributors

jayralencar avatar jupitercl avatar rafaelgfirmino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

basel's Issues

Enforcing Foreign Key Contstraints [HOW-TO]

I have some FK's of a child table that have ON DELETE RESTRICT.
Currently the SQLite database is not enforcing it and having read the SQLite documentation, to have this work, a command needs to executed to call "PRAGMA foreign_keys = ON".

How can I made this call through the basel.database objects?

How to do a route with a parameter [Question - How to]

I have a route named "person" and the person.html page has the list of all people in the database. I have modified the edit button in the person row of the list to now call a new function which will (should ) display the details for that person.

I have created the personDetail route/view/controller via the basel-crud cli.

I am passing the item selected on the person.html, into the function in the personController as shown.

$scope.changeView = function(item) {
    $location.path("/personDetail"); //this will load the personDetail page no problem
    //$location.path("/personDetail/" + item.id); //this does not load the personDetail. 
  }

How can I get this new route (ie: /personDetail/1) to actually route to the personDetail page.

mac os build generation issue

Hi Team,

I am generating the build for mac os application, it generated but application title and tab titles not presented and contents also after installing the ".dmg" file.

Please, anyone helps me to this issue.

thanks,
Gopalakrishna U.

Links do not work

After doing basel-crud myCrud -t tableName -c myController -v myView.html -r my-route --menu
I expected for it to create a page and add it to the menu... Sadly when I click the link on the menu it does not take me to the new page... the link does nothing.

Multidimensional keys and static views

I've tried Basel, and there are two reasons I cannot use it.

  1. I need support for multidimensional primary and foreign keys. I have a table whose primary key is in part a foreign key to another table (to make sure I don't make mistakes entering data).
  2. I need support for a static view. A static view implements only the list() method. It is also called a report. Its entire raison d'etre is to display the results of a SELECT query with no form fields or editable pieces of data. What's the point in building a database application if you can't see the results?

How to Manually Add Route (Help with)

I see in the app.js there is commented code , so I uncommeted it

//For new routes:
    	$routeProviderReference.when('/when',{
	 		controller: 'test',
	 	   templateUrl: 'views/test.html'
        })

I then created a test controller similar to the example controller and I also added a test.html page based upon the example.html.
In the index.html I added in the script tag for the new controller

<script src="controllers/testController.js"></script>

and in the menu div's I added a new list item and commented out the items from the database

<ul class="nav navbar-nav">
  <li ng-repeat="menu in menus">
     <!-- <a href="#/{{menu.route}}">{{menu.name}}</a> -->
 </li>
 <li >
   <a href="#/test">Test</a>
 </li>
</ul>

I can't get this route to load. When I change the href in my menu item to example, the example route/page will load. Can you tell me what I am missing or is adding manual routes not possible

[Foreign Key] PRAGMA db call does not work

Per you instruction, I tried
basel.database.run("PRAGMA foreign_keys = ON");

I put it in the app.config and it did not work
I tried it in the controller - when the controller loads and also in a function call and both did not work

Error: ENOENT: no such file or directory, open database

demo ⚡ $ basel-database --table USERS --columns "id:INTEGER, name:CHAR(100), email:TEXT, profile:INTEGER" --pk id --incremental id --references "profile:profiles.id"
? What is the primary key? id
/usr/local/lib/node_modules/basel/node_modules/sql.js/js/sql.js:5
1<process.argv.length?process.argv[1].replace(/\\/g,"/"):"unknown-program");f.arguments=process.argv.slice(2);"undefined"!==typeof module&&(module.exports=f);process.on("uncaughtException",function(a){if(!(a instanceof ka))throw a;});f.inspect=function(){return"[Emscripten Module object]"}}else if(fa)f.print||(f.print=print),"undefined"!=typeof printErr&&(f.printErr=printErr),f.read="undefined"!=typeof read?read:function(){throw"no read() available (jsc?)";},f.readBinary=function(a){if("function"===
                                                                                                                                                                                                                               ^

Error: ENOENT: no such file or directory, open '/Users/hafonso/Workspace/sandbox/js/demo/model/Users/hafonso/Workspace/sandbox/js/demo/model/database.db.db'
    at Object.fs.openSync (fs.js:557:18)
    at Object.fs.writeFileSync (fs.js:1222:33)
    at sqlite.write (/usr/local/lib/node_modules/basel/node_modules/sqlite-sync/sqlite.js:405:9)
    at sqlite.connect (/usr/local/lib/node_modules/basel/node_modules/sqlite-sync/sqlite.js:77:12)
    at Object.exports.init (/usr/local/lib/node_modules/basel/lib/database.js:26:15)
    at Object.exports.wizard (/usr/local/lib/node_modules/basel/lib/database.js:46:8)
    at PromptUI.completed (/usr/local/lib/node_modules/basel/bin/basel-database.js:101:15)
    at PromptUI.onCompletion (/usr/local/lib/node_modules/basel/node_modules/inquirer/lib/ui/prompt.js:69:10)
    at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.completed (/usr/local/lib/node_modules/basel/node_modules/rx/dist/rx.js:1793:12)
    at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/usr/local/lib/node_modules/basel/node_modules/rx/dist/rx.js:1730:14)

env: node\r: No such file or directory

executing:
basel-init myApp result on this message error:

env: node\r: No such file or directory

It seems there is a none unix return somewhere x(

I fix it using:
sudo find /usr/local/lib/node_modules/basel -type f -exec perl -pi -e 's/\r\n|\n|\r/\n/g' {} \;

Using a yosimite in my mac.

Problem creating the project

Hello developers . I am new to the world of nodejs and I could not run basel- init . Install through npm but the next step to execute "init -base newapp " I get a warning "file or directory not found."

Thank you

Option -d does not leave a trace on a init

When I try to initialize application with database, I cannot find trace of database in it. There is a module, but it's not integrated in aplication, I tought it would be somehow integrated with some database example.

Problem npm start

fap48nt@fap48nt-Aspire-ES1-572:~/BaselApps/Ejemplo$ npm start

[email protected] start /home/fap48nt/BaselApps/Ejemplo
electron main.js

fs.js:646
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^

Error: ENOENT: no such file or directory, open '/home/fap48nt/BaselApps/Ejemplo/node_modules/electron-prebuilt/path.txt'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object. (/home/fap48nt/BaselApps/Ejemplo/node_modules/electron-prebuilt/index.js:4:42)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: electron main.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/fap48nt/.npm/_logs/2018-05-30T13_20_24_546Z-debug.log

basel js problem

E:\crud>basel-crud Booking -t crud -c bookingController -v booking.html -r booking --menu 1
Connected in database
Creating view...
C:\Users\maush\AppData\Roaming\npm\node_modules\basel\node_modules\sql.js\js\sql.js:5
1<process.argv.length?process.argv[1].replace(/\/g,"/"):"unknown-program");f.arguments=process.argv.slice(2);"undefined"!==typeof module&&(module.exports=f);process.on("uncaughtException",function(a){if(!(a instanceof ka))throw a;});f.inspect=function(){return"[Emscripten Module object]"}}else if(fa)f.print||(f.print=print),"undefined"!=typeof printErr&&(f.printErr=printErr),f.read="undefined"!=typeof read?read:function(){throw"no read() available (jsc?)";},f.readBinary=function(a){if("function"===
^

TypeError: jsdom.env is not a function
at C:\Users\maush\AppData\Roaming\npm\node_modules\basel\lib\crud.js:104:12
at tryToString (fs.js:456:3)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)

Can not get the error messages back from the db.

Inside the generated controller, the save function has this function call to insert a new record:
basel.database.insert($scope.table_name, $scope.form);
and the update is:

basel.database.update($scope.table_name, $scope.form, {
        id: id
      });

How can I access an error message that is returned from the database.

FYI - Duplicated controllers are added to the Index.js

I am now using the cli CRUD function to add my controllers and routes and noticed that two entries are being created in the index.html.

Here is the info from the CRUD creation:

C:\WorkshopManager>basel-crud workshop
? What is the database table? workshop
? What is the route way? workshop
Connected in database
Creating view...
Route renamed for workshop_1
View created!
Creating controller...
Controller created!

CRUD created!

And here is what is now in the index.html

	<script src="app.js"></script>

	<!-- Controllers -->
	<script src="controllers/mainController.js"></script><script src="controllers/workshopController.js"></script>
	<script src="controllers/addressController.js"></script>
	<script src="controllers/workshopController.js"></script>

Cancel in Modal Popup leaves changes in list

I was testing a change to an item using the edit (modal) form.
If you change any field, the change is immediately shown in the list, behind the modal form (which will happen because both are bound to the same item model.

BUT if you click the cancel button to close the modal form, the change is still in the list which should not happen because the save button was not clicked.

I made this change in the controller cancel function and now the list re-displays the valid data.
You might want to implement this change or should I try to do it myself (I have never done that to someone else's code!)


  $scope.cancel = function() {
    //$scope.form = {};
    //this will refresh the page without the changes
    $scope.list();
  }

packager problem

I try to clone the project and pack the app.

$npm install basel
$./node_modules/basel/bin/basel-init.js SOME_APP
$cd SOME_APP/
$npm install
$npm start    

works fine till here, but ...

$npm run win64
$cd  myApp-win32-x64/
$./myApp.exe

It can execute but the angular seems not work, the title of the app is {{app.title}}.
I guess the reason is the electron-packager do not include module/database.db while packing.

npm install get a error during install electron-prebuilt

Please,

Change the package.json "devDependecnies" generated from this
"devDependencies": {
"electron-prebuilt": "latest",
"electron-packager": "^6.0.0",
"basel-cli": "",
"jquery": "^2.2.2",
"angular": "1.5.1",
"angular-route": "1.5.1",
"angular-utils-pagination": "^0.11.0"
},
to
"devDependencies": {
"angular": "1.5.1",
"angular-route": "1.5.1",
"angular-utils-pagination": "^0.11.0",
"basel-cli": "
",
"electron": "^1.8.2",
"electron-packager": "^6.0.0",
"jquery": "^2.2.2"
},
and this resolve this issue.
thank's a lot

Cannot Pack Basel

I just clone your git, install node dependencies with npm. I also tried to make a crud with basel-crud and it successfully create the model/database.db file. Then, i tried to package it with this command :
electron-packager . myApp --platform=win32 --arch=x64 , Although it successfully create myApp.exe however, once i run the produced executable, the aps showed a problem as below :
ini
I guess it failed to load angular js, what should i do to fx this ?

Question: Nesting tabs within the Index.html

I am looking at the base Basel project and the Index.html display the other views within the following tag:
<div ng-view="" class="container"></div>
I am wondering how i can have another views display tabs, and each would then have a partial view.

For example I only want two menu items. People and Workshops.
The People.html page would list people in the people table.
When I click a button on a person row, it displays a Person.html view, and on this page it has 4 tabs: Email, Phones, Address, Other.

Then if you click a tab, you get to see the information for that partial view.

Is this possible?
Would the routes, for each tab then load that partial view OR do I have to have a route for each tab, and in those views code up the tabs but only display the infor for that tab.

Thanks in advance for all your help

Angular 2+

Is it possible to use basel with angular 2+?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.