Skip to content

Commit

Permalink
Merge branch 'hotfix/2019.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
PenghaiZhang committed Sep 20, 2019
2 parents 8cf2a6c + faf11cf commit 3a1c903
Show file tree
Hide file tree
Showing 24 changed files with 187 additions and 146 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ after_success:
- aws s3 --region us-east-1 cp --recursive s3://edalexdev/equella_artifacts/$TRAVIS_BRANCH/$TRAVIS_BUILD_NUMBER/ s3://edalexdev/equella_artifacts/$TRAVIS_BRANCH/latest/
env:
global:
- secure: t1XK7R/R3+gYgJCL+YNFPfpew+QZXl5b7jFkfNOwKDG+gGEApZCrx5NNkA+anPbK4VLnmjGz4EgIItfsSOmEQL6W4jr1MiD6cQV8RV9tYHhPmfPiJy0aDWOgIWIxPtpzAcSvgkZzCheHxY8PGbTi+XStRMfF6/Iat6cN7erHcO9Ur3ri10uas01xPaJJC+naXZGx0JZDTRLmGc8GFzgOwaiIUWOzPZyqsqnBEytvyuJFGe1BUfVEvr4UUb/LBiH0UgpganncFy2WHX+CWT8VFemIoNCM7jAp5oKCTHWyEH72WzGGo6+RCnmJs3Loc+6IUT2M7qNhEm8+PmQwWL9d5ihb6OSnJG9u+Pmq88E+E0eOzZnhQ3XpRjI1CRYYOKi8RBPAjlGDYBMSOo0HRzDJnuU+ZdwdJCZ0x7a/2xCgpxA2YpH+FycGWQo9b+n5JYl++n7gfaJhVcbxrob5TfcgDyj4M3Mkr0bsAwueYG1hY9vFNq9wbgFXA5UPL/khJt9OtR3akEBnrx9lySK0tXtq7zj+KKit92Ty+EfhtEF29IHHHn/pyvFBzWjO1VqsRm+cnOIyY2nLz9D8SZGaaJy7elbXc+PLjd8eHSwX/dY7DyB4MO0td4E40H+Wwxy0pfZXW5x+tdo0UGLBb9i5OoLuKFcRjmj02WcIi6TqJ3EbNdQ=
- secure: fao/RBFgwO/kaxMGbAsR2xuQgnXebRSP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h2g4UDWJU3mQwNnGwhfn2K/td4pDsazaWYhnm2DjW5e7a03uA5ccf4Cfb2AaqE5ED7hGnTifkQbnykaNXtVLyDVzHf44022FM6ldpEWP2yWrLUhKJ9yNMsmMeYYdWRj/itSdZ895hzXtFO4kcY4NR8MF+7njTx1rwFk1kTsLZ0OX6Z36LUvnVpisLxaRuiN+LGSoTRzPpzVDnGa3lL9TQw3eVbqEUuRDlg1rDOf42KNMhT6nttCwqTthKTewuXA9QuYV5VTuXs=
- secure: kUfo8ful+ObyD6zPttIxB5dHwCbvUhgZBhvb7cJQ+6xnqdI5WPnSDes2zYyPklh9+p7bt00v3vGLhNem719a3Me3Ju2QjTSZiOtLvZod3klZRokNsgDkJNjNRhtgflThSvcYUbclNZe9pyQ6lz1EOffbTSMJx09OcdkF/gN7B0xK04ha+pWyNb6lqPeKx6q44k+qVotflpFh56eiyNoC4VZ6MgF+N51A/dDQyJJpPhqWkIup7Q8uD2bzPWcz5PN4YBqezrwT4qxbdeejzQ+fwCIT0Ls7B59rivyDp7Esp35TamTbZLK24Je0/Lg/hsW5ybA3/PmFOU2QUdzc2YZ8aT6p9QQjr1F3EDRsyMYmqYUtuFI9KzROoNaQ21If1HoGXZkL83RvCuE36xTDOuLifVWNiEOdII2hb62lW2s/JBcSUS0BlFd2UoxsrPzohBF4gQjQTbWwV9HW+sdHxk20YpU4IG7pyEiQO2Hsuau/M9iCdp0lsgKo6My43kzQSGZTPgESNKWg+YKxy07mgptttErHuDyVrVq6qMMFX+OI8QmUb31GR5j0g3lTPrfpAYyL/Vzlg/T9b8BUc7WYWWL5P41TIb9WMIgmLtARsGkEz/fsa1Cb9tMiZ7jOQLRxq455f54tC55LzhgrO+2elFku8a/cbWXguHzyKf301qHoZGI=
- NODE_JS_VERSION=8.11.3
2 changes: 1 addition & 1 deletion Installer/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ lazy val upgradeManager = LocalProject("UpgradeManager")
installerZip := {
val log = streams.value.log
val ver = equellaVersion.value
val dirname = s"equella-installer-${ver.majorMinor}"
val dirname = s"equella-installer-${ver.semanticVersion}"
val outZip = target.value / s"$dirname.zip"
val serverData = baseDirectory.value / "data/server"
val allServerFiles = serverData ** "*" pair (relativeTo(serverData), false)
Expand Down
22 changes: 12 additions & 10 deletions Source/Plugins/Core/com.equella.core/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,20 @@
"bundleps:langbundle": "cross-env-shell \"purs bundle \"${npm_package_config_psglob}\" -m Tools.GenLangStrings --main Tools.GenLangStrings -o target/genlang.js\""
},
"dependencies": {
"@date-io/luxon": "1.3.5",
"@date-io/luxon": "1.3.7",
"@material-ui/core": "3.9.3",
"@material-ui/icons": "3.0.2",
"@material-ui/lab": "3.0.0-alpha.30",
"@material-ui/styles": "3.0.0-alpha.10",
"@tinymce/tinymce-react": "3.1.1",
"@tinymce/tinymce-react": "3.2.0",
"axios": "0.19.0",
"create-react-class": "15.6.3",
"downshift": "2.2.3",
"es6-object-assign": "1.1.0",
"history": "4.7.2",
"history": "4.9.0",
"jspolyfill-array.prototype.find": "0.1.3",
"luxon": "1.11.4",
"luxon": "1.16.0",
"lodash": "4.17.11",
"material-ui-pickers": "2.2.4",
"oeq-cloudproviders": "git+https://github.com/apereo/openEQUELLA-cloudprovidersdk.git#32d958ddfff64ca748e7e1b2eae0f0487946a487",
"parcel-bundler": "1.12.1",
Expand Down Expand Up @@ -66,16 +67,17 @@
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "22.2.3",
"@types/luxon": "1.11.1",
"@types/luxon": "1.15.1",
"@types/lodash": "4.14.136",
"@types/tinymce": "4.5.22",
"@types/node": "9.6.48",
"@types/react": "16.8.19",
"@types/react-autosuggest": "9.3.8",
"@types/node": "9.6.49",
"@types/react": "16.8.23",
"@types/react-autosuggest": "9.3.9",
"@types/react-color": "2.17.0",
"@types/react-dom": "16.8.4",
"@types/react-redux": "5.0.21",
"@types/react-router": "5.0.1",
"@types/react-router-dom": "4.3.3",
"@types/react-router": "5.0.2",
"@types/react-router-dom": "4.3.4",
"@types/react-swipeable-views": "0.12.2",
"@types/redux-logger": "3.0.7",
"@types/sprintf-js": "1.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ import { WithStyles, Icon, withStyles, Theme } from "@material-ui/core";
import { fade } from "@material-ui/core/styles/colorManipulator";
import { createStyles } from "@material-ui/core/styles";
import { commonString } from "../util/commonstrings";
import { debounce } from "lodash";

interface AppBarQueryProps {
onSearch?: (query?: string) => void;
onChange: (query: string) => void;
query: string;
}

interface AppBarQueryState {
searchText: string;
}
const styles = (theme: Theme) =>
createStyles({
queryWrapper: {
Expand Down Expand Up @@ -46,17 +49,39 @@ const styles = (theme: Theme) =>
});

class AppBarQuery extends React.Component<
AppBarQueryProps & WithStyles<"queryWrapper" | "queryIcon" | "queryField">
AppBarQueryProps & WithStyles<"queryWrapper" | "queryIcon" | "queryField">,
AppBarQueryState
> {
constructor(
props: AppBarQueryProps &
WithStyles<"queryWrapper" | "queryIcon" | "queryField">
) {
super(props);
this.state = {
searchText: ""
};
}

// Do a search after user stops typing for 500 milliseconds.
// Purescript passes a concrete search function to onChange.
debouncedSearch = debounce(() => {
this.props.onChange(this.state.searchText);
}, 500);

handleTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
this.setState(
{
searchText: e.target.value
},
() => {
this.debouncedSearch();
}
);
};

render() {
const { classes, onChange, query } = this.props;
const { classes } = this.props;
const { searchText } = this.state;
return (
<div className={classes.queryWrapper}>
<div className={classes.queryIcon}>
Expand All @@ -66,8 +91,8 @@ class AppBarQuery extends React.Component<
type="text"
aria-label={commonString.action.search}
className={classes.queryField}
value={query}
onChange={e => onChange(e.target.value)}
value={searchText}
onChange={this.handleTextChange}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import javax.servlet.http.HttpServletRequest
import javax.ws.rs._
import javax.ws.rs.core.Response.{ResponseBuilder, Status}
import javax.ws.rs.core.{Context, Response, StreamingOutput, UriInfo}
import org.jboss.resteasy.annotations.cache.NoCache

import scala.collection.JavaConverters._
import scala.concurrent.ExecutionContext.Implicits
Expand Down Expand Up @@ -82,6 +83,7 @@ class WizardApi {
}

@GET
@NoCache
@Path("state")
def getState(@PathParam("wizid") wizid: String, @Context req: HttpServletRequest): ItemState = {
withWizardState(wizid, req, false) { wsi =>
Expand Down Expand Up @@ -182,6 +184,7 @@ class WizardApi {

}

@NoCache
@GET
@Path("provider/{providerId}/{serviceId}")
def proxyGET(@PathParam("wizid") wizid: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
@Singleton
public class QtiAssessmentResultServiceImpl implements QtiAssessmentResultService {
private static final URI URI_SOURCE =
URI.create("uri://equella/" + ApplicationVersion.get().getMmr());
URI.create("uri://equella/" + ApplicationVersion.get().getSemanticVersion());

@Inject private QtiAssessmentResultDao dao;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public SectionResult renderHtml(RenderEventContext context) throws Exception {
.getBody()
.addReadyStatements(
CHECK_VERSION,
version.getMmr(),
version.getSemanticVersion(),
version.getCommit(),
version.getDisplay(),
VERSION_SERVER_URL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
@SuppressWarnings("nls")
@NonNullByDefault
public class ResourcesService {
private static String baseUrl = "p/r/" + ApplicationVersion.get().getMmr() + '/';
private static String baseUrl = "p/r/" + ApplicationVersion.get().getSemanticVersion() + '/';

private static Map<String, String> renamed =
ImmutableMap.<String, String>builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public SectionResult renderHtml(RenderEventContext context) {
if (!guest) {
Version version = ApplicationVersion.get();
model.setDisplayVersion(version.getDisplay());
model.setFullVersion(MessageFormat.format("{0} {1}", version.getMmr(), version.getCommit()));
model.setFullVersion(
MessageFormat.format("{0} {1}", version.getSemanticVersion(), version.getCommit()));
}
model.setDisplayLinks(!guest);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@
import java.io.Serializable;
import java.util.Date;
import java.util.Iterator;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

@Singleton
@NonNullByDefault
Expand All @@ -71,6 +74,8 @@ public class ReplicatedCacheServiceImpl
/** Caches identified by cacheId. */
private final Cache<String, ReplicatedCacheImpl<?>> caches = CacheBuilder.newBuilder().build();

private static final Log LOGGER = LogFactory.getLog(ReplicatedCacheServiceImpl.class);

@Override
public synchronized <V extends Serializable> ReplicatedCache<V> getCache(
String cacheId, long maxLocalCacheSize, long ttl, TimeUnit ttlUnit) {
Expand Down Expand Up @@ -144,15 +149,21 @@ public Optional<ExpiringValue<V>> load(String key)
@Override
public synchronized Optional<V> get(@NonNull String key) {
checkNotNull(key);
if (zookeeperService.isCluster()) {
cache.refresh(CurrentInstitution.get());
}

LoadingCache<String, Optional<ExpiringValue<V>>> c =
cache.getIfPresent(CurrentInstitution.get());
if (c != null) {
LoadingCache<String, Optional<ExpiringValue<V>>> c;
try {
c = cache.get(CurrentInstitution.get());
Optional<ExpiringValue<V>> op = c.getUnchecked(key);
if (op.isPresent()) {
V ev = op.get().getValue();
return Optional.fromNullable(ev);
}

} catch (ExecutionException e) {
LOGGER.error("Fail to access cache of institution " + CurrentInstitution.get());
}
return Optional.absent();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void init() {
if (version.isDevelopment()) {
prefix = "tasksdev/";
} else {
prefix = "tasks-" + version.getMmr() + '/';
prefix = "tasks-" + version.getSemanticVersion() + '/';
}
ZK_TASKPATH = prefix + ZK_TASKPATH;
ZK_GLOBALTASKPATH = prefix + ZK_GLOBALTASKPATH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

@SuppressWarnings("nls")
public final class Version {
private final String mmr; // MMR = major.minor.revision
private final String display;
private final String displayName;
private final String semanticVersion;
private final String commit;
private boolean dev;

Expand All @@ -49,17 +49,15 @@ public static Version load(Properties p) {
if (p == null) {
return new Version("dev" + new Random().nextInt(1000), "Development", "dev (dev)", true);
} else {
return new Version(
p.getProperty("version.mmr"),
p.getProperty("version.display"),
p.getProperty("version.commit"),
false);
String displayName = p.getProperty("version.display");
String semanticVersion = displayName.substring(0, displayName.indexOf("-"));
return new Version(semanticVersion, displayName, p.getProperty("version.commit"), false);
}
}

private Version(String mmr, String display, String commit, boolean dev) {
this.mmr = mmr;
this.display = display;
private Version(String semanticVersion, String displayName, String commit, boolean dev) {
this.semanticVersion = semanticVersion;
this.displayName = displayName;
this.commit = commit;
this.dev = dev;
}
Expand All @@ -72,16 +70,16 @@ public String getCommit() {
return commit;
}

public String getMmr() {
return mmr;
public String getSemanticVersion() {
return semanticVersion;
}

public String getDisplay() {
return display;
return displayName;
}

public String getFull() {
return MessageFormat.format("{0} ({1})", mmr, display);
return MessageFormat.format("{0} ({1})", semanticVersion, displayName);
}

/**
Expand Down Expand Up @@ -111,11 +109,11 @@ public boolean greaterVersionThan(String otherVersion) {

// Empty or non-digit this.version? Allow anything. Either way return
// false.
if (Check.isEmpty(mmr) || !Character.isDigit(mmr.charAt(0))) {
if (Check.isEmpty(semanticVersion) || !Character.isDigit(semanticVersion.charAt(0))) {
return false;
}

return getMajorMinorValue(mmr) > getMajorMinorValue(otherVersion);
return getMajorMinorValue(semanticVersion) > getMajorMinorValue(otherVersion);
}

/**
Expand Down
11 changes: 7 additions & 4 deletions Source/Server/equellaserver/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Path.rebase
import java.time.LocalDate
import java.time.format.DateTimeFormatter

javacOptions ++= Seq("-source", "1.8")

Expand All @@ -18,7 +20,7 @@ val axis2Version = "1.6.2"
val TomcatVersion = "8.5.41"
val SwaggerVersion = "1.5.22"
val RestEasyVersion = "3.5.0.Final"
val simpledbaVersion = "0.1.8-SNAPSHOT"
val simpledbaVersion = "0.1.9"
val circeVersion = "0.11.1"
val jsoupVersion = "1.11.3"
val sttpVersion = "1.5.11"
Expand Down Expand Up @@ -328,10 +330,11 @@ additionalPlugins := {
}

upgradeZip := {
val log = streams.value.log
val ver = equellaVersion.value
val log = streams.value.log
val ver = equellaVersion.value
var releaseDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
val outZip
: File = target.value / s"tle-upgrade-${ver.majorMinor}.r${ver.commits} (${ver.majorMinor}-${ver.releaseType}).zip"
: File = target.value / s"tle-upgrade-${ver.major}.${ver.minor}.r${releaseDate} (${ver.semanticVersion}-${ver.releaseType}).zip"
val plugVer = ver.fullVersion
val zipFiles = Seq(
assembly.value -> "equella-server.jar",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,10 @@ public void upgrade(UpgradeResult result, File tleInstallDir) throws Exception {

private File getUpgradeZip(Path installPath, File versionProps) throws ConfigurationException {
final PropertiesConfiguration props = new PropertiesConfiguration(versionProps);
final String mmr = (String) props.getProperty("version.mmr");
final String display = (String) props.getProperty("version.display");
String filename = MessageFormat.format("tle-upgrade-{0} ({1}).zip", mmr, display);
final String displayName = (String) props.getProperty("version.display");
final String semanticVersion = displayName.substring(0, displayName.indexOf("-"));
String filename =
MessageFormat.format("tle-upgrade-{0} ({1}).zip", semanticVersion, displayName);
return installPath.resolve("manager/updates/" + filename).toFile();
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Tools/UpgradeManager/resources/templates/main.st
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ $("templates/page")(script={
<form id="mainform" action="$buttonAction$" method="get">
<dl id="statusversion">
<dt>Deployed Version:</dt>
<dd>$version.displayName$ <span style="color: #AAAAAA;"> ($version.mmr$) </span></dd>
<dd>$version.displayName$ <span style="color: #AAAAAA;"> ($version.semanticVersion$) </span></dd>
<dt>Server Status:</dt>
<dd id="ajaxstatus">...</dd>
</dl>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$("templates/heading-content")(heading=heading, content={
$if(versions)$
<ul>
$versions:{<li><input id="version$it.mmr$" class="version-item" type="radio" name="version" value="$it.filename$" /><label for="version$it.mmr$">$it.displayName$ <span style="color: #AAAAAA;"> ($it.mmr$) </span></label> </li>}$
$versions:{<li><input id="version$it.semanticVersion$" class="version-item" type="radio" name="version" value="$it.filename$" /><label for="version$it.semanticVersion$">$it.displayName$ <span style="color: #AAAAAA;"> ($it.semanticVersion$) </span></label> </li>}$
</ul>
$else$
No versions found
$endif$
})$
})$
Loading

0 comments on commit 3a1c903

Please sign in to comment.