Bo.
Bo.

Reputation: 665

KeystoneJS: add custom dynamic field to generated Admin UI

I use KeystoneJS as Node.js CMS

Is it possible to add custom dynamic field to generated Admin UI?

In particular to add custom dynamic link to foreign host to the generated page:

For example I have a model and would like to add custom_link to see it in generated UI:

Message.add({
  uId: { type: String, initial: true, required: true },
  title: { type: String, initial: true, required: true },
  custom_link: { type: Types.Url, default: 'some_host_name/' + dynamic_unique_name, required: true }
})

Message.defaultColumns = 'runId, stat, custom_link'
Message.register()

In that way, generated custom link will be not dynamic constant.

is there a correct way to make it dynamic?

Upvotes: 1

Views: 777

Answers (1)

ByteMaster
ByteMaster

Reputation: 182

I think the only way to achieve that is to make pre/post hook using mongoose Scheme to update your custom dynamic field.

For example look here stackoverflow question or Mongoose docs

Upvotes: 1

Related Questions