Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate possibility of pushing webadmin changes to own config #31

Open
bviktor opened this issue Jan 18, 2019 · 9 comments
Open

Investigate possibility of pushing webadmin changes to own config #31

bviktor opened this issue Jan 18, 2019 · 9 comments

Comments

@bviktor
Copy link
Collaborator

bviktor commented Jan 18, 2019

No description provided.

@bviktor
Copy link
Collaborator Author

bviktor commented Jan 28, 2019

https://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes

yum install inotify-tools

Then

inotifywait -m -e modify foo.txt

If only I could log the changes...

inotifywait --quiet --monitor --event modify FILE | while read; do
    # trim the trailing space from inotifywait output
    REPLY=${REPLY% }
    filename=${REPLY%% *}
    # do whatever you want with the $filename
done

@bviktor
Copy link
Collaborator Author

bviktor commented Jan 30, 2019

Maybe we should save the default files everytime we run killinuxfloor reset, then when inotify says there's a change, make a diff, and apply the diff to the My-* files?

@bviktor
Copy link
Collaborator Author

bviktor commented Jan 30, 2019

But then what about map cycles? We store them in a custom file... duh.

@bviktor
Copy link
Collaborator Author

bviktor commented Jan 30, 2019

Maybe we should make them read-only in webadmin, much like bans?

@bviktor
Copy link
Collaborator Author

bviktor commented Jan 30, 2019

Nah, instead, we should make everything editable in webadmin. Then we don't have to deal with command line at all. But then we gotta find a way to make the 2 "default" cycles immutable.

@bviktor
Copy link
Collaborator Author

bviktor commented Jan 30, 2019

default_maplist.html

    cycleId = "<%maplistidx%>";
    document.getElementById("simpleEditBtn").hidden = true;
    if (cycleId <= 1)
    {
        document.getElementById("mlactions.save").hidden = true;
        document.getElementById("mlactions.delete").hidden = true;
        document.getElementById("jsmlctrls").hidden = true;
        document.getElementById("jsmapcycle").readOnly = true;

        //var element = document.getElementById("jsmapcycle");
        //element.classList.remove("ui-sortable");

        /* remove the delete buttons reactively
         * ugly, but this way we can avoid touching js files */
        [].forEach.call(document.querySelectorAll('.deleteButton'), function (el)
        {
            el.style.visibility = 'hidden';
        });

        //[].forEach.call(document.querySelectorAll('.ui-droppable'), function (el)
        //{
        //    el.classList.remove("ui-droppable");
        //});
    }

@bviktor
Copy link
Collaborator Author

bviktor commented Jan 30, 2019

Still needs work, gotta disable drag-n-drop somehow.

@bviktor
Copy link
Collaborator Author

bviktor commented Feb 2, 2019

The responsible code in default_maplist_editor.js:

    /* cycle map reordering */
    _jsmapcycle.sortable({
        axis: "y",
        containment: "parent",
        cancel: ".deleteButton",
        start: function(ev, ui) {
            $(ui.helper).addClass('dragging');
        },
        stop: function(ev, ui) {
            $(ui.helper).removeClass('dragging');
        }
    });

    /* cycle map dropping */
    $('#jsmapcycle').parent().droppable({
        accept: "li.mapEntry",
        hoverClass: "dropHover",
        activeClass: "droppable",
        drop: function(ev, ui) {
            var item = $('.entry', ui.draggable).text();
            item = createMapListEntry(item);
            getDeleteMe(item);
            setupRndLimitEditor($(item));
            _jsmapcycle.append(item);
            _jsmapcycle.sortable("refresh");
            _jsmapcycle.sortable("refreshPositions");
        }
    });

Without these it works perfectly, but this is, again, JS, so you can't patch it, coz it's served as gzip...

But in the meanwhile I realized it's not even a problem, because the save button is already hidden, so apart from UI glitches, nothing wrong can happen.

bviktor added a commit that referenced this issue Feb 2, 2019
@bviktor
Copy link
Collaborator Author

bviktor commented Feb 2, 2019

Uh, this may not necessarily work because there are several keys with multiple values and crudini just won't work with those :(

bviktor added a commit that referenced this issue Feb 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant