Studio: some fixes, show user id when running localhost

This commit is contained in:
Pieter Vander Vennet 2023-12-03 03:33:02 +01:00
parent 26214ed2a3
commit 09ea799ad4
2 changed files with 45 additions and 22 deletions

View file

@ -12,10 +12,11 @@
export let osmConnection: OsmConnection
let displayName = UIEventSource.FromPromise(
osmConnection.getInformationAboutUser(info.owner)
osmConnection.getInformationAboutUser(info.owner),
).mapD((response) => response.display_name)
let selfId = osmConnection.userDetails.mapD((ud) => ud.uid)
function fetchIconDescription(layerId): any {
if (category === "themes") {
return AllKnownLayouts.allKnownLayouts.get(layerId).icon
@ -32,6 +33,14 @@
</div>
<b class="px-1">{info.id}</b>
{#if info.owner && info.owner !== $selfId}
(made by {$displayName ?? info.owner})
{#if $displayName}
(made by {$displayName}
{#if window.location.host.startsWith("127.0.0.1")}
- {info.owner}
{/if}
)
{:else }
({info.owner})
{/if}
{/if}
</NextButton>

View file

@ -299,6 +299,9 @@ export default class EditLayerState extends EditJsonState<LayerConfigJson> {
function cleanArray(data: object, key: string): boolean{
if(!data){
return false
}
if (data[key]) {
// A bit of cleanup
const lBefore = data[key].length
@ -312,7 +315,18 @@ export default class EditLayerState extends EditJsonState<LayerConfigJson> {
}
this.configuration.addCallbackAndRunD((layer) => {
const changed = cleanArray(layer, "tagRenderings") || cleanArray(layer, "pointRenderings")
let changed = cleanArray(layer, "tagRenderings") || cleanArray(layer, "pointRenderings")
for (const tr of layer.tagRenderings ?? []) {
if(typeof tr === "string"){
continue
}
const qtr = (<QuestionableTagRenderingConfigJson> tr)
if(qtr.freeform && Object.keys(qtr.freeform ).length === 0){
delete qtr.freeform
changed = true
}
}
if(changed){
this.configuration.ping()
}