summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java6
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java6
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureImageListPage.java5
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java30
-rw-r--r--dozentenmodul/src/main/properties/i18n/page.properties3
-rw-r--r--dozentenmodul/src/main/properties/i18n/page_de_DE.properties1
-rw-r--r--dozentenmodul/src/main/properties/i18n/page_tr_TR.properties1
7 files changed, 34 insertions, 18 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
index 9434ad25..f3ad5701 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
@@ -316,9 +316,13 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa
if (!hasLatestVersion(image))
return;
if (ContainerUtils.isContainerImageLinked(image)){
- ContainerUtils.showWarning(me,LOGGER);
+ ContainerUtils.showWarning(me, I18n.PAGE.getString("LectureImageList.WizardPage.errorMessage.containerLinkedWithLecture") ,LOGGER);
+ return;
+ } else if (ContainerUtils.isDataContainer(image)) {
+ ContainerUtils.showWarning(me, I18n.PAGE.getString("LectureImageList.WizardPage.errorMessage.imageIsDataContainer") ,LOGGER);
return;
}
+
new LectureWizard(SwingUtilities.getWindowAncestor(this), image, image.getLatestVersionId()).setVisible(true);
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
index 1bf231f2..57acf57d 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
@@ -199,9 +199,13 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
if (newImage == null)
return;
if (ContainerUtils.isContainerImageLinked(newImage)) {
- ContainerUtils.showWarning(me, LOGGER);
+ ContainerUtils.showWarning(me, I18n.PAGE.getString("LectureImageList.WizardPage.errorMessage.containerLinkedWithLecture") ,LOGGER);
+ return;
+ } else if (ContainerUtils.isDataContainer(newImage)) {
+ ContainerUtils.showWarning(me, I18n.PAGE.getString("LectureImageList.WizardPage.errorMessage.imageIsDataContainer") ,LOGGER);
return;
}
+
final ImageMetaCallback callback = new ImageMetaCallback() {
@Override
public void fetchedImageDetails(ImageDetailsRead imageDetails,
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureImageListPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureImageListPage.java
index 1c35df7b..b00bfbd7 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureImageListPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureImageListPage.java
@@ -95,6 +95,11 @@ public class LectureImageListPage extends LectureImageListPageLayout {
setErrorMessage(I18n.PAGE.getString("LectureImageList.WizardPage.errorMessage.containerLinkedWithLecture"));
return false;
}
+ else if (ContainerUtils.isDataContainer(selected)) {
+ setErrorMessage(I18n.PAGE.getString("LectureImageList.WizardPage.errorMessage.imageIsDataContainer"));
+ return false;
+ }
+
else if (selected != null && selected.isValid && ImagePerms.canLink(selected)) {
state.image = selected;
state.imageVersionId = selected.getLatestVersionId();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java
index 54400439..d6836c8d 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java
@@ -60,32 +60,32 @@ public class ContainerUtils {
return false;
}
+ public static boolean isDataContainer(ImageSummaryRead image) {
+
+ ContainerDefinition containerDefinition = getContainerDefinition(Session.getSatelliteToken(), image.getLatestVersionId());
+ if (containerDefinition.getContainerMeta().getImageType() == ContainerMeta.ContainerImageType.DATA) {
+ return true;
+ }
+ return false;
+ }
+
public static List<ImageSummaryRead> getDataContainerImages() {
String satelliteToken = Session.getSatelliteToken();
List<ImageSummaryRead> images = ImageCache.get(true);
List<ImageSummaryRead> dataContainerImages = new ArrayList<>();
for (ImageSummaryRead image : images) {
if (image.getVirtId().equals(TConst.VIRT_DOCKER)) {
- try {
- byte[] rawVirtConfig;
- ByteBuffer byteBuffer = ThriftManager.getSatClient().getImageVersionVirtConfig(satelliteToken,
- image.getLatestVersionId());
- rawVirtConfig = ThriftUtil.unwrapByteBuffer(byteBuffer);
- ContainerDefinition containerDefinition = ContainerDefinition.fromByteArray(rawVirtConfig);
- if (containerDefinition.getContainerMeta().getImageType() == ContainerMeta.ContainerImageType.DATA)
- dataContainerImages.add(image);
-
- } catch (TException e) {
- // LOGGER.error("Failed to retrieve virtualizer config for image version " + "'"
- // + image.getLatestVersionId() + ", see trace: ", e);
- }
+
+ ContainerDefinition containerDefinition = getContainerDefinition(satelliteToken, image.getLatestVersionId());
+ if (containerDefinition.getContainerMeta().getImageType() == ContainerMeta.ContainerImageType.DATA)
+ dataContainerImages.add(image);
}
}
return dataContainerImages;
}
- public static void showWarning(Component c, Logger logger) {
- Gui.showMessageBox(c, I18n.WINDOW.getString("LectureDetails.Message.error.containerLinkedWithLecture"),
+ public static void showWarning(Component c, String message, Logger logger) {
+ Gui.showMessageBox(c, message,
MessageType.WARNING, logger, null);
}
diff --git a/dozentenmodul/src/main/properties/i18n/page.properties b/dozentenmodul/src/main/properties/i18n/page.properties
index 1c096ad5..430af273 100644
--- a/dozentenmodul/src/main/properties/i18n/page.properties
+++ b/dozentenmodul/src/main/properties/i18n/page.properties
@@ -107,8 +107,9 @@ LectureCreation.WizardPage.description.1=Click on ''Next'' to set permissions \
# LectureImageListPage
LectureImageList.WizardPage.description=Click on ''Next''
-LectureImageList.WizardPage.errorMessage.containerLinkedWithLecture=This image is already linked with a lecture. \
+LectureImageList.WizardPage.errorMessage.containerLinkedWithLecture=This Image is already linked with a lecture. \
Please create a new image.
+LectureImageList.WizardPage.errorMessage.imageIsDataContainer=This Image is a Data Container and can not linked with a Lecture.
LectureImageList.WizardPage.errorMessage.noPerms=Insufficient permissions to link to this VM.
LectureImageList.WizardPage.errorMessage.invalidVM=Invalid VM selected
diff --git a/dozentenmodul/src/main/properties/i18n/page_de_DE.properties b/dozentenmodul/src/main/properties/i18n/page_de_DE.properties
index 8a7efd04..350d2e1f 100644
--- a/dozentenmodul/src/main/properties/i18n/page_de_DE.properties
+++ b/dozentenmodul/src/main/properties/i18n/page_de_DE.properties
@@ -106,6 +106,7 @@ LectureCreation.WizardPage.description.1=Klicken Sie auf ''Weiter'', um Berechti
LectureImageList.WizardPage.description=Klicken Sie auf ''Weiter''
LectureImageList.WizardPage.errorMessage.containerLinkedWithLecture=Dieses Image ist bereits mit einer Veranstaltung \
verlinkt. Bitte erstellen Sie ein neues Image.
+LectureImageList.WizardPage.errorMessage.imageIsDataContainer=Dieses Image ist ein Datencontainer und kann nicht mit einer Veranstaltung verknüpft werden.
LectureImageList.WizardPage.errorMessage.noPerms=Unzureichende Berechtigungen, um auf diese VM zu verlinken.
LectureImageList.WizardPage.errorMessage.invalidVM=Ungültige VM ausgewählt
diff --git a/dozentenmodul/src/main/properties/i18n/page_tr_TR.properties b/dozentenmodul/src/main/properties/i18n/page_tr_TR.properties
index 678bd5f4..d0f9b49b 100644
--- a/dozentenmodul/src/main/properties/i18n/page_tr_TR.properties
+++ b/dozentenmodul/src/main/properties/i18n/page_tr_TR.properties
@@ -97,6 +97,7 @@ LectureCreation.WizardPage.description.1=Erişim izinlerini ayarlamak için ''İ
# LectureImageListPage
LectureImageList.WizardPage.description=''İleri'' butonuna tıklayın
LectureImageList.WizardPage.errorMessage.containerLinkedWithLecture=
+LectureImageList.WizardPage.errorMessage.imageIsDataContainer=
LectureImageList.WizardPage.errorMessage.noPerms=Bu sanal makineye bağlantı eklemek için yeterli erişim izni yok.
LectureImageList.WizardPage.errorMessage.invalidVM=Geçersiz sanal makine seçildi