Skip to content

Commit

Permalink
[BACKLOG-17645] - Create a new default property to be able to disable…
Browse files Browse the repository at this point in the history
… the environment+browser check
  • Loading branch information
Elio Freitas authored and afrjorge committed Jul 18, 2017
1 parent 694837f commit 9689b15
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
13 changes: 12 additions & 1 deletion ui/src/main/java/org/pentaho/di/ui/core/PropsUI.java
Expand Up @@ -109,6 +109,8 @@ public class PropsUI extends Props {


private static final String LEGACY_PERSPECTIVE_MODE = "LegacyPerspectiveMode"; private static final String LEGACY_PERSPECTIVE_MODE = "LegacyPerspectiveMode";


private static final String DISABLE_BROWSER_ENVIRONMENT_CHECK = "DisableBrowserEnvironmentCheck";

private static List<GUIOption<Object>> editables; private static List<GUIOption<Object>> editables;


/** /**
Expand Down Expand Up @@ -1212,7 +1214,7 @@ public void setCanvasGridSize( int gridSize ) {
} }


/** /**
* getSupportedVersion * Gets the supported version of the requested software.
* *
* @param property the key for the software version * @param property the key for the software version
* @return an integer that represents the supported version for the software. * @return an integer that represents the supported version for the software.
Expand All @@ -1221,6 +1223,15 @@ public int getSupportedVersion( String property ) {
return Integer.parseInt( properties.getProperty( property ) ); return Integer.parseInt( properties.getProperty( property ) );
} }


/**
* Ask if the browsing environment checks are disabled.
*
* @return 'true' if disabled 'false' otherwise.
*/
public boolean isBrowserEnvironmentCheckDisabled() {
return "Y".equalsIgnoreCase( properties.getProperty( DISABLE_BROWSER_ENVIRONMENT_CHECK, "N" ) );
}

public boolean isLegacyPerspectiveMode() { public boolean isLegacyPerspectiveMode() {
return "Y".equalsIgnoreCase( properties.getProperty( LEGACY_PERSPECTIVE_MODE, "N" ) ); return "Y".equalsIgnoreCase( properties.getProperty( LEGACY_PERSPECTIVE_MODE, "N" ) );
} }
Expand Down
14 changes: 10 additions & 4 deletions ui/src/main/java/org/pentaho/di/ui/spoon/Spoon.java
Expand Up @@ -501,9 +501,9 @@ public class Spoon extends ApplicationWindow implements AddUndoPositionInterface
// "Redo : not available \tCTRL-Y" // "Redo : not available \tCTRL-Y"
private static final String REDO_UNAVAILABLE = BaseMessages.getString( PKG, "Spoon.Menu.Redo.NotAvailable" ); private static final String REDO_UNAVAILABLE = BaseMessages.getString( PKG, "Spoon.Menu.Redo.NotAvailable" );


private static boolean unsupportedBrowserEnvironment; private static Boolean unsupportedBrowserEnvironment;


private static boolean webkitUnavailable; private static Boolean webkitUnavailable;


private static String availableBrowser; private static String availableBrowser;


Expand Down Expand Up @@ -9121,6 +9121,12 @@ public void hideSplash() {
} }


private void checkEnvironment() { private void checkEnvironment() {
if ( EnvironmentUtils.getInstance().isBrowserEnvironmentCheckDisabled() ) {
webkitUnavailable = null;
unsupportedBrowserEnvironment = null;
availableBrowser = "";
return;
}
webkitUnavailable = EnvironmentUtils.getInstance().isWebkitUnavailable(); webkitUnavailable = EnvironmentUtils.getInstance().isWebkitUnavailable();
unsupportedBrowserEnvironment = EnvironmentUtils.getInstance().isUnsupportedBrowserEnvironment(); unsupportedBrowserEnvironment = EnvironmentUtils.getInstance().isUnsupportedBrowserEnvironment();
availableBrowser = EnvironmentUtils.getInstance().getBrowserName(); availableBrowser = EnvironmentUtils.getInstance().getBrowserName();
Expand Down Expand Up @@ -9280,11 +9286,11 @@ public Composite getDesignParent() {
return sashform; return sashform;
} }


public static boolean isUnsupportedBrowserEnvironment() { public static Boolean isUnsupportedBrowserEnvironment() {
return unsupportedBrowserEnvironment; return unsupportedBrowserEnvironment;
} }


public static boolean isWebkitUnavailable() { public static Boolean isWebkitUnavailable() {
return webkitUnavailable; return webkitUnavailable;
} }


Expand Down
31 changes: 12 additions & 19 deletions ui/src/main/java/org/pentaho/di/ui/util/EnvironmentUtils.java
Expand Up @@ -50,8 +50,6 @@ public static synchronized EnvironmentUtils getInstance( ) {
} }


/** /**
* isUnsupportedBrowserEnvironment
*
* Checks the available browser to see if it is an unsupported one. * Checks the available browser to see if it is an unsupported one.
* *
* @return 'true' if in a unSupported browser environment 'false' otherwise. * @return 'true' if in a unSupported browser environment 'false' otherwise.
Expand All @@ -64,17 +62,15 @@ public synchronized boolean isUnsupportedBrowserEnvironment() {
if ( userAgent == null ) { if ( userAgent == null ) {
return true; return true;
} }
return checkUserAgent( MSIE_PATTERN.matcher( userAgent ), getSupportedVersion("min.windows.browser.supported") ) return checkUserAgent( MSIE_PATTERN.matcher( userAgent ), getSupportedVersion( "min.windows.browser.supported" ) )
|| checkUserAgent( SAFARI_PATTERN.matcher( userAgent ), getSupportedVersion("min.mac.browser.supported") ); || checkUserAgent( SAFARI_PATTERN.matcher( userAgent ), getSupportedVersion( "min.mac.browser.supported" ) );
} }


private boolean checkUserAgent( Matcher matcher, int version ) { private boolean checkUserAgent( Matcher matcher, int version ) {
return ( matcher.find() && Integer.parseInt( matcher.group( 1 ) ) < version ); return ( matcher.find() && Integer.parseInt( matcher.group( 1 ) ) < version );
} }


/** /**
* getUserAgent
*
* Ask for user Agent of the available browser. * Ask for user Agent of the available browser.
* *
* @return a string that contains the user agent of the browser. * @return a string that contains the user agent of the browser.
Expand All @@ -93,8 +89,6 @@ protected String getUserAgent() {
} }


/** /**
* isWebkitUnavailable
*
* Checks the existence of the webkit library on ubuntu 16 or ubuntu 14 . * Checks the existence of the webkit library on ubuntu 16 or ubuntu 14 .
* *
* @return 'true' if the webkit library is not present in ubuntu 16 or ubuntu 14 , 'false' otherwise. * @return 'true' if the webkit library is not present in ubuntu 16 or ubuntu 14 , 'false' otherwise.
Expand All @@ -104,14 +98,12 @@ public synchronized boolean isWebkitUnavailable() {
String osName = getEnvironmentName(); String osName = getEnvironmentName();
return ( ( path == null || path.length() < 1 || !path.contains( "webkit" ) ) return ( ( path == null || path.length() < 1 || !path.contains( "webkit" ) )
&& &&
( osName.contains( SUPPORTED_DISTRIBUTION_NAME + " " + getSupportedVersion("max.ubuntu.os.distribution.supported") ) ( osName.contains( SUPPORTED_DISTRIBUTION_NAME + " " + getSupportedVersion( "max.ubuntu.os.distribution.supported" ) )
|| ||
osName.contains( SUPPORTED_DISTRIBUTION_NAME + " " + getSupportedVersion("min.ubuntu.os.distribution.supported") ) ) ); osName.contains( SUPPORTED_DISTRIBUTION_NAME + " " + getSupportedVersion( "min.ubuntu.os.distribution.supported" ) ) ) );
} }


/** /**
* getWebkitPath
*
* Ask for the path in the system for the webkit library. * Ask for the path in the system for the webkit library.
* *
* @return a string that contains the path or 'null' if not found. * @return a string that contains the path or 'null' if not found.
Expand All @@ -121,8 +113,6 @@ protected String getWebkitPath() {
} }


/** /**
* getOsName
*
* Ask for the Operating system name. * Ask for the Operating system name.
* *
* @return a string that contains the current Operating System. * @return a string that contains the current Operating System.
Expand All @@ -140,8 +130,6 @@ protected String getOsName() {
} }


/** /**
* getSupportedVersion
*
* Gets the supported version of the required Property. * Gets the supported version of the required Property.
* *
* @param property a string with the required property. * @param property a string with the required property.
Expand All @@ -152,8 +140,15 @@ protected int getSupportedVersion( String property ) {
} }


/** /**
* getLinuxDistribution * Ask if the browsing environment checks are disabled.
* *
* @return 'true' if disabled 'false' otherwise.
*/
public boolean isBrowserEnvironmentCheckDisabled() {
return PropsUI.getInstance().isBrowserEnvironmentCheckDisabled();
}

/**
* Ask for the running linux distribution. * Ask for the running linux distribution.
* *
* @return a string that contains the distribution name or a empty string if it could not find the name. * @return a string that contains the distribution name or a empty string if it could not find the name.
Expand Down Expand Up @@ -184,8 +179,6 @@ protected BufferedReader getBufferedReaderFromProcess( Process p ) {
} }


/** /**
* getBrowserName
*
* Ask for the browser name. * Ask for the browser name.
* *
* @return a String that contains the browser name. * @return a String that contains the browser name.
Expand Down
Expand Up @@ -8,6 +8,7 @@ BackgroundColorB=255
BackgroundColorG=255 BackgroundColorG=255
BackgroundColorR=255 BackgroundColorR=255
DefaultPreviewSize=1000 DefaultPreviewSize=1000
DisableBrowserEnvironmentCheck=N
EnableAntiAliasing=N EnableAntiAliasing=N
FontFixedName=Courier FontFixedName=Courier
GraphColorB=255 GraphColorB=255
Expand Down

0 comments on commit 9689b15

Please sign in to comment.