From 6285616163490b3caccff4e1bc216fbda02baee5 Mon Sep 17 00:00:00 2001
From: yvesn <yvesn>
Date: Wed, 24 May 2017 13:02:19 +0000
Subject: [PATCH] SSDM-5068 : ELN config on GUI - using blockUI while loading
 view

SVN: 38218
---
 .../js/views/SettingsForm/SettingsFormView.js | 75 +++++++++++--------
 1 file changed, 42 insertions(+), 33 deletions(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js
index 1cc93a010c9..cb4101c92c5 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js
@@ -31,45 +31,54 @@ function SettingsFormView(settingsFormController, settingsFormModel) {
 
 		var $container = views.content;
 
-		var $form = $("<div>");
-		var $formColumn = $("<div>");
-		$form.append($formColumn);
+		Util.blockUI(null, null, true);
+		// delay painting just a bit so blockUI can be shown
+		window.setTimeout((function($container) {
 
-		var typeTitle = "Settings";
+			var $form = $("<div>");
+			var $formColumn = $("<div>");
+			$form.append($formColumn);
 
-		var $formTitle = $("<h2>").append(typeTitle);
+			var typeTitle = "Settings";
 
-		//
-		// Toolbar
-		//
-		var toolbarModel = [];		
+			var $formTitle = $("<h2>").append(typeTitle);
 
-		if(this._settingsFormModel.mode === FormMode.VIEW) {
-			//Edit
-			var $editButton = FormUtil.getButtonWithIcon("glyphicon-edit", function () {
-				mainController.changeView("showEditSettingsPage");
-			});
-			toolbarModel.push({ component : $editButton, tooltip: "Edit" });
-		} else { //Create and Edit
-			//Save
-			var $saveBtn = FormUtil.getButtonWithIcon("glyphicon-floppy-disk", (function() {
-				this._settingsFormController.save(this._getSettings());
-			}).bind(this), "Save");
-			$saveBtn.removeClass("btn-default");
-			$saveBtn.addClass("btn-primary");
-			toolbarModel.push({ component : $saveBtn, tooltip: "Save" });
-		}
-		
-		var $header = views.header;
-		$header.append($formTitle);
-		$header.append(FormUtil.getToolbar(toolbarModel));
+			//
+			// Toolbar
+			//
+			var toolbarModel = [];		
+
+			if(this._settingsFormModel.mode === FormMode.VIEW) {
+				//Edit
+				var $editButton = FormUtil.getButtonWithIcon("glyphicon-edit", function () {
+					mainController.changeView("showEditSettingsPage");
+				});
+				toolbarModel.push({ component : $editButton, tooltip: "Edit" });
+			} else { //Create and Edit
+				//Save
+				var $saveBtn = FormUtil.getButtonWithIcon("glyphicon-floppy-disk", (function() {
+					this._settingsFormController.save(this._getSettings());
+				}).bind(this), "Save");
+				$saveBtn.removeClass("btn-default");
+				$saveBtn.addClass("btn-primary");
+				toolbarModel.push({ component : $saveBtn, tooltip: "Save" });
+			}
+			
+			var $header = views.header;
+			$header.append($formTitle);
+			$header.append(FormUtil.getToolbar(toolbarModel));
+
+			this._paintGeneralSection($formColumn);
+			// this._paintStorageSection($formColumn);
+			this._paintDataSetTypesForFileNamesSection($formColumn);
+			this._paintSampleTypesDefinition($formColumn);
+
+			$container.append($form);
+
+			Util.unblockUI();
 
-		this._paintGeneralSection($formColumn);
-		// this._paintStorageSection($formColumn);
-		this._paintDataSetTypesForFileNamesSection($formColumn);
-		this._paintSampleTypesDefinition($formColumn);
+		}).bind(this, $container), 20);
 
-		$container.append($form);
 	}
 
 	this._getSettings = function() {
-- 
GitLab