Skip to content

Commit

Permalink
#7629 fix vertical jumping during maven download
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz Jurowicz committed Jul 3, 2018
1 parent 7b908da commit 4646f96
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
6 changes: 6 additions & 0 deletions js/notebook/src/shared/style/beakerx.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
}
}

.text-ellipsis * {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.bko-modal {
position: absolute;
left: 50%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static java.util.Arrays.asList;
import static org.apache.commons.io.FileUtils.byteCountToDisplaySize;

public class MvnLoggerWidget {
Expand All @@ -44,9 +45,11 @@ public MvnLoggerWidget(Message parentMessage) {
@Override
public void run() {
if (jarNumbers > 0) {
String info = getInfo(currentLine);
String sizeWithUnit = byteCountToDisplaySize(new Double(sizeInKb * 1000).longValue());
String status = String.format("%d jar%s, %s downloaded at %s", jarNumbers, getPluralFormWhenNumberOfJarGreaterThanOne(), sizeWithUnit, speed);
String status = String.format("%d jar%s, %s downloaded at %s %s", jarNumbers, getPluralFormWhenNumberOfJarGreaterThanOne(), sizeWithUnit, speed, info);
widget.setValue(status + "</br>" + formatCurrentLine());
widget.setDomClasses(asList("text-ellipsis"));
}
}
}, 0, PERIOD);
Expand Down Expand Up @@ -79,10 +82,9 @@ private String calculateSpeed(String[] info) {
}

private String[] split(String line) {
Pattern pattern = Pattern.compile("\\((.*?)\\)");
Matcher matcher = pattern.matcher(line);
if (matcher.find()) {
String infoWithBrackets = matcher.group();
String infoWithBrackets = this.getInfo(line);

if (infoWithBrackets != null) {
return infoWithBrackets.replace("(", "").
replace(")", "").
split(" ");
Expand All @@ -91,6 +93,17 @@ private String[] split(String line) {
return new String[0];
}

private String getInfo(String line) {
Pattern pattern = Pattern.compile("\\((.*?)\\)");
Matcher matcher = pattern.matcher(line);
if (matcher.find()) {
String infoWithBrackets = matcher.group();
return infoWithBrackets;

}
return null;
}

private double calculateJarSizeInKb(String[] info) {
String unit = info[1];
if (unit.toLowerCase().equals("kb")) {
Expand Down

0 comments on commit 4646f96

Please sign in to comment.