Kaffy - a quick and flexible admin interface for phoenix applications

We have been using it actively in one of our projects. Can you tell us what feature do you want?

Hi Siddhant. I want to be able to set some resource(s) as read-only and not be able to create new one, edit or delete existing one. That’s the first thing. Then I could use it more and I will probably find another feature requests. :slight_smile: What do you think about that?

Thanks for all the work; this project looks great. I’m looking at the different libraries available and I’m wondering what the current state of the project is - it looks like this isn’t being developed anymore - are there plans to continue? Torch seems to still be actively maintained.

Hello everyone,

I’d like to thank everyone who’s used, provided feedback, submitted features and PRs, or just showed interest in Kaffy.

Open source software needs a community to grow. I think Kaffy has enough interest and potential.

<rant>
I have been extremely busy during this pandemic working full time on other software projects. I’m trying my best to avoid (or maybe deal with) the “burnout”.
</rant>

If you are interested in becoming a maintainer for Kaffy, please message me either here or privately with your GitHub account. A few members have already showed interest which I’m grateful for (and I’ll be in touch with you guys again). If you think you can actively (or semi-actively) maintain Kaffy, drop me a line.

Having said that, I have no intention of abandoning the project. Once I’m out of this busy phase, working on Kaffy again would be a pleasure. For the time being, the project needs to show that it’s not dead and it’s still being actively used.

Thank you all for your understanding and support.

14 Likes

Is it possible to get the demo up and running again? =)

Hey @aesmail! Just wondering if you’ve found some maintainers to help with kaffy or are still on the search for some. My team is currently leveraging kaffy for our internal admin dashboards, but we’re about three PRs deep on support we need to continue using kaffy. (one I’ve submitted, one someone else has submitted, and one in progress that fixes support for embeds of cardinality 1 and adds some level of support for embeds of many cardinality). Additionally, it looks like it may need some additional fixes to work with Phoenix 1.6.

I’m happy to volunteer as a maintainer if we can get some of these bug fixes and updates flowing again. Happy to lend a hand for the good of the community!

8 Likes

Hello @kelcecil,

Thanks for the initiative. I’ll be in touch with you :slight_smile:

4 Likes

Really great job, thx for sharing this project with the community.

Im wondering if is there a way i can translate all the admin pages?
For example, buttons like “New”, “Delete”, i want to change them to my language. There is something like that in kaffy?

1 Like

Hey franciellevp,

Thanks for the initiative. Offering translations/localization is currently in the pipeline. Development on kaffy is slowly getting back on track so I’d suggest to follow the repo to keep an eye on this. When it lands, I’ll ping you to help with adding your language :slight_smile:

4 Likes

hii me again

im having trouble to insert a FK in form_fields

def form_fields(_) do
  [
    owner_id: nil,
  ]
end

I want to add the user_id that is creating a post.
The idea is to make the input hidden in the form.

But when i try to insert i just cant because the user is always blank.

A user has_many posts and posts belongs_to an user
How can i get the user_id when creating a post in Kaffy?
I tried to put it with the value key, but no success, also without defining a PostAdmin, to Kaffy auto_detects the inputs, the user is blank too.
(im new to elixir/phoenix)

it turns out that i was missing the user_id in my changeset.

|> cast(attrs, [:title, :body, :user_id])

dumb but im newbie :sweat_smile:
Kaffy worked perfectly after that

1 Like

Kaffy v0.9.1 has just been released. This is a community release since it was mainly developed by the community (issues and PRs submitted). Thank you all for contributing.

Please note that if you use/depend on Kaffy for your app, you should stick to v0.9.x since v0.10 will not be backwards compatible.

The main thing for v0.9.1 was keeping compatibility with the latest phoenix releases.
It also fixes a few issues submitted by the community.

3 Likes

Hi @aesmail
It is not clear to me (and I can’t find it on docs) how to use has_one / belongs_to relation on the index view.

Nearest thing I found was:

category_id: %{
        value: fn p -> get_category!(p.category_id).name end,
        filters: Enum.map(list_categories(), fn c -> {c.name, c.id} end)
      },

What is get_category?
Are you doing a query per row?
What’s the best way to preload the relations on Kaffy?

Thanks!

get_category!() is a custom function not related to Kaffy.

You can actually customize the query to preload the wanted relations. This will modify the query that Kaffy runs for the index view, which means it will only be executed once (not per row).

You can do something like this:

# the admin module
defmodule MyApp.Context.SchemaAdmin do
  def custom_index_query(_conn, _schema, query) do
    from(r in query, preload: [:my_relations])
  end

  def index(_) do
    [
      title: nil,
      belongs_to_field_id: %{name: "Hits", value: fn p -> p.belongs_to_field.something end},
      date: %{name: "Date Added", value: fn p -> p.inserted_at end}
    ]
  end
end

I hope this makes things a bit clearer. Let me know if you have any more questions :slightly_smiling_face:

2 Likes

Thanks, I forget that documentation section. Helps me a lot.

1 Like

Hi @aesmail I made a little contribution. I will be supporting this as maximum as possible this project.

Thanks!

2 Likes

Thank you @julismz :pray:t2:

Your PR has been merged :+1:t2:

I appreciate your contributions and enthusiasm!

2 Likes

is there a planned schedule for release of v0.10?

What does v0.10 aim at?

The plan for v0.10 is to be released very soon (August or September).
The focus will be on extensibility.

Kaffy v0.9.3 has just been released

v0.9.3 (2022-08-13)

Fixed

  • The :readonly option was ignored when defining :choices for a specific field in form_fields.

  • Fix generating forms for embeds and enums.

Added

  • Added the option to disable creating new records.

  • A new :bottom option to display menu items at the bottom of the side menu.

  • A smarter inflector covering more plural cases.

  • Better documentation generation for ExDocs.

  • Allow list actions to have select inputs.

2 Likes