Skip to content

A Directus v9 extension (interface) for generating human-readable ids for text fields

Notifications You must be signed in to change notification settings

floodnet-nyc/directus-extension-human-readable-id

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Directus Extension: dwaring87-interface-human-readable-id

A Directus v9 Interface for generating a human-readable ID for a text or string field in a collection. The ID takes the form of {adjective}-{color}-{animal}, such as spicy-blue-eagle or mean-pink-starfish.

Screenshot of the new item creation page showing the human-readable-id field

The different components of the ID can be manually selected from all of the possible values or a custom value can be entered.

Screenshot of the edit dialog showing how the different components of the id can be manually selected

This extension is inspired by the IDs generated by coolaj86/human-readable-ids.

Use Case

The idea is that this provides a realtively large set of random combinations that can be used as easily-remembered codes or IDs.

Installation

This repository contains a custom Directus interface that must be built and then installed into your Directus instance.

Install

Install the node dependencies:

npm install

Customize

The available options for each component (adjective, color, animal) can be customized by modifying the files in the src/assets/ directory before building the extension.

Build

Build the extension (using rollup via directus-extension):

npm run build

Deploy

The dist/index.js file must be moved to the directus /extensions/interfaces directory. First, set the DIRECTUS_EXTENSIONS_PATH environment variable to the path of the Directus extensions directory (either directly or by setting it in a .env file in the repository root directory). Then, use the included deploy script to copy the appropriate files:

DIRECTUS_EXTENSIONS_PATH=/directus/extensions npm run deploy

Usage

To use the interface, create a standard text or string field and select "Human Readable ID" as the interface for the field.

1. Create a new Standard Field in a Collection

Screen Shot 2022-07-19 at 5 52 23 PM

2. Set the type as either String or Text

Screen Shot 2022-07-19 at 5 53 27 PM

3. Select Human Readable ID as the Interface

Screen Shot 2022-07-19 at 5 54 18 PM

About

A Directus v9 extension (interface) for generating human-readable ids for text fields

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vue 62.2%
  • JavaScript 37.8%