Image improvements. Added name
testing/ogcore-api/pipeline/head This commit looks good
Details
testing/ogcore-api/pipeline/head This commit looks good
Details
parent
9a96b04e7f
commit
290cbb0ae0
|
@ -60,6 +60,7 @@ class CreateImageAction extends AbstractController
|
|||
$latestImageRepo = $this->entityManager->getRepository(ImageImageRepository::class)->findLatestVersionByImageAndRepository($image, $repository);
|
||||
|
||||
$imageImageRepository = new ImageImageRepository();
|
||||
$imageImageRepository->setName($image->getName().'_v'.($latestImageRepo ? $latestImageRepo->getVersion() + 1 : 1));
|
||||
$imageImageRepository->setImage($image);
|
||||
$imageImageRepository->setRepository($repository);
|
||||
$imageImageRepository->setStatus(ImageStatus::IN_PROGRESS);
|
||||
|
|
|
@ -53,12 +53,13 @@ class ConvertAction extends AbstractOgRepositoryController
|
|||
}
|
||||
|
||||
$imageImageRepositoryEntity = new ImageImageRepository();
|
||||
$imageImageRepositoryEntity->setName($imageEntity->getName().'_v'.$imageImageRepositoryEntity->getVersion() + 1);
|
||||
$imageImageRepositoryEntity->setStatus(ImageStatus::PENDING);
|
||||
$imageImageRepositoryEntity->setImage($imageEntity);
|
||||
$imageImageRepositoryEntity->setRepository($repository);
|
||||
$imageImageRepositoryEntity->setVersion(1);
|
||||
|
||||
$this->entityManager->persist($imageImageRepositoryEntity);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->logger->info('Converting image', ['image' => $image]);
|
||||
|
||||
|
@ -74,6 +75,7 @@ class ConvertAction extends AbstractOgRepositoryController
|
|||
if (isset($content['error']) && $content['code'] === Response::HTTP_INTERNAL_SERVER_ERROR ) {
|
||||
throw new ValidatorException('Error converting image');
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
|
||||
$inputData = [
|
||||
'imageName' => $image,
|
||||
|
|
|
@ -39,18 +39,18 @@ class CreateAuxFilesAction extends AbstractOgRepositoryController
|
|||
|
||||
$params = [
|
||||
'json' => [
|
||||
'image' => $image->getName().'_v'.$data->getVersion().'.img'
|
||||
'image' => $data->getName().'.img'
|
||||
]
|
||||
];
|
||||
|
||||
$this->logger->info('Creating aux files', ['image' => $image->getName()]);
|
||||
$this->logger->info('Creating aux files', ['image' => $data->getName()]);
|
||||
|
||||
$repository = $data->getRepository();
|
||||
|
||||
$content = $this->createRequest('POST', 'http://'.$repository->getIp().':8006/ogrepository/v1/images/torrentsum', $params);
|
||||
|
||||
$inputData = [
|
||||
'imageName' => $image->getName(),
|
||||
'imageName' => $data->getName(),
|
||||
'imageImageRepositoryUuid' => $data->getUuid(),
|
||||
];
|
||||
|
||||
|
|
|
@ -45,6 +45,13 @@ class DeleteTrashAction extends AbstractOgRepositoryController
|
|||
$this->entityManager->persist($image);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$imageImageCollection = $image->getImageImageRepositories();
|
||||
|
||||
if ($imageImageCollection->isEmpty()) {
|
||||
$this->entityManager->remove($image);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
return new JsonResponse(data: $content, status: Response::HTTP_OK);
|
||||
}
|
||||
}
|
|
@ -51,9 +51,11 @@ class ImportAction extends AbstractOgRepositoryController
|
|||
}
|
||||
|
||||
$imageImageRepositoryEntity = new ImageImageRepository();
|
||||
$imageImageRepositoryEntity->setName($imageEntity->getName().'_v'.$imageImageRepositoryEntity->getVersion() + 1);
|
||||
$imageImageRepositoryEntity->setStatus(ImageStatus::AUX_FILES_PENDING);
|
||||
$imageImageRepositoryEntity->setImage($imageEntity);
|
||||
$imageImageRepositoryEntity->setRepository($repository);
|
||||
$imageImageRepositoryEntity->setVersion(1);
|
||||
|
||||
$this->entityManager->persist($imageImageRepositoryEntity);
|
||||
$this->entityManager->flush();
|
||||
|
@ -74,7 +76,7 @@ class ImportAction extends AbstractOgRepositoryController
|
|||
|
||||
$inputData = [
|
||||
'imageName' => $image,
|
||||
'imageUuid' => $imageImageRepositoryEntity->getUuid(),
|
||||
'imageImageRepositoryUuid' => $imageImageRepositoryEntity->getUuid(),
|
||||
];
|
||||
|
||||
$this->createService->__invoke(null, CommandTypes::CREATE_IMAGE_AUX_FILE, TraceStatus::IN_PROGRESS, $content['job_id'], $inputData);
|
||||
|
|
Loading…
Reference in New Issue