Performance optimazations

This commit is contained in:
Pieter Vander Vennet 2022-01-26 20:47:08 +01:00
parent 632e7e9f9a
commit d2b245ab54
15 changed files with 321 additions and 214 deletions

View file

@ -161,8 +161,6 @@ class AutomationPanel extends Combine{
whenDone("empty")
return true;
}
stateToShow.setData("Applying metatags")
pipeline.updateAllMetaTagging("triggered by automaton")
stateToShow.setData("Gathering applicable elements")
let handled = 0
@ -178,7 +176,7 @@ class AutomationPanel extends Combine{
const feature = ffs.feature
const renderingTr = targetAction.GetRenderValue(feature.properties)
const rendering = renderingTr.txt
log.push("<a href='https://openstreetmap.org/"+feature.properties.id+"' target='_blank'>"+feature.properties.id+"</a>: "+new SubstitutedTranslation(renderingTr, new UIEventSource<any>(feature.properties), state).ConstructElement().innerText)
log.push("<a href='https://openstreetmap.org/"+feature.properties.id+"' target='_blank'>"+feature.properties.id+"</a>: "+new SubstitutedTranslation(renderingTr, new UIEventSource<any>(feature.properties), undefined).ConstructElement().innerText)
const actions = Utils.NoNull(SubstitutedTranslation.ExtractSpecialComponents(rendering)
.map(obj => obj.special))
for (const action of actions) {

View file

@ -18,6 +18,8 @@ import {SubstitutedTranslation} from "../SubstitutedTranslation";
import ValidatedTextField from "../Input/ValidatedTextField";
import {QueryParameters} from "../../Logic/Web/QueryParameters";
import {TagUtils} from "../../Logic/Tags/TagUtils";
import {InputElement} from "../Input/InputElement";
import {DropDown} from "../Input/DropDown";
export default class FilterView extends VariableUiElement {
constructor(filteredLayer: UIEventSource<FilteredLayer[]>, tileLayers: { config: TilesourceConfig, isDisplayed: UIEventSource<boolean> }[]) {
@ -242,17 +244,26 @@ export default class FilterView extends VariableUiElement {
const values : FilterState[] = options.map((f, i) => ({
currentFilter: f.osmTags, state: i
}))
const radio = new RadioButton(
options.map(
(option, i) =>
new FixedInputElement(option.question.Clone().SetClass("block"), i)
),
{
dontStyle: true
}
);
return [radio,
radio.GetValue().map(
let filterPicker : InputElement<number>
if(options.length <= 6){
filterPicker = new RadioButton(
options.map(
(option, i) =>
new FixedInputElement(option.question.Clone().SetClass("block"), i)
),
{
dontStyle: true
}
);
}else{
filterPicker = new DropDown("", options.map((option, i) => ({
value: i, shown: option.question.Clone()
})))
}
return [filterPicker,
filterPicker.GetValue().map(
i => values[i],
[],
selected => {

View file

@ -1,6 +1,7 @@
import Translations from "./i18n/Translations";
import {VariableUiElement} from "./Base/VariableUIElement";
import FeaturePipelineState from "../Logic/State/FeaturePipelineState";
import Loading from "./Base/Loading";
export default class CenterMessageBox extends VariableUiElement {
@ -10,7 +11,7 @@ export default class CenterMessageBox extends VariableUiElement {
const message = updater.runningQuery.map(
isRunning => {
if (isRunning) {
return {el: t.loadingData};
return {el: new Loading(t.loadingData)};
}
if (!updater.sufficientlyZoomed.data) {
return {el: t.zoomIn}
@ -26,8 +27,8 @@ export default class CenterMessageBox extends VariableUiElement {
super(message.map(toShow => toShow.el))
this.SetClass("block " +
"rounded-3xl bg-white text-xl font-bold text-center pointer-events-none p-4")
this.SetClass("flex justify-around " +
"rounded-3xl bg-white text-xl font-bold pointer-events-none p-4")
this.SetStyle("transition: opacity 750ms linear")
message.addCallbackAndRun(toShow => {