Fix rendering new attributes, so that they dont render as dynamic. Fix adding new objectClasses to entries, need langtag to render the component
All checks were successful
Create Docker Image / Test Application (x86_64) (push) Successful in 28s
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 1m28s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 4m47s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s

This commit is contained in:
Deon George 2025-04-08 22:04:48 +10:00
parent 2abc321eca
commit a7be4e00b4
6 changed files with 14 additions and 9 deletions

View File

@ -6,6 +6,7 @@ use Illuminate\Contracts\View\View;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use App\Classes\LDAP\Attribute; use App\Classes\LDAP\Attribute;
use App\Ldap\Entry;
/** /**
* Represents an ObjectClass Attribute * Represents an ObjectClass Attribute
@ -74,6 +75,7 @@ final class ObjectClass extends Attribute
return view('components.attribute.objectclass') return view('components.attribute.objectclass')
->with('o',$this) ->with('o',$this)
->with('edit',$edit) ->with('edit',$edit)
->with('langtag',Entry::TAG_NOTAG)
->with('old',$old) ->with('old',$old)
->with('new',$new); ->with('new',$new);
} }

View File

@ -97,7 +97,6 @@ class APIController extends Controller
/** /**
* Return the required and additional attributes for an object class * Return the required and additional attributes for an object class
* *
* @param Request $request
* @param string $objectclass * @param string $objectclass
* @return array * @return array
*/ */

View File

@ -93,11 +93,11 @@ class HomeController extends Controller
return $request->noheader return $request->noheader
? view(sprintf('components.attribute.widget.%s',$id)) ? view(sprintf('components.attribute.widget.%s',$id))
->with('o',Factory::create($dn,$id,[],$request->objectclasses)) ->with('o',Factory::create(dn: $dn,attribute: $id,values: [],oc: $request->objectclasses))
->with('value',$request->value) ->with('value',$request->value)
->with('langtag',Entry::TAG_NOTAG) ->with('langtag',Entry::TAG_NOTAG)
->with('loop',$xx) ->with('loop',$xx)
: new AttributeType(Factory::create($dn,$id,[],$request->objectclasses),TRUE) : new AttributeType(Factory::create($dn,$id,[],$request->objectclasses),new: TRUE,edit: TRUE)
->render(); ->render();
} }

View File

@ -2,6 +2,8 @@
namespace App\View\Components; namespace App\View\Components;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component; use Illuminate\View\Component;
use App\Classes\LDAP\Attribute as LDAPAttribute; use App\Classes\LDAP\Attribute as LDAPAttribute;
@ -32,13 +34,13 @@ class Attribute extends Component
/** /**
* Get the view / contents that represent the component. * Get the view / contents that represent the component.
* *
* @return \Illuminate\Contracts\View\View|\Closure|string * @return View|string
*/ */
public function render() public function render(): View|string
{ {
return $this->o return $this->o
? $this->o ? $this->o
->render($this->edit,$this->old,$this->new) ->render(edit: $this->edit,old: $this->old,new: $this->new)
: $this->na; : $this->na;
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\View\Components; namespace App\View\Components;
use Closure;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;
use Illuminate\View\Component; use Illuminate\View\Component;
@ -30,7 +29,7 @@ class AttributeType extends Component
/** /**
* Get the view / contents that represent the component. * Get the view / contents that represent the component.
*/ */
public function render(): View|Closure|string public function render(): View
{ {
return view('components.attribute-type') return view('components.attribute-type')
->with('o',$this->o) ->with('o',$this->o)

View File

@ -46,6 +46,9 @@
if (added_oc.indexOf(item) !== -1) if (added_oc.indexOf(item) !== -1)
return; return;
// Add our new OC to the list of OCs
oc.push(item);
// Add attribute to the page // Add attribute to the page
$.ajax({ $.ajax({
method: 'POST', method: 'POST',