summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java77
1 files changed, 46 insertions, 31 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java
index 0bea8587..266351cf 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java
@@ -115,40 +115,43 @@ public class ContainerPanel extends JPanel {
image.getLatestVersionId());
rawVirtConfig = ThriftUtil.unwrapByteBuffer(byteBuffer);
containerDefinition = ContainerDefinition.fromByteArray(rawVirtConfig);
- } catch (TException e) {
- LOGGER.error("Failed to retrieve virtualizer config for image version " + "'" + image.getLatestVersionId()
- + ", see trace: ", e);
- }
- txtContainerImageName.setText(image.imageName);
- txtContainerImageName.setEnabled(false);
- // TODO simplify this mess. ContainerBuildContextMethod is to complex or useless
- switch (containerDefinition.getContainerImageContext()) {
- case DOCKERFILE:
- txtContainerRecipe.setText(containerDefinition.getContainerRecipe());
- break;
- case IMAGE_REPOSITORY:
- txtContainerRecipe.setText(containerDefinition.getContainerMeta().getImageRepo());
- break;
- case GIT_REPOSITORY:
- txtContainerRecipe.setText(containerDefinition.getContainerMeta().getBuildContextUrl());
- break;
- case DOCKER_ARCHIVE:
- txtContainerRecipe.setText(containerDefinition.getContainerMeta().getImageName());
- break;
- default:
- LOGGER.error("Unknown Build Context");
- break;
- }
+ txtContainerImageName.setText(image.imageName);
+ txtContainerImageName.setEnabled(false);
+ // TODO simplify this mess. ContainerBuildContextMethod is to complex or useless
+ switch (containerDefinition.getContainerImageContext()) {
+ case DOCKERFILE:
+ txtContainerRecipe.setText(containerDefinition.getContainerRecipe());
+ break;
+ case IMAGE_REPOSITORY:
+ txtContainerRecipe.setText(containerDefinition.getContainerMeta().getImageRepo());
+ break;
+ case GIT_REPOSITORY:
+ txtContainerRecipe.setText(containerDefinition.getContainerMeta().getBuildContextUrl());
+ break;
+ case DOCKER_ARCHIVE:
+ txtContainerRecipe.setText(containerDefinition.getContainerMeta().getImageName());
+ break;
+ default:
+ LOGGER.error("Unknown Build Context");
+ break;
+ }
- cboContainerImageType.setSelectedItem(containerDefinition.getContainerMeta().getImageType());
+ cboContainerImageType.setSelectedItem(containerDefinition.getContainerMeta().getImageType());
- if (context.equals(IMAGE_CONTEXT)) {
- initImageDetails();
- } else if (context.equals(CONTAINER_CONTEXT)) {
- initContainerDetails();
- } else {
- LOGGER.error("Container Panel init failed: Please use proper context");
+ if (context.equals(IMAGE_CONTEXT)) {
+ initImageDetails();
+ } else if (context.equals(CONTAINER_CONTEXT)) {
+ initContainerDetails();
+ } else {
+ LOGGER.error("Container Panel init failed: Please use proper context");
+ }
+
+
+ } catch (TException e) {
+ LOGGER.error("Failed to retrieve virtualizer config for image version " + "'" + image.getLatestVersionId()
+ + ", see trace: ", e);
+ disableAll();
}
}
@@ -253,4 +256,16 @@ public class ContainerPanel extends JPanel {
cbo.setSelectedItem(ContainerMeta.ContainerImageType.LECTURE);
return cbo;
}
+
+ public void disableAll() {
+
+ for (Component component : pnlContainerMeta.getComponents()) {
+ component.setEnabled(false);
+ }
+
+ txtContainerRecipe.setEnabled(false);
+ pnlContainerMeta.setEnabled(false);
+ cboContainerImageType.setEnabled(false);
+ txtContainerImageName.setEnabled(false);
+ }
}