aesmail

aesmail

Kaffy - a quick and flexible admin interface for phoenix applications

Hello guys,

I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the current global pandemic, I kind of had the mindset and time to work on a few things on that list.

The package is in its very early stages, but I started using it for my own projects.
The following is part of the README file.

Kaffy

Extremely simple yet powerful admin interface for phoenix applications

Why another admin interface

Kaffy was created out of a need to have a minimum, flexible, and customizable admin interface
without the need to touch the current codebase. It should work out of the box just by adding some
configs in your config.exs file (with the exception of adding a one liner to your router.ex file).

A few points that encouraged the creation of Kaffy:

  • Taking contexts into account.
    • Supporting contexts makes the admin interface better organized.
  • Can handle as many schemas as necessary.
    • Whether we have 1 schema or 1000 schemas, the admin interface should adapt well.
  • Have a visually pleasant user interface.
    • This might be subjective.
  • No generators or generated templates.
    • I believe the less files there are the better. This also means it’s easier to upgrade for users when releasing new versions. This might mean some flexibility and customizations will be lost, but it’s a trade-off.
  • Existing schemas/contexts shouldn’t have to be modified.
    • I shouldn’t have to change my code in order to adapt to the package, the package should adapt to my code.
  • Should be easy to use whether with a new project or with existing projects with a lot of schemas.
    • Adding kaffy should be as easy for existing projects as it is for new ones.
  • Highly flexible and customizable.
    • Provide as many configurable options as possible.
  • As few dependencies as possible.
    • Currently kaffy only depends on phoenix and ecto.
  • Simple authorization.
    • I need to limit access for some admins to some schemas.
  • Minimum assumptions.
    • Need to modify a schema’s primary key? Need to hide a certain field? No problem.

GitHub link
Hex package

All critique, criticism, PRs, and feedback are welcome.

First 10 of 97 Posts! Switch mode

aesmail

aesmail

v0.2.0 was just released

Changes

  • Kaffy now supports phoenix 1.4 and higher.
  • The :otp_app config is now required (breaking change).
  • Removed some deprecation warnings when compiling kaffy (apparently introduced some new warnings).
  • Massively simplified configurations. The only required configs now are otp_app , ecto_repo , and router .
  • Added a CHANGELOG file to communicate and track changes easily.
  • Kaffy will now auto-detect your schemas and admin modules if they’re not set explicitly. See the README file for more. This should get me closer to my original post’s points:

Can handle as many schemas as necessary

and

Should be easy to use whether with a new project or with existing projects with a lot of schemas

Thank you for your interest. I’m getting extremely motivated to work on this project with the current response/feedback.

14
Post #1
tfwright

tfwright

I’m seeing an error on the show view for a resource with an embedded struct:

Protocol.UndefinedError: protocol Phoenix.HTML.Safe not implemented for %{} of type Map. This protocol is implemented for the following type(s): Decimal, Phoenix.LiveView.Rendered, Phoenix.LiveView.Comprehension, Phoenix.LiveView.Component, Float, Time, BitString, Phoenix.HTML.Form, Atom, DateTime, NaiveDateTime, Integer, Date, List, Tuple


1
File "lib/phoenix_html/safe.ex" line 1 in Phoenix.HTML.Safe.impl_for!/1 (phoenix_html)
2
File "lib/phoenix_html/safe.ex" line 15 in Phoenix.HTML.Safe.to_iodata/1 (phoenix_html)
3
File "lib/phoenix_html.ex" line 154 in Phoenix.HTML.html_escape/1 (phoenix_html)
4
File "lib/keyword.ex" line 832 in Keyword.update!/4 (elixir)
5
File "lib/phoenix_html/form.ex" line 825 in Phoenix.HTML.Form.generic_input/4 (phoenix_html)
6
File "lib/kaffy_web/templates/resource/show.html.eex" line 8 in anonymous fn/4 in KaffyWeb.ResourceView."show.html"/1 (kaffy)
7
File "lib/enum.ex" line 2111 in Enum."-reduce/3-lists^foldl/2-0-"/3 (elixir)
8
File "lib/kaffy_web/templates/resource/show.html.eex" line 5 in KaffyWeb.ResourceView."show.html"/1 (kaffy)

On the list view it displays [object Object] for what I assume is the offending column

aesmail

aesmail

Thank you for reporting this. Support for embedded schemas/fields is still not there yet. There’s already an issue on GitHub though so it’s planned. If you could share some generic code here or on GitHub of what your schema looks like that would greatly help.

Thanks.

tfwright

tfwright

I’ll add it to the Github issue, which probably would have been the proper place to report this in the first place. Sorry, and thank you!

aesmail

aesmail

v0.2.1 (2020-05-10)

  • [feature] Added support for embedded schemas.
  • [feature] Added support for :map fields for json values.
  • [enhancement] Use the json library configured for phoenix instead of hardcoding Jason.
  • [bugfix] Don’t crash when the schema has a has_many or has_one association.
  • [bugfix] Don’t crash when the schema has a map field or an embedded schema.
aesmail

aesmail

v0.3.0 (2020-05-11)

This version has a few bug fixes and a few nice additions.

Mainly:

  • A much improved and much more detailed README file.
  • The introduction of callbacks!
aesmail

aesmail

v0.3.1 (2020-05-12)

  • [enhancement] A better way to handle foreign key fields with a huge amount of records to select from.
  • [enhancement] Retrieve the actual name of the association field from the association struct.

This update will make things extremely easier for people who have too many records in the database.

Example:

Creating a new Comment record with a belongs_to :post, MyApp.Blog.Post association, where we have more than 20 posts. Kaffy will render the following:

Once the search button is clicked, a new window will open like the following:

Posts are paginated and searchable. Once you select a post, kaffy will populate its ID in the form and close the window:

Screen Shot 2020-05-12 at 06.41.11

antonioparisi

antonioparisi

this project looks very promising. well done @aesmail - at the moment I’m using react-admin to handle admin panel on a phoenix application, but happy to start migrating over Kaffy, will check it out soon.

Coming from Ruby 2 years ago, I really missed something similar to active admin on elixir. and Kaffy looks very similar to it :blush:

aesmail

aesmail

Thank you @antonioparisi !

I hope you’ll try and find kaffy useful. Please let me know if you face any issues since I’m very interested in the experience of kaffy being used in existing projects.

And you’re right. My biggest inspirations are the built-in admin from django and activeadmin from rails since I’ve been using both heavily for other projects. I’m trying to combine the best features from these two.

I’m not familiar with react-admin, but it looks awesome! If you don’t mind me asking, what do you like most about it?

I’ll try to use it for a few days and see what good ideas can be implemented in kaffy.

antonioparisi

antonioparisi

To be fair I’ve been kinda forced to use react-admin because of the open source availability in terms of admin panels out there at the time when I started. It offers the most reasonable approach to build something straight forward and customisable using react.
Unique big downside of it is that being detached from the APIs (phoenix app), you’ve to build your own endpoints for any action, which to be honest with you is a huge ball-ache :slight_smile:

I’ll try Kaffy ASAP since it looks awesome so far in the Phoenix/Elixir world. I’ll give you my feedback on it as soon as I can.

Thanks so much for the amazing work you put on it so far @aesmail keep up the good work!

Last Post!

cgraham

cgraham

Does Kaffy work with Phoenix 1.8? Couldn’t figure out how to do it. Thx!

Where Next?

Trending in Announcing Top

bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
385 14863 120
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
zachdaniel
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses: I had hope...
New

Other Trending Topics Top

type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
bjorng
We want to introduce a new native datatype to Erlang: native records. Although replacing all tuple records with native records is not our...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
yureehuh
Introduction Founded in 2017 by landscape ecologist and fire mitigation expert Harry Statter, Frontline developed the first fully integra...
New

We're in Beta

About us Mission Statement