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

#7629 fix vertical jumping during maven download #7634

Merged
merged 1 commit into from
Jul 3, 2018
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
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