Skip to content

Permalink and state

Stéphane Brunner edited this page Nov 23, 2022 · 21 revisions

Interaction between the Login, the Permalink, and the Layertree throw the state.

graph TD;
    PSO[(Original Permalink State)];
    PS[(Permalink State)];
    CS[(Layer Tree State)];
    subgraph Permalink responcability area
    URL
    PC1[The UI - share];
    PC2[Set to the URL];
    end
    subgraph Layer Tree responcability area
    C1[Original permalink mapper];
    C2[Permalink mapper];
    C3[The UI];
    C4[Search action to state converter];
    C5[The Map];
    end    
    subgraph Other responcability area
    O[Component]
    end
    URL-->PSO;
    PS-->PC1;
    PS-->PC2;
    PSO-->C1;
    C1-->CS;
    CS-->C2;
    C2-->PS;
    O --> C4;
    O -- or dirrectly --> CS;
    CS -- update UI from state --> C3;
    C3 --> CS;
    CS-->C5;
    C4-->CS
Loading

All the UI changes should pass throw the state - no direct changes.

In a simpler component than the layer tree, we will not have a dedicated RXJS state (just an internal state)

The permalink states will be a dictionary with str -> str.

The layertree state can be something like:

{
  "root": {
    "name": "<name of open theme>",
    "children_ids": [...]
    ...
  },
  <id-calculated-by-ngeo>: <same as the theme>
}

Of hierarchic state?

We will probably also have:

  • Something to store the result of the tree web service.
  • Some event to communicate with the search, the filter, ...

== Permalink state (Persistent state) ==

Initially:

state:

{}

event:

new_state(
  "tree", 
  {
    "tree_groups": "OSM functions mixed",
    "tree_enable_osm_firestations": "no"
  }
);

=> state:

{ 
  "tree": {
    "tree_groups": "OSM functions mixed",
    "tree_enable_osm_firestations": "no"
  }
}

event:

new_state(
  "theme", 
  {
    "theme": "Test"
  }
);

=> state:

{ 
  "tree": {
    "tree_groups": "OSM functions mixed",
    "tree_enable_osm_firestations": "no"
  },
  "theme": {
    "theme": "Test"
  }
}

event:

new_state(
  "tree", 
  {
    "tree_groups": "Test",
    "tree_enable_test": "yes",
  }
);

=> state:

{ 
  "tree": {
    "tree_groups": "test",
    "tree_enable_test": "yes"
  },
  "theme": {
    "theme": "Test"
  }
}

Note: that tree_enable_osm_firestations is removed.

To create the URL we combine all the state => ?tree_groups=test&tree_enable_test=yes&theme=Test

If two components have the same key, it's an error => to be defined what we will do...

Clone this wiki locally