๐Ÿš€ Allow moving ASSET folders / changing parent folder

Currently there is no way to move an ASSET folder or change its parent folder once it has been created. It would be very useful to have the ability to reorganize the directory structure by moving folders within the hierarchy.

The suggested implementation could work in one of two ways: either by allowing direct modification of the parent ID field, or by providing a selection interface where the user can choose a new parent folder from the existing structure.

This feature would improve project organization and flexibility, especially in larger projects where the folder structure may need to evolve over time.

During my testing, I found that simply adding the PARENT FOLDER ID field to the form already enables folder moving functionality. The user just needs to know the ID of the target folder. For this reason, I have also added a READONLY field displaying the folder ID, which makes it easier to identify the destination folder.

>> modules\Assets\assets\dialogs\asset-folder.js

                <div v-if="isEdit" class="kiss-margin">
                    <label class="kiss-text-caption">{{ t('Folder ID') }}</label>
                    <div class="kiss-size-xsmall kiss-color-muted kiss-margin-xsmall-top">
                        {{ val._id }}
                    </div>
                </div>

                <div v-if="isEdit" class="kiss-margin">
                    <label class="kiss-text-caption">{{ t('Parent folder ID') }}</label>
                    <input
                        type="text"
                        class="kiss-input kiss-margin-xsmall"
                        v-model="val._p"
                        :placeholder="t('Parent ID is EMPTY')"
                    >
                </div>

and a simple validation check on save

            if (this.val._p == this.val._id) {
                App.ui.notify('A folder cannot be its own parent.', 'danger');
                return false;
            }

Done: Add possibility to set parent folder for an asset folder ยท Cockpit-HQ/Cockpit@0107075 ยท GitHub

I must admit your solution is better, thank you! :vulcan_salute:

Would it be possible to unify the footer when editing an asset and a folder to have a consistent appearance? This is just a minor visual thing :slight_smile:

/cockpit/modules/Assets/assets/dialogs/asset-folder.js
from line 137

            <hr class="kiss-width-1-1 kiss-margin-remove">
            <div class="kiss-padding kiss-padding-remove-bottom kiss-bgcolor-contrast">
                <div class="kiss-size-small">

                    <div class="kiss-flex kiss-flex-middle">
                        <div class="kiss-size-4 kiss-margin-small-end kiss-flex" title="ID"><icon>adjust</icon></div>
                        <div class="kiss-text-truncate kiss-text-bold kiss-text-monospace kiss-size-small kiss-flex-1">
                            {{ val._id }}
                            </div>
                        <a :title="t('Copy')" @click="copyID()"><icon>content_copy</icon></a>
                    </div>

            </div>
            <div class="kiss-padding kiss-bgcolor-contrast">
                <div class="kiss-button-group kiss-flex kiss-child-width-1-2">
                    <button class="kiss-button" kiss-offcanvas-close :disabled="loading">
                        {{ t('Cancel') }}
                    </button>
                    <button
                        class="kiss-button kiss-button-primary"
                        @click="save"
                        :disabled="loading || !val.name"
                    >
                        <span v-if="loading">{{ t('Saving...') }}</span>
                        <span v-else>{{ t('Save') }}</span>
                    </button>
                </div>
            </div>
        </div>
    `,

    methods: {

        copyID() {
            App.utils.copyText(this.val._id, () =>  App.ui.notify('ID copied!'));
        },