summaryrefslogtreecommitdiffstats
path: root/dozentenmodul
diff options
context:
space:
mode:
authorralph isenmann2021-10-21 16:48:26 +0200
committerralph isenmann2021-10-28 14:11:42 +0200
commite2ff793807e678296da566d19c1d18fbcf9c3fcf (patch)
tree8b213345640ec2b13e97ffb65fb536e0c455091f /dozentenmodul
parent[client] refactoring: apply changes from master-sync-share (diff)
downloadtutor-module-e2ff793807e678296da566d19c1d18fbcf9c3fcf.tar.gz
tutor-module-e2ff793807e678296da566d19c1d18fbcf9c3fcf.tar.xz
tutor-module-e2ff793807e678296da566d19c1d18fbcf9c3fcf.zip
[client] refactoring: improve i18n, hide unsed ContainerImageType in ContainerPanel
Diffstat (limited to 'dozentenmodul')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java76
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java2
-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/page_layout.properties11
-rw-r--r--dozentenmodul/src/main/properties/i18n/page_layout_de_DE.properties13
-rw-r--r--dozentenmodul/src/main/properties/i18n/panel.properties2
-rw-r--r--dozentenmodul/src/main/properties/i18n/panel_de_DE.properties2
8 files changed, 55 insertions, 53 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 d01b7200..42a50418 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
@@ -26,7 +26,7 @@ public class ContainerPanel extends JPanel {
*/
private static final long serialVersionUID = -3335320345960410582L;
- // TODO Set the height of txtContainerRecipe to a proper Value
+ // TODO Set the height of txtContainerRecipe to a proper Value
public static final String IMAGE_CONTEXT = "IMAGE";
public static final String CONTAINER_CONTEXT = "CONTAINER";
@@ -53,19 +53,15 @@ public class ContainerPanel extends JPanel {
pnlContainerMeta = new JPanel();
GridManager grdContainerMeta = new GridManager(pnlContainerMeta, 3);
- QLabel lblContainerRunOpt = new QLabel(
- I18n.PANEL.getString("ContainerPanel.ContainerStartOptions.label"));
- lblContainerRunOpt.setToolTipText(
- I18n.PANEL.getString("ContainerPanel.ContainerStartOptions.tooltip"));
+ QLabel lblContainerRunOpt = new QLabel(I18n.PANEL.getString("ContainerPanel.ContainerStartOptions.label"));
+ lblContainerRunOpt.setToolTipText(I18n.PANEL.getString("ContainerPanel.ContainerStartOptions.tooltip"));
txtContainerRun = new JTextField();
grdContainerMeta.add(lblContainerRunOpt);
grdContainerMeta.add(txtContainerRun, 2).fill(true, false).expand(true, false);
grdContainerMeta.nextRow();
- QLabel lblContainerRunCommand = new QLabel(
- I18n.PANEL.getString("ContainerPanel.ContainerRunCommand.label"));
- lblContainerRunCommand.setToolTipText(
- I18n.PANEL.getString("ContainerPanel.ContainerRunCommand.tooltip"));
+ 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);
@@ -77,8 +73,7 @@ public class ContainerPanel extends JPanel {
GridManager grdContainer = new GridManager(this, 2, false, new Insets(8, 2, 8, 2));
- QLabel lblContainerImageName = new QLabel(
- I18n.PANEL.getString("ContainerPanel.Label.ImageName.text"));
+ QLabel lblContainerImageName = new QLabel(I18n.PANEL.getString("ContainerPanel.Label.ImageName.text"));
grdContainer.add(lblContainerImageName);
txtContainerImageName = new JTextField();
grdContainer.add(txtContainerImageName, 1).fill(true, false).expand(true, false);
@@ -90,8 +85,7 @@ public class ContainerPanel extends JPanel {
scrollableTextArea.setPreferredSize(Gui.getScaledDimension(0, 200));
grdContainer.add(scrollableTextArea, 2).fill(true, true).expand(true, true);
- lblContainerImageType = new QLabel(
- I18n.PANEL.getString("ContainerPanel.Label.ContainerImageType.text"));
+ 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);
@@ -102,24 +96,26 @@ public class ContainerPanel extends JPanel {
}
/**
- * Retrieves Container specific details for the currently displayed lecture and disables gui elements for
- * the specific context.
+ * Retrieves Container specific details for the currently displayed lecture and
+ * disables gui elements for the specific context.
*
- * @param satelliteToken The satelliteToken from which the information are retrieved.
- * @param image The ImageDetailsRead which has general information about Image (name, type, version, etc.)
+ * @param satelliteToken The satelliteToken from which the information are
+ * retrieved.
+ * @param image The ImageDetailsRead which has general information
+ * about Image (name, type, version, etc.)
* @param context In which context this Panel ist used (Image or Lecture)
*/
public void init(String satelliteToken, ImageDetailsRead image, String context) {
try {
byte[] rawVirtConfig;
- ByteBuffer byteBuffer = ThriftManager.getSatClient()
- .getImageVersionVirtConfig(satelliteToken, image.getLatestVersionId());
+ ByteBuffer byteBuffer = ThriftManager.getSatClient().getImageVersionVirtConfig(satelliteToken,
+ 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);
+ LOGGER.error("Failed to retrieve virtualizer config for image version " + "'" + image.getLatestVersionId()
+ + ", see trace: ", e);
}
txtContainerImageName.setText(image.imageName);
@@ -156,17 +152,22 @@ public class ContainerPanel extends JPanel {
private void initImageDetails() {
+ // TODO currently no support for different containerImageType
+ lblContainerImageType.setVisible(false);
+ cboContainerImageType.setEditable(false);
+ cboContainerImageType.setVisible(false);
+
cboContainerImageType.setSelectedItem(containerDefinition.getContainerMeta().getImageType());
if (containerDefinition.getContainerMeta().getImageType() == ContainerMeta.ContainerImageType.DATA) {
- // do not allowed to change type if it is data
+ // do not allow changing type if it is data
cboContainerImageType.setEnabled(false);
- }
- else {
- // do not allow to switch type to data after creation
+ } else {
+ // do not allow switching type to data after creation
cboContainerImageType.removeItem(ContainerMeta.ContainerImageType.DATA);
}
- // currently do not allow user to change the Image Repository or Dockerfile in the suite.
+ // currently, do not allow user to change the Image Repository or Dockerfile in
+ // the suite.
txtContainerRecipe.setEnabled(false);
// do not show container specific input options
@@ -187,9 +188,8 @@ public class ContainerPanel extends JPanel {
public void addToChangeMonitor(DialogChangeMonitor changeMonitor) {
if (isFirstTime) {
- changeMonitor.add(txtContainerRecipe)
- .addConstraint(new DialogChangeMonitor.TextNotEmptyConstraint(
- I18n.PANEL.getString("ContainerPanel.Constraint.NoEmptyDockerfile.text")));
+ changeMonitor.add(txtContainerRecipe).addConstraint(new DialogChangeMonitor.TextNotEmptyConstraint(
+ I18n.PANEL.getString("ContainerPanel.Constraint.NoEmptyDockerfile.text")));
changeMonitor.add(txtContainerRun);
changeMonitor.add(txtContainerRunCommand);
changeMonitor.add(bindMountConfigurator);
@@ -203,7 +203,8 @@ public class ContainerPanel extends JPanel {
*
* @param satelliteToken for current session to communicate with Sat.
* @param image of the image version, which will be updated.
- * @return Returns true uf upload successfully finished, false if error occurred.
+ * @return Returns true uf upload successfully finished, false if error
+ * occurred.
*/
public boolean saveChanges(String satelliteToken, ImageDetailsRead image) {
@@ -219,9 +220,8 @@ public class ContainerPanel extends JPanel {
if (!newConDev.equals(containerDefinition)) {
LOGGER.info("Update Container Definition");
try {
- ThriftManager.getSatClient()
- .setImageVersionVirtConfig(satelliteToken, image.getLatestVersionId(),
- newConDev.toByteBuffer());
+ ThriftManager.getSatClient().setImageVersionVirtConfig(satelliteToken, image.getLatestVersionId(),
+ newConDev.toByteBuffer());
} catch (TException e) {
LOGGER.error("Upload new ContainerDefinition failed", e);
return false;
@@ -230,17 +230,18 @@ public class ContainerPanel extends JPanel {
return true;
}
- public static ComboBox<ContainerMeta.ContainerImageType> createContainerImageTypeCBO (){
+ 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){
+ @Override
+ public String renderItem(ContainerMeta.ContainerImageType item) {
+ switch (item) {
case LECTURE:
return "Pool";
case BATCH:
return "Pool/Cluster";
case DATA:
- return "Daten";
+ return I18n.PANEL.getString("ContainerPanel.ContainerImageType.Item.label");
default:
return "";
}
@@ -253,4 +254,3 @@ public class ContainerPanel extends JPanel {
return cbo;
}
}
-
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 878f07f8..283019b6 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
@@ -243,7 +243,7 @@ public class ContainerUploadPage extends ContainerUploadPageLayout {
break;
case DOCKER_ARCHIVE:
if (txtImageTar.getText() == null || txtImageTar.getText().isEmpty()) {
- setWarningMessage("No Image provided");
+ setWarningMessage(I18n.PAGE.getString("ContainerUploadPage.Warning.NoDockerArchive"));
return false;
}
break;
diff --git a/dozentenmodul/src/main/properties/i18n/page.properties b/dozentenmodul/src/main/properties/i18n/page.properties
index eef4b242..1c096ad5 100644
--- a/dozentenmodul/src/main/properties/i18n/page.properties
+++ b/dozentenmodul/src/main/properties/i18n/page.properties
@@ -73,6 +73,7 @@ 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.NoDockerArchive=No Docker Archive 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 ba151a9a..8a7efd04 100644
--- a/dozentenmodul/src/main/properties/i18n/page_de_DE.properties
+++ b/dozentenmodul/src/main/properties/i18n/page_de_DE.properties
@@ -69,6 +69,7 @@ ContainerUploadPage.Description.ContainerDefFinished=Container Definition vollst
ContainerUploadPage.Warning.NoReceipt=Keine Containeranweisungen angegeben!
ContainerUploadPage.Warning.NoValidDockerfiler=Kein valides Dockerfile angegeben!
ContainerUploadPage.Warning.NoGitRepository=Kein Git Repository angegeben!
+ContainerUploadPage.Warning.NoDockerArchive=Kein Docker Archive angegeben!
ContainerUploadPage.Warning.NoProperName=Bitte Imagenamen setzen
ContainerUploadPage.Warning.NoRunOptions=Bitte Container Start Optionen setzen
ContainerUploadPage.Warning.NoImageRepo=Kein Image Repository angegeben
diff --git a/dozentenmodul/src/main/properties/i18n/page_layout.properties b/dozentenmodul/src/main/properties/i18n/page_layout.properties
index b14eae34..7b2f3b13 100644
--- a/dozentenmodul/src/main/properties/i18n/page_layout.properties
+++ b/dozentenmodul/src/main/properties/i18n/page_layout.properties
@@ -65,14 +65,13 @@ ContainerUploadPage.GitRepository.label=Git Repository
ContainerUploadPage.GitRepository.toolTipText=Set clone address of Git Repository [git@ | http://] [.git]. Currently no Validation Checks!
ContainerUploadPage.ImageRepository.ToolTipText=Specify the Container Image by his Repository Name (e.g python:3.7 or tensorflow/tensorflow)
ContainerUploadPage.CheckBox.ContainsLicenseRestricted.text=Contains license restricted software
-ContainerUploadPage.ContainerImageFile.label=Pre-build Container Image
-ContainerUploadPage.ContainerImageFile.ToolTipText=<html>Optionally attach a tar archive of a container image to the upload.<br>\
-Open dialogue with double click<html>
+ContainerUploadPage.ContainerImageFile.label=Container Image
+ContainerUploadPage.ContainerImageFile.ToolTipText=<html>Attach a container image archived as tarball<br>\
+For example: docker save IMAGE --output image_name.tar<html>
ContainerUploadPage.Infobox.label=Information
ContainerUploadPage.Infobox.text=Enter the information necessary for creating a container image here.\n\n\
-Container images are currently built and run on clients. \
-If the build takes too much time, you can optionally add a pre-built \
-container image as a tar archive to the upload (docker save).
+It is possible to reference an image directly from a public registry or to add a self-created \
+image to the upload. For more information on creating an image, see the bwLehrpool documentation.
# ImageUploadSummaryPageLayout
ImageUploadSummary.WizardPage.title=Done!
diff --git a/dozentenmodul/src/main/properties/i18n/page_layout_de_DE.properties b/dozentenmodul/src/main/properties/i18n/page_layout_de_DE.properties
index de385d68..4972b451 100644
--- a/dozentenmodul/src/main/properties/i18n/page_layout_de_DE.properties
+++ b/dozentenmodul/src/main/properties/i18n/page_layout_de_DE.properties
@@ -64,16 +64,13 @@ ContainerUploadPage.GitRepository.label=Git Repository
ContainerUploadPage.GitRepository.toolTipText=Clone Addresse des Git Repositories setzen. [git@ | http://] [.git]. Derzeit keine Validierungsprüfungen!
ContainerUploadPage.ImageRepository.ToolTipText=Geben Sie das Container-Image durch seinen Repository-Namen an (z.B. python:3.7 oder tensorflow/tensorflow)
ContainerUploadPage.CheckBox.ContainsLicenseRestricted.text=Enthält lizenzpflichtige Software
-ContainerUploadPage.ContainerImageFile.label=Vorgebautes Container-Image\
-
-ContainerUploadPage.ContainerImageFile.ToolTipText=<html>Fügen Sie dem Upload optional ein ein als tar archiviertes Container-Image an.<br>\
-Öffne Dialog mit Doppelklick<html>
+ContainerUploadPage.ContainerImageFile.label=Container-Image
+ContainerUploadPage.ContainerImageFile.ToolTipText=<html>Fügen Sie ein archiviertes Container-Image als tar-Datei an.<br>\
+Zum Beispiel: docker save IMAGE --output image_name.tar.<html>
ContainerUploadPage.Infobox.label=Hinweis
ContainerUploadPage.Infobox.text=Geben Sie hier die zur Erstellung eines Container-Images nötigen Informationen an.\n\n\
-Container-Images werden derzeit auf Clients gebaut und ausgeführt. \
-Sollte der Bau zu viel Zeit benötigen, können Sie optional dem \
-Upload ein vorgebautes Container-Image als tar-Archive hinzufügen\
-(docker save).
+Es ist möglich ein Image direkt von einer öffentlichen Registry zu referenzieren oder ein selbsterstelltes \
+Image dem Upload hinzuzufügen. Weiter Informationen zur Erstellung entnehmen Sie der bwLehrpool-Dokumentation.
# ImageUploadSummaryPageLayout
ImageUploadSummary.WizardPage.title=Fertig!
diff --git a/dozentenmodul/src/main/properties/i18n/panel.properties b/dozentenmodul/src/main/properties/i18n/panel.properties
index 8770f86f..44fbee3b 100644
--- a/dozentenmodul/src/main/properties/i18n/panel.properties
+++ b/dozentenmodul/src/main/properties/i18n/panel.properties
@@ -8,3 +8,5 @@ ContainerPanel.ContainerRunCommand.label=Container Run Command
ContainerPanel.ContainerRunCommand.tooltip=Specify the programme and arguments for the Docker Run command.
ContainerPanel.Label.ContainerImageType.text=Container Image Type
+
+ContainerPanel.ContainerImageType.Item.label=Data
diff --git a/dozentenmodul/src/main/properties/i18n/panel_de_DE.properties b/dozentenmodul/src/main/properties/i18n/panel_de_DE.properties
index e3f47cba..9b5b06bb 100644
--- a/dozentenmodul/src/main/properties/i18n/panel_de_DE.properties
+++ b/dozentenmodul/src/main/properties/i18n/panel_de_DE.properties
@@ -8,3 +8,5 @@ ContainerPanel.ContainerRunCommand.label=Container-Startbefehl
ContainerPanel.ContainerRunCommand.tooltip=Geben Sie das Programm und Argumente für docker run an.
ContainerPanel.Label.ContainerImageType.text=Container-Image-Typ
+
+ContainerPanel.ContainerImageType.Item.label=Daten