Meteor Kitchen - code generator for Meteor

Thanks @perak!

Super-Admin is the top-level admin. Some contents are not allowed to view/edit/delete by a normal admin. This is a special role that i think it’s useful.

Cheers and more Power!
Marvin

Let’s say then built-in “admin” is “super-admin”, and you can add “sub-admin” and restrict that role to some data/pages. Does that works?

IoT - Internet of Things

Just added new example:

Live app is here: http://generator-iot.meteor.com/

Source code (input file for generator) is here: https://github.com/perak/kitchen-examples/tree/master/example-iot

Enjoy!

News from kitchen: file upload support. Added new example here: http://generator-upload.meteor.com

1 Like

Hi perak!

I am creating an application that follows much the standard example “invoices”, I have some problems in relation to data on-screen display of “details” of an entity, perhaps even problem in my code, you could help me? Are there any specific place for questions and problems Meteor Kitchen?

Thanks from Brazil!

Hi,

please give me more details about your problem. Btw, can you show me your input json file? (or at least problematic part of it).

Hi Perak,

I’m really liking Meteor Kitchen – thanks for the great work on it!
I have a question about how I could include an image collection in my JSON, though. I’m using CollectionFS to store the images, so instead of

this.Images = new Meteor.Collection("images")

I want to do

this.Images = new FS.Collection("images", configObj)

where configOjb has some configuration info. But I’d like to keep it as both/collections/images.js with my other collections. Here’s a gist of what I have (based on MK boilerplate for a standard collection): https://gist.github.com/nickbenes/0cb013e8a4522c63169d.

Any suggestions on how I could do that within a Meteor Kitchen JSON?

Thanks!

Hi, support for CollectionFS is added in latest version 0.9.39. (Note: it’s fresh and must have bugs :).

Please check “upload example”:

Source is here: https://github.com/perak/kitchen-examples/tree/master/example-upload
Live example is here: http://generator-upload.meteor.com/

There is also short story in “getting started”: http://www.meteorkitchen.com/getting_started#file-uploads

Ah… you cannot configure kitchen to generate configObj, but it looks like this functionality is “must have”. Please add issue for that: https://github.com/perak/kitchen-site/issues

Hi perak!

Thank you for answer, OK, let’s go.

My problem is that my collection of “sale”, created a field that stores the customer id (customerid), and created the other three fields which in my view of customers through a search with the “doc” can assign the correct value to these fields, the screen of “details” have the same search but the values do not appear as they appear in view. This problem also happens to my items list because it is on the screen “details” of “customer”, first I want to solve the problem of information from the “client” and then follow through with the items, and I believe that is the same solution.

Here’s my json.

   {
      "application":{
        "meta_title":"Pizzaria",
        "meta_description":"Pizzaria - Building",
        "theme":"bootswatch-flatly",
        "collections":[
          {
            "name":"cliente",
            "fields":[
              {
                "name":"nome",
                "title":"Nome",
                "required":true
              },
              {
                "name":"cpf",
                "title":"CPF",
                "required":true
              },
              {
                "name":"telefone",
                "title":"Telefone"
              },
              {
                "name":"email",
                "title":"E-mail",
                "type":"email"
              },
              {
                "name":"bairro",
                "title":"Bairro",
                "required":true,
                "input":"select",
                "input_items":[
                  {
                    "value":"Santa Monica",
                    "title":"Santa Mônica"
                  },
                  {
                    "value":"Segismundo Pereira",
                    "title":"Segismundo Pereira"
                  },
                  {
                    "value":"Santa Luzia",
                    "title":"Santa Luzia"
                  }
                ]
              },
              {
                "name":"logradouro",
                "title":"Logradouro",
                "type":"string",
                "required":true
              }
            ]
          },
          {
            "name":"produto",
            "fields":[
              {
                "name":"descricao",
                "title":"Descricao",
                "required":true
              },
              {
                "name":"preco",
                "title":"Preco",
                "required":true
              }
            ]
          },
          {
            "name":"venda",
            "fields":[
              {
                "name":"mesa",
                "title":"Número da mesa",
                "required":true,
                "input":"select",
                "input_items":[
                  {
                    "value":"Entrega",
                    "title":"Entrega"
                  },
                  {
                    "value":"1",
                    "title":"1"
                  },
                  {
                    "value":"2",
                    "title":"2"
                  },
                  {
                    "value":"3",
                    "title":"3"
                  }
                ]
              },
              {
                "name":"produto",
                "title":"Produto",
                "required":true,
                "input":"select",
                "lookup_query":{
                  "name":"venda_produtos",
                  "collection":"produto",
                  "filter":{

                  }
                },
                "exportable":true,
                "lookup_key":"descricao",
                "lookup_field":"descricao"
              },
              {
                "name":"clienteId",
                "title":"Cliente",
                "required":true,
                "input":"select",
                "lookup_query":{
                  "name":"venda_clientes",
                  "collection":"cliente",
                  "filter":{

                  }
                },
                "exportable":true,
                "lookup_field":"nome",
                "lookup_key":"_id",
                "show_in_dataview":false,
                "show_in_read_only_form":false
              },
              {
                "name":"clienteNome",
                "title":"Cliente",
                "show_in_insert_form":false,
                "show_in_update_form":false
              },
              {
                "name":"clienteLogradouro",
                "title":"Logradouro do Cliente",
                "show_in_insert_form":false,
                "show_in_update_form":false,
                "exportable":true
              },
              {
                "name":"clienteBairro",
                "title":"Bairro do Cliente",
                "show_in_insert_form":false,
                "show_in_update_form":false,
                "exportable":true
              },
              {
                "name":"tipoPagamento",
                "title":"Tipo do pagamento",
                "required":true,
                "input":"radio",
                "input_items":[
                  {
                    "value":"Cartão Débito/Crédito",
                    "title":"Cartão Débito/Crédito"
                  },
                  {
                    "value":"Dinheiro",
                    "title":"Dinheiro"
                  }
                ]
              },
              {
                "name":"dataVenda",
                "title":"Data",
                "type":"date",
                "format":"DD/MM/YYYY",
                "input":"datepicker",
                "default":"today",
                "required":true,
                "exportable":true
              }
            ],
            "owner_field":"ownerId",
            "read_owner_only":true,
            "write_owner_only":true
          }
        ],
        "free_zone":{
          "pages":[
            {
              "name":"client",
              "components":[
                {
                  "name":"viewClient",
                  "type":"dataview",
                  "title":"Clientes",
                  "text_if_empty":"Nenhum cliente cadastrado",
                  "query":{
                    "name":"customers",
                    "collection":"cliente",
                    "filter":{

                    }
                  },
                  "insert_route":"client.insert",
                  "edit_route":"client.update",
                  "edit_route_params":[
                    {
                      "name":"clienteId",
                      "value":"this._id"
                    }
                  ],
                  "details_route":"client.details",
                  "details_route_params":[
                    {
                      "name":"clienteId",
                      "value":"this._id"
                    }
                  ]
                }
              ],
              "queries": [
                            {
                                "name": "cliente_vendas",
                                "collection": "venda",
                                "filter": {}
                            }
                        ],
              "pages":[
                {
                  "name":"insert",
                  "components":[
                    {
                      "name":"insert_form",
                      "type":"form",
                      "mode":"insert",
                      "title":"Novo cliente",
                      "query":{
                        "name":"customers_empty",
                        "collection":"cliente",
                        "filter":{
                          "_id":null
                        }
                      },
                      "submit_route":"client",
                      "cancel_route":"client"
                    }
                  ]
                },
                {
                  "name":"details",
                  "route_params":[
                    "clienteId"
                  ],
                  "components":[
                    {
                      "name":"details_form",
                      "type":"form",
                      "mode":"read_only",
                      "title":"Details",
                      "layout":"horizontal",
                      "query":{
                        "name":"customer_details",
                        "collection":"cliente",
                        "filter":{
                          "_id":":clienteId"
                        }
                      },
                      "close_route":"client",
                      "back_route":"client"
                    }
                  ]
                },
                {
                  "name":"update",
                  "route_params":[
                    "clienteId"
                  ],
                  "components":[
                    {
                      "name":"update_form",
                      "type":"form",
                      "mode":"update",
                      "title":"Editar cliente",
                      "query":{
                        "name":"customers_update",
                        "collection":"cliente",
                        "filter":{
                          "_id":":clienteId"
                        }
                      },
                      "submit_route":"client",
                      "cancel_route":"client"
                    }
                  ]
                }
              ]
            },
            {
              "name":"product",
              "components":[
                {
                  "name":"viewProduct",
                  "type":"dataview",
                  "title":"Produtos",
                  "text_if_empty":"Nenhum produto cadastrado",
                  "query":{
                    "name":"produtos",
                    "collection":"produto",
                    "filter":{

                    }
                  },
                  "insert_route":"product.insert",
                  "edit_route":"product.update",
                  "edit_route_params":[
                    {
                      "name":"produtoId",
                      "value":"this._id"
                    }
                  ],
                  "details_route":"product.details",
                  "details_route_params":[
                    {
                      "name":"produtoId",
                      "value":"this._id"
                    }
                  ]
                }
              ],
              "pages":[
                {
                  "name":"insert",
                  "components":[
                    {
                      "name":"insert_form",
                      "type":"form",
                      "mode":"insert",
                      "title":"Novo produto",
                      "query":{
                        "name":"products_empty",
                        "collection":"produto",
                        "filter":{
                          "_id":null
                        }
                      },
                      "submit_route":"product",
                      "cancel_route":"product"
                    }
                  ]
                },
                {
                  "name":"details",
                  "route_params":[
                    "produtoId"
                  ],
                  "components":[
                    {
                      "name":"details_form",
                      "type":"form",
                      "mode":"read_only",
                      "title":"Details",
                      "layout":"horizontal",
                      "query":{
                        "name":"product_details",
                        "collection":"produto",
                        "filter":{
                          "_id":":produtoId"
                        }
                      },
                      "close_route":"product",
                      "back_route":"product"
                    }
                  ]
                },
                {
                  "name":"update",
                  "route_params":[
                    "produtoId"
                  ],
                  "components":[
                    {
                      "name":"update_form",
                      "type":"form",
                      "mode":"update",
                      "title":"Editar produto",
                      "query":{
                        "name":"product_update",
                        "collection":"produto",
                        "filter":{
                          "_id":":produtoId"
                        }
                      },
                      "submit_route":"product",
                      "cancel_route":"product"
                    }
                  ]
                }
              ]
            },
            {
              "name":"sale",
              "components":[
                {
                  "name":"viewSale",
                  "type":"dataview",
                  "title":"Vendas",
                  "text_if_empty":"Nenhuma venda cadastrada",
                  "query":{
                    "name":"vendas",
                    "collection":"venda",
                    "filter":{

                    },
                    "options":{
                      "transform":"function(doc) { 
                                            var clienteAtual = Cliente.findOne({_id: doc.clienteId }); 
                                            if(clienteAtual)
                                            { 
                                                doc.clienteNome     = clienteAtual.nome;
                                                doc.clienteLogradouro = clienteAtual.logradouro;
                                                doc.clienteBairro   = clienteAtual.bairro;
                                            }
                                            return doc; }",
                      "sort":{
                        "_id":-1
                      }
                    }
                  },
                  "insert_route":"sale.insert",
                  "edit_route":"sale.update",
                  "edit_route_params":[
                    {
                      "name":"vendaId",
                      "value":"this._id"
                    }
                  ],
                  "details_route":"sale.details",
                  "details_route_params":[
                    {
                      "name":"vendaId",
                      "value":"this._id"
                    }
                  ]
                }
              ],
              "queries":[
                {
                  "name":"clientes_vendas",
                  "collection":"cliente",
                  "filter":{

                  }
                }
              ],
              "pages":[
                {
                  "name":"insert",
                  "components":[
                    {
                      "name":"insert_form",
                      "type":"form",
                      "mode":"insert",
                      "title":"Nova venda",
                      "query":{
                        "name":"sales_empty",
                        "collection":"venda",
                        "filter":{

                        }
                      },
                      "submit_route":"sale.details",
                      "submit_route_params":[
                        {
                          "name":"vendaId",
                          "value":"newId"
                        }
                      ],
                      "cancel_route":"sale"
                    }
                  ]
                },
                {
                  "name":"details",
                  "template":"page_subcontent_tabnav",
                  "route_params":["vendaId"],
                  "components":[
                    {
                      "name":"details_form",
                      "type":"form",
                      "mode":"read_only",
                      "title":"Detalhes da venda",
                      "layout":"horizontal",
                      "query":{
                        "name":"sale_details",
                        "collection":"venda",
                        "filter":{
                          "_id": ":vendaId"
                        },
                        "options":{
                          "transform":"function(doc) { 
                                            var clienteAtual = Cliente.findOne({_id: doc.clienteId }); 
                                            if(clienteAtual)
                                            { 
                                                doc.clienteNome     = clienteAtual.nome;
                                                doc.clienteLogradouro = clienteAtual.logradouro;
                                                doc.clienteBairro   = clienteAtual.bairro;
                                            }
                                            return doc; }",
                          "sort":{
                            "_id":-1
                          }
                        }
                      },
                      "close_route":"sale",
                      "back_route":"sale"
                    }
                  ]
                },
                {
                  "name":"update",
                  "route_params":[
                    "vendaId"
                  ],
                  "components":[
                    {
                      "name":"update_form",
                      "type":"form",
                      "mode":"update",
                      "title":"Editar venda",
                      "query":{
                        "name":"sale_update",
                        "collection":"venda",
                        "filter":{
                          "_id":":vendaId"
                        }
                      },
                      "submit_route":"sale",
                      "cancel_route":"sale"
                    }
                  ]
                }
              ]
            }
          ],
          "menus":[
            {
              "name":"left_menu",
              "class":"nav navbar-nav",
              "items":[
                {
                  "title":"Clientes",
                  "route":"client"
                },
                {
                  "title":"Produtos",
                  "route":"product"
                },
                {
                  "title":"Vendas",
                  "route":"sale"
                }
              ]
            }
          ]
        }
      }
    }

Hi Perak,
You read my mind on the feature in 0.9.39, and on the “but it also needs…” mod to that. Very impressive work. I’ll add an issue for the config object. Thanks!

Late reply, yes, it should also works.

By the way, how do I update my version? upon checking my version it’s 0.9.30 but the latest is 0.9.40., maybe that’s why the upload example doesn’t generate the correct code.

Thanks!

Marvin

Marvin, just install meteor kitchen again:

curl http://www.meteorkitchen.com/install | /bin/sh

Stay tuned and keep it updated, many new cool features coming soon. :+1:

1 Like

News from “Kitchen”: new example application generated with meteor-kitchen: minimalistic cloud IDE

Live example is here: http://generator-ide.meteor.com/

Source code (input file for generator) is here: https://github.com/perak/kitchen-examples/tree/master/example-ide

Enjoy! :smile:

Thanks @perak for all the hard work even if you have little time to this project! :+1:

Awesome project for sure! I have been fiddling with the kitchen site hoping to create a json sub-view in the object editor. I did this mainly because I find that it is hard to keep track of where you are in the object editor and the total json view is just too big.

Anyways awesome project and keep up the good work!!

New fancy example added: application showing radiation level from IoT geiger counter in spline chart real time (useful in case of nuclear war :slight_smile: ).

Live example is here: http://generator-geiger.meteor.com/

Source code (input file for generator) is here: https://github.com/perak/kitchen-examples/tree/master/example-geiger

Enjoy!

1 Like

Just got back from a trip and saw this latest M-K radiation app. I love it!

It’s funny, because that’s actually what I do right now. Cell phones instead of geiger counters, but it turns out they can still detect radiation!
http://gammapix.com/sites/ and http://www.imageinsightinc.com/

Meteor Kitchen just keeps getting better!

By the way, I ran into another issue that I’m not sure has a good solution yet. I’m wanting to use an npm module (node-opencv) via @arunoda’s meteorhacks:npm. That package adds a packages.json file to the root directory and you can add arbitrary npm dependencies there. Is there a way to define the contents of that packages.json file within a Meteor Kitchen definition file? It would be great to have “npm” as another optional field in the “packages” object and just define dependencies there…

Thanks again!

Great Application Perak! :smile:

By the way, maybe you want to check out meteor upload csv importer on my github repo and maybe you can integrate it on your dataview and forms example. It has bugs but it’s working locally.

Thanks!

New cool feature added in v0.9.43: describe application in everyday human language and meteor-kitchen generates code!

Something like this:

My dear computer,

I want site with three pages: home, customers and about.
In home page I want jumbotron with title: "This application is written in human language!", text: "Human to describe app, machine to write code!", button url: "customers".
Please create one collection: customers.
In customers collection I want three fields: name, address and e-mail.
In customers page I want CRUD for customers collection.
In about page I want text: "This application is written in human language using Meteor Kitchen, code generator for Meteor".

That's it, please create this application for me.

Thank you.
Petar

See source code is here: https://github.com/perak/kitchen-examples/tree/master/example-human
Live application is here: http://generator-human.meteor.com/

Enjoy! :smile:

3 Likes