Skip to content

Commit

Permalink
attempting to fix missing production dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
jflamy committed Sep 12, 2023
1 parent e8e5e5c commit 4257eb5
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 102 deletions.
2 changes: 1 addition & 1 deletion launch/owlcms h2 no reset.launch
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="owlcms"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="owlcms"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dvaadin.frontend.hotdeploy=false -Dlogback.configurationFile=logback-console.xml -Dvaadin.devmode.devTools.enabled=true"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dvaadin.frontend.hotdeploy=true &#13;&#10; -Dvaadin.devmode.devTools.enabled=true&#13;&#10; -Dlogback.configurationFile=logback-console.xml"/>
</launchConfiguration>
1 change: 1 addition & 0 deletions owlcms/frontend/components/AttemptBoard.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class CurrentAttempt extends LitElement {

firstUpdated(_changedProperties) {
super.firstUpdated(_changedProperties);
this.$server.openDialog();
}

isBreak() {
Expand Down
1 change: 1 addition & 0 deletions owlcms/frontend/components/DecisionBoard.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class DecisionBoard extends LitElement {

firstUpdated(_changedProperties) {
super.firstUpdated(_changedProperties);
this.$server.openDialog();
}

isBreak() {
Expand Down
1 change: 1 addition & 0 deletions owlcms/frontend/components/Results.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ class Results extends LitElement {
console.debug("ready");
super.firstUpdated(_changedProperties);
document.body.setAttribute("theme", "dark");
this.$server.openDialog();
}

start() {
Expand Down
1 change: 1 addition & 0 deletions owlcms/frontend/components/ResultsLeadersRanks.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ class ResultsFull extends LitElement {
console.debug("ready");
super.firstUpdated(_changedProperties);
document.body.setAttribute("theme", "dark");
this.$server.openDialog();
}

start() {
Expand Down
1 change: 1 addition & 0 deletions owlcms/frontend/components/ResultsMedals.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class ResultsMedals extends LitElement {
console.debug("ready");
super.firstUpdated(_changedProperties);
document.body.setAttribute("theme", "dark");
this.$server.openDialog();
}

start() {
Expand Down
1 change: 1 addition & 0 deletions owlcms/frontend/components/TimerElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class TimerElement extends LitElement {

updateTime(time) {
var newTime = this._formatTime(time);
if (newTime == "NaN:NaN") return;
if (newTime != this.lastTime) {
var s = this.renderRoot.querySelector('#timer');
if (s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public default boolean isSwitchableDisplay() {
}

public default void openDialog(Dialog dialog) {
// logger.debug("openDialog {} {}", dialog, dialog.isOpened());
logger.warn("openDialog {} {}", dialog, (dialog != null ? dialog.isOpened() : "-"));
if (dialog == null) {
buildDialog((Component)this);
dialog = this.getDialog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
package app.owlcms.displays.attemptboard;

import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.ClientCallable;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.internal.AllowInert;
import com.vaadin.flow.router.Route;

import app.owlcms.init.OwlcmsSession;
Expand Down Expand Up @@ -59,4 +61,11 @@ protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
decisions.setPublicFacing(false);
}

@AllowInert
@ClientCallable
@Override
public void openDialog() {
super.openDialog(getDialog());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.dialog.Dialog;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.internal.AllowInert;
import com.vaadin.flow.component.littemplate.LitTemplate;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.notification.Notification.Position;
Expand Down Expand Up @@ -298,9 +299,11 @@ public boolean isVideo() {
return video;
}

@AllowInert
@ClientCallable
@Override
public void openDialog() {
logger.warn("openDialog called");
DisplayParameters.super.openDialog(getDialog());
}

Expand Down Expand Up @@ -789,7 +792,6 @@ protected void onAttach(AttachEvent attachEvent) {
syncWithFOP(fop);
// we send on fopEventBus, listen on uiEventBus.
uiEventBus = uiEventBusRegister(this, fop);
openDialog();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

import com.google.common.eventbus.Subscribe;
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.ClientCallable;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.internal.AllowInert;
import com.vaadin.flow.router.Route;

import app.owlcms.data.config.Config;
Expand Down Expand Up @@ -95,4 +97,12 @@ protected void onAttach(AttachEvent attachEvent) {
decisions.setDontReset(true);
setSilenced(isSilencedByDefault());
}


@AllowInert
@ClientCallable
@Override
public void openDialog() {
super.openDialog(getDialog());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,6 @@ protected void onAttach(AttachEvent attachEvent) {
getElement().setProperty("showLiftRanks",
Competition.getCurrent().isSnatchCJTotalMedals() && !Competition.getCurrent().isSinclair());
SoundUtils.enableAudioContextNotification(this.getElement());
openDialog();
}

protected void setAbbreviateName(boolean abbreviateNames) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@

import org.slf4j.LoggerFactory;

import com.vaadin.flow.component.ClientCallable;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.internal.AllowInert;
import com.vaadin.flow.router.Route;

import app.owlcms.data.agegroup.AgeGroup;
Expand Down Expand Up @@ -58,34 +60,14 @@ public String getPageTitle() {
return getTranslation("ScoreboardMultiRanksTitle") + OwlcmsSession.getFopNameIfMultiple();
}

private JsonValue getRanksJson(Athlete a, Ranking r, LinkedHashMap<String, Participation> ageGroupMap2) {
JsonArray ranks = Json.createArray();
int i = 0;
for (Entry<String, Participation> e : ageGroupMap.entrySet()) {
Participation p = e.getValue();
// logger,debug("a {} k {} v {}", a.getShortName(), e.getKey(), p);
if (p == null) {
ranks.set(i, formatRank(null));
} else {
switch (r) {
case CLEANJERK:
ranks.set(i, formatRank(p.getCleanJerkRank()));
break;
case SNATCH:
ranks.set(i, formatRank(p.getSnatchRank()));
break;
case TOTAL:
ranks.set(i, formatRank(p.getTotalRank()));
break;
default:
break;
}
}
i++;
}
return ranks;
@AllowInert
@ClientCallable
@Override
public void openDialog() {
super.openDialog(getDialog());
}

@Override
protected String formatRank(Integer total) {
if (total == null) {
return "&nbsp;";
Expand All @@ -98,29 +80,6 @@ protected String formatRank(Integer total) {
}
}

private void setCurrentAthleteParticipations(Athlete a) {
OwlcmsSession.withFop(fop -> {
ageGroupMap = new LinkedHashMap<>(fop.getAgeGroupMap());
for (Entry<String, Participation> cape : ageGroupMap.entrySet()) {
cape.setValue(null);
}
if (a != null) {
// logger,debug(">>>setCurrentAthleteParticipations begin");
// logger,debug("setting {}", a.getShortName());
for (Participation p : a.getParticipations()) {
AgeGroup ag = p.getCategory() != null ? p.getCategory().getAgeGroup() : null;
if (ag != null) {
// logger,debug("athlete {} curRankings {} {}", a, ag.getCode(), p);
ageGroupMap.put(ag.getCode(), p);
}
}
// logger,debug("<<<setCurrentAthleteParticipations end");
} else {
// logger,debug("+++ cleared");
}
});
}

@Override
protected JsonArray getAgeGroupNamesJson(LinkedHashMap<String, Participation> currentAthleteParticipations) {
JsonArray ageGroups = Json.createArray();
Expand Down Expand Up @@ -182,7 +141,58 @@ protected void getAthleteJson(Athlete a, JsonObject ja, Category curCat, int lif
}
// logger.debug("{} {} {}", a.getShortName(), fop.getState(), highlight);
ja.put("classname", highlight);

setTeamFlag(a, ja);
}

private JsonValue getRanksJson(Athlete a, Ranking r, LinkedHashMap<String, Participation> ageGroupMap2) {
JsonArray ranks = Json.createArray();
int i = 0;
for (Entry<String, Participation> e : ageGroupMap.entrySet()) {
Participation p = e.getValue();
// logger,debug("a {} k {} v {}", a.getShortName(), e.getKey(), p);
if (p == null) {
ranks.set(i, formatRank(null));
} else {
switch (r) {
case CLEANJERK:
ranks.set(i, formatRank(p.getCleanJerkRank()));
break;
case SNATCH:
ranks.set(i, formatRank(p.getSnatchRank()));
break;
case TOTAL:
ranks.set(i, formatRank(p.getTotalRank()));
break;
default:
break;
}
}
i++;
}
return ranks;
}

private void setCurrentAthleteParticipations(Athlete a) {
OwlcmsSession.withFop(fop -> {
ageGroupMap = new LinkedHashMap<>(fop.getAgeGroupMap());
for (Entry<String, Participation> cape : ageGroupMap.entrySet()) {
cape.setValue(null);
}
if (a != null) {
// logger,debug(">>>setCurrentAthleteParticipations begin");
// logger,debug("setting {}", a.getShortName());
for (Participation p : a.getParticipations()) {
AgeGroup ag = p.getCategory() != null ? p.getCategory().getAgeGroup() : null;
if (ag != null) {
// logger,debug("athlete {} curRankings {} {}", a, ag.getCode(), p);
ageGroupMap.put(ag.getCode(), p);
}
}
// logger,debug("<<<setCurrentAthleteParticipations end");
} else {
// logger,debug("+++ cleared");
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import java.util.List;
import java.util.function.BiPredicate;

import com.vaadin.flow.component.ClientCallable;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.internal.AllowInert;
import com.vaadin.flow.router.Route;

import app.owlcms.data.athlete.Athlete;
Expand All @@ -31,6 +33,13 @@ public String getPageTitle() {
return getTranslation("Scoreboard.LiftingOrder") + OwlcmsSession.getFopNameIfMultiple();
}

@AllowInert
@ClientCallable
@Override
public void openDialog() {
super.openDialog(getDialog());
}

@Override
protected int countSubsets(List<Athlete> athlete) {
boolean snatchPresent = (athlete.get(0).getActuallyAttemptedLifts() < 3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@

import org.slf4j.LoggerFactory;

import com.vaadin.flow.component.ClientCallable;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.internal.AllowInert;
import com.vaadin.flow.router.Location;
import com.vaadin.flow.router.Route;

Expand All @@ -34,7 +36,7 @@
@Route("displays/results")

public class ResultsNoLeaders extends Results {

Logger logger = (Logger) LoggerFactory.getLogger(ResultsNoLeaders.class);

/**
Expand All @@ -54,9 +56,17 @@ public ResultsNoLeaders() {
public String getPageTitle() {
return getTranslation("Scoreboard") + OwlcmsSession.getFopNameIfMultiple();
}


@AllowInert
@ClientCallable
@Override
public void openDialog() {
super.openDialog(getDialog());
}

/**
* @see app.owlcms.apputils.queryparameters.DisplayParameters#readParams(com.vaadin.flow.router.Location, java.util.Map)
* @see app.owlcms.apputils.queryparameters.DisplayParameters#readParams(com.vaadin.flow.router.Location,
* java.util.Map)
*/
@Override
public HashMap<String, List<String>> readParams(Location location, Map<String, List<String>> parametersMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import java.util.List;

import com.vaadin.flow.component.ClientCallable;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.internal.AllowInert;
import com.vaadin.flow.router.Route;

import app.owlcms.data.athlete.Athlete;
Expand All @@ -30,6 +32,13 @@ public String getPageTitle() {
return getTranslation("Scoreboard.RankingOrder") + OwlcmsSession.getFopNameIfMultiple();
}

@AllowInert
@ClientCallable
@Override
public void openDialog() {
super.openDialog(getDialog());
}

@Override
protected List<Athlete> getOrder(FieldOfPlay fop) {
return fop.getResultsOrder();
Expand Down
Loading

0 comments on commit 4257eb5

Please sign in to comment.