Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divider/Alias setup flow #9528

Closed
benhaynes opened this issue Nov 5, 2021 · 9 comments · Fixed by #9742
Closed

Divider/Alias setup flow #9528

benhaynes opened this issue Nov 5, 2021 · 9 comments · Fixed by #9742
Assignees

Comments

@benhaynes
Copy link
Sponsor Member

The divider (and maybe all aliases or presentation types) should not have a "Default Value" or "Required" toggle. That's extra visual noise and might confuse users.

Screen Shot 2021-11-05 at 10 43 54 AM

@benhaynes
Copy link
Sponsor Member Author

Also, the key is not _super useful here (nor the type), but we do have a title interface option. I wonder if there's a way to combine these?

Also, small request to move the title above the color/icon options. 👍

@benhaynes
Copy link
Sponsor Member Author

I wonder if there's a way to "auto create" a key (eg: divider-abcd) for these presentation interfaces that have "Hide Label" enabled. Then we could hide the key and type (always disabled)... which would only leave the interface options. Sounds cleeeeean!

@azrikahar
Copy link
Contributor

I wonder if there's a way to "auto create" a key (eg: divider-abcd) for these presentation interfaces that have "Hide Label" enabled.

dzMA5chLFE

Does this fit the requirement here? Maybe we can bump it up to 8 random chars to further reduce possibility of collisions. (Though I wonder will this ever happen even for 6 chars anyways...)

Of course the above is just to show and confirm the randomly generated IDs. This should be the end result:

0AuGQtw44V


One question I do have would be is this the expected outcome?

chrome_Gxtqcj7Q4S

Just wondering will the random chars be remotely "daunting" to non-technical users here. If it's deem not to, then I'll proceed with the current iteration with a PR. 👍

@benhaynes
Copy link
Sponsor Member Author

I love this!! Wondering if it would feel cleaner to do divider-1 (dropping the category to keep it shorter, and moving to an auto-increment index). Not sure how possible this is, since we'd need to loop over existing fields to see which number is not taken. Also, then when you reorder these, the numbers might be out of sequence (not an issue unless you're OCD).

I think if we remove the category (eg: presentation) and keep 6 characters, we should be good as-is!

Also, we should be able to allow editing the key (in the advanced editor) for presentation-only fields, since there's no data there... but that's a question for the future.

@rijkvanzanten
Copy link
Member

I love this!! Wondering if it would feel cleaner to do divider-1 (dropping the category to keep it shorter, and moving to an auto-increment index). Not sure how possible this is, since we'd need to loop over existing fields to see which number is not taken. Also, then when you reorder these, the numbers might be out of sequence (not an issue unless you're OCD).

I think I would actually prefer going with the short hash here for this exact reason. Having divider-1, divider-3 and divider-2 in that order would kill me.

@azrikahar
Copy link
Contributor

Also, we should be able to allow editing the key (in the advanced editor) for presentation-only fields, since there's no data there... but that's a question for the future.

Is this the expected "editing the key in advanced editor" here? Haven't modified anything since technically it's "hidden" on the new field flow area, but definitely still visible (and editable) in the advanced editor:

JPBan7o8WM

@benhaynes
Copy link
Sponsor Member Author

Ahh, true! Though I don't know if you can edit it after the field is created, even through the advanced editor.

@azrikahar
Copy link
Contributor

azrikahar commented Nov 12, 2021

ohh after it's created. Now I understand what the "no data" meant now 👍

Just tried to give it a shot, was able to apply the same "interfaces with hide label" logic to make the key editable, but unfortunately the API currently will hit an error, especially the "where field.field" (field.field being the key in this case) since it can't find itself as we updated the key. Of course this assumes if we don't want to introduce changes in these parts in the API for this added flexibility.

if (field.meta) {
const record = await this.knex
.select('id')
.from('directus_fields')
.where({ collection, field: field.field })
.first();
if (record) {
await this.itemsService.updateOne(record.id, {
...field.meta,
collection: collection,
field: field.field,
});
} else {
await this.itemsService.createOne({
...field.meta,
collection: collection,
field: field.field,
});
}
}

@azrikahar azrikahar self-assigned this Nov 12, 2021
@benhaynes
Copy link
Sponsor Member Author

I think we'll be adding the functionality to be able to edit any field key sometime in the future, so no need to add special logic now. 👍

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants