mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 02:38:50 +02:00
Added admin page for devices
This commit is contained in:
parent
c11d78e52f
commit
df0a8254bf
5 changed files with 139 additions and 9 deletions
|
@ -31,6 +31,7 @@ namespace App\Services;
|
|||
|
||||
use App\Entity\AttachmentType;
|
||||
use App\Entity\Category;
|
||||
use App\Entity\Device;
|
||||
use App\Entity\NamedDBElement;
|
||||
use App\Entity\Part;
|
||||
use App\Exceptions\EntityNotSupported;
|
||||
|
@ -110,12 +111,16 @@ class EntityURLGenerator
|
|||
return $this->urlGenerator->generate('part_edit', ['id' => $entity->getID()]);
|
||||
}
|
||||
|
||||
if($entity instanceof AttachmentType) {
|
||||
if ($entity instanceof AttachmentType) {
|
||||
return $this->urlGenerator->generate('attachment_type_edit', ['id' => $entity->getID()]);
|
||||
}
|
||||
|
||||
if($entity instanceof Category) {
|
||||
return $this->urlGenerator->generate("category_edit", ['id' => $entity->getID()]);
|
||||
if ($entity instanceof Category) {
|
||||
return $this->urlGenerator->generate("category_edit", ['id' => $entity->getID()]);
|
||||
}
|
||||
|
||||
if ($entity instanceof Device) {
|
||||
return $this->urlGenerator->generate("device_edit", ['id' => $entity->getID()]);
|
||||
}
|
||||
|
||||
//Otherwise throw an error
|
||||
|
@ -135,14 +140,18 @@ class EntityURLGenerator
|
|||
return $this->urlGenerator->generate('part_new');
|
||||
}
|
||||
|
||||
if($entity instanceof AttachmentType) {
|
||||
if ($entity instanceof AttachmentType) {
|
||||
return $this->urlGenerator->generate('attachment_type_new');
|
||||
}
|
||||
|
||||
if($entity instanceof Category) {
|
||||
if ($entity instanceof Category) {
|
||||
return $this->urlGenerator->generate('category_new');
|
||||
}
|
||||
|
||||
if ($entity instanceof Device) {
|
||||
return $this->urlGenerator->generate('device_new');
|
||||
}
|
||||
|
||||
throw new EntityNotSupported('The given entity is not supported yet!');
|
||||
}
|
||||
|
||||
|
@ -181,14 +190,18 @@ class EntityURLGenerator
|
|||
|
||||
public function deleteURL($entity) : string
|
||||
{
|
||||
if($entity instanceof AttachmentType) {
|
||||
if ($entity instanceof AttachmentType) {
|
||||
return $this->urlGenerator->generate('attachment_type_delete', ['id' => $entity->getID()]);
|
||||
}
|
||||
|
||||
if($entity instanceof Category) {
|
||||
if ($entity instanceof Category) {
|
||||
return $this->urlGenerator->generate('category_delete', ['id' => $entity->getID()]);
|
||||
}
|
||||
|
||||
if ($entity instanceof Device) {
|
||||
return $this->urlGenerator->generate('device_delete', ['id' => $entity->getID()]);
|
||||
}
|
||||
|
||||
throw new EntityNotSupported('The given entity is not supported yet!');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue