Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PPP-5411] [PPP-5420] Update Pentaho User Console community release h… #5794

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
8 changes: 8 additions & 0 deletions assemblies/pentaho-server/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@
<directory>${project.build.directory}/pentaho-solutions/system/dialects/hsqldb</directory>
<outputDirectory>pentaho-solutions/system</outputDirectory>
</fileSet>
<!-- license -->
<fileSet>
<directory>${project.basedir}/../..</directory>
<includes>
<include>LICENSE.TXT</include>
</includes>
<outputDirectory>.</outputDirectory>
</fileSet>
</fileSets>

<dependencySets>
Expand Down
63 changes: 0 additions & 63 deletions user-console/LICENSE.txt

This file was deleted.

12 changes: 12 additions & 0 deletions user-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,18 @@
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-license-file</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy file="${project.basedir}/../LICENSE.TXT" tofile="${project.build.directory}/classes/org/pentaho/mantle/public/LICENSE.TXT"/>
</tasks>
</configuration>
</execution>
<execution>
<id>copy-jquery-files</id>
<phase>generate-resources</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@
import org.pentaho.gwt.widgets.client.utils.string.StringUtils;
import org.pentaho.mantle.client.MantleApplication;
import org.pentaho.mantle.client.messages.Messages;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.TextResource;

import java.util.Date;

public class AboutCommand extends AbstractCommand {
private static final String LICENSE_FILE_URL = GWT.getHostPageBaseURL() + "mantle/LICENSE.TXT";

interface MyTextResource extends ClientBundle {
@Source("org/pentaho/mantle/public/license.txt")
TextResource myText();
}
private static final String LICENSE_READ_ERROR =
"Error reading license file from server URL: \"" + LICENSE_FILE_URL + "\"";

private String versionText;
private String licenseText;

public AboutCommand() {
}
Expand All @@ -47,9 +46,33 @@ protected void performOperation() {
performOperation( true );
}

/**
* Begins callback chain for About window values then opens the window:
* -> retrieve version (if not set)
* -> retrieve license text (if not set nor error)
* -> show the window
*/
protected void performOperation( boolean feedback ) {
if ( StringUtils.isEmpty( MantleApplication.mantleRevisionOverride ) == false ) {
showAboutDialog( MantleApplication.mantleRevisionOverride );
retrieveVersionValue();
}


//Setters are here to be accessible in RequestCallbacks
private void setVersionText( String text ) {
versionText = text;
}

private void setLicenseFileText( String text ) {
licenseText = text.replace( "\t", "&emsp;" );
licenseText = "<pre>" + licenseText + "</pre>";
}

private void retrieveVersionValue() {
if ( versionText != null && !versionText.isEmpty() ) {
retrieveLicenseFileText();
} else if ( StringUtils.isEmpty( MantleApplication.mantleRevisionOverride ) == false ) {
setVersionText( MantleApplication.mantleRevisionOverride );
retrieveLicenseFileText();
} else {
final String url = GWT.getHostPageBaseURL() + "api/version/show"; //$NON-NLS-1$
RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.GET, url );
Expand All @@ -59,43 +82,58 @@ protected void performOperation( boolean feedback ) {
requestBuilder.sendRequest( null, new RequestCallback() {

public void onError( Request request, Throwable exception ) {
// showError(exception);
}

public void onResponseReceived( Request request, Response response ) {
showAboutDialog( response.getText() );
setVersionText( response.getText() );
retrieveLicenseFileText();
}
} );
} catch ( RequestException e ) {
Window.alert( e.getMessage() );
// showError(e);
}
}
}

public String readTextFile() {
MyTextResource resource = GWT.create(MyTextResource.class);
String text = resource.myText().getText();
text = text.replace("\t", "&emsp;");
text = "<pre>" + text + "</pre>";
return text;
private void retrieveLicenseFileText() {
//if we already have a license text value that isn't the ERROR value, don't bother getting the value again.
if ( licenseText != null && !licenseText.isEmpty() && licenseText != LICENSE_READ_ERROR ) {
showAboutDialog();
} else {
RequestBuilder licenseFileRequest = new RequestBuilder( RequestBuilder.GET, LICENSE_FILE_URL );
licenseFileRequest.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" );
licenseFileRequest.setHeader( "accept", "text/plain" );

try {
licenseFileRequest.sendRequest( null, new RequestCallback() {

public void onError( Request request, Throwable exception ) {
setLicenseFileText( LICENSE_READ_ERROR );
showAboutDialog();
}

public void onResponseReceived( Request request, Response response ) {
setLicenseFileText( response.getText() );
showAboutDialog();
}
} );
} catch ( RequestException e ) {
Window.alert( e.getMessage() );
}
}
}

private void showAboutDialog( String version ) {
@SuppressWarnings( "deprecation" )
String licenseInfo = Messages.getString( "licenseInfo", "" + ( ( new Date() ).getYear() + 1900 ) );
private void showAboutDialog() {
String releaseLabel = Messages.getString( "release" );
PromptDialogBox dialogBox =
new PromptDialogBox( null, Messages.getString( "ok" ), null, false, true ); //$NON-NLS-1$

new PromptDialogBox( null, Messages.getString( "ok" ), null, false, true ); //$NON-NLS-1$
VerticalPanel aboutContent = new VerticalPanel();
aboutContent.setBorderWidth(0);
String licenseText = readTextFile();
aboutContent.setBorderWidth( 0 );
aboutContent.setStyleName( "about-splash" );
aboutContent.add( new Label( releaseLabel + " " + version ) );
aboutContent.add( new Label( releaseLabel + " " + versionText ) );
aboutContent.add( new HTML( licenseText ) );
dialogBox.setContent( aboutContent );
dialogBox.setPixelSize(700, 400);
dialogBox.setPixelSize( 700, 400 );
dialogBox.center();
}
}

This file was deleted.