summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard
diff options
context:
space:
mode:
authorManuel Bentele2021-05-19 11:46:36 +0200
committerManuel Bentele2021-05-19 11:46:36 +0200
commitaad75f084c9635878a11e701163ad66e034023ba (patch)
treee18aef591ccd4616687ed53e0b407d58014d9785 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard
parent[client,server] Rename 'vm.disk' package to 'virtualization.disk' (diff)
parent[client] Allow user to set a container type for container images (diff)
downloadtutor-module-aad75f084c9635878a11e701163ad66e034023ba.tar.gz
tutor-module-aad75f084c9635878a11e701163ad66e034023ba.tar.xz
tutor-module-aad75f084c9635878a11e701163ad66e034023ba.zip
Merge branch 'feature/docker'
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java27
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java9
2 files changed, 31 insertions, 5 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java
index 5fcc6dcd..0496261f 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java
@@ -24,6 +24,8 @@ public class ContainerUploadPageLayout extends WizardPage {
protected final QLabel lblImageName;
protected final JTextArea txtInfoText;
+ protected final JTextField txtImageRepo;
+
protected final JTabbedPane tpInput;
protected final JTextField txtGitRepo;
@@ -38,8 +40,24 @@ public class ContainerUploadPageLayout extends WizardPage {
setDescription(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.description"));
GridManager grid = new GridManager(this, 3, false);
+ JPanel imageRepoPanel = new JPanel();
+ imageRepoPanel.setVisible(true);
+ GridManager tmpGrid = new GridManager(imageRepoPanel, 2, true, new Insets(5, 0, 5, 0));
+ QLabel lblImageRepo = new QLabel(
+ I18n.PAGE_LAYOUT.getString("ContainerUploadPage.DockerFile.label"));
+ lblImageRepo.setToolTipText(
+ I18n.PAGE_LAYOUT.getString("ContainerUploadPage.ImageRepository.ToolTipText"));
+ txtImageRepo = new JTextField();
+ txtImageRepo.setEditable(true);
+ txtImageRepo.setToolTipText(
+ I18n.PAGE_LAYOUT.getString("ContainerUploadPage.ImageRepository.ToolTipText"));
+ tmpGrid.add(lblImageRepo);
+ tmpGrid.add(txtImageRepo).fill(true, false).expand(true, false);
+ tmpGrid.finish(false);
+
+
JPanel p1 = new JPanel();
- p1.setVisible(true);
+ p1.setVisible(false);
GridManager g1 = new GridManager(p1, 3, true, new Insets(5, 0, 5, 0));
QLabel imageFileCaption = new QLabel(
I18n.PAGE_LAYOUT.getString("ContainerUploadPage.DockerFile.label"));
@@ -68,13 +86,12 @@ public class ContainerUploadPageLayout extends WizardPage {
tpInput = new JTabbedPane();
tpInput.addTab("Dockerfile", p1);
tpInput.addTab("Git Repository", p2);
- tpInput.setSelectedIndex(ContainerBuildContextMethod.FILE.ordinal());
+ tpInput.addTab("Image Repository", imageRepoPanel);
+ // set "Image Repository" as selected
+ tpInput.setSelectedIndex(2);
grid.add(tpInput, 3).fill(true, false);
- // Start as with Dockerfile as input!
- tpInput.setSelectedIndex(0);
-
lblImageName = new QLabel(I18n.PANEL.getString("ContainerPanel.Label.ImageName.text"));
txtImageName = new JTextField();
grid.add(lblImageName);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java
index c2db8554..466b26a0 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java
@@ -233,6 +233,12 @@ public class ContainerUploadPage extends ContainerUploadPageLayout {
ContainerBuildContextMethod method = getBuildContextMethod();
switch (method) {
+ case IMAGE_REPO:
+ if (txtImageRepo.getText() == null || txtImageRepo.getText().isEmpty()) {
+ setWarningMessage(I18n.PAGE.getString("ContainerUploadPage.Warning.NoImageRepo"));
+ return false;
+ }
+ break;
case FILE:
if (txtImageFile.getText() == null || txtImageFile.getText().isEmpty()) {
setWarningMessage(I18n.PAGE.getString("ContainerUploadPage.Warning.NoReceipt"));
@@ -271,6 +277,9 @@ public class ContainerUploadPage extends ContainerUploadPageLayout {
case FILE:
containerDefinition.setContainerRecipe(state.descriptionFile);
break;
+ case IMAGE_REPO:
+ containerMeta.setImageRepo(txtImageRepo.getText());
+ state.descriptionFile = getDummyFile();
case GIT_REPOSITORY:
containerMeta.setBuildContextUrl(txtGitRepo.getText());
state.descriptionFile = getDummyFile();