Actually, I just discovered it is possible after all to select the null wokrspace, but you have to select a line that is only one pixel high :/

I could fix this in an international manner, but what do you mean with "configurable"?

Regards

Niels


On 17/07/2019 10:05, Andrea Aime wrote:
Hi,
so yesterday I did a quick check, a way to have Select2 show up the "unselected" option is to make it a non empty string,
something rough like this seems to work:

diff --git a/src/web/core/src/main/java/org/geoserver/web/wicket/Select2DropDownChoice.java b/src/web/core/src/main/java/org/geoserver/web/wicket/Select2DropDownChoice.java
index 8f363b6e2c..7ab1257c83 100644
--- a/src/web/core/src/main/java/org/geoserver/web/wicket/Select2DropDownChoice.java +++ b/src/web/core/src/main/java/org/geoserver/web/wicket/Select2DropDownChoice.java
@@ -9,12 +9,14 @@ import org.apache.wicket.Component;
 import org.apache.wicket.behavior.Behavior;
 import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
 import org.apache.wicket.markup.head.OnLoadHeaderItem;
 import org.apache.wicket.markup.html.form.DropDownChoice;
 import org.apache.wicket.markup.html.form.IChoiceRenderer;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.request.resource.PackageResourceReference;
 import org.wicketstuff.select2.Select2Behavior;
+import org.wicketstuff.select2.Select2ResourcesBehavior;

 /** Auto-complete version of a {@link org.apache.wicket.markup.html.form.DropDownChoice} */
 public class Select2DropDownChoice<T> extends DropDownChoice<T> {
@@ -70,6 +72,11 @@ public class Select2DropDownChoice<T> extends DropDownChoice<T> {
         initBehaviors();
     }

+    @Override
+    protected String getNullValidDisplayValue() {
+        return "-No workspace-";
+    }
+
     private void initBehaviors() {
         add(new Select2Behavior());
         add(new KeyboardBehavior());

Of course it's not done, it would have to be made configurable and internationalized. Don't think I can work on it, have to finish a few things before vacation with family next week, anyone interested in picking this up?
Otherwise let's just open a ticket with a summary of this discussion

Cheers
Andrea



On Tue, Jul 16, 2019 at 7:48 PM Andrea Aime <[email protected] <mailto:[email protected]>> wrote:

    Hi Jody,
    interesting... the option is actually there, but the auto-complete
    dropdown does not seem to show it.
    From the current development series:

    <select wicket:id="workspace" name="context:panel:workspace"
    id="workspace4e">

        <option value=""></option>

        <option selected="selected"
    value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ff3">cite</option>

        <option
    
value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ffb">it.geosolutions</option>


        <option
    value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ff7">nurc</option>

        <option
    value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ff9">sde</option>

        <option
    value="WorkspaceInfoImpl--570ae188:124761b8d78:-7fff">sf</option>

        <option
    value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ff5">tiger</option>

        <option
    value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ffd">topp</option>

    Cheers
    Andrea      </select>



    On Tue, Jul 16, 2019 at 7:38 PM Jody Garnett
    <[email protected] <mailto:[email protected]>> wrote:

        I think I have changed a style back to global, when
        accidentally creating it in a workspace... checking now.

        Okay that functionality worked in GeoServer 2.9.4 (last
        release before the new style editor) but no longer works now.

        The prior style editor had an empty entry at the top of the
        list to represent the global style folder.

        <select name="workspace">
        <option selected="selected" value=""></option>
        <option
        value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ff3">cite</option>
        <option
        
value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ffb">it.geosolutions</option>
        <option
        value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ff7">nurc</option>
        <option
        value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ff9">sde</option>
        <option
        value="WorkspaceInfoImpl--570ae188:124761b8d78:-7fff">sf</option>
        <option
        value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ff5">tiger</option>
        <option
        value="WorkspaceInfoImpl--570ae188:124761b8d78:-7ffd">topp</option>
        </select>


        --
        Jody Garnett


        On Tue, 16 Jul 2019 at 02:27, Niels Charlier <[email protected]
        <mailto:[email protected]>> wrote:

            The SLD file is moved and all of its images copied (copied
            because it might be used by multiple styles), this is all
            handled by GeoServerResourcePersister.

            This works the same via GUI or REST. All that needs to
            happen is remove the IF-block that prevents it in the
            StyleController.

            The only issue I see is that it is not possible to set
            workspace back to NULL. I don't see a clear way to resolve
            that, because it is a general principle of the geoserver
            REST that null values are ignored in PUTs (so the user
            must not specify fields that have not changed). Changing
            this principle for the workspace field only would break
            consistency and backwards compatibility. It is a
            functional question to think about.

            On the other side, it is a not a very likely use case
            (changing workspace back to null). I just discovered that
            this is not even possible with the GUI, because the
            dropdown doesn't have null valid set to true. Nobody has
            complained about that either.

            Kind Regards
            Niels

            On 15/07/2019 10:48, Andrea Aime wrote:
            I believe changing workspace is allowed via UI right? If
            so, I don't see a reason to disallow from REST,
            provided it ends up behaving the same (see if the UI code
            moves only the style or also the symbols associated).

            Cheers
            Andrea

            On Thu, Jul 11, 2019 at 10:43 AM Niels Charlier
            <[email protected] <mailto:[email protected]>> wrote:

                Hello,

                At the moment it is not possible to change the
                workspace of a style with
                a REST put request. This is explicitly prevented by a
                block of code:

                
https://github.com/geoserver/geoserver/blob/master/src/restconfig/src/main/java/org/geoserver/rest/catalog/StyleController.java#L474

                However, when this check is removed, it seems to work
                fine to change the
                workspace of a style this way. After all this is
                already allowed in the
                GUI, which does nothing special to implement it. It
                is the low level
                GeoServerResourcePersister that handles moving all
                the files to a
                different directory when a style workspace is
                changed. This is why it
                works fine with rest too.

                So, could the block of code preventing this perhaps
                be removed?

                One issue is however that is not possible to remove
                the workspace from a
                style. The rest services only changes specified
                properties, ignoring
                nulls, so it is not possible to change something back
                to null via the
                rest in general I think.

                Kind Regards

                Niels



                _______________________________________________
                Geoserver-devel mailing list
                [email protected]
                <mailto:[email protected]>
                https://lists.sourceforge.net/lists/listinfo/geoserver-devel



--
            Regards, Andrea Aime == GeoServer Professional Services
            from the experts! Visit http://goo.gl/it488V for more
            information. == Ing. Andrea Aime @geowolf Technical Lead
            GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa
            (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob:
            +39 339 8844549 http://www.geo-solutions.it
            http://twitter.com/geosolutions_it
            -------------------------------------------------------
            /Con riferimento alla normativa sul trattamento dei dati
            personali (Reg. UE 2016/679 - Regolamento generale sulla
            protezione dei dati “GDPR”), si precisa che ogni
            circostanza inerente alla presente email (il suo
            contenuto, gli eventuali allegati, etc.) è un dato la cui
            conoscenza è riservata al/i solo/i destinatario/i
            indicati dallo scrivente. Se il messaggio Le è giunto per
            errore, è tenuta/o a cancellarlo, ogni altra operazione è
            illecita. Le sarei comunque grato se potesse darmene
            notizia. This email is intended only for the person or
            entity to which it is addressed and may contain
            information that is privileged, confidential or otherwise
            protected from disclosure. We remind that - as provided
            by European Regulation 2016/679 “GDPR” - copying,
            dissemination or use of this e-mail or the information
            herein by anyone other than the intended recipient is
            prohibited. If you have received this email by mistake,
            please notify us immediately by telephone or e-mail./

            _______________________________________________
            Geoserver-devel mailing list
            [email protected]
            <mailto:[email protected]>
            https://lists.sourceforge.net/lists/listinfo/geoserver-devel



--
    Regards, Andrea Aime == GeoServer Professional Services from the
    experts! Visit http://goo.gl/it488V for more information. == Ing.
    Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di
    Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax:
    +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it
    http://twitter.com/geosolutions_it
    ------------------------------------------------------- /Con
    riferimento alla normativa sul trattamento dei dati personali
    (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati
    “GDPR”), si precisa che ogni circostanza inerente alla presente
    email (il suo contenuto, gli eventuali allegati, etc.) è un dato
    la cui conoscenza è riservata al/i solo/i destinatario/i indicati
    dallo scrivente. Se il messaggio Le è giunto per errore, è
    tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei
    comunque grato se potesse darmene notizia. This email is intended
    only for the person or entity to which it is addressed and may
    contain information that is privileged, confidential or otherwise
    protected from disclosure. We remind that - as provided by
    European Regulation 2016/679 “GDPR” - copying, dissemination or
    use of this e-mail or the information herein by anyone other than
    the intended recipient is prohibited. If you have received this
    email by mistake, please notify us immediately by telephone or
    e-mail./



--

Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- /Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail./

_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to