georchestra / mapstore2-georchestra

geOrchestra newest viewer
Other
6 stars 23 forks source link

Layer Editing - Attribute Editor #49

Closed tdipisa closed 4 years ago

tdipisa commented 5 years ago

In edit mode within the attribute panel, each attribute field must provide the following if configured:

Coded values, validation format and min/max limits can be defined by the administrator inside the plugin configuration during the viewer context creation.

These kind of support is layer dependent, this means that inside the attribute table configuration the administrator must include specific configuration properties for each layer for which he wants to provide the above (coded values and validations).

Issue in MapStore: https://github.com/geosolutions-it/MapStore2/issues/5230

offtherailz commented 4 years ago

We have custom editor options: See this dependent project. https://github.com/geosolutions-it/MapStore2-C040/blob/master/localConfig.json#L368

where you define RULES (regex that apply identify the layer and the attribute to apply) and each rule can use a custom editor.

The linked config has a custom editor called "AddressesEditor", that is a customization present only in that installation.

In MapStore we have only "DropDownEditor" that can be configured with a fixed list of values (this covers the first point). We can add a NumberEditor that can be used to define min and max and a FormatEditor that checks if the content matches a regex.

MaelREBOUX commented 4 years ago

As seen this morning I find that using the configuration of the attribute table plugin is more suitable for my personnal use cases.

These kind of support is layer dependent, this means that inside the attribute table configuration the administrator must include specific configuration properties for each layer for which he wants to provide the above (coded values and validations).

Need to test ;)

offtherailz commented 4 years ago

I report some additional information about the meeting:

MaelREBOUX commented 4 years ago

This is the test layer layer for editing : https://public-test.sig.rennesmetropole.fr/geoserver/wfs?REQUEST=DescribeFeatureType&TYPENAME=test:mapstore_test

But I have issues to correctly set up the permissions for being editing by anyone in WFS. It is not ou traditionnal way...

CREATE TABLE mapstore_test
(
    id integer NOT NULL DEFAULT nextval('urba_foncier.mapstore_test_id_seq'::regclass),
    att_integer integer,
    att_integer_constr integer NOT NULL,
    att_long numeric,
    att_varchar character varying(50) COLLATE pg_catalog."default" DEFAULT ''::character varying,
    att_varchar_constr character varying(50) COLLATE pg_catalog."default" DEFAULT ''::character varying,
    att_text text COLLATE pg_catalog."default",
    att_text_constr text COLLATE pg_catalog."default",
    att_url text COLLATE pg_catalog."default",
    att_boolen boolean,
    att_date_iso date,
    att_date_timestamp timestamp without time zone DEFAULT now(),
    geom geometry(Point,3948),
    CONSTRAINT mapstore_test_pk PRIMARY KEY (id)
        USING INDEX TABLESPACE bdu,
    CONSTRAINT att_varchar_constr_dom CHECK (att_varchar_constr::text = ANY (ARRAY['Non renseigné'::text, 'Publicité'::text, 'Pré-enseigne'::text, 'Enseigne'::text])),
    CONSTRAINT att_integer_constr_check CHECK (att_integer_constr < 5),
    CONSTRAINT att_text_constr_dom CHECK (att_text_constr = ANY (ARRAY['non renseigné'::text, 'permanent'::text, 'temporaire'::text]))
)
MaelREBOUX commented 4 years ago

@offtherailz @tdipisa

I still cannot correctly set up the permissions for obtain a WFS layer edited by anyone (ie not authentificated). I wrote a message to the mailing list for support. Could you help ?

tdipisa commented 4 years ago

@MaelREBOUX I will check it tomorrow, thank you anyway.

tdipisa commented 4 years ago

@MaelREBOUX

I still cannot correctly set up the permissions for obtain a WFS layer edited by anyone (ie not authentificated).

I saw that in our DEV instance of geOrchestra there is a specific security rule at WFS service level that prevent other users (also anonymous) to write data through WFS

image

I'm quite confident that you have something similar in your public-test instance. Therefore I don't think that you can provide write access to us on test:mapstore_test.

Maybe you can share an export of the dataset in SHP format? If you can do that we can publish it in our DEV instance.

Anyway I think that we don't necessarily need to finally save a modification, what we have to do here is to properly setup the edit mode in MS according to the data and the configuration of the plugin for that layer.

MaelREBOUX commented 4 years ago

Sad news but logical for geOrchestra : need to be authentificated for this kind of work.

From our point of view it is important to test in the conditions of production, ie : table with constraints.

So... I think you have a PostGIS database on the demo platform ? If yes : could you create the layer described above : https://github.com/georchestra/mapstore2-georchestra/issues/49#issuecomment-614747779

tdipisa commented 4 years ago

@MaelREBOUX

Sad news but logical for geOrchestra : need to be authentificated for this kind of work.

Of course, that's exactly what I supposed in my previous comment.

From our point of view it is important to test in the conditions of production, ie : table with constraints.

OK

So... I think you have a PostGIS database on the demo platform ? If yes : could you create the layer described above : #49 (comment)

OK, let's try with this

randomorder commented 4 years ago

@tdipisa I created a database and table on our DEV environment. I just had to tweak a little the creation script (we don't have a bdu tablespace or a urba_foncier schema):

geoserver=> CREATE TABLE mapstore_test
(
    id integer NOT NULL DEFAULT nextval('mapstore_test_id_seq'::regclass),
    att_integer integer,
    att_integer_constr integer NOT NULL,
    att_long numeric,
    att_varchar character varying(50) COLLATE pg_catalog."default" DEFAULT ''::character varying,
    att_varchar_constr character varying(50) COLLATE pg_catalog."default" DEFAULT ''::character varying,
    att_text text COLLATE pg_catalog."default",
    att_text_constr text COLLATE pg_catalog."default",
    att_url text COLLATE pg_catalog."default",
    att_boolen boolean,
    att_date_iso date,
    att_date_timestamp timestamp without time zone DEFAULT now(),
    geom geometry(Point,3948),
    CONSTRAINT mapstore_test_pk PRIMARY KEY (id),
    CONSTRAINT att_varchar_constr_dom CHECK (att_varchar_constr::text = ANY (ARRAY['Non renseigné'::text, 'Publicité'::text, 'Pré-enseigne'::text, 'Enseigne'::text])),                                                                                                                                                                           CONSTRAINT att_integer_constr_check CHECK (att_integer_constr < 5),
    CONSTRAINT att_text_constr_dom CHECK (att_text_constr = ANY (ARRAY['non renseigné'::text, 'permanent'::text, 'temporaire'::text]))
);
CREATE TABLE

More detail in the doc for the DEV server. The layer is published here

Any issues let me know

tdipisa commented 4 years ago

@randomorder Thank you so much for this. You forgot to include this constraint:

CONSTRAINT att_integer_constr_check CHECK (att_integer_constr < 5),

@offtherailz @vlt1 I've pepared this context in our DEV where I've populated the layer with some points. Constraints are properly working DB side.

tdipisa commented 4 years ago

@MaelREBOUX I think we are ready now, thank you.