w
Right another question: Conditions are they only used on certain package extension types or can they be used by all types as part of their manifest ?
j
Conditions are evaluated to know if the extension should load. In theory it is supported on all extensions. They will simply not load unless the conditions are right.
You could also build in your own checks in the main element being loaded
If you use conditions, your javascript file won't even be requested before the conditions are true
w
OK just the manifests I have currently don't seem to have conditions. Is it only dashboards right now ?
Yeh I just wanted to play around with them and I was gonna just code a super simple one after I see how the existing ones worked and on what manifest types
j
entity actions are a good example for conditions, where you'd like them only to be visible if you have user permissions to see them for example
w
Now wondering why I can't see conditions for my entity action manifest in Typescript 🤔 One for later on when not jugglign 'real' work
Nope still don't show for me... (see screenshot for completions I have) What am I doing wrong @Jacob Overgaard or @Niels Lyngsø ? https://cdn.discordapp.com/attachments/1219583246061535325/1219713592782487623/image.png?ex=660c4dcd&is=65f9d8cd&hm=60fd9426a55e1559b77e925f2a8792a1f0d9ad6ecc1c1393579786aa483f3186&
Never mind, I am just bloody blind 🙈
I need to go back to bed !!
n
Sleep well 😛
To be technically correct, then actually not everything supports conditions. But most things — It depends on the way its implemented/begin used. So we actively indicate the support via types. Entity Actions is one, as you can see in your screenshot above, when you have slept.. 😛 We can implement it for everything, so its also a question of seeing the need for it. 🙂
w
Yeh makes sense thats it not on every tiny little thing, ie localization thats conditional or a modal thats not registered via a condition.
Are you able to tell me what manifests support it currently, without me having to do a game of trial and error and/or source code diving please
Also the conditions that you ship currently is it just know the magic string they are, or is there a type/token/const for them I can use ?
Friendly bump ⬆️ @Jacob Overgaard
j
no consts yet
w
OK looking up stuff it is 🙂
Right giving conditions a go and TypeScript compiler yelling at me. It's complaining about the
match
property in the JSON for the `Umb.Condition.SectionAlias`condition Error
Object literal may only specify known properties, and 'match' does not exist in type 'UmbConditionConfigBase<string>'.
Am I missing an import or something ?!
Copy code
ts
import { UMB_DOCUMENT_ENTITY_TYPE } from "@umbraco-cms/backoffice/document";
import { ManifestEntityAction } from "@umbraco-cms/backoffice/extension-registry";
import { ExaminePeekEntityAction } from "./examinepeek.entityaction.ts";

const entityAction: ManifestEntityAction = {
    type: 'entityAction',
    kind: 'default',
    alias: 'examinepeek.entity.action',
    name: 'Examine Peek Entity Action',
    weight: 400,
    api: ExaminePeekEntityAction,
    meta: {
        icon: 'icon-sensor',
        label: 'Examine Peek',
    },
    forEntityTypes: [ UMB_DOCUMENT_ENTITY_TYPE ],
    conditions: [{
        alias: "Umb.Condition.SectionAlias",
        match: "Umb.Section.Content"
    }]
}
export const manifests = [entityAction];
https://cdn.discordapp.com/attachments/1219583246061535325/1220870458367541361/image.png?ex=66108337&is=65fe0e37&hm=43482070eaca073f3ec49abb8109f57dcc47eced499b54d19a44a35f3048ed64&
j
not sure what's going on with typescript there, but does it make sense to use a condition for you entity action here? you are already saying it should only work on document entity types, so shouldn't matter which section it's shown in
w
I want to use/experiment with conditions. Yes probably don’t need one but just wanted to use them. Will try on a dashboard
Not sure what the difference is between the EntityActionManifest conditions property and the DashboardManifest as this has lit up with lots more completion in VSCode https://cdn.discordapp.com/attachments/1219583246061535325/1221066805024657519/image.png?ex=66113a14&is=65fec514&hm=8a9f32cbaacaa35e5efbd726733dee175b3179126637dcf7216c3cf5726268a7&
j
that shows all the standard conditions
not all will apply to a dashboard
w
OK I really need to just play and experiment I think
10 Views