[{"data":1,"prerenderedAt":618},["ShallowReactive",2],{"footer-primary":3,"footer-secondary":93,"footer-description":119,"tv-short-hops":121,"tv-short-hops-seasons":131,"tv-short-hops-episodes":154,"sales-reps":366},{"items":4},[5,29,49,69],{"id":6,"title":7,"url":8,"page":8,"children":9},"522e608a-77b0-4333-820d-d4f44be2ade1","Solutions",null,[10,15,20,25],{"id":11,"title":12,"url":8,"page":13},"fcafe85a-a798-4710-9e7a-776fe413aae5","Headless CMS",{"permalink":14},"/solutions/headless-cms",{"id":16,"title":17,"url":8,"page":18},"79972923-93cf-4777-9e32-5c9b0315fc10","Backend-as-a-Service",{"permalink":19},"/solutions/backend-as-a-service",{"id":21,"title":22,"url":8,"page":23},"0fa8d0c1-7b64-4f6f-939d-d7fdb99fc407","Product Information",{"permalink":24},"/solutions/product-information-management",{"id":26,"title":27,"url":28,"page":8},"63946d54-6052-4780-8ff4-91f5a9931dcc","100+ Things to Build","https://directus.io/blog/100-tools-apps-and-platforms-you-can-build-with-directus",{"id":30,"title":31,"url":8,"page":8,"children":32},"8ab4f9b1-f3e2-44d6-919b-011d91fe072f","Resources",[33,37,41,45],{"id":34,"title":35,"url":36,"page":8},"f951fb84-8777-4b84-9e91-996fe9d25483","Documentation","https://docs.directus.io",{"id":38,"title":39,"url":40,"page":8},"366febc7-a538-4c08-a326-e6204957f1e3","Guides","https://docs.directus.io/guides/",{"id":42,"title":43,"url":44,"page":8},"aeb9128e-1c5f-417f-863c-2449416433cd","Community","https://directus.chat",{"id":46,"title":47,"url":48,"page":8},"da1c2ed8-0a77-49b0-a903-49c56cb07de5","Release Notes","https://github.com/directus/directus/releases",{"id":50,"title":51,"url":8,"page":8,"children":52},"d61fae8c-7502-494a-822f-19ecff3d0256","Support",[53,57,61,65],{"id":54,"title":55,"url":56,"page":8},"8c43c781-7ebd-475f-a931-747e293c0a88","Issue Tracker","https://github.com/directus/directus/issues",{"id":58,"title":59,"url":60,"page":8},"d77bb78e-cf7b-4e01-932a-514414ba49d3","Feature Requests","https://github.com/directus/directus/discussions?discussions_q=is:open+sort:top",{"id":62,"title":63,"url":64,"page":8},"4346be2b-2c53-476e-b53b-becacec626a6","Community Chat","https://discord.com/channels/725371605378924594/741317677397704757",{"id":66,"title":67,"url":68,"page":8},"26c115d2-49f7-4edc-935e-d37d427fb89d","Cloud Dashboard","https://directus.cloud",{"id":70,"title":71,"url":8,"page":8,"children":72},"49141403-4f20-44ac-8453-25ace1265812","Organization",[73,78,84,88],{"id":74,"title":75,"url":76,"page":77},"1f36ea92-8a5e-47c8-914c-9822a8b9538a","About","/about",{"permalink":76},{"id":79,"title":80,"url":81,"page":82},"b84bf525-5471-4b14-a93c-225f6c386005","Careers","#",{"permalink":83},"/careers",{"id":85,"title":86,"url":87,"page":8},"86aabc3a-433d-434b-9efa-ad1d34be0a34","Brand Assets","https://drive.google.com/drive/folders/1lBOTba4RaA5ikqOn8Ewo4RYzD0XcymG9?usp=sharing",{"id":89,"title":90,"url":8,"page":91},"8d2fa1e3-198e-4405-81e1-2ceb858bc237","Contact",{"permalink":92},"/contact",{"items":94},[95,101,107,113],{"id":96,"title":97,"url":8,"page":98,"children":100},"8a1b7bfa-429d-4ffc-a650-2a5fdcf356da","Cloud Policies",{"permalink":99},"/cloud-policies",[],{"id":102,"title":103,"url":81,"page":104,"children":106},"bea848ef-828f-4306-8017-6b00ec5d4a0c","License",{"permalink":105},"/bsl",[],{"id":108,"title":109,"url":81,"page":110,"children":112},"4e914f47-4bee-42b7-b445-3119ee4196ef","Terms",{"permalink":111},"/terms",[],{"id":114,"title":115,"url":81,"page":116,"children":118},"ea69eda6-d317-4981-8421-fcabb1826bfd","Privacy",{"permalink":117},"/privacy",[],{"description":120},"\u003Cp>A composable backend to build your Headless CMS, BaaS, and more.&nbsp;\u003C/p>",{"id":122,"title":123,"logo":124,"cover":125,"tile":126,"announcement_text":8,"description":127,"slug":128,"one_liner":129,"card_text":8,"status":130,"sort":8},"c266c576-a3d2-4e32-9411-3dfe86bb3a5e","Short Hops","406bf00a-8810-43bd-a86e-f2ef1cc6de01","d27ed5b8-e7cc-4961-bce1-85c46491334a","2166990a-8dbf-4956-8b25-11b72ad203d5","Directus is a super powerful data platform, and as you work with it more it's true power can be realized. In Short Hops, our team provide quick insights in how to get the most from Directus.","short-hops","Quick tips, tricks, and ideas to get the most from Directus and become a power user.","published",[132,145],{"id":133,"number":134,"show":122,"year":135,"episodes":136},"a1886f5f-e5c4-4dd2-ac8a-d2e7c176f813",2,"2024",[137,138,139,140,141,142,143,144],"e82ffa88-91c1-4605-aefa-67bb8e20a9ed","1fb83779-28e9-4523-bcbc-57065d7177a1","f711e94f-14c1-48dd-b00c-70a340351412","fcb6f3f2-d6f3-4905-a3d9-b44aed7bb25c","2d192e76-378b-4540-9d41-2506460a50af","cc653542-7721-4b37-8978-60fee90081dc","0bfed0fe-2c73-4528-8a6a-d3b39b4c0528","0cbf2b23-545e-4ea7-ae45-47707292caec",{"id":146,"number":147,"show":122,"year":135,"episodes":148},"e708d08e-2aea-44fa-a335-9e2af2d40d7e",1,[149,150,151,152,153],"a0f37f8b-c789-4421-b6c4-e4f681028d66","2766c70a-1fc0-46b1-ac5e-b464ca245334","9627b3fd-7a5b-4748-9c18-4ce318ac2cab","511b1967-c04f-42db-b515-911de7981d33","74a53f16-9a2b-42de-bca2-5de319565462",[155,174,191,209,225,242,258,273,288,303,318,334,349],{"id":149,"slug":156,"vimeo_id":157,"description":158,"tile":159,"length":160,"resources":8,"people":161,"episode_number":147,"published":165,"title":166,"video_transcript_html":167,"video_transcript_text":168,"content":8,"seo":8,"status":130,"episode_people":169,"recommendations":171,"season":172},"conditional-fields","903063878","Learn how to conditionally show and hide fields inside of Directus Editor.","d4c79052-82e1-4e08-8461-a5ac9a4bf9a1",7,[162],{"name":163,"url":164},"Bryant Gillespie","https://directus.io/team/bryant-gillespie","2024-03-15","Conditional Fields ","\u003Cp>Speaker 0: Hi. Welcome back to another episode of Short Hops where I give you a couple of my best directest tips and tricks. I'm your host, Brian Gillespie, and today we are talking about conditional fields. This is one of my favorite features. I know I say that a lot, but, as a a pet peeve of mine, I hate presenting information or or fields for somebody to fill out that aren't relevant or aren't necessary.\u003C/p>\u003Cp>And the conditional fields inside Directus allow you to create a better user experience for your content editors, your marketers, anybody who's using the actual Directus app. And typically, that could be nontechnical folks, and they will thank you if you build a great experience using these conditional fields. So let's take a look at a pretty common scenario. You know, we've got posts on our site. These could be resources, whatever.\u003C/p>\u003Cp>We've got different types of posts. And depending on the type of post, we may not need things like a video URL or, if we're doing a case study, we probably wanna have company name or contact name, company URL. But in all other scenarios, it's not necessary to present this. So let's control this. We'll go into our data model and for our posts, let's just create a new radio button called post type.\u003C/p>\u003Cp>We'll give a couple choices. Right? We have a blog or an article. We have video. We have a case study.\u003C/p>\u003Cp>Great. Okay. So it's for score study. Perfect. Okay.\u003C/p>\u003Cp>So now I hit Save and we have a post type. Maybe we sort this out. Cool. Great job, Bryant. Let's pat you on the back.\u003C/p>\u003Cp>And we pick blog or video, post type, case study. None of this actually changes. Right? So this is where our custom fields come into play. This video URL, let's go in and go to the field settings.\u003C/p>\u003Cp>We're gonna hide this on the detail view. We don't need it, until we do. So let's show when type equals video. So the name here is just adding some additional context to this condition, and we're gonna set up a rule for this. So when the post type equals video, then we are going to unhide that.\u003C/p>\u003Cp>So we're gonna make sure hidden on detail is unchecked. And just like that, we can go in and now for our blog post, you can see that video field is hidden, but if I change it to the post type to video, now we can see we've got that field for video URL. Some other ways that I use this, you can see I have a group of fields here. We could go in and add a detail detail group for this. So let's just call this case study details.\u003C/p>\u003Cp>Right? And if I go into the conditions for this, maybe we'll we'll hide this by default and show when type equals case study. So give it a name just so we have that. Again we'll set this condition or the rule for this when the post type equals case study, we are going to show this item inside the form. And then last but not least, I'll just drag my items into the actual form.\u003C/p>\u003Cp>So if I use this grouping, I I don't necessarily have to add the conditions to these individual fields because they're part of that group. So now if I scroll and for any blog posts, you see that we just have content image for a video now that video URL pops up, but for a case study, I now have this collapsible case study details section. One other quick way that I use this. A common scenario is that we need to disable editing after a particular item is created inside a collection. So if I had some fields that I wanted to prevent the user from editing after I created an item, I could do the conditional fields for that.\u003C/p>\u003Cp>So let's just say I wanted to prevent the user from, let's add a field for date published. That'll be a good example. Date published, cool, and let's just pretend that if there is a this has already been published or there's a date published, I want to prevent people from editing the slug of this particular item. So I can go into our conditions and if date published, do not allow editing. So I can go in and set date published where is that new field that we just created.\u003C/p>\u003Cp>If date value isn't null, we are going to disable editing this value. Alright. So let's save that, And on this post now we have a date published, but if I go in and choose a date published, you could see that now I cannot edit that slug, which, you know, could help prevent, any 404 errors in the future. That's just one of the ways that you can use conditional fields. I hope this is tremendously helpful for you.\u003C/p>\u003Cp>Keep the questions coming. I love seeing these pop up in the community. Stay tuned for the next episode.\u003C/p>","Hi. Welcome back to another episode of Short Hops where I give you a couple of my best directest tips and tricks. I'm your host, Brian Gillespie, and today we are talking about conditional fields. This is one of my favorite features. I know I say that a lot, but, as a a pet peeve of mine, I hate presenting information or or fields for somebody to fill out that aren't relevant or aren't necessary. And the conditional fields inside Directus allow you to create a better user experience for your content editors, your marketers, anybody who's using the actual Directus app. And typically, that could be nontechnical folks, and they will thank you if you build a great experience using these conditional fields. So let's take a look at a pretty common scenario. You know, we've got posts on our site. These could be resources, whatever. We've got different types of posts. And depending on the type of post, we may not need things like a video URL or, if we're doing a case study, we probably wanna have company name or contact name, company URL. But in all other scenarios, it's not necessary to present this. So let's control this. We'll go into our data model and for our posts, let's just create a new radio button called post type. We'll give a couple choices. Right? We have a blog or an article. We have video. We have a case study. Great. Okay. So it's for score study. Perfect. Okay. So now I hit Save and we have a post type. Maybe we sort this out. Cool. Great job, Bryant. Let's pat you on the back. And we pick blog or video, post type, case study. None of this actually changes. Right? So this is where our custom fields come into play. This video URL, let's go in and go to the field settings. We're gonna hide this on the detail view. We don't need it, until we do. So let's show when type equals video. So the name here is just adding some additional context to this condition, and we're gonna set up a rule for this. So when the post type equals video, then we are going to unhide that. So we're gonna make sure hidden on detail is unchecked. And just like that, we can go in and now for our blog post, you can see that video field is hidden, but if I change it to the post type to video, now we can see we've got that field for video URL. Some other ways that I use this, you can see I have a group of fields here. We could go in and add a detail detail group for this. So let's just call this case study details. Right? And if I go into the conditions for this, maybe we'll we'll hide this by default and show when type equals case study. So give it a name just so we have that. Again we'll set this condition or the rule for this when the post type equals case study, we are going to show this item inside the form. And then last but not least, I'll just drag my items into the actual form. So if I use this grouping, I I don't necessarily have to add the conditions to these individual fields because they're part of that group. So now if I scroll and for any blog posts, you see that we just have content image for a video now that video URL pops up, but for a case study, I now have this collapsible case study details section. One other quick way that I use this. A common scenario is that we need to disable editing after a particular item is created inside a collection. So if I had some fields that I wanted to prevent the user from editing after I created an item, I could do the conditional fields for that. So let's just say I wanted to prevent the user from, let's add a field for date published. That'll be a good example. Date published, cool, and let's just pretend that if there is a this has already been published or there's a date published, I want to prevent people from editing the slug of this particular item. So I can go into our conditions and if date published, do not allow editing. So I can go in and set date published where is that new field that we just created. If date value isn't null, we are going to disable editing this value. Alright. So let's save that, And on this post now we have a date published, but if I go in and choose a date published, you could see that now I cannot edit that slug, which, you know, could help prevent, any 404 errors in the future. That's just one of the ways that you can use conditional fields. I hope this is tremendously helpful for you. Keep the questions coming. I love seeing these pop up in the community. Stay tuned for the next episode.",[170],"d068cba1-d3f0-4ff8-b800-9a0e65620674",[],{"id":146,"number":147,"show":122,"year":135,"episodes":173},[149,150,151,152,153],{"id":150,"slug":175,"vimeo_id":176,"description":177,"tile":178,"length":179,"resources":8,"people":180,"episode_number":134,"published":182,"title":183,"video_transcript_html":184,"video_transcript_text":185,"content":8,"seo":8,"status":130,"episode_people":186,"recommendations":188,"season":189},"global-bookmarks","903063261","Learn how to create preset layouts, including filters and sorts, inside of Directus Explore.","50c8ecc4-7a85-4779-9d1c-c5d02bb5d56e",4,[181],{"name":163,"url":164},"2024-03-22","Global Bookmarks","\u003Cp>Speaker 0: Hi. Welcome back to another episode of Short Hops. I'm your host, Brian Gillespie. And today I wanna talk to you about Global Bookmarks inside Directus. This is one of my favorite features.\u003C/p>\u003Cp>I say that a lot, but I I love this feature just because it is really great to preset some nice defaults for your nontechnical users when you onboard them into a Directus project. Your content editors, your marketers, anybody else that you're working with that has access to the Directus app will thank you, when you set up really nice global bookmarks for them. So right now you can see inside, this particular project, this is my Agency OS project, I have these bookmarks that are set up and these are set up as global bookmarks. So out of the gate, Directus allows you to customize any of these specific views to your liking. So I can go in and adjust the layout to be Kanban, table, calendar view.\u003C/p>\u003Cp>Within the table view, I can adjust the different widths. I can set up different filters, control the fields that I want to display. And for users who are new to Directus, it is a a really beautiful UI, but when they first log in, they may not have all their different views set up. Well, they're they're definitely not going to have that. So as a developer, as the technical person, as the lead on this project, do yourself a favor as well.\u003C/p>\u003Cp>Set up global bookmarks. So how do we do that? You know, if I click edit on this, I could see that it's a global bookmark. But if I go in and let's just say I bookmark a view, new bookmark. Great.\u003C/p>\u003Cp>We can see that is not the default. It is a personal bookmark. So to make these bookmarks global, what can I do? I go into my settings, I go to our bookmarks tab, and then I can look for the bookmark name that I've got set up. So that one that I just created called bookmark, but it could be a challenge.\u003C/p>\u003Cp>Right? Maybe I sort by ascending order. This is new bookmark. If I wanted to make this global, all I have to do is go into that specific one and change the scope. So I could change it to all users here and hit save and now that becomes a global bookmark that is available for any user that logs into Directus.\u003C/p>\u003Cp>And if I click edit, I can see that as well. But let's say I want to edit that in the future, I can also just go back to it and there are you have the ability to preset layouts. And here in this layout preview, you can even control, what fields are displayed and things like the column widths. So a lot of this power is available to you and not necessarily right in front of your face, so it's easy to overlook. So that's one of my favorite tips.\u003C/p>\u003Cp>I'll catch you on the next episode.\u003C/p>","Hi. Welcome back to another episode of Short Hops. I'm your host, Brian Gillespie. And today I wanna talk to you about Global Bookmarks inside Directus. This is one of my favorite features. I say that a lot, but I I love this feature just because it is really great to preset some nice defaults for your nontechnical users when you onboard them into a Directus project. Your content editors, your marketers, anybody else that you're working with that has access to the Directus app will thank you, when you set up really nice global bookmarks for them. So right now you can see inside, this particular project, this is my Agency OS project, I have these bookmarks that are set up and these are set up as global bookmarks. So out of the gate, Directus allows you to customize any of these specific views to your liking. So I can go in and adjust the layout to be Kanban, table, calendar view. Within the table view, I can adjust the different widths. I can set up different filters, control the fields that I want to display. And for users who are new to Directus, it is a a really beautiful UI, but when they first log in, they may not have all their different views set up. Well, they're they're definitely not going to have that. So as a developer, as the technical person, as the lead on this project, do yourself a favor as well. Set up global bookmarks. So how do we do that? You know, if I click edit on this, I could see that it's a global bookmark. But if I go in and let's just say I bookmark a view, new bookmark. Great. We can see that is not the default. It is a personal bookmark. So to make these bookmarks global, what can I do? I go into my settings, I go to our bookmarks tab, and then I can look for the bookmark name that I've got set up. So that one that I just created called bookmark, but it could be a challenge. Right? Maybe I sort by ascending order. This is new bookmark. If I wanted to make this global, all I have to do is go into that specific one and change the scope. So I could change it to all users here and hit save and now that becomes a global bookmark that is available for any user that logs into Directus. And if I click edit, I can see that as well. But let's say I want to edit that in the future, I can also just go back to it and there are you have the ability to preset layouts. And here in this layout preview, you can even control, what fields are displayed and things like the column widths. So a lot of this power is available to you and not necessarily right in front of your face, so it's easy to overlook. So that's one of my favorite tips. I'll catch you on the next episode.",[187],"e0a22db4-5bcc-40ba-bc49-ce2d7a549ca7",[],{"id":146,"number":147,"show":122,"year":135,"episodes":190},[149,150,151,152,153],{"id":151,"slug":192,"vimeo_id":193,"description":194,"tile":195,"length":196,"resources":8,"people":197,"episode_number":199,"published":200,"title":201,"video_transcript_html":202,"video_transcript_text":203,"content":8,"seo":8,"status":130,"episode_people":204,"recommendations":206,"season":207},"multitenancy","903059602","Learn how to achieve multitenancy inside of a Directus project using Roles and Relational Fields.","e5e721aa-c6c9-4196-8d5c-4220388a59eb",10,[198],{"name":163,"url":164},3,"2024-03-29","Multitenancy","\u003Cp>Speaker 0: Hi. Welcome back to the next episode of Short Hops. I'm your host Brian Gillespie. Today we are talking about how to achieve multi tenancy inside Directus. So tenancy is just using the same resources to serve multiple groups of users.\u003C/p>\u003Cp>I think the term came from apartment buildings, maybe. Got multiple tenants that share have their own apartments, but they share the same resources. They share the same building. Maybe that's where it came from. But anyway, it is a very common convention in SaaS that we have multiple different accounts or teams or whatever you call your tenant collection using the same application, but each team needs to only see their individual resources or data in this case.\u003C/p>\u003Cp>Achieving it inside Directus is pretty simple. There are 4 steps we're going to cover. Let's dive right in. Alright. So the first thing we're gonna do is create a tenant collection.\u003C/p>\u003Cp>Now what you name this is totally up to you. You could call it teams, you could call it accounts, which is one of my personal preferences. But, you know, if you're coming from something like Laravel, I think out of the box, they have something called teams. So we can add a couple of additional fields if we need to. These system fields are really nice, just a quick little shortcut, but I'll go ahead and create a team collection here and we'll just give it a team name.\u003C/p>\u003Cp>Right? So let's go in and create a team, we'll call it test team A, we'll save this. Let's go ahead and create another team, test team B. So now we have 2 teams, we've got our team tenant collection. Let's, let's mark this off on our list here.\u003C/p>\u003Cp>Boom. Step 1, done. Alright. So the next step is to create a relationship between this tenant collection and our Directus users collection. So Directus users gets created whenever you bootstrap your Directus instance.\u003C/p>\u003Cp>So if I'm looking at my data model, I'll find that under the Directus users here. And what kind of relationship you set up depends on how you want your tenancy model to work. So if users could belong to multiple teams, you're gonna use a many to many relationship. But if a user could belong to just one team, you could use a many to 1 or and the reverse one to many. So in this case, let's say we want users to belong to multiple teams or they could potentially belong to multiple teams.\u003C/p>\u003Cp>Now in that case, we are going to create a many to many relationship. So I'll just search for that here. And inside Teams, let's call our field users and we are going to look for the Directus users collection. Right? So I'm inside my team's data model, go to the mini to mini relationship.\u003C/p>\u003Cp>We'll create a new field called users, and the related collection is gonna be directus_users. Now I can show a link to that item, but if I open up the advanced section, I can see this junction collection that Directus is gonna create for me. I was calling this teams_directususers, and then we have the team's ID and the directus_usersid. Underscoreid. Too many.\u003C/p>\u003Cp>I'm also gonna create the corresponding field on the Directus users collection as well. Great. So I'll just go ahead and save this and with that relationship out of the way, we can mark off step 2 of the process. Now step 3 is gonna be creating our actual data collections. And for each one of those collections, we need to create a many to one relationship back to our tenant collection.\u003C/p>\u003Cp>So let's just keep this super simple and create a new collection called tasks. Very simple. I could even go in and, you know, add these system fields. Maybe we want to know who created the task, what date it was updated, and we'll just give this task a title. Right?\u003C/p>\u003Cp>Great. The next thing we're gonna do here is add a mini to 1 relationship back to that tenant collection. So we're just gonna call this team and the related collection is gonna be called teams. We'll hit save and now we have that relationship that will allow us to filter out those permissions when we're making those API calls. Alright.\u003C/p>\u003Cp>Great. So now if we just go in and let's create a couple of test task, A will assign that to test team a, and we'll create test task b. Go ahead and assign that to team b. Alright. Great.\u003C/p>\u003Cp>So now we've got the collection, and for each one of our data collections, like, let's say I had projects and then tasks, I would add that same relationship, that many to one relationship back to my tenant collection. So with that out of the way, let's go ahead and mark this off. And then the last piece of the puzzle here is to set up our permissions inside Directus to restrict access based on the user's team. What what teams are the users included on? We wanna restrict access based on that.\u003C/p>\u003Cp>So we're gonna go to our settings, go to access control, and let's create a new user or a new role, I should say. Let's call it user, and I'll enable app access here. You don't necessarily have to do that, You know, this is just to showcase the functionality. If you want them using the Directus app, you can. If it is API only, the API still respect these permission settings.\u003C/p>\u003Cp>Alright. So what I'm gonna do here, I'm just gonna go ahead and enable all these permissions by default, and then I'm gonna go in and start restricting this. So our share functionality, I don't necessarily need. Maybe I don't even want these users to be able to delete tasks or things like that. We definitely want them to be able to create new tasks.\u003C/p>\u003Cp>Maybe they can create new teams, But it when it comes to seeing tasks and editing task and seeing teams, we only want them to see the things that they are a part of. So how do we do that? We could go into our custom permissions in that case. So we'll just click on that and use custom, and then we will set up a filter rule. So here we are filtering the items that this particular user or this role which will apply to a user can have access to.\u003C/p>\u003Cp>So in this case, we've got that team field and because we used a many to 1 relationship or a many to many relationship, we have to use the is one of because the actual users, the direct us the team and the direct us users, it could be an array of teams that they are a part of. Directus has these dynamic variables we can use as well. So dollar sign current underscore user in all caps will allow us to access the current logged in user. We'll go for the dot teams because that was the field that we specified on the user collection, and then we're looking through our junction table. So that is underscore teams teams underscore ID, and then we have ID.\u003C/p>\u003Cp>So with this, and if I just copy this rule, we can apply that to the edit access as well. So I can go in and edit raw value. I could just paste this here, save it. Okay, great. So now if I were to create a new user, let's call them test user a, and just do test at example.com.\u003C/p>\u003Cp>Give them a nice secure password, and I go into the role settings. We'll select the user role, save that, open up a incognito window so we get a fresh set of cookies, and let's just log in to this user and see what's actually available. Alright so we logged in we cannot see any particular tasks here. Now if I refresh the task I could see that, but we have not associated that user with an actual team yet. So if I scroll down to the bottom let's add that user to team A and we'll hit Save.\u003C/p>\u003Cp>And now if I refresh this window we could see that that user has access to test task a, but they cannot see test task b, which is a part of the second team, which is test team b. Very simple. That is how you set up tenancy inside Directus. I hope this tip was helpful. Bring on some more questions.\u003C/p>\u003Cp>I want to cover more of those for you.\u003C/p>","Hi. Welcome back to the next episode of Short Hops. I'm your host Brian Gillespie. Today we are talking about how to achieve multi tenancy inside Directus. So tenancy is just using the same resources to serve multiple groups of users. I think the term came from apartment buildings, maybe. Got multiple tenants that share have their own apartments, but they share the same resources. They share the same building. Maybe that's where it came from. But anyway, it is a very common convention in SaaS that we have multiple different accounts or teams or whatever you call your tenant collection using the same application, but each team needs to only see their individual resources or data in this case. Achieving it inside Directus is pretty simple. There are 4 steps we're going to cover. Let's dive right in. Alright. So the first thing we're gonna do is create a tenant collection. Now what you name this is totally up to you. You could call it teams, you could call it accounts, which is one of my personal preferences. But, you know, if you're coming from something like Laravel, I think out of the box, they have something called teams. So we can add a couple of additional fields if we need to. These system fields are really nice, just a quick little shortcut, but I'll go ahead and create a team collection here and we'll just give it a team name. Right? So let's go in and create a team, we'll call it test team A, we'll save this. Let's go ahead and create another team, test team B. So now we have 2 teams, we've got our team tenant collection. Let's, let's mark this off on our list here. Boom. Step 1, done. Alright. So the next step is to create a relationship between this tenant collection and our Directus users collection. So Directus users gets created whenever you bootstrap your Directus instance. So if I'm looking at my data model, I'll find that under the Directus users here. And what kind of relationship you set up depends on how you want your tenancy model to work. So if users could belong to multiple teams, you're gonna use a many to many relationship. But if a user could belong to just one team, you could use a many to 1 or and the reverse one to many. So in this case, let's say we want users to belong to multiple teams or they could potentially belong to multiple teams. Now in that case, we are going to create a many to many relationship. So I'll just search for that here. And inside Teams, let's call our field users and we are going to look for the Directus users collection. Right? So I'm inside my team's data model, go to the mini to mini relationship. We'll create a new field called users, and the related collection is gonna be directus_users. Now I can show a link to that item, but if I open up the advanced section, I can see this junction collection that Directus is gonna create for me. I was calling this teams_directususers, and then we have the team's ID and the directus_usersid. Underscoreid. Too many. I'm also gonna create the corresponding field on the Directus users collection as well. Great. So I'll just go ahead and save this and with that relationship out of the way, we can mark off step 2 of the process. Now step 3 is gonna be creating our actual data collections. And for each one of those collections, we need to create a many to one relationship back to our tenant collection. So let's just keep this super simple and create a new collection called tasks. Very simple. I could even go in and, you know, add these system fields. Maybe we want to know who created the task, what date it was updated, and we'll just give this task a title. Right? Great. The next thing we're gonna do here is add a mini to 1 relationship back to that tenant collection. So we're just gonna call this team and the related collection is gonna be called teams. We'll hit save and now we have that relationship that will allow us to filter out those permissions when we're making those API calls. Alright. Great. So now if we just go in and let's create a couple of test task, A will assign that to test team a, and we'll create test task b. Go ahead and assign that to team b. Alright. Great. So now we've got the collection, and for each one of our data collections, like, let's say I had projects and then tasks, I would add that same relationship, that many to one relationship back to my tenant collection. So with that out of the way, let's go ahead and mark this off. And then the last piece of the puzzle here is to set up our permissions inside Directus to restrict access based on the user's team. What what teams are the users included on? We wanna restrict access based on that. So we're gonna go to our settings, go to access control, and let's create a new user or a new role, I should say. Let's call it user, and I'll enable app access here. You don't necessarily have to do that, You know, this is just to showcase the functionality. If you want them using the Directus app, you can. If it is API only, the API still respect these permission settings. Alright. So what I'm gonna do here, I'm just gonna go ahead and enable all these permissions by default, and then I'm gonna go in and start restricting this. So our share functionality, I don't necessarily need. Maybe I don't even want these users to be able to delete tasks or things like that. We definitely want them to be able to create new tasks. Maybe they can create new teams, But it when it comes to seeing tasks and editing task and seeing teams, we only want them to see the things that they are a part of. So how do we do that? We could go into our custom permissions in that case. So we'll just click on that and use custom, and then we will set up a filter rule. So here we are filtering the items that this particular user or this role which will apply to a user can have access to. So in this case, we've got that team field and because we used a many to 1 relationship or a many to many relationship, we have to use the is one of because the actual users, the direct us the team and the direct us users, it could be an array of teams that they are a part of. Directus has these dynamic variables we can use as well. So dollar sign current underscore user in all caps will allow us to access the current logged in user. We'll go for the dot teams because that was the field that we specified on the user collection, and then we're looking through our junction table. So that is underscore teams teams underscore ID, and then we have ID. So with this, and if I just copy this rule, we can apply that to the edit access as well. So I can go in and edit raw value. I could just paste this here, save it. Okay, great. So now if I were to create a new user, let's call them test user a, and just do test at example.com. Give them a nice secure password, and I go into the role settings. We'll select the user role, save that, open up a incognito window so we get a fresh set of cookies, and let's just log in to this user and see what's actually available. Alright so we logged in we cannot see any particular tasks here. Now if I refresh the task I could see that, but we have not associated that user with an actual team yet. So if I scroll down to the bottom let's add that user to team A and we'll hit Save. And now if I refresh this window we could see that that user has access to test task a, but they cannot see test task b, which is a part of the second team, which is test team b. Very simple. That is how you set up tenancy inside Directus. I hope this tip was helpful. Bring on some more questions. I want to cover more of those for you.",[205],"162809be-8ab8-4cc7-977b-19ea714080a0",[],{"id":146,"number":147,"show":122,"year":135,"episodes":208},[149,150,151,152,153],{"id":152,"slug":210,"vimeo_id":211,"description":212,"tile":213,"length":160,"resources":8,"people":214,"episode_number":179,"published":216,"title":217,"video_transcript_html":218,"video_transcript_text":219,"content":8,"seo":8,"status":130,"episode_people":220,"recommendations":222,"season":223},"looping-flows","903062109","Learn how to chain and set up loops inside of Flows inside of Directus Automate.","c10cf109-3a58-48a8-8106-c036cf10e597",[215],{"name":163,"url":164},"2024-04-05","Looping Flows","\u003Cp>Speaker 0: Hi. Welcome back to another episode of Short Hops. I'm your host, Brian Gillespie. And today, I'm going to show you how to loop with flows. This topic comes up a lot inside the community.\u003C/p>\u003Cp>How do we chain flows together inside Directus? But if I back up a minute, flows are a great automation tool inside Directus. You can automate simple and complex workflows using the tools we provide, but there is a little bit of a learning curve, especially when you're trying to, loop through an array of objects or array of strings and perform some type of action on those within a flow. It actually requires 2 flows and we'll cover the steps in this quick video. So what are the steps needed to actually do this?\u003C/p>\u003Cp>We are going to create a first flow that collects our data that we want to loop through and perform an action on. And then we will create a second flow that actually performs those actions. And then last but not least, we to the first flow, we add an trigger flow operation and pass an array to that next flow, and that will do the looping for us. So, let's get back into the real world. A really common scenario here is I've got a list of users or subscribers that I want to loop through and send individual email notifications to or could be in app notifications.\u003C/p>\u003Cp>So I've got my subscriber list here, but let's go ahead and create our first flow. We'll just call it trigger email notifications. Perfect. For our setup here, the trigger, I'm just going to run this manually, and I'm going to select the subscribers collection. And I could, require somebody to select the individual subscribers here.\u003C/p>\u003Cp>I'm just going to turn that off because we don't necessarily need that and I'm going to trigger this on the collection page only because I want to notify all the subscribers at one time. We will require confirmation. Do you want to email these folks? Great. So we'll finish our setup.\u003C/p>\u003Cp>And the next operation inside our flow, we're gonna get our subscribers. So I'll just go to read data. We'll get our collection. We're going to choose subscribers there. And I could filter this down using a query.\u003C/p>\u003Cp>So so I could grab only active subscribers or subscribers with the first name Bryant if I wanted to. Or I could use this IDs field to pluck specific subscribers by the ID. In this case, we just want to pick all the subscribers. Sounds great. And then the next flow or the next operation inside this flow, I should say, is going to be sending our email.\u003C/p>\u003Cp>So in this case, we're going to trigger another flow. And inside our payload here, I'm going to go to edit raw value. I'll wrap this in quotations. We'll use our mustache syntax from Directus, and I'm just going to use git underscore subscribers, which is the key of that last operation. Whenever a flow runs, each operation has its own key and the data returned from that operation gets appended to an object that you can access the data through that key.\u003C/p>\u003Cp>Great. So now we've got our payload, but we don't have a specific flow to actually run. So let's go in and create that second flow and then we'll come back and update this. So we'll create a new flow. We'll call it send email.\u003C/p>\u003Cp>Maybe we even give it a nice email icon. And as far as the trigger, this is going to be triggered by another flow. The response body here is what we would return from this flow to the first flow. Lots of flows going on. We don't necessarily need to return anything here, so I'm just going to hit finish setup.\u003C/p>\u003Cp>And we will set up our email action. So we'll call this send email. The 2, if I look at my subscribers, I've got email. So the syntax here is going to be dollar sign triggered.email. Great.\u003C/p>\u003Cp>Make sure you hit enter to save that. And let's just give this a subject. Here's the subject and does flow looping work? Can Brian make it work? Right.\u003C/p>\u003Cp>Great. So we've got our flow here. All this does is receives data from another flow, sends an email to the person that we sent. The last piece of the puzzle here is in our trigger email notifications flow. We will go in and select that new flow that we just created and boom, everything is buttoned up.\u003C/p>\u003Cp>If I go back to my subscribers content collection and trigger email notifications, bada bing bada boom, we go back to our flows. I could see if this actually ran or not. So I could see the payload there. I could see what we passed to that second flow. And here in my logs, you can see this flow ran 4 separate times, which is convenient because I have 4 separate subscribers.\u003C/p>\u003Cp>So I could see here's the email that was sent. And if I happen to hop open my inbox, boom, there we could see the message. So that is how you can loop flows together to create, complex scenarios that are totally automated. This is great for sending emails or other actions that you need to loop through. Hope it was helpful.\u003C/p>\u003Cp>Catch you on the next episode. Ciao.\u003C/p>","Hi. Welcome back to another episode of Short Hops. I'm your host, Brian Gillespie. And today, I'm going to show you how to loop with flows. This topic comes up a lot inside the community. How do we chain flows together inside Directus? But if I back up a minute, flows are a great automation tool inside Directus. You can automate simple and complex workflows using the tools we provide, but there is a little bit of a learning curve, especially when you're trying to, loop through an array of objects or array of strings and perform some type of action on those within a flow. It actually requires 2 flows and we'll cover the steps in this quick video. So what are the steps needed to actually do this? We are going to create a first flow that collects our data that we want to loop through and perform an action on. And then we will create a second flow that actually performs those actions. And then last but not least, we to the first flow, we add an trigger flow operation and pass an array to that next flow, and that will do the looping for us. So, let's get back into the real world. A really common scenario here is I've got a list of users or subscribers that I want to loop through and send individual email notifications to or could be in app notifications. So I've got my subscriber list here, but let's go ahead and create our first flow. We'll just call it trigger email notifications. Perfect. For our setup here, the trigger, I'm just going to run this manually, and I'm going to select the subscribers collection. And I could, require somebody to select the individual subscribers here. I'm just going to turn that off because we don't necessarily need that and I'm going to trigger this on the collection page only because I want to notify all the subscribers at one time. We will require confirmation. Do you want to email these folks? Great. So we'll finish our setup. And the next operation inside our flow, we're gonna get our subscribers. So I'll just go to read data. We'll get our collection. We're going to choose subscribers there. And I could filter this down using a query. So so I could grab only active subscribers or subscribers with the first name Bryant if I wanted to. Or I could use this IDs field to pluck specific subscribers by the ID. In this case, we just want to pick all the subscribers. Sounds great. And then the next flow or the next operation inside this flow, I should say, is going to be sending our email. So in this case, we're going to trigger another flow. And inside our payload here, I'm going to go to edit raw value. I'll wrap this in quotations. We'll use our mustache syntax from Directus, and I'm just going to use git underscore subscribers, which is the key of that last operation. Whenever a flow runs, each operation has its own key and the data returned from that operation gets appended to an object that you can access the data through that key. Great. So now we've got our payload, but we don't have a specific flow to actually run. So let's go in and create that second flow and then we'll come back and update this. So we'll create a new flow. We'll call it send email. Maybe we even give it a nice email icon. And as far as the trigger, this is going to be triggered by another flow. The response body here is what we would return from this flow to the first flow. Lots of flows going on. We don't necessarily need to return anything here, so I'm just going to hit finish setup. And we will set up our email action. So we'll call this send email. The 2, if I look at my subscribers, I've got email. So the syntax here is going to be dollar sign triggered.email. Great. Make sure you hit enter to save that. And let's just give this a subject. Here's the subject and does flow looping work? Can Brian make it work? Right. Great. So we've got our flow here. All this does is receives data from another flow, sends an email to the person that we sent. The last piece of the puzzle here is in our trigger email notifications flow. We will go in and select that new flow that we just created and boom, everything is buttoned up. If I go back to my subscribers content collection and trigger email notifications, bada bing bada boom, we go back to our flows. I could see if this actually ran or not. So I could see the payload there. I could see what we passed to that second flow. And here in my logs, you can see this flow ran 4 separate times, which is convenient because I have 4 separate subscribers. So I could see here's the email that was sent. And if I happen to hop open my inbox, boom, there we could see the message. So that is how you can loop flows together to create, complex scenarios that are totally automated. This is great for sending emails or other actions that you need to loop through. Hope it was helpful. Catch you on the next episode. Ciao.",[221],"02be9ae3-3608-4fc4-89c1-625c9a3f620e",[],{"id":146,"number":147,"show":122,"year":135,"episodes":224},[149,150,151,152,153],{"id":153,"slug":226,"vimeo_id":227,"description":228,"tile":229,"length":179,"resources":8,"people":230,"episode_number":232,"published":233,"title":234,"video_transcript_html":235,"video_transcript_text":236,"content":8,"seo":8,"status":130,"episode_people":237,"recommendations":239,"season":240},"sort-fields","903061460","Learn how to add sort fields inside of new and existing relationships inside of Directus.","d4a8d6b2-e82a-4fe0-a1b0-6c8448c5ede5",[231],{"name":163,"url":164},5,"2024-04-12","Sort Fields","\u003Cp>Bryant: Hi. Welcome back to the next episode of Short Hops. I'm your host Brian Gillespie and today we are talking about sort fields. This is one that I see come up a lot in our community. Very simple fix, and most people overlook this functionality.\u003C/p>\u003Cp>But surprise surprise, you can add sort fields anytime. So I see this coming up often on our many to any relationships, like our page builder scenario or even standard, like, one to many or many to many relationships. Wanna be able to sort those related items within that particular field. So let's just throw together a page builder here, we'll just call this our page blocks. Great.\u003C/p>\u003Cp>And then we've got our block FAQs, etcetera. So here on this screen, I don't have a sort option when I'm using the the wizard here, but if I go to continue an advanced field creation mode, I go to my relationship, you'll see there is an option for sort field. So I don't have to manually add a sort field, I can just add sort here and at the bottom, I could see that Directus will create this for me. Likewise, if I wanted to call it something else something else, I wanted to get really fancy with it, I can. So I don't have to name it sort, that's just kind of standard convention, but adding that sort field is as simple as that.\u003C/p>\u003Cp>So just go into advanced creation mode. Great. And then when I go to my pages now, I go to build a page, I could go in and create a new block, test test. Great. Let's add a hero, test, test and then I can rearrange those using that particular sort field.\u003C/p>\u003Cp>Great. But what about existing relationships? So if I look at projects for example. Right, if I go in and create a test task and a new task, oh, I can't even spell today, test project. Right.\u003C/p>\u003Cp>I've already got this relationship set up, but my sort fields, I don't have a way to sort this. How do I fix it? So I just go into my data model, I go to Projects, I look for my field that has a relationship, in this case, it's Tasks, and I go to that relationship tab and I have sort field. So I can pick that item up from one of the existing fields, which there are none, or I can simply just key something in here and Directus is smart enough to know that this field does not exist, so it will actually create it for you. And with that, all I have to do is now go back to our project and I could sort those items however I want.\u003C/p>\u003Cp>That's it. Easy peasy. I'll catch you on the next one.\u003C/p>","Hi. Welcome back to the next episode of Short Hops. I'm your host Brian Gillespie and today we are talking about sort fields. This is one that I see come up a lot in our community. Very simple fix, and most people overlook this functionality. But surprise surprise, you can add sort fields anytime. So I see this coming up often on our many to any relationships, like our page builder scenario or even standard, like, one to many or many to many relationships. Wanna be able to sort those related items within that particular field. So let's just throw together a page builder here, we'll just call this our page blocks. Great. And then we've got our block FAQs, etcetera. So here on this screen, I don't have a sort option when I'm using the the wizard here, but if I go to continue an advanced field creation mode, I go to my relationship, you'll see there is an option for sort field. So I don't have to manually add a sort field, I can just add sort here and at the bottom, I could see that Directus will create this for me. Likewise, if I wanted to call it something else something else, I wanted to get really fancy with it, I can. So I don't have to name it sort, that's just kind of standard convention, but adding that sort field is as simple as that. So just go into advanced creation mode. Great. And then when I go to my pages now, I go to build a page, I could go in and create a new block, test test. Great. Let's add a hero, test, test and then I can rearrange those using that particular sort field. Great. But what about existing relationships? So if I look at projects for example. Right, if I go in and create a test task and a new task, oh, I can't even spell today, test project. Right. I've already got this relationship set up, but my sort fields, I don't have a way to sort this. How do I fix it? So I just go into my data model, I go to Projects, I look for my field that has a relationship, in this case, it's Tasks, and I go to that relationship tab and I have sort field. So I can pick that item up from one of the existing fields, which there are none, or I can simply just key something in here and Directus is smart enough to know that this field does not exist, so it will actually create it for you. And with that, all I have to do is now go back to our project and I could sort those items however I want. That's it. Easy peasy. I'll catch you on the next one.",[238],"c28a2713-ef7b-4e63-b3ac-23aec0f53fa5",[],{"id":146,"number":147,"show":122,"year":135,"episodes":241},[149,150,151,152,153],{"id":137,"slug":243,"vimeo_id":244,"description":245,"tile":246,"length":179,"resources":8,"people":8,"episode_number":147,"published":247,"title":248,"video_transcript_html":249,"video_transcript_text":250,"content":251,"seo":252,"status":130,"episode_people":253,"recommendations":255,"season":256},"transformation-presets","983673160","Discover the power of transformation presets in Directus to streamline your image handling processes. Learn how to create and use these presets to standardize image formats, sizes, and even apply custom transformations across your entire website or application","9ceeec94-7ef3-455a-bb85-ca8c0cad2827","2024-07-26","Transformation Presets","\u003Cp>Speaker 0: Welcome back to another episode of Short Hops. I'm your host Brian Gillespie. And today, we are covering transformation presets. What are transformation presets, you ask? So one of the more powerful features inside Directus is the ability to transform your images.\u003C/p>\u003Cp>We could do things like cropping. We can adjust the color, change it to gray scale. We can use more compressed formats like webp and avif to make our site load faster. Transformation presets are just shortcuts for those. So you can standardize images and formats, sizes across your entire website or application quickly and easily.\u003C/p>\u003Cp>So let's take a look. I'm inside a sample project. I've got, some assets here. And if I just open up this, bunny, this is actually probably a hare. You know, we could do things like this where we have our transformations.\u003C/p>\u003Cp>Right? So I can adjust the width of this image. I can adjust the height of this image. But imagine I've got a blog page where I have cards that are all, roughly a same size. That's a good use case for transformation presets.\u003C/p>\u003Cp>So what can I do? We're gonna go into the Directus settings, to our project settings. We're gonna scroll down to files and storage. And I'll zoom in even further for you here. So there's a couple of settings when it comes to transformations.\u003C/p>\u003Cp>I can allow all transformations, which is basically, hey, I can whatever transformation I wanna do as long as it is valid sharp, which is the underlying library that we use, we can do that. I can also disable all transformations, so you get what you get as far as images. And last but not least, I can limit the transformations to presets below. So if you're concerned about people absolutely killing your server with transformations or kind of standardizing, you probably wanna do this limiting option. But as far as our presets, again, these are just shortcuts that you set up to, you know, standardize the format.\u003C/p>\u003Cp>So you could see this one called 800 width, or 800 w, is basically just a preset width of 800. We use the webp format. And instead of having to pass all these parameters when I actually get the image, I could just do something like this where in my URL for that specific image, you know, slash assets, slash the UUID for that file, I add a key param and I do 800w. Right? So that saves me a lot of time.\u003C/p>\u003Cp>And again, helps me standardize across my website. Creating these presets is super simple. I just go in. If I wanted to create a new preset, let's call it purple. Right?\u003C/p>\u003Cp>We'll do 800 wide. Let's do a webp format. And I've just got a additional transform that I wanna do here. We're gonna tint the image and we're gonna apply our directus purple, hence the name purple. So we'll do fit inside, that's great.\u003C/p>\u003Cp>Save this. And now if I go back to this specific image, all I have to do is change that key. And I now get a purple tinted hair in a field image. Looks amazing. So that is it for transformation presets.\u003C/p>\u003Cp>Try this out. Leverage it in your projects. It's super helpful. We'll catch you on the next one.\u003C/p>","Welcome back to another episode of Short Hops. I'm your host Brian Gillespie. And today, we are covering transformation presets. What are transformation presets, you ask? So one of the more powerful features inside Directus is the ability to transform your images. We could do things like cropping. We can adjust the color, change it to gray scale. We can use more compressed formats like webp and avif to make our site load faster. Transformation presets are just shortcuts for those. So you can standardize images and formats, sizes across your entire website or application quickly and easily. So let's take a look. I'm inside a sample project. I've got, some assets here. And if I just open up this, bunny, this is actually probably a hare. You know, we could do things like this where we have our transformations. Right? So I can adjust the width of this image. I can adjust the height of this image. But imagine I've got a blog page where I have cards that are all, roughly a same size. That's a good use case for transformation presets. So what can I do? We're gonna go into the Directus settings, to our project settings. We're gonna scroll down to files and storage. And I'll zoom in even further for you here. So there's a couple of settings when it comes to transformations. I can allow all transformations, which is basically, hey, I can whatever transformation I wanna do as long as it is valid sharp, which is the underlying library that we use, we can do that. I can also disable all transformations, so you get what you get as far as images. And last but not least, I can limit the transformations to presets below. So if you're concerned about people absolutely killing your server with transformations or kind of standardizing, you probably wanna do this limiting option. But as far as our presets, again, these are just shortcuts that you set up to, you know, standardize the format. So you could see this one called 800 width, or 800 w, is basically just a preset width of 800. We use the webp format. And instead of having to pass all these parameters when I actually get the image, I could just do something like this where in my URL for that specific image, you know, slash assets, slash the UUID for that file, I add a key param and I do 800w. Right? So that saves me a lot of time. And again, helps me standardize across my website. Creating these presets is super simple. I just go in. If I wanted to create a new preset, let's call it purple. Right? We'll do 800 wide. Let's do a webp format. And I've just got a additional transform that I wanna do here. We're gonna tint the image and we're gonna apply our directus purple, hence the name purple. So we'll do fit inside, that's great. Save this. And now if I go back to this specific image, all I have to do is change that key. And I now get a purple tinted hair in a field image. Looks amazing. So that is it for transformation presets. Try this out. Leverage it in your projects. It's super helpful. We'll catch you on the next one.","\u003Cp>In this episode of Short Hops, dive into the world of transformation presets in Directus. Host Bryant Gillespie guides you through this powerful feature that allows you to standardize and optimize images across your projects with ease.\u003C/p>\n\u003Cp>What you'll learn:\u003C/p>\n\u003Cul>\n\u003Cli>Understanding transformation presets and their benefits\u003C/li>\n\u003Cli>How to access and configure transformation settings in Directus\u003C/li>\n\u003Cli>Creating custom presets for width, format, and special effects\u003C/li>\n\u003Cli>Applying presets to images using simple URL parameters\u003C/li>\n\u003Cli>Balancing flexibility and control with transformation options\u003C/li>\n\u003Cli>Real-world use cases for standardizing images in web applications\u003C/li>\n\u003C/ul>\n\u003Cp>Whether you're managing a blog, e-commerce site, or complex web application, this episode provides valuable insights into streamlining your image handling process. Learn how to create presets that ensure consistency, improve load times with modern formats like WebP, and even apply custom transformations like color tinting.\u003C/p>","a142eef1-b2ac-48e7-8b53-d4add5047669",[254],"4c955a81-4deb-4d16-940d-fe54a4f3307f",[],{"id":133,"number":134,"show":122,"year":135,"episodes":257},[137,138,139,140,141,142,143,144],{"id":138,"slug":259,"vimeo_id":260,"description":261,"tile":262,"length":199,"resources":8,"people":8,"episode_number":134,"published":247,"title":263,"video_transcript_html":264,"video_transcript_text":265,"content":266,"seo":267,"status":130,"episode_people":268,"recommendations":270,"season":271},"soft-delete","983672903","Learn how to set up and use the archive functionality to declutter your views, improve workflow, and maintain a clean data structure without permanently deleting items. ","725e6b81-e003-479b-b5c0-154330a159f1","Soft Delete","\u003Cp>Speaker 0: Hello, and welcome back to yet another episode of Short Hops. I'm your host, Brian Gillespie. Today, I wanna cover the soft delete features inside Directus. It's called archive. So the archive feature allows you just to move records or items out of your way that are archived, that are no longer needed.\u003C/p>\u003Cp>Alright? So the example that we have here is our inbox. You can see I've got a couple of new items that have arrived in the inbox with, you know, contact forms and newsletter. Some of these things I need to take care of. Some of them have already been assigned.\u003C/p>\u003Cp>Some of them have already been closed. That's great. What do I what if I wanna get rid of these ones that are closed, get them out of my view? You know, I could certainly come in and create a filter for that using the filters inside Directus, really easy. Isn't empty or, I'm sorry, isn't does not equal closed.\u003C/p>\u003Cp>Right? So I could save that as the default view, but I've got another option. And that is using the archive feature. So to find that, I just go to the specific collection that I wanna edit. In that case, this is the inbox.\u003C/p>\u003Cp>I'm gonna scroll down the page until I come across the archive settings. So I'm gonna choose the archive field, which is basically what field do we wanna act on to archive or unarchive records. And then we want to enable this. And then we're gonna add a value. So if the value is closed we're gonna archive that record.\u003C/p>\u003Cp>If we unarchive something we bring it back, we're gonna set the value to new. Right? And that's really all we have to do in this case. We go back to our inbox and now you can see I don't see any of these records that have been closed. And this one that came in 19 hours ago, if I go in and just do like a quick edit on that, change this to closed, you can see that no longer shows up.\u003C/p>\u003Cp>Now on the right hand side bar, I get a new archive option. So I could show active items, I could show archived items, or I could show all of them. And then if I wanna bring an item back, I could just click in it or, and click this unarchive option, and that will change the status for me. Or I could manually change the status or I could do this in bulk by just setting the status to assigned, right? And now I no longer have those archived items.\u003C/p>\u003Cp>Now super simple, great little UX addition. One thing to remember though, this does not necessarily apply to the actual API. You know, this is only inside the data studio. If you want like a soft delete feature inside the API you can either do that using permissions or when you run your API calls, you wanna make sure that you look for the ones where status is new or assigned. So these settings only apply within the data studio.\u003C/p>\u003Cp>And with that, that's it for this episode of Short Hops. Stay tuned for the next one.\u003C/p>","Hello, and welcome back to yet another episode of Short Hops. I'm your host, Brian Gillespie. Today, I wanna cover the soft delete features inside Directus. It's called archive. So the archive feature allows you just to move records or items out of your way that are archived, that are no longer needed. Alright? So the example that we have here is our inbox. You can see I've got a couple of new items that have arrived in the inbox with, you know, contact forms and newsletter. Some of these things I need to take care of. Some of them have already been assigned. Some of them have already been closed. That's great. What do I what if I wanna get rid of these ones that are closed, get them out of my view? You know, I could certainly come in and create a filter for that using the filters inside Directus, really easy. Isn't empty or, I'm sorry, isn't does not equal closed. Right? So I could save that as the default view, but I've got another option. And that is using the archive feature. So to find that, I just go to the specific collection that I wanna edit. In that case, this is the inbox. I'm gonna scroll down the page until I come across the archive settings. So I'm gonna choose the archive field, which is basically what field do we wanna act on to archive or unarchive records. And then we want to enable this. And then we're gonna add a value. So if the value is closed we're gonna archive that record. If we unarchive something we bring it back, we're gonna set the value to new. Right? And that's really all we have to do in this case. We go back to our inbox and now you can see I don't see any of these records that have been closed. And this one that came in 19 hours ago, if I go in and just do like a quick edit on that, change this to closed, you can see that no longer shows up. Now on the right hand side bar, I get a new archive option. So I could show active items, I could show archived items, or I could show all of them. And then if I wanna bring an item back, I could just click in it or, and click this unarchive option, and that will change the status for me. Or I could manually change the status or I could do this in bulk by just setting the status to assigned, right? And now I no longer have those archived items. Now super simple, great little UX addition. One thing to remember though, this does not necessarily apply to the actual API. You know, this is only inside the data studio. If you want like a soft delete feature inside the API you can either do that using permissions or when you run your API calls, you wanna make sure that you look for the ones where status is new or assigned. So these settings only apply within the data studio. And with that, that's it for this episode of Short Hops. Stay tuned for the next one.","\u003Cp>In this episode of Short Hops, host Bryant Gillespie delves into the soft delete functionality in Directus, known as the archive feature. Discover how this powerful tool can help you manage your records more efficiently and keep your workspace organized.\u003C/p>\n\u003Cp>What you'll learn:\u003C/p>\n\u003Cul>\n\u003Cli>Understanding the archive feature and its benefits\u003C/li>\n\u003Cli>How to set up and configure archive settings for a collection\u003C/li>\n\u003Cli>Using the archive feature to declutter your views\u003C/li>\n\u003Cli>Archiving and unarchiving individual or bulk items\u003C/li>\n\u003Cli>Viewing active, archived, or all items in your collection\u003C/li>\n\u003Cli>Important considerations when using the archive feature with the API\u003C/li>\n\u003C/ul>","17168efd-4993-4e52-9615-d2558575ceed",[269],"1fc9239c-6474-4e3e-b01c-85f25181d668",[],{"id":133,"number":134,"show":122,"year":135,"episodes":272},[137,138,139,140,141,142,143,144],{"id":139,"slug":274,"vimeo_id":275,"description":276,"tile":277,"length":160,"resources":8,"people":8,"episode_number":199,"published":247,"title":278,"video_transcript_html":279,"video_transcript_text":280,"content":281,"seo":282,"status":130,"episode_people":283,"recommendations":285,"season":286},"m2a-relationships","983672403","Discover how to use Directus's powerful many-to-any relationships to create flexible and dynamic content structures. Learn to set up a versatile page builder that allows linking diverse content types to a single parent collection. ","d59cf454-5e42-4cbd-a1cd-27ddf09f151d","M2A Relationships","\u003Cp>Speaker 0: Welcome back to another episode of Short Hops. I'm your host Brian Gillespie. And today, we're gonna show you how to relate anything to anything or everything inside your Directus instance. So that is done using the many to any relationships or the builder interface that we have inside the project. And, basically, it allows you to link items from a parent collection to any other child collection in the database.\u003C/p>\u003Cp>So it is useful for page builder scenarios, other types of dynamic content creation, very helpful when you're building a CMS. You know, you might want to empower your marketing team and allow them to build complex layouts without actually touching code, and without a ton of effort on your part. So, you know, this graphic kind of illustrates what we've got going on here. We've got 3 different types of content. These are gonna be set up as different collections inside Directus.\u003C/p>\u003Cp>We've got a container for that content, like we wanna put all this content on a blog post or a page. And then we have this Junction collection, which has the ID of the blog, the collection for the actual different types of content we have, and then a ID for the content within that collection. So that's kind of how it all fits together at a high level. Let's jump into Directus and actually set this up. So I'm just in one of my demo projects and I'm gonna hop over to the data model section here and I'm also gonna do a little mouse highlighter thing.\u003C/p>\u003Cp>So what I've already done here is basically gone through and defined collections for all of my different components on a page. I've got a hero section that has a title, some buttons, and a background. I've got a, CTA section which has a title, some buttons and an image. I've got FAQs that have a title, a headline and some actual FAQs, some questions for us to answer. And what I don't have here is a container for this.\u003C/p>\u003Cp>What is it? What is the vessel for this? Let's create a new collection called pages. We'll just give this a generated UUID. I'm gonna leave the rest of this blank for now.\u003C/p>\u003Cp>We'll give this page a title. Probably want to give it a slug so we can access it or a permalink or something like that. And now we're into the many to any relationships inside Directus. So how do we set this up? Alright.\u003C/p>\u003Cp>I'm gonna go down to the relational section, I'm gonna look for the builder or m2a, and I typically call this something like blocks, content blocks, page blocks, you know, your specific naming convention, you know, use what feels right for you. But when we set this up, unlike the other relationships in Directus where we have to pick 1 collection that we want to relate to, here we can pick as many collections as we want. So I want the block hero. I want the, block FAQs. I want the block CTA collection.\u003C/p>\u003Cp>And once I'm done with that, I'll hit save, and that will create that field for me. Now if I go into my data model and I look at the very bottom, you can see that Directus has created this junction collection for us called pages blocks, or pages underscore blocks. If we take a look at it, we can see we have a relationship back to the pages ID, and then we have an item and a collection. So, these relate to the actual blocks that we selected like hero or CTA or FAQ. So now, how does this all come together when we're actually setting up or creating a page?\u003C/p>\u003Cp>Alright. We give it a title. We'll call this slash for the slug just because that's the homepage or you know, root home page, whatever you wanna call it, index. Great. And then I go in and create some blocks.\u003C/p>\u003Cp>So I can create a hero block. This is my hero. You are my hero. Okay. Go in and fill out the rest of these fields as well.\u003C/p>\u003Cp>Maybe we add some FAQs. Right? FAQs, we'll give it a title. Let's add one question to it. What is many to any?\u003C/p>\u003Cp>The answer is magic. Alright. So we'll go ahead and save this. Save this, and now we have that page builder scenario where we can set this up, right? If I wanna be able to drag and drop the order of that, I could just go back to that relationship.\u003C/p>\u003Cp>I go to pages, I go to blocks, and I look for my relationship here. I'm just gonna add a sort field, we'll call it sort. Directus will create that for me. And now I can drag and drop to rearrange these blocks and that would be the order that we would render those on the front end. So now I'm just gonna go in and quickly give public access to those blocks.\u003C/p>\u003Cp>So I've got a hero, I've got FAQs, and I also have pages and pages blocks. You know, set up your permissions based on what you need for your specific project, but I just wanted to take a look at this really quickly on this video. So we're gonna go into our API. We'll do a slash item slash pages. And here we could see we've got a title, we've got our slug, we've got our blocks.\u003C/p>\u003Cp>Great. But how do I get the information within the blocks? Right? So I'll just call fields. Let's get all the root level fields and we'll do a comma, and then I'm gonna say blocks dot item dot ID.\u003C/p>\u003Cp>Let's do another one like blocks dot item or no, let's just get all the fields from the item and take a look at that. Right. Cool. Alright. So now I could see just by, you know, setting up this quick little param for fields, I've got the actual content of my blocks.\u003C/p>\u003Cp>So I've got my FAQs and here's what that looks like. I've got my item, my hero here, so we could see that as well. And then you would obviously, like feed that into your front end. You probably got some type of component that loops through these things and dynamically renders the correct for that. So that is it for this video.\u003C/p>\u003Cp>I hope this demystified some of the many to any relationships for you. There's definitely more meat on the bone here, but come back for the next video. We'll see you.\u003C/p>","Welcome back to another episode of Short Hops. I'm your host Brian Gillespie. And today, we're gonna show you how to relate anything to anything or everything inside your Directus instance. So that is done using the many to any relationships or the builder interface that we have inside the project. And, basically, it allows you to link items from a parent collection to any other child collection in the database. So it is useful for page builder scenarios, other types of dynamic content creation, very helpful when you're building a CMS. You know, you might want to empower your marketing team and allow them to build complex layouts without actually touching code, and without a ton of effort on your part. So, you know, this graphic kind of illustrates what we've got going on here. We've got 3 different types of content. These are gonna be set up as different collections inside Directus. We've got a container for that content, like we wanna put all this content on a blog post or a page. And then we have this Junction collection, which has the ID of the blog, the collection for the actual different types of content we have, and then a ID for the content within that collection. So that's kind of how it all fits together at a high level. Let's jump into Directus and actually set this up. So I'm just in one of my demo projects and I'm gonna hop over to the data model section here and I'm also gonna do a little mouse highlighter thing. So what I've already done here is basically gone through and defined collections for all of my different components on a page. I've got a hero section that has a title, some buttons, and a background. I've got a, CTA section which has a title, some buttons and an image. I've got FAQs that have a title, a headline and some actual FAQs, some questions for us to answer. And what I don't have here is a container for this. What is it? What is the vessel for this? Let's create a new collection called pages. We'll just give this a generated UUID. I'm gonna leave the rest of this blank for now. We'll give this page a title. Probably want to give it a slug so we can access it or a permalink or something like that. And now we're into the many to any relationships inside Directus. So how do we set this up? Alright. I'm gonna go down to the relational section, I'm gonna look for the builder or m2a, and I typically call this something like blocks, content blocks, page blocks, you know, your specific naming convention, you know, use what feels right for you. But when we set this up, unlike the other relationships in Directus where we have to pick 1 collection that we want to relate to, here we can pick as many collections as we want. So I want the block hero. I want the, block FAQs. I want the block CTA collection. And once I'm done with that, I'll hit save, and that will create that field for me. Now if I go into my data model and I look at the very bottom, you can see that Directus has created this junction collection for us called pages blocks, or pages underscore blocks. If we take a look at it, we can see we have a relationship back to the pages ID, and then we have an item and a collection. So, these relate to the actual blocks that we selected like hero or CTA or FAQ. So now, how does this all come together when we're actually setting up or creating a page? Alright. We give it a title. We'll call this slash for the slug just because that's the homepage or you know, root home page, whatever you wanna call it, index. Great. And then I go in and create some blocks. So I can create a hero block. This is my hero. You are my hero. Okay. Go in and fill out the rest of these fields as well. Maybe we add some FAQs. Right? FAQs, we'll give it a title. Let's add one question to it. What is many to any? The answer is magic. Alright. So we'll go ahead and save this. Save this, and now we have that page builder scenario where we can set this up, right? If I wanna be able to drag and drop the order of that, I could just go back to that relationship. I go to pages, I go to blocks, and I look for my relationship here. I'm just gonna add a sort field, we'll call it sort. Directus will create that for me. And now I can drag and drop to rearrange these blocks and that would be the order that we would render those on the front end. So now I'm just gonna go in and quickly give public access to those blocks. So I've got a hero, I've got FAQs, and I also have pages and pages blocks. You know, set up your permissions based on what you need for your specific project, but I just wanted to take a look at this really quickly on this video. So we're gonna go into our API. We'll do a slash item slash pages. And here we could see we've got a title, we've got our slug, we've got our blocks. Great. But how do I get the information within the blocks? Right? So I'll just call fields. Let's get all the root level fields and we'll do a comma, and then I'm gonna say blocks dot item dot ID. Let's do another one like blocks dot item or no, let's just get all the fields from the item and take a look at that. Right. Cool. Alright. So now I could see just by, you know, setting up this quick little param for fields, I've got the actual content of my blocks. So I've got my FAQs and here's what that looks like. I've got my item, my hero here, so we could see that as well. And then you would obviously, like feed that into your front end. You probably got some type of component that loops through these things and dynamically renders the correct for that. So that is it for this video. I hope this demystified some of the many to any relationships for you. There's definitely more meat on the bone here, but come back for the next video. We'll see you.","\u003Cp>In this comprehensive episode of Short Hops, host Bryant Gillespie dives deep into the world of many-to-any relationships in Directus. Learn how to create flexible content structures that allow you to relate anything to well... anything within your Directus instance, opening up powerful possibilities for dynamic content creation and management.\u003C/p>\n\u003Cp>What you'll learn:\u003C/p>\n\u003Cul>\n\u003Cli>Understanding the concept and benefits of many-to-any relationships\u003C/li>\n\u003Cli>Setting up collections for different content types (e.g., hero sections, CTAs, FAQs)\u003C/li>\n\u003Cli>Creating a parent collection to contain diverse content blocks\u003C/li>\n\u003Cli>Implementing the builder interface for many-to-any relationships\u003C/li>\n\u003Cli>Configuring and managing junction collections\u003C/li>\n\u003Cli>Adding drag-and-drop functionality for content block ordering\u003C/li>\n\u003Cli>Querying and retrieving complex relational data through the API\u003C/li>\n\u003C/ul>\n\u003Cp>Bryant guides you through a practical, step-by-step process of:\u003C/p>\n\u003Cul>\n\u003Cli>Creating collections for various content types\u003C/li>\n\u003Cli>Setting up a parent 'pages' collection\u003C/li>\n\u003Cli>Implementing the many-to-any relationship using the builder interface\u003C/li>\n\u003Cli>Understanding the automatically generated junction collection\u003C/li>\n\u003Cli>Adding and managing content blocks within pages\u003C/li>\n\u003Cli>Implementing sort functionality for content blocks\u003C/li>\n\u003Cli>Setting up permissions for public access\u003C/li>\n\u003Cli>Querying the API to retrieve complex relational data\u003C/li>\n\u003C/ul>\n\u003Cp>Whether you're building a website with dynamic layouts, a complex CMS, or any system requiring versatile content structures, this technique will empower your team to create sophisticated content without the need for constant developer intervention.\u003C/p>","ac6f05df-e1e7-4170-9114-e13f2420a669",[284],"53c09b3e-ea64-421b-8b1b-da48e6ec07fd",[],{"id":133,"number":134,"show":122,"year":135,"episodes":287},[137,138,139,140,141,142,143,144],{"id":140,"slug":289,"vimeo_id":290,"description":291,"tile":292,"length":179,"resources":8,"people":8,"episode_number":179,"published":247,"title":293,"video_transcript_html":294,"video_transcript_text":295,"content":296,"seo":297,"status":130,"episode_people":298,"recommendations":300,"season":301},"focal-point","983672154","Learn to maintain the focus of your images during asset transformations, enhancing the visual appeal of your website or application.","9031652a-9389-473a-9f8b-a5473b3fc8bc","Focal Point","\u003Cp>Speaker 0: And welcome back to another episode of Short Hops. I'm your host, Brian Gillespie. And in this episode, I wanna talk about the focal point feature inside Directus. What is a focal point? It's basically just a way for you to keep your image, your the focus of your image in frame when you do asset transformation like cropping at different image sizes, different image aspect ratios.\u003C/p>\u003Cp>Basically, you wanna keep folks in frame. So what does that actually look like? Right? When you are using Directus in a CMS use case, like this is powering content for our website or our application and we're serving images from that. Directus has a robust asset transformation.\u003C/p>\u003Cp>So I can do all types of cropping and formatting for our images, compositing, you know, color manipulation if I need to. But you want your website to look amazing. And part of that is images. Right? So you could see here in this case, I've got a article card here, a blog post card and our rabbit is actually getting cut off.\u003C/p>\u003Cp>We don't want that. Right? The focal point feature inside Directus comes to the rescue here. So let's open up our Directus instance and I just want to showcase this, right? So we've got an image over here of a coach tying a soccer player's shoes or a football for anybody outside the states.\u003C/p>\u003Cp>And, you could see that this should be the obvious focal point of the image, but it's kind of not in the center. Right? So by default, we're gonna crop from the center. But, here down below, I can see focal point, I have an x coordinate and a y coordinate. When we leave those things blank, if I just open up this image in a new tab, and we do something like this where we adjust the width and height of this image.\u003C/p>\u003Cp>Width equals, let's say, 400 and we wanna look at taller, skinnier image. So I'm gonna do the height at 800. And immediately what you could see is we we lose context. Right? Our football player is halfway cut off.\u003C/p>\u003Cp>We don't even see the coach. How can we fix that? That is where the focal point comes into play. So you can manually adjust this or there's even a nice extension that, uses AI to automatically generate this. But the easiest way to edit the focal point is just go to the edit button on the top right hand side.\u003C/p>\u003Cp>We'll see the image editor over here. There is the focal point tool. I'll click that, that'll give me a little focal point highlight here. And I'll just place that over the elements that I want to focus on and just expand that, right? So I wanna make sure I get the player and the coach, and we'll just save that.\u003C/p>\u003Cp>We can see those x and y coordinates have been updated. And then I'm just gonna simply refresh this image and now that focal point, the coach and his player, are in frame, are in focus. So that is the focal point tool inside Directus. Stay tuned for the next episode of Short Hops.\u003C/p>","And welcome back to another episode of Short Hops. I'm your host, Brian Gillespie. And in this episode, I wanna talk about the focal point feature inside Directus. What is a focal point? It's basically just a way for you to keep your image, your the focus of your image in frame when you do asset transformation like cropping at different image sizes, different image aspect ratios. Basically, you wanna keep folks in frame. So what does that actually look like? Right? When you are using Directus in a CMS use case, like this is powering content for our website or our application and we're serving images from that. Directus has a robust asset transformation. So I can do all types of cropping and formatting for our images, compositing, you know, color manipulation if I need to. But you want your website to look amazing. And part of that is images. Right? So you could see here in this case, I've got a article card here, a blog post card and our rabbit is actually getting cut off. We don't want that. Right? The focal point feature inside Directus comes to the rescue here. So let's open up our Directus instance and I just want to showcase this, right? So we've got an image over here of a coach tying a soccer player's shoes or a football for anybody outside the states. And, you could see that this should be the obvious focal point of the image, but it's kind of not in the center. Right? So by default, we're gonna crop from the center. But, here down below, I can see focal point, I have an x coordinate and a y coordinate. When we leave those things blank, if I just open up this image in a new tab, and we do something like this where we adjust the width and height of this image. Width equals, let's say, 400 and we wanna look at taller, skinnier image. So I'm gonna do the height at 800. And immediately what you could see is we we lose context. Right? Our football player is halfway cut off. We don't even see the coach. How can we fix that? That is where the focal point comes into play. So you can manually adjust this or there's even a nice extension that, uses AI to automatically generate this. But the easiest way to edit the focal point is just go to the edit button on the top right hand side. We'll see the image editor over here. There is the focal point tool. I'll click that, that'll give me a little focal point highlight here. And I'll just place that over the elements that I want to focus on and just expand that, right? So I wanna make sure I get the player and the coach, and we'll just save that. We can see those x and y coordinates have been updated. And then I'm just gonna simply refresh this image and now that focal point, the coach and his player, are in frame, are in focus. So that is the focal point tool inside Directus. Stay tuned for the next episode of Short Hops.","\u003Cp>In this episode of Short Hops, host Bryant Gillespie explores the powerful focal point feature in Directus. Learn how this tool can significantly improve the visual quality of your website or application by ensuring that the key elements of your images remain in frame, even when cropped or resized.\u003C/p>\n\u003Cp>What you'll learn:\u003C/p>\n\u003Cul>\n\u003Cli>Understanding the concept of focal points in image management\u003C/li>\n\u003Cli>How focal points affect image cropping and transformations\u003C/li>\n\u003Cli>Setting up and adjusting focal points in Directus\u003C/li>\n\u003Cli>Practical demonstration using a real-world example\u003C/li>\n\u003Cli>Improving image presentation across different sizes and aspect ratios\u003C/li>\n\u003Cli>Tips for optimizing your images for various layouts and devices\u003C/li>\n\u003C/ul>","22dc323c-b8a7-4156-a058-7f6d19e732c9",[299],"065d18bb-3c9f-49a7-916f-eb4418da66b9",[],{"id":133,"number":134,"show":122,"year":135,"episodes":302},[137,138,139,140,141,142,143,144],{"id":141,"slug":304,"vimeo_id":305,"description":306,"tile":307,"length":179,"resources":8,"people":8,"episode_number":232,"published":247,"title":308,"video_transcript_html":309,"video_transcript_text":310,"content":311,"seo":312,"status":130,"episode_people":313,"recommendations":315,"season":316},"dynamic-relational-interfaces","983671908","Learn how to create a more intuitive user experience in Directus by implementing dynamic filters on relational interfaces. This episode teaches you to set up dependent field relationships, allowing users to see only relevant options when selecting related items. ","0eb0d695-342c-447c-b406-bc7980733cae","Dynamic Relational Interfaces","\u003Cp>Speaker 0: Welcome back to another episode of Short Hops. I'm your host Brian Gillespie. And in this episode, I'm gonna give you one of the coolest tips and tricks that I've probably ever shared here on Short Ops. So stick with me on this one. It's really cool.\u003C/p>\u003Cp>Alright. So what are we focused on today? We're going to build a better user experience using filters on our relational interfaces. That is a mouthful, kind of underwhelming title. But let's dive into an example project and I'll show you what we've got going on.\u003C/p>\u003Cp>So this is a sample Directus instance. This is my Agency OS project that we put out under the Directus Labs organization. Be sure to check that out. But I wanna show you the scenario. So I'm creating a project in here, and we've got an organization, and we could add multiple contacts to this.\u003C/p>\u003Cp>So a a project belongs to an organization. Let's go with Tesla, in this case, pretty ambiguous name. And then I want to add an existing contact to this. But you could see here, here's my problem. If I take a look, I get all the contacts for this.\u003C/p>\u003Cp>So, you know, I'm only wanting to be able to select contacts that are at Tesla. So this is kind of a dependency here. How do we manage something like this? So I'm just going to open the settings, we're going to go into our data model. I'm going to look for the projects collection.\u003C/p>\u003Cp>And here inside organization, we've got contacts right beside it. What I'm looking for, you know, we could see the relationship tab and how all these things come together. But when I go into the interface, and this is a mini to mini collection or relationship, so you'll have to be mindful of how you've got your relationship set up. But if I want to set that up dependent upon a field that we already have, I could do something like this. Down here in my filter, you know, I could go in and and like hard code a value of, you know, show me all the contacts where the name contains Ashley.\u003C/p>\u003Cp>But we want this to be dynamic, right, so I'm gonna drill into our organizations. This is a many to many relationship. And I'm gonna say organizations dot id equals, and I could do this. So I'm gonna do mustache brackets here, and I'm gonna do organization, which is the name of that other field inside our data model. Alright.\u003C/p>\u003Cp>Great. So let's take a look at this and we'll go back, we'll create a new project. Right now if I click add existing, no contacts show up. How come? Right?\u003C/p>\u003Cp>So what I could do here, we'll say Directus test. That's the company we wanna do this project for. And now I only see the contacts who are part of that organization. Right? Likewise, if I change this to Tesla, I open it up and I see I've got Elon Dusk here as the only option to select.\u003C/p>\u003Cp>So that's it. Take a look at the filter on any of the relational interfaces that you've set up, this is a a nice little technique to use in certain scenarios like this one. That's it for this episode. Stay tuned for the next one.\u003C/p>","Welcome back to another episode of Short Hops. I'm your host Brian Gillespie. And in this episode, I'm gonna give you one of the coolest tips and tricks that I've probably ever shared here on Short Ops. So stick with me on this one. It's really cool. Alright. So what are we focused on today? We're going to build a better user experience using filters on our relational interfaces. That is a mouthful, kind of underwhelming title. But let's dive into an example project and I'll show you what we've got going on. So this is a sample Directus instance. This is my Agency OS project that we put out under the Directus Labs organization. Be sure to check that out. But I wanna show you the scenario. So I'm creating a project in here, and we've got an organization, and we could add multiple contacts to this. So a a project belongs to an organization. Let's go with Tesla, in this case, pretty ambiguous name. And then I want to add an existing contact to this. But you could see here, here's my problem. If I take a look, I get all the contacts for this. So, you know, I'm only wanting to be able to select contacts that are at Tesla. So this is kind of a dependency here. How do we manage something like this? So I'm just going to open the settings, we're going to go into our data model. I'm going to look for the projects collection. And here inside organization, we've got contacts right beside it. What I'm looking for, you know, we could see the relationship tab and how all these things come together. But when I go into the interface, and this is a mini to mini collection or relationship, so you'll have to be mindful of how you've got your relationship set up. But if I want to set that up dependent upon a field that we already have, I could do something like this. Down here in my filter, you know, I could go in and and like hard code a value of, you know, show me all the contacts where the name contains Ashley. But we want this to be dynamic, right, so I'm gonna drill into our organizations. This is a many to many relationship. And I'm gonna say organizations dot id equals, and I could do this. So I'm gonna do mustache brackets here, and I'm gonna do organization, which is the name of that other field inside our data model. Alright. Great. So let's take a look at this and we'll go back, we'll create a new project. Right now if I click add existing, no contacts show up. How come? Right? So what I could do here, we'll say Directus test. That's the company we wanna do this project for. And now I only see the contacts who are part of that organization. Right? Likewise, if I change this to Tesla, I open it up and I see I've got Elon Dusk here as the only option to select. So that's it. Take a look at the filter on any of the relational interfaces that you've set up, this is a a nice little technique to use in certain scenarios like this one. That's it for this episode. Stay tuned for the next one.","\u003Cp>In this episode of Short Hops, host Bryant Gillespie shares an invaluable tip for improving the user experience in Directus projects. Learn how to implement dynamic filters on relational interfaces, creating more intuitive and efficient data entry processes.\u003C/p>\n\u003Cp>What you'll learn:\u003C/p>\n\u003Cul>\n\u003Cli>Understanding the challenge of managing related data in complex structures\u003C/li>\n\u003Cli>How to set up dependent field relationships in Directus\u003C/li>\n\u003Cli>Implementing dynamic filters on many-to-many relationships\u003C/li>\n\u003Cli>Using mustache syntax to create context-aware filters\u003C/li>\n\u003Cli>Practical demonstration using a real-world project management scenario\u003C/li>\n\u003C/ul>","014f5dc9-1c15-4db0-adae-425834f62e90",[314],"3553bb41-b085-40b8-ab7c-ee118829e345",[],{"id":133,"number":134,"show":122,"year":135,"episodes":317},[137,138,139,140,141,142,143,144],{"id":142,"slug":319,"vimeo_id":320,"description":321,"tile":322,"length":232,"resources":8,"people":8,"episode_number":323,"published":247,"title":324,"video_transcript_html":325,"video_transcript_text":326,"content":327,"seo":328,"status":130,"episode_people":329,"recommendations":331,"season":332},"dynamic-variables","983671644","Learn to use dynamic variables like $CURRENT_USER, $CURRENT_ROLE, and $NOW to create personalized views and time-based queries both in the app interface and API calls. ","6eee710c-cce7-4302-889b-841998b61be1",6,"Dynamic Variables","\u003Cp>Speaker 0: Alright. Welcome back to another episode of Short Hops. I'm your host, Brian Gillespie. In this episode, we are talking about your friends who make filtering easier, dynamic variables. Dynamic variables, you can use these in any API calls when you are doing some filtering.\u003C/p>\u003Cp>You can also use these inside the app. And I'll show you a couple of quick use cases for them. But we'll just run through the most popular ones. These are the main ones. We have dollar sign current underscore user.\u003C/p>\u003Cp>That will give you the current ID of a particular logged in user. Current role will give you the current role ID of a logged in user, of the current logged in user. And then we have dollar sign now which will give you the current timestamp and you can do adjustments with this as well like now minus 1 year, now plus 2 hours. And I'll I'll show you how to get the most out of these in the application here. Alright, so let's take a look at a specific scenario.\u003C/p>\u003Cp>I'm inside a sample app. I've got a contacts table here. Some of these would be assigned to me, some of them would not be. But if I take a look at it, just a a standard kind of CRM format. So now if I wanted to take a look at all of my contacts, and maybe what I want to do is put a bookmark in that every user has access to, a global bookmark.\u003C/p>\u003Cp>But it's dynamic in that when they click on it, it shows their specific contacts. So the bookmark is is globally available, but it is filtered based on the current user. So how can we do something like that? Right? I can go in and I'm gonna set a filter here, let's say user created equals dollar sign underscore current user.\u003C/p>\u003Cp>And now, I get a list of my specific contacts or the ones that I created. Right? You know, I could also, you know, have the owner of my organization as well. So if the owner of the organization equals current user, that is my list. Right?\u003C/p>\u003Cp>And now I can go in and actually bookmark this and I may call it something like my contacts, because we can make this globally available. Great. So that is one way to use this. Let's take the scenario where I want to, you know, show me all the posts that have been published within the last month. Right, so again, I can use those dynamic variables to make filtering easier because I, you know, I don't wanna do the math and figure out what it was a month ago.\u003C/p>\u003Cp>So I'm just gonna go in, date published is greater than and we'll do dollar sign now minus 1 month. And boom we could see that. And again, these same filters you can use within the API as well. So if I just pull up just a little API tool called Bruno that I've been using. And we are calling these posts.\u003C/p>\u003Cp>So if we just get the post resource, we could see we're getting all of our posts here. This is just items slash posts. Now if I add a param for the date published, and let's do gt or underscore gt, which is greater than. And we'll do that dollar sign now. We'll do that same kind of query that we used.\u003C/p>\u003Cp>1 month. And here you could see I'm only getting like 1 or 2 posts. Or if I wanted to see everything that's published within the last day, boom. So that's how this works. That is dynamic variables.\u003C/p>\u003Cp>A lot you can do with these. So make sure you check them out. Read up on the documentation. And we'll see you in the next episode.\u003C/p>","Alright. Welcome back to another episode of Short Hops. I'm your host, Brian Gillespie. In this episode, we are talking about your friends who make filtering easier, dynamic variables. Dynamic variables, you can use these in any API calls when you are doing some filtering. You can also use these inside the app. And I'll show you a couple of quick use cases for them. But we'll just run through the most popular ones. These are the main ones. We have dollar sign current underscore user. That will give you the current ID of a particular logged in user. Current role will give you the current role ID of a logged in user, of the current logged in user. And then we have dollar sign now which will give you the current timestamp and you can do adjustments with this as well like now minus 1 year, now plus 2 hours. And I'll I'll show you how to get the most out of these in the application here. Alright, so let's take a look at a specific scenario. I'm inside a sample app. I've got a contacts table here. Some of these would be assigned to me, some of them would not be. But if I take a look at it, just a a standard kind of CRM format. So now if I wanted to take a look at all of my contacts, and maybe what I want to do is put a bookmark in that every user has access to, a global bookmark. But it's dynamic in that when they click on it, it shows their specific contacts. So the bookmark is is globally available, but it is filtered based on the current user. So how can we do something like that? Right? I can go in and I'm gonna set a filter here, let's say user created equals dollar sign underscore current user. And now, I get a list of my specific contacts or the ones that I created. Right? You know, I could also, you know, have the owner of my organization as well. So if the owner of the organization equals current user, that is my list. Right? And now I can go in and actually bookmark this and I may call it something like my contacts, because we can make this globally available. Great. So that is one way to use this. Let's take the scenario where I want to, you know, show me all the posts that have been published within the last month. Right, so again, I can use those dynamic variables to make filtering easier because I, you know, I don't wanna do the math and figure out what it was a month ago. So I'm just gonna go in, date published is greater than and we'll do dollar sign now minus 1 month. And boom we could see that. And again, these same filters you can use within the API as well. So if I just pull up just a little API tool called Bruno that I've been using. And we are calling these posts. So if we just get the post resource, we could see we're getting all of our posts here. This is just items slash posts. Now if I add a param for the date published, and let's do gt or underscore gt, which is greater than. And we'll do that dollar sign now. We'll do that same kind of query that we used. 1 month. And here you could see I'm only getting like 1 or 2 posts. Or if I wanted to see everything that's published within the last day, boom. So that's how this works. That is dynamic variables. A lot you can do with these. So make sure you check them out. Read up on the documentation. And we'll see you in the next episode.","\u003Cp>In this episode of Short Hops, host Bryant Gillespie introduces you to the power of dynamic variables in Directus. Learn how these versatile tools can significantly enhance your filtering capabilities, allowing you to create more personalized and time-sensitive data views with ease.\u003C/p>\n\u003Cp>What you'll learn:\u003C/p>\n\u003Cul>\n\u003Cli>Understanding the concept and benefits of dynamic variables in Directus\u003C/li>\n\u003Cli>Overview of key dynamic variables: $CURRENT_USER, $CURRENT_ROLE, and $NOW\u003C/li>\n\u003Cli>Using dynamic variables in the Directus app interface\u003C/li>\n\u003Cli>Implementing dynamic variables in API calls\u003C/li>\n\u003Cli>Creating user-specific views and global bookmarks with personalized results\u003C/li>\n\u003Cli>Utilizing time-based queries for content management\u003C/li>\n\u003C/ul>","7c0faac8-c4a5-42fe-a6a8-5199de342e6c",[330],"59719367-7875-4483-a727-162fd24e9064",[],{"id":133,"number":134,"show":122,"year":135,"episodes":333},[137,138,139,140,141,142,143,144],{"id":143,"slug":335,"vimeo_id":336,"description":337,"tile":338,"length":232,"resources":8,"people":8,"episode_number":160,"published":247,"title":339,"video_transcript_html":340,"video_transcript_text":341,"content":342,"seo":343,"status":130,"episode_people":344,"recommendations":346,"season":347},"version-control","983671293","Learn how to make stress-free edits to published content without affecting the live version. Bryant walks you through how to enable content versioning in Directus and how to create and manage different versions of content.","54340f51-3329-4209-8cae-5589ac7d6f33","Version Control","\u003Cp>Speaker 0: Alright. And welcome back to another episode of Short Hops. I'm your host, Brian Gillespie. In this episode, we are gonna cover content versioning. So what is content versioning?\u003C/p>\u003Cp>Basically it allows you to do stress free editing on articles or content or pages, whatever you're serving up, that you've already published. Right? We've all been through it. Hey, we need to make some edits to a page. I need to be able to save those edits, but I don't wanna push those live until we get approval or we've had time to vet them out.\u003C/p>\u003Cp>So content versioning allows you to basically make changes and edits without affecting the published version of a piece of content. Now how do we set that up? Right? I am in a sample Directus instance. This is one of my blog posts, a very nice piece by mister Carrot Gillespie, about steampunk rabbits and why they are the future of work.\u003C/p>\u003Cp>So I've got some edits that I wanna make to this, but this is already published. So any edits that I make, if I save, could potentially show up live on our site. So content versioning to the rescue. How do we enable this? We go to our settings.\u003C/p>\u003Cp>We go to the collection we would like to enable versioning for. And we'll go down to the settings for this and we'll find the content versioning header. We'll check the box. I'm sure you know what that will do. And now we'll go back to our post.\u003C/p>\u003Cp>So at the top we can see now we have this little badge for main. So that is the main piece of content. That's the the main version that we are going to publish. So if I wanna make some changes here, I could just go and create a new version. This is, BG edits, And the key is important here.\u003C/p>\u003Cp>We'll just call this Bryant's edits. Great. I've created that new version. Now I could go in and make all the changes I want here. This looks pretty good.\u003C/p>\u003Cp>Okay. So what I can do now is save this version and I've got 2 versions here. I can see Bryant's edits. I could potentially, you know, send this to somebody on our team, ask them to review it. And then once I am ready to promote or publish this version, we've got a a function here called promote version.\u003C/p>\u003Cp>So basically I'm gonna click promote version. This will then show me a difference between what is published and what is the, the edits that I'm making. And here I can confirm which version should be used for each of these individual fields. So if I don't want to overwrite the summary, I can, you know, use whatever is in the the main version here. Or likewise, in this case, I want to overwrite everything entirely.\u003C/p>\u003Cp>I'll hit this and I've got the option to keep or delete. I could, keep this change, and now those changes that I make are now published in the main content version. Now when I'm accessing versions via the API, especially on like a front end or something, let's say I'm trying to fetch this piece of content. So I'm just gonna go to items slash posts and I could see the post here. Right?\u003C/p>\u003Cp>If I were to go in and, you know, create a new version, let's just call it test version, and here's some more changes. We'll just save. Oh, actually, let's switch that. Here's the changes. And we'll save this version.\u003C/p>\u003Cp>So now I'm working on the test version. If I run that API call again, you could see I don't see those changes. Right? But if I am calling an individual piece of content, I can add a version param to this. So I could say version equals test, and I could see here's the changes that we have.\u003C/p>\u003Cp>Right? Great. So, that is content versioning. There's also a separate API endpoint for this as well if you wanna get all the individual content versions and it does support all the regular global parameters. So make sure you check out the documentation on this on how to leverage it further.\u003C/p>\u003Cp>That's it for this episode. We'll catch you on the next one.\u003C/p>","Alright. And welcome back to another episode of Short Hops. I'm your host, Brian Gillespie. In this episode, we are gonna cover content versioning. So what is content versioning? Basically it allows you to do stress free editing on articles or content or pages, whatever you're serving up, that you've already published. Right? We've all been through it. Hey, we need to make some edits to a page. I need to be able to save those edits, but I don't wanna push those live until we get approval or we've had time to vet them out. So content versioning allows you to basically make changes and edits without affecting the published version of a piece of content. Now how do we set that up? Right? I am in a sample Directus instance. This is one of my blog posts, a very nice piece by mister Carrot Gillespie, about steampunk rabbits and why they are the future of work. So I've got some edits that I wanna make to this, but this is already published. So any edits that I make, if I save, could potentially show up live on our site. So content versioning to the rescue. How do we enable this? We go to our settings. We go to the collection we would like to enable versioning for. And we'll go down to the settings for this and we'll find the content versioning header. We'll check the box. I'm sure you know what that will do. And now we'll go back to our post. So at the top we can see now we have this little badge for main. So that is the main piece of content. That's the the main version that we are going to publish. So if I wanna make some changes here, I could just go and create a new version. This is, BG edits, And the key is important here. We'll just call this Bryant's edits. Great. I've created that new version. Now I could go in and make all the changes I want here. This looks pretty good. Okay. So what I can do now is save this version and I've got 2 versions here. I can see Bryant's edits. I could potentially, you know, send this to somebody on our team, ask them to review it. And then once I am ready to promote or publish this version, we've got a a function here called promote version. So basically I'm gonna click promote version. This will then show me a difference between what is published and what is the, the edits that I'm making. And here I can confirm which version should be used for each of these individual fields. So if I don't want to overwrite the summary, I can, you know, use whatever is in the the main version here. Or likewise, in this case, I want to overwrite everything entirely. I'll hit this and I've got the option to keep or delete. I could, keep this change, and now those changes that I make are now published in the main content version. Now when I'm accessing versions via the API, especially on like a front end or something, let's say I'm trying to fetch this piece of content. So I'm just gonna go to items slash posts and I could see the post here. Right? If I were to go in and, you know, create a new version, let's just call it test version, and here's some more changes. We'll just save. Oh, actually, let's switch that. Here's the changes. And we'll save this version. So now I'm working on the test version. If I run that API call again, you could see I don't see those changes. Right? But if I am calling an individual piece of content, I can add a version param to this. So I could say version equals test, and I could see here's the changes that we have. Right? Great. So, that is content versioning. There's also a separate API endpoint for this as well if you wanna get all the individual content versions and it does support all the regular global parameters. So make sure you check out the documentation on this on how to leverage it further. That's it for this episode. We'll catch you on the next one.","\u003Cp>In this episode of Short Hops, host Bryant Gillespie explains content versioning in Directus. Learn how to make stress-free edits to published content without affecting the live version.\u003C/p>\n\u003Cp>Bryant walks you through:\u003C/p>\n\u003Cul>\n\u003Cli>What content versioning is and why it's useful\u003C/li>\n\u003Cli>How to enable content versioning in Directus\u003C/li>\n\u003Cli>Creating and managing different versions of content\u003C/li>\n\u003Cli>Promoting edited versions to replace the main published version\u003C/li>\n\u003Cli>Accessing specific versions via the API\u003C/li>\n\u003C/ul>\n\u003Cp>Perfect for content managers, developers, and anyone looking to streamline their content editing process. Discover how to make changes confidently and collaborate effectively using Directus's powerful versioning features.\u003C/p>","1e57efe3-b06c-4a0e-bb18-e34a2b4ca08a",[345],"0ab97766-5821-4f3a-b192-7c38cf1288af",[],{"id":133,"number":134,"show":122,"year":135,"episodes":348},[137,138,139,140,141,142,143,144],{"id":144,"slug":350,"vimeo_id":351,"description":352,"tile":353,"length":354,"resources":8,"people":8,"episode_number":355,"published":247,"title":356,"video_transcript_html":357,"video_transcript_text":358,"content":359,"seo":360,"status":130,"episode_people":361,"recommendations":363,"season":364},"complex-queries","983670600","Dive into the world of Directus REST API querying in this informative episode. Learn how to perform complex queries, filter results, and work with relational data using the Directus SDK. ","222a28d6-c2e4-43fc-a61f-dc57132bac26",9,8,"Complex Queries via API","\u003Cp>Speaker 0: Welcome back to yet another episode of Short Hops. I'm your host, Brian Gillespie. And today, I wanna cover, a tough topic for new comers to direct us, which can be setting up your queries via the REST API. So today we are going to query our hearts out, and kind of run through some complex queries more than just, yeah, you know, calling a standard endpoint, very simple. Alright.\u003C/p>\u003Cp>So, I've got a example project over here. I've got some pages that we're working with within a collection. And over here on the right, I've just set up a simple little node project and pulled in our SDK. If you are working with the Directus API, I highly recommend using the SDK, just because we've got some little convenience methods in here for you. It makes it much easier to work with your Directus API.\u003C/p>\u003Cp>So I have got, I've imported the create Directus function. We've got a a rest API, we're gonna read some items, so that's one of the methods we're gonna call. And then I'm just creating a client here, so the format's very simple. We pass the URL, we tag on, a rest function at the end, or with rest function at the end, and then we can call that client. So I'm just saying, hey, defining a constant.\u003C/p>\u003Cp>We'll await that request to pages, and I don't have anything in the filter here. I could actually comment this out if I wanted to. And then let's just run node index dotjs, and we could see I'm getting a bunch of pages here. So one of the first things that you might wanna do when working with the API, the REST API acts like GraphQL in that I can call the specific fields that I want. So I can add a parameter here for fields and we'll just say I want the ID, the title, and maybe the blocks for this specific page.\u003C/p>\u003Cp>So now if I call this again, we can see a Directus has given me just the information that I asked for. That's great. What if we wanted to filter this down though? Right? I'm getting a bunch of different pages.\u003C/p>\u003Cp>Some of these are published, some of them are not. Maybe we just wanna see only the published pages, right? So that's where our filter comes back in. And here, let's add a comma there. And now let's do a filter where the status, and we've got a couple of operators here.\u003C/p>\u003Cp>There's actually a lot of operators. You can find these on the documentation. And we want the status to be equal to published. Great. We can run that again.\u003C/p>\u003Cp>And now I shouldn't see, like, a test with new default because I'm seeing that over there. Great. Okay. I don't see that one in the list, But let's say I wanted to actually limit the number of results that I see, I could do something like this where I just add a limit parameter and we'll pass that too. And now I should only get back to pages.\u003C/p>\u003Cp>Right? So I see my home page. I'm getting the manifesto page here. And I can see the blocks. This is an ID.\u003C/p>\u003Cp>We'll go about fetching that in a moment. Now what if we have a more complex filter where we need to stack different conditions together? So for that, you have the and and or operators. So I could do something like this. And instead of an object, this is gonna be an array.\u003C/p>\u003Cp>So I'm gonna pass an array of objects like status is equal to published. Can I do formatting on this? I don't have Prettier or ESLint setup on this project. But So I want the status is equal to published and maybe the permalink let's just get the home page, right? So I'm gonna do equal to not home but slash because I can see that right here, this permalink.\u003C/p>\u003Cp>Great. And even though I've got a limit of 2, I should only get one back. Permalink is equal to, did I save that, or status is equal to publish. Oh, that's an or filter. So we want both of these conditions.\u003C/p>\u003Cp>Right? Let's do that. So we want to match both of those conditions. And now the only item I get back in my array of data is the home page. Great.\u003C/p>\u003Cp>So that's how we can stack filters together. Let's take this a step further and for our blocks, we want to get the content within those blocks. And, you can expand the relationships within a single API call within Directus which is again is super nice as well. So we'll do blocks, let's add, this is actually gonna be an object so we'll do blocks. We'll give it an array of fields that we want to give for the block.\u003C/p>\u003Cp>Let's get the block ID, maybe we want to get the collection for that block, This is set up using our many to any builder relationship and we'll do item dot star. So the star or asterisk is a wild card. That should return all the fields or all the root level fields for the item within the block. So let's run this and actually see what we get out of it. And now you can see I'm actually getting the data for my blocks.\u003C/p>\u003Cp>So I can see, you know, this is columns, we've got a title, we've got a headline, we've got the actual rows. So I could even drill further into those relationships via a single API call if I wanted. Now there's one other field that I want to pull within this and we'll do hide block. And do we have hide block? Okay.\u003C/p>\u003Cp>So now I've I've got this hide block on here. You know, within the page builder, maybe I wanna hide one of these individual blocks so that it doesn't show on a page. I can query that on my front end so that, you know, hey, we we don't have to remove this, maybe we want to show it at a later date, but I wanna hide this specific block and not render that when I consume that API on my front end. So how would I do something like that? This is a setup on the relational field, right?\u003C/p>\u003Cp>So at the top level here we can filter based on the pages, but there is a special parameter that you can use to filter the relational data in a single API call. So you'll see how powerful this is in just a moment. We'll go in and we'll do deep parameter. And we're going to look at our blocks. And now it's like we've got a whole another query within this, right?\u003C/p>\u003Cp>So I'm just going to preface this with a underscore or an underscore and we're gonna do a filter and now we are filtering on the block level. So the related blocks we wanna do hide block is equal to not equal to true. Alright so let's see what that returns. And I'm just gonna clear out my console here and I shouldn't see the first item as a quote because I have removed that or filtered it out. Forgot my comma at the end there.\u003C/p>\u003Cp>So we'll clear one more time, call this out. If I zoom back up to the top of this, you could see the first block in my array here is the form section. Right now if I go in and I just hide a lot of these blocks, right? I've hidden the first three blocks, the first section that I see in my API call should be this FAQ one. Let's clear this again.\u003C/p>\u003Cp>Just to make it easier we'll do node dot JS and, oh, I forgot to save the actual item over here. Let's try that one more time. Node. Js index dot JS, there we go. And now the first block that we see is the FAQ section.\u003C/p>\u003Cp>Right? If I wanted to see all the blocks that we hid, I could just change that to not equal to false or I could set it to equal to true, either way. But now I can see here's all the blocks that we hid within that specific page. So I hope this has been a great tutorial on just the sorts of things you could do with the, global parameters when you're calling the API. Stay tuned for more episodes of Short Hops.\u003C/p>\u003Cp>That's it. We'll see you.\u003C/p>","Welcome back to yet another episode of Short Hops. I'm your host, Brian Gillespie. And today, I wanna cover, a tough topic for new comers to direct us, which can be setting up your queries via the REST API. So today we are going to query our hearts out, and kind of run through some complex queries more than just, yeah, you know, calling a standard endpoint, very simple. Alright. So, I've got a example project over here. I've got some pages that we're working with within a collection. And over here on the right, I've just set up a simple little node project and pulled in our SDK. If you are working with the Directus API, I highly recommend using the SDK, just because we've got some little convenience methods in here for you. It makes it much easier to work with your Directus API. So I have got, I've imported the create Directus function. We've got a a rest API, we're gonna read some items, so that's one of the methods we're gonna call. And then I'm just creating a client here, so the format's very simple. We pass the URL, we tag on, a rest function at the end, or with rest function at the end, and then we can call that client. So I'm just saying, hey, defining a constant. We'll await that request to pages, and I don't have anything in the filter here. I could actually comment this out if I wanted to. And then let's just run node index dotjs, and we could see I'm getting a bunch of pages here. So one of the first things that you might wanna do when working with the API, the REST API acts like GraphQL in that I can call the specific fields that I want. So I can add a parameter here for fields and we'll just say I want the ID, the title, and maybe the blocks for this specific page. So now if I call this again, we can see a Directus has given me just the information that I asked for. That's great. What if we wanted to filter this down though? Right? I'm getting a bunch of different pages. Some of these are published, some of them are not. Maybe we just wanna see only the published pages, right? So that's where our filter comes back in. And here, let's add a comma there. And now let's do a filter where the status, and we've got a couple of operators here. There's actually a lot of operators. You can find these on the documentation. And we want the status to be equal to published. Great. We can run that again. And now I shouldn't see, like, a test with new default because I'm seeing that over there. Great. Okay. I don't see that one in the list, But let's say I wanted to actually limit the number of results that I see, I could do something like this where I just add a limit parameter and we'll pass that too. And now I should only get back to pages. Right? So I see my home page. I'm getting the manifesto page here. And I can see the blocks. This is an ID. We'll go about fetching that in a moment. Now what if we have a more complex filter where we need to stack different conditions together? So for that, you have the and and or operators. So I could do something like this. And instead of an object, this is gonna be an array. So I'm gonna pass an array of objects like status is equal to published. Can I do formatting on this? I don't have Prettier or ESLint setup on this project. But So I want the status is equal to published and maybe the permalink let's just get the home page, right? So I'm gonna do equal to not home but slash because I can see that right here, this permalink. Great. And even though I've got a limit of 2, I should only get one back. Permalink is equal to, did I save that, or status is equal to publish. Oh, that's an or filter. So we want both of these conditions. Right? Let's do that. So we want to match both of those conditions. And now the only item I get back in my array of data is the home page. Great. So that's how we can stack filters together. Let's take this a step further and for our blocks, we want to get the content within those blocks. And, you can expand the relationships within a single API call within Directus which is again is super nice as well. So we'll do blocks, let's add, this is actually gonna be an object so we'll do blocks. We'll give it an array of fields that we want to give for the block. Let's get the block ID, maybe we want to get the collection for that block, This is set up using our many to any builder relationship and we'll do item dot star. So the star or asterisk is a wild card. That should return all the fields or all the root level fields for the item within the block. So let's run this and actually see what we get out of it. And now you can see I'm actually getting the data for my blocks. So I can see, you know, this is columns, we've got a title, we've got a headline, we've got the actual rows. So I could even drill further into those relationships via a single API call if I wanted. Now there's one other field that I want to pull within this and we'll do hide block. And do we have hide block? Okay. So now I've I've got this hide block on here. You know, within the page builder, maybe I wanna hide one of these individual blocks so that it doesn't show on a page. I can query that on my front end so that, you know, hey, we we don't have to remove this, maybe we want to show it at a later date, but I wanna hide this specific block and not render that when I consume that API on my front end. So how would I do something like that? This is a setup on the relational field, right? So at the top level here we can filter based on the pages, but there is a special parameter that you can use to filter the relational data in a single API call. So you'll see how powerful this is in just a moment. We'll go in and we'll do deep parameter. And we're going to look at our blocks. And now it's like we've got a whole another query within this, right? So I'm just going to preface this with a underscore or an underscore and we're gonna do a filter and now we are filtering on the block level. So the related blocks we wanna do hide block is equal to not equal to true. Alright so let's see what that returns. And I'm just gonna clear out my console here and I shouldn't see the first item as a quote because I have removed that or filtered it out. Forgot my comma at the end there. So we'll clear one more time, call this out. If I zoom back up to the top of this, you could see the first block in my array here is the form section. Right now if I go in and I just hide a lot of these blocks, right? I've hidden the first three blocks, the first section that I see in my API call should be this FAQ one. Let's clear this again. Just to make it easier we'll do node dot JS and, oh, I forgot to save the actual item over here. Let's try that one more time. Node. Js index dot JS, there we go. And now the first block that we see is the FAQ section. Right? If I wanted to see all the blocks that we hid, I could just change that to not equal to false or I could set it to equal to true, either way. But now I can see here's all the blocks that we hid within that specific page. So I hope this has been a great tutorial on just the sorts of things you could do with the, global parameters when you're calling the API. Stay tuned for more episodes of Short Hops. That's it. We'll see you.","\u003Cp>Join host Bryant Gillespie in this in-depth episode of Short Hops as he tackles a challenging topic for Directus newcomers: setting up queries via the REST API. Bryant walks you through complex querying techniques using the Directus SDK, demonstrating how to efficiently interact with your Directus instance.\u003C/p>\n\u003Cp>In this episode, you'll learn:\u003C/p>\n\u003Cul>\n\u003Cli>How to set up a basic Node.js project with the Directus SDK\u003C/li>\n\u003Cli>Querying specific fields and limiting results\u003C/li>\n\u003Cli>Implementing filters for published content\u003C/li>\n\u003Cli>Using complex filters with AND/OR operators\u003C/li>\n\u003Cli>Expanding relationships within a single API call\u003C/li>\n\u003Cli>Filtering relational data using the deep parameter\u003C/li>\n\u003Cli>Practical examples of querying and filtering page builder blocks\u003C/li>\n\u003C/ul>\n\u003Cp>Whether you're new to Directus or looking to level up your API skills, this episode provides valuable insights into crafting powerful queries. Discover how to efficiently retrieve and filter your data, work with relational fields, and optimize your API calls for better performance.\u003C/p>","5c71b202-e026-4251-856d-20466be7a17e",[362],"20ccfe78-9e3e-449c-81ea-324f7e3b22de",[],{"id":133,"number":134,"show":122,"year":135,"episodes":365},[137,138,139,140,141,142,143,144],{"reps":367},[368,424],{"name":369,"sdr":8,"link":370,"countries":371,"states":373},"John Daniels","https://meet.directus.io/meetings/john2144/john-contact-form-meeting",[372],"United States",[374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423],"Michigan","Indiana","Ohio","West Virginia","Kentucky","Virginia","Tennessee","North Carolina","South Carolina","Georgia","Florida","Alabama","Mississippi","New York","MI","IN","OH","WV","KY","VA","TN","NC","SC","GA","FL","AL","MS","NY","Connecticut","CT","Delaware","DE","Maine","ME","Maryland","MD","Massachusetts","MA","New Hampshire","NH","New Jersey","NJ","Pennsylvania","PA","Rhode Island","RI","Vermont","VT","Washington DC","DC",{"name":425,"link":426,"countries":427},"Michelle Riber","https://meetings.hubspot.com/mriber",[428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,405,616,617],"Albania","ALB","Algeria","DZA","Andorra","AND","Angola","AGO","Austria","AUT","Belgium","BEL","Benin","BEN","Bosnia and Herzegovina","BIH","Botswana","BWA","Bulgaria","BGR","Burkina Faso","BFA","Burundi","BDI","Cameroon","CMR","Cape Verde","CPV","Central African Republic","CAF","Chad","TCD","Comoros","COM","Côte d'Ivoire","CIV","Croatia","HRV","Czech Republic","CZE","Democratic Republic of Congo","COD","Denmark","DNK","Djibouti","DJI","Egypt","EGY","Equatorial Guinea","GNQ","Eritrea","ERI","Estonia","EST","Eswatini","SWZ","Ethiopia","ETH","Finland","FIN","France","FRA","Gabon","GAB","Gambia","GMB","Ghana","GHA","Greece","GRC","Guinea","GIN","Guinea-Bissau","GNB","Hungary","HUN","Iceland","ISL","Ireland","IRL","Italy","ITA","Kenya","KEN","Latvia","LVA","Lesotho","LSO","Liberia","LBR","Libya","LBY","Liechtenstein","LIE","Lithuania","LTU","Luxembourg","LUX","Madagascar","MDG","Malawi","MWI","Mali","MLI","Malta","MLT","Mauritania","MRT","Mauritius","MUS","Moldova","MDA","Monaco","MCO","Montenegro","MNE","Morocco","MAR","Mozambique","MOZ","Namibia","NAM","Niger","NER","Nigeria","NGA","North Macedonia","MKD","Norway","NOR","Poland","POL","Portugal","PRT","Republic of Congo","COG","Romania","ROU","Rwanda","RWA","San Marino","SMR","São Tomé and Príncipe","STP","Senegal","SEN","Serbia","SRB","Seychelles","SYC","Sierra Leone","SLE","Slovakia","SVK","Slovenia","SVN","Somalia","SOM","South Africa","ZAF","South Sudan","SSD","Spain","ESP","Sudan","SDN","Sweden","SWE","Tanzania","TZA","Togo","TGO","Tunisia","TUN","Uganda","UGA","United Kingdom","GBR","Vatican City","VAT","Zambia","ZMB","Zimbabwe","ZWE","UK","Germany","Netherlands","Switzerland","CH","NL",1773850417694]