aesmail

aesmail

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.

Showing Posts 1 to 10

aesmail

aesmail OP

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 OP

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 OP

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 OP

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 OP

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 OP

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!

Where Next? Top

Trending in Announcing Top

wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews