summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorralph isenmann2021-08-13 15:55:00 +0200
committerralph isenmann2021-08-13 15:59:10 +0200
commit07f20c09c48e350bca1c33c19dba25bb2b536679 (patch)
tree276d0588830eaae99221f95a50abe9f53f0f046d
parent[*] Add "modern" way to set target Java version (diff)
downloadtutor-module-07f20c09c48e350bca1c33c19dba25bb2b536679.tar.gz
tutor-module-07f20c09c48e350bca1c33c19dba25bb2b536679.tar.xz
tutor-module-07f20c09c48e350bca1c33c19dba25bb2b536679.zip
[client] minor fixes to container related part
- fix typos - do not allow empty Dockerfiles - add translations
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ContainerBindMountTable.java10
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java45
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java18
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java4
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/model/ContainerDefinition.java22
-rw-r--r--dozentenmodul/src/main/properties/i18n/configurator.properties6
-rw-r--r--dozentenmodul/src/main/properties/i18n/configurator_de_DE.properties8
-rw-r--r--dozentenmodul/src/main/properties/i18n/page.properties1
-rw-r--r--dozentenmodul/src/main/properties/i18n/page_de_DE.properties1
-rw-r--r--dozentenmodul/src/main/properties/i18n/panel.properties10
-rw-r--r--dozentenmodul/src/main/properties/i18n/panel_de_DE.properties11
-rw-r--r--dozentenmodul/src/main/properties/i18n/panel_tr_TR.properties10
13 files changed, 93 insertions, 60 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ContainerBindMountTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ContainerBindMountTable.java
index b812d9af..81c76303 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ContainerBindMountTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ContainerBindMountTable.java
@@ -1,5 +1,6 @@
package org.openslx.dozmod.gui.control.table;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.virtualization.configuration.container.ContainerBindMount;
import java.util.ArrayList;
@@ -11,9 +12,12 @@ public class ContainerBindMountTable extends ListTable<ContainerBindMount> {
*/
private static final long serialVersionUID = -2908607335582645909L;
- public static final ListTableColumn COL_SOURCE = new ListTableColumn("SOURCE");
- public static final ListTableColumn COL_TARGET = new ListTableColumn("TARGET");
- public static final ListTableColumn COL_OPTIONS = new ListTableColumn("OPTIONS");
+ public static final ListTableColumn COL_SOURCE = new ListTableColumn(
+ I18n.CONFIGURATOR.getString("ContainerBindMount.BindMountTable.col.src"));
+ public static final ListTableColumn COL_TARGET = new ListTableColumn(
+ I18n.CONFIGURATOR.getString("ContainerBindMount.BindMountTable.col.dest"));
+ public static final ListTableColumn COL_OPTIONS = new ListTableColumn(
+ I18n.CONFIGURATOR.getString("ContainerBindMount.BindMountTable.col.opt"));
public ContainerBindMountTable() {
super(COL_SOURCE, COL_TARGET, COL_OPTIONS);
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 b2201239..1cb861ee 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
@@ -30,9 +30,8 @@ public class ContainerPanel extends JPanel {
public static final String IMAGE_CONTEXT = "IMAGE";
public static final String CONTAINER_CONTEXT = "CONTAINER";
- private final Logger LOGGER = Logger.getLogger(ContainerBindMountConfigurator.class);
+ private final Logger LOGGER = Logger.getLogger(ContainerPanel.class);
- // TODO ContainerImageType should be set in MetaData
private final QLabel lblContainerImageType;
private final ComboBox<ContainerMeta.ContainerImageType> cboContainerImageType;
@@ -65,6 +64,8 @@ public class ContainerPanel extends JPanel {
QLabel lblContainerRunCommand = new QLabel(
I18n.PANEL.getString("ContainerPanel.ContainerRunCommand.label"));
+ lblContainerRunCommand.setToolTipText(
+ I18n.PANEL.getString("ContainerPanel.ContainerRunCommand.tooltip"));
txtContainerRunCommand = new JTextField();
grdContainerMeta.add(lblContainerRunCommand);
grdContainerMeta.add(txtContainerRunCommand, 2).fill(true, false).expand(true, false);
@@ -89,20 +90,9 @@ public class ContainerPanel extends JPanel {
scrollableTextArea.setPreferredSize(Gui.getScaledDimension(0, 200));
grdContainer.add(scrollableTextArea, 2).fill(true, true).expand(true, true);
- // TODO copy-paste in ImageMetaDataPageLayout for this ContainerImageType component
- lblContainerImageType = new QLabel("Container Image Type");
- cboContainerImageType = new ComboBox<>(
- new ComboBox.ComboBoxRenderer<ContainerMeta.ContainerImageType>() {
- @Override public String renderItem(ContainerMeta.ContainerImageType item) {
- if (item == null)
- return "null";
- return item.toString(); // shows the provided label
- }
- }, ContainerMeta.ContainerImageType.class);
- for (ContainerMeta.ContainerImageType type : ContainerMeta.ContainerImageType.values()) {
- cboContainerImageType.addItem(type);
- }
- cboContainerImageType.setSelectedItem(ContainerMeta.ContainerImageType.LECTURE);
+ lblContainerImageType = new QLabel(
+ I18n.PANEL.getString("ContainerPanel.Label.ContainerImageType.text"));
+ cboContainerImageType = ContainerPanel.createContainerImageTypeCBO();
grdContainer.add(lblContainerImageType);
grdContainer.add(cboContainerImageType).fill(true, false).expand(true, false);
@@ -236,5 +226,28 @@ public class ContainerPanel extends JPanel {
}
return true;
}
+
+ public static ComboBox<ContainerMeta.ContainerImageType> createContainerImageTypeCBO (){
+ ComboBox<ContainerMeta.ContainerImageType> cbo = new ComboBox<>(
+ new ComboBox.ComboBoxRenderer<ContainerMeta.ContainerImageType>() {
+ @Override public String renderItem(ContainerMeta.ContainerImageType item) {
+ switch (item){
+ case LECTURE:
+ return "Pool";
+ case BATCH:
+ return "Pool/Cluster";
+ case DATA:
+ return "Daten";
+ default:
+ return "";
+ }
+ }
+ }, ContainerMeta.ContainerImageType.class);
+ for (ContainerMeta.ContainerImageType type : ContainerMeta.ContainerImageType.values()) {
+ cbo.addItem(type);
+ }
+ cbo.setSelectedItem(ContainerMeta.ContainerImageType.LECTURE);
+ return cbo;
+ }
}
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 e3c80ea3..b0201e47 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
@@ -83,10 +83,9 @@ public class ContainerUploadPageLayout extends WizardPage {
tpInput = new JTabbedPane();
tpInput.addTab("Dockerfile", p1);
- tpInput.addTab("Git Repository", p2);
- tpInput.addTab("Image Repository", imageRepoPanel);
- // set "Image Repository" as selected
- tpInput.setSelectedIndex(2);
+ tpInput.addTab("Git-Repository", p2);
+ tpInput.addTab("Image-Repository", imageRepoPanel);
+ tpInput.setSelectedIndex(0);
grid.add(tpInput, 3).fill(true, false);
grid.nextRow();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java
index bec7e3dc..14145c75 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java
@@ -7,6 +7,7 @@ import org.openslx.dozmod.gui.control.ComboBox.ComboBoxRenderer;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.helper.GridManager;
import org.openslx.dozmod.gui.helper.I18n;
+import org.openslx.dozmod.gui.panel.ContainerPanel;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.WizardPage;
import org.openslx.thrifthelper.Comparators;
@@ -75,20 +76,9 @@ public abstract class ImageMetaDataPageLayout extends WizardPage {
grid.add(chkLicenseRestricted, 2);
grid.nextRow();
- // TODO copy-paste in ContainerPanel for this ContainerImageType component
- lblContainerImageType = new QLabel("Container Image Type");
- cboContainerImageType = new ComboBox<>(
- new ComboBox.ComboBoxRenderer<ContainerMeta.ContainerImageType>() {
- @Override public String renderItem(ContainerMeta.ContainerImageType item) {
- if (item == null)
- return "null";
- return item.toString(); // shows the provided label
- }
- }, ContainerMeta.ContainerImageType.class);
- for (ContainerMeta.ContainerImageType type : ContainerMeta.ContainerImageType.values()) {
- cboContainerImageType.addItem(type);
- }
- cboContainerImageType.setSelectedItem(ContainerMeta.ContainerImageType.LECTURE);
+ lblContainerImageType = new QLabel(
+ I18n.PANEL.getString("ContainerPanel.Label.ContainerImageType.text"));
+ cboContainerImageType = ContainerPanel.createContainerImageTypeCBO();
grid.add(lblContainerImageType);
grid.add(cboContainerImageType).fill(true, false).expand(true, false);
lblContainerImageType.setVisible(false);
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 6d2078f8..b21564a6 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
@@ -244,6 +244,10 @@ public class ContainerUploadPage extends ContainerUploadPageLayout {
setWarningMessage(I18n.PAGE.getString("ContainerUploadPage.Warning.NoReceipt"));
return false;
}
+ if (! ContainerDefinition.isValidDockerfile(txtImageFile.getText())) {
+ setWarningMessage(I18n.PAGE.getString("ContainerUploadPage.Warning.NoValidDockerfiler"));
+ return false;
+ }
break;
case GIT_REPOSITORY:
if (txtGitRepo.getText() == null || txtGitRepo.getText().isEmpty()) {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/model/ContainerDefinition.java b/dozentenmodul/src/main/java/org/openslx/dozmod/model/ContainerDefinition.java
index 23142b51..99d73c23 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/model/ContainerDefinition.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/model/ContainerDefinition.java
@@ -4,6 +4,9 @@ import org.openslx.dozmod.thrift.cache.MetaDataCache;
import org.openslx.virtualization.configuration.VirtualizationConfigurationDocker;
import org.openslx.virtualization.configuration.VirtualizationConfigurationException;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.Scanner;
public class ContainerDefinition extends
org.openslx.virtualization.configuration.container.ContainerDefinition {
@@ -27,4 +30,23 @@ public class ContainerDefinition extends
}
return null;
}
+
+ public static boolean isValidDockerfile(String dockerfile) {
+ try {
+ File file = new File(dockerfile);
+ if (file.length() == 0)
+ return false;
+
+ Scanner scanner = new Scanner(file);
+ while (scanner.hasNext()) {
+ if(scanner.next().contains("FROM")){
+ return true;
+ }
+ }
+ scanner.close();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
}
diff --git a/dozentenmodul/src/main/properties/i18n/configurator.properties b/dozentenmodul/src/main/properties/i18n/configurator.properties
index f96b2558..625cb357 100644
--- a/dozentenmodul/src/main/properties/i18n/configurator.properties
+++ b/dozentenmodul/src/main/properties/i18n/configurator.properties
@@ -128,4 +128,8 @@ Startup.SoundState.unmuted=Unmute
# ContainerBindMountConfigurator
ContainerBindMount.BindMount.text=Bind Mount Configuration
ContainerBindMount.Button.AddBindMount.text=Add Bind Mount
-ContainerBindMount.Button.DeleteBindMount.text=Remove Bind Mount \ No newline at end of file
+ContainerBindMount.Button.DeleteBindMount.text=Remove Bind Mount
+
+ContainerBindMount.BindMountTable.col.src=Source
+ContainerBindMount.BindMountTable.col.dest=Target
+ContainerBindMount.BindMountTable.col.opt=Options
diff --git a/dozentenmodul/src/main/properties/i18n/configurator_de_DE.properties b/dozentenmodul/src/main/properties/i18n/configurator_de_DE.properties
index 1a39a3e3..6e5f7caa 100644
--- a/dozentenmodul/src/main/properties/i18n/configurator_de_DE.properties
+++ b/dozentenmodul/src/main/properties/i18n/configurator_de_DE.properties
@@ -126,6 +126,10 @@ Startup.SoundState.muted=Stummschalten
Startup.SoundState.unmuted=Aktivieren
# ContainerBindMountConfigurator
-ContainerBindMount.BindMount.text=Bind Mount Configuration
+ContainerBindMount.BindMount.text=Bind-Mount-Konfiguration
ContainerBindMount.Button.AddBindMount.text=Bind Mount hinzufügen
-ContainerBindMount.Button.DeleteBindMount.text=Bind Mount entfernen \ No newline at end of file
+ContainerBindMount.Button.DeleteBindMount.text=Bind Mount entfernen
+
+ContainerBindMount.BindMountTable.col.src=Quelle
+ContainerBindMount.BindMountTable.col.dest=Ziel
+ContainerBindMount.BindMountTable.col.opt=Optionen
diff --git a/dozentenmodul/src/main/properties/i18n/page.properties b/dozentenmodul/src/main/properties/i18n/page.properties
index fb951700..eef4b242 100644
--- a/dozentenmodul/src/main/properties/i18n/page.properties
+++ b/dozentenmodul/src/main/properties/i18n/page.properties
@@ -71,6 +71,7 @@ ImageOvfConversion.Dialog.RemoveTmpDirectory.title=Delete temporary directory?
ContainerUploadPage.Description.ContainerDefFinished=Container definition finished
ContainerUploadPage.Warning.NoImageRepo=No Image Repository provided
ContainerUploadPage.Warning.NoReceipt=No Container Recipe provided!
+ContainerUploadPage.Warning.NoValidDockerfiler=No valid Dockerfile provided!
ContainerUploadPage.Warning.NoGitRepository=No Git Repository provided!
ContainerUploadPage.Warning.NoProperName=Set proper Image Name
ContainerUploadPage.Warning.NoRunOptions=Set container run options
diff --git a/dozentenmodul/src/main/properties/i18n/page_de_DE.properties b/dozentenmodul/src/main/properties/i18n/page_de_DE.properties
index 599bb26d..67c3662a 100644
--- a/dozentenmodul/src/main/properties/i18n/page_de_DE.properties
+++ b/dozentenmodul/src/main/properties/i18n/page_de_DE.properties
@@ -67,6 +67,7 @@ ImageOvfConversion.Dialog.RemoveTmpDirectory.title=Temporäres Verzeichnis lösc
# ContainerUploadPage
ContainerUploadPage.Description.ContainerDefFinished=Container Definition vollständig
ContainerUploadPage.Warning.NoReceipt=Keine Containeranweisungen angegeben!
+ContainerUploadPage.Warning.NoValidDockerfiler=Kein valides Dockerfile angegeben!
ContainerUploadPage.Warning.NoGitRepository=Kein Git Repository angegeben!
ContainerUploadPage.Warning.NoProperName=Bitte Imagenamen setzen
ContainerUploadPage.Warning.NoRunOptions=Bitte Container Start Optionen setzen
diff --git a/dozentenmodul/src/main/properties/i18n/panel.properties b/dozentenmodul/src/main/properties/i18n/panel.properties
index f78c5f36..8770f86f 100644
--- a/dozentenmodul/src/main/properties/i18n/panel.properties
+++ b/dozentenmodul/src/main/properties/i18n/panel.properties
@@ -4,11 +4,7 @@ ContainerPanel.ContainerStartOptions.tooltip=Please provide the Container Run Op
ContainerPanel.Label.ImageName.text=Image Name
ContainerPanel.Constraint.NoEmptyDockerfile.text=Empty Dockerfile not allowed!
+ContainerPanel.ContainerRunCommand.label=Container Run Command
+ContainerPanel.ContainerRunCommand.tooltip=Specify the programme and arguments for the Docker Run command.
-ContainerPanel.ContainerRunCommand.label="Container Run Command"
-
-# UNUSED
-ImageDetails.Constraint.NoEmptyName.text=Empty Name not allowed!
-ImageDetails.Constraint.NoEmptyRunOptions.text=No Container Run Options provided!
-
-
+ContainerPanel.Label.ContainerImageType.text=Container Image Type
diff --git a/dozentenmodul/src/main/properties/i18n/panel_de_DE.properties b/dozentenmodul/src/main/properties/i18n/panel_de_DE.properties
index 440978dd..e3f47cba 100644
--- a/dozentenmodul/src/main/properties/i18n/panel_de_DE.properties
+++ b/dozentenmodul/src/main/properties/i18n/panel_de_DE.properties
@@ -1,11 +1,10 @@
# ContainerPanel
-ContainerPanel.ContainerStartOptions.label=Container Start Optionen
+ContainerPanel.ContainerStartOptions.label=Container-Startoptionen
ContainerPanel.ContainerStartOptions.tooltip=Bitte die Container Start Optionen angeben (Port, Name, Env,...)
-ContainerPanel.Label.ImageName.text=Image Name
+ContainerPanel.Label.ImageName.text=Image-Name
ContainerPanel.Constraint.NoEmptyDockerfile.text=Es muss ein Dockerfile angegeben werden!
+ContainerPanel.ContainerRunCommand.label=Container-Startbefehl
+ContainerPanel.ContainerRunCommand.tooltip=Geben Sie das Programm und Argumente für docker run an.
-# UNUSED
-ImageDetails.Constraint.NoEmptyName.text=Es muss ein Name angegeben werden!
-ImageDetails.Constraint.NoEmptyRunOptions.text=Keine Container Start Optionen angegeben!
-ContainerPanel.ContainerRunCommand.label="Container Run Befehl"
+ContainerPanel.Label.ContainerImageType.text=Container-Image-Typ
diff --git a/dozentenmodul/src/main/properties/i18n/panel_tr_TR.properties b/dozentenmodul/src/main/properties/i18n/panel_tr_TR.properties
index 09416eef..e371bb01 100644
--- a/dozentenmodul/src/main/properties/i18n/panel_tr_TR.properties
+++ b/dozentenmodul/src/main/properties/i18n/panel_tr_TR.properties
@@ -1,10 +1,6 @@
# ContainerPanel
-ContainerPanel.ContainerStartOptions.label=Container ba?latma seçenekleri
-ContainerPanel.ContainerStartOptions.tooltip=Lütfen container ba?latma seçeneklerini girin (Port, Name, Env,...)
-ContainerPanel.Label.ImageName.text=Görüntü ad?
+ContainerPanel.ContainerStartOptions.label=Container ba?latma se�enekleri
+ContainerPanel.ContainerStartOptions.tooltip=L�tfen container ba?latma se�eneklerini girin (Port, Name, Env,...)
+ContainerPanel.Label.ImageName.text=G�r�nt� ad?
ContainerPanel.Constraint.NoEmptyDockerfile.text=Dockerfile bo? b?rak?lamaz!
-
-# UNUSED
-ImageDetails.Constraint.NoEmptyName.text=Görüntü ad? bo? b?rak?lamaz!
-ImageDetails.Constraint.NoEmptyRunOptions.text=Container ba?latma seçenekleri girilmedi!