Super Powers Needed in JCB #984
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#984
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Joomla Component Builder (JCB), has super powers. Which is another way of saying it now allows for powers to be pulled in from a global array of areas, over which you have full control. This allows for easy sharing of your powers between your JCB instances with your own power repositories on https://git.vdm.dev/[username]/my-powers. While at the same time be able to use the JCB core powers where needed.
Let's explain:
This feature called super-powers, manages powers by use of layers, events, tasks, methods, switches, and algorithms that all work in combination of different ways to achieve super powers.
The [powers] are:
The [layers] are:
The [events] are:
The [tasks] are:
The [methods] are:
The [switches] are:
The [algorithms] are:
These terminologies and ideas are what you need to remember whenever you read any of the comments and other information about super-powers in JCB.
JCB uses powers as the foundation of all it builds. You can build things with JCB without knowing how to use or work with powers. But JCB cannot build anything without powers. That means JCB needs to load powers from the [layer:core] and usually will do this whenever an [event] is triggered based on the [algorithm:cascading].
All these events can possibly move powers into your [layer:database]. These [events] have the [method:auto] behaviour, and therefore we make use of the [algorithm:cascading] that allows for overriding any power in any way you like. Beware that divergence from the core powers may have side effects and therefore should only be done with knowledge and full understanding on your part.
Let's Explain the [algorithm:cascading]
During [events] we must [auto] load powers, and so there is a search path for each event.
The [event:compile] when building your component, here is the [algorithm:cascading]:
This means, that if JCB gets a [power:guid] in the [layer:database] it stops the search and uses that found power. But if not, it will continue until it finds the power, or it will show an error that the power could not be found. Once it finds the power, it will make sure that the power is in [layer:database], and if [layer:local] is active, it will update those as well as determined by the approved path selection of each power.
The [event:sync] when the sync button is clicked, here is the [algorithm:cascading]:
This means, that if JCB gets a [power:guid] in any of the targeted [layer:own] it stops the search for that power at the first instance it finds that power. Then JCB will update your [layer:database] with the found power, irrespective of modify or creation date. The [power:guid] is used as the key, and should JCB therefore have a power in any of your [layer:own] it will override the [layer:core] and [layer:local] version of any power, and update the [layer:database].
The [event:reset] when the reset button is clicked, will update [layer:database] with [layer:core] version of the selected powers if found in [layer:core], irrespective of modify or creation date.
The [event:init] when the init button is clicked, will initialise [layer:database] with all [layers] powers not found in [layer:database]. Should you have the same power in multiple of the layers, here is the [algorithm:cascading]:
This means, that if JCB gets a [power:guid] in any of the targeted [layer:own] it will not use any of the other [layers] versions. JCB will add this first found power to your [layer:database] unless it's already in [layer:database], in which case it will be ignored. Use [event:sync] or [event:reset] should you like to update [layer:database] existing powers.
How should the format look like of the repository?
Here is my current idea:
What each part will mean:
Okay so the first demonstration of JCB build super powers has happened, you can see it in these two repositories:
I think you will enjoy these two new classes, that is doing all the heavy lifting to make this work:
There is really still so much room for growth, but this will have to do as we now need to move on to the function in JCB that will use these repositories.
I will push out the beta with that builds these repositories in the next few days.
Okay we just finished the gitea API backend:
https://git.vdm.dev/joomla/gitea