summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard
diff options
context:
space:
mode:
authorralph isenmann2021-03-11 08:22:36 +0100
committerManuel Bentele2021-03-11 10:05:59 +0100
commitd85ee0495619121d263d722fb5546237696f0e3c (patch)
tree15377400cd7de16763b6816d86b585236da079c6 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard
parent[client] Disable VM configuration for Docker containers (diff)
downloadtutor-module-d85ee0495619121d263d722fb5546237696f0e3c.tar.gz
tutor-module-d85ee0495619121d263d722fb5546237696f0e3c.tar.xz
tutor-module-d85ee0495619121d263d722fb5546237696f0e3c.zip
[client] Fix switch between container and vm in lecture
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java27
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureImageListPage.java7
2 files changed, 23 insertions, 11 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java
index 86ae6dad..018c0206 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java
@@ -1,9 +1,5 @@
package org.openslx.dozmod.gui.wizard;
-import java.awt.Window;
-
-import javax.swing.JOptionPane;
-
import org.apache.log4j.Logger;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
import org.openslx.bwlp.thrift.iface.LectureWrite;
@@ -13,16 +9,16 @@ import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.LectureListWindow;
-import org.openslx.dozmod.gui.wizard.page.LectureCreationPage;
-import org.openslx.dozmod.gui.wizard.page.LectureCustomPermissionPage;
-import org.openslx.dozmod.gui.wizard.page.LectureImageListPage;
-import org.openslx.dozmod.gui.wizard.page.LectureLocationSelectionPage;
-import org.openslx.dozmod.gui.wizard.page.LectureOptionsPage;
+import org.openslx.dozmod.gui.wizard.page.*;
import org.openslx.dozmod.state.LectureWizardState;
import org.openslx.dozmod.thrift.Session;
import org.openslx.dozmod.thrift.ThriftActions;
import org.openslx.dozmod.thrift.cache.LectureCache;
import org.openslx.dozmod.thrift.cache.MetaDataCache;
+import org.openslx.dozmod.util.ContainerUtils;
+
+import javax.swing.*;
+import java.awt.*;
public class LectureWizard extends Wizard implements UiFeedback {
@@ -37,7 +33,7 @@ public class LectureWizard extends Wizard implements UiFeedback {
/**
* Wizard for creating or editing a lecture.
- *
+ *
* @param parent window of this wizard
* @param image ImageSummaryRead of the image to link this lecture to,
* if this is null it will add the LectureImageListPage to
@@ -64,6 +60,17 @@ public class LectureWizard extends Wizard implements UiFeedback {
}
}
+ @Override public void setVisible(boolean b) {
+ if (state.image != null && state.imageVersionId != null) {
+ if (ContainerUtils.isContainerImageLinked(state.image)) {
+ dispose();
+ super.setVisible(false);
+ return;
+ }
+ }
+ super.setVisible(true);
+ }
+
@Override
public String getWindowTitle() {
return I18n.WIZARD.getString("Lecture.Wizard.title");
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 3b4935cb..1c35df7b 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
@@ -15,6 +15,7 @@ import org.openslx.dozmod.gui.wizard.layout.LectureImageListPageLayout;
import org.openslx.dozmod.permissions.ImagePerms;
import org.openslx.dozmod.state.LectureWizardState;
import org.openslx.dozmod.thrift.cache.ImageCache;
+import org.openslx.dozmod.util.ContainerUtils;
import org.openslx.util.QuickTimer;
import org.openslx.util.QuickTimer.Task;
@@ -90,7 +91,11 @@ public class LectureImageListPage extends LectureImageListPageLayout {
private boolean isPageValid() {
ImageSummaryRead selected = imageTable.getSelectedItem();
- if (selected != null && selected.isValid && ImagePerms.canLink(selected)) {
+ if (ContainerUtils.isContainerImageLinked(selected)) {
+ setErrorMessage(I18n.PAGE.getString("LectureImageList.WizardPage.errorMessage.containerLinkedWithLecture"));
+ return false;
+ }
+ else if (selected != null && selected.isValid && ImagePerms.canLink(selected)) {
state.image = selected;
state.imageVersionId = selected.getLatestVersionId();
setDescription(I18n.PAGE.getString("LectureImageList.WizardPage.description"));