<commit_before><template>
    <modal-template
        :active="true"
        type="info"
        @close="closeModal">
        <template slot="modal-header">
            Edit Multiple Competencies
        </template>
        <template
            v-if="isProcessing"
            slot="modal-body">
            <div class="section has-text-centered">
                <span class="icon is-large">
                    <i class="fa fa-spinner fa-2x fa-pulse" />
                </span>
            </div>
        </template>
        <template
            slot="modal-body"
            v-else-if="!isSearching">
            <div
                v-for="(item,idx) in addedPropertiesAndValues"
                :key="item">
                <AddProperty
                    :profile="profile"
                    :editingMultipleCompetencies="true"
                    @property-string-updated="propertyStringUpdated"
                    :idx="idx"
                    @is-searching="isSearching=true"
                    :addedPropertiesAndValuesFromSearching="item" />
                <span v-if="item['error']">
                    {{ item['error'] }}
                </span>
            </div>
            <p
                class="help is-danger"
                v-if="errorMessage !== []">
                {{ this.errorMessage[0] }}
            </p>
        </template>
        <template
            slot="modal-body"
            v-if="isSearching">
            <Search view="multi-edit" />
        </template>
        <template slot="modal-foot">
            <div class="buttons is-spaced">
                <button
                    @click="onCancel"
                    class="button is-outlined is-dark">
                    <span class="icon">
                        <i class="fa fa-times" />
                    </span>
                    <span>cancel</span>
                </button>
                <button
                    v-if="!isSearching"
                    class="button is-outlined is-success"
                    @click="applyToMultiple"
                    :disabled="disableApplyButton">
                    <span class="icon">
                        <i class="fa fa-save" />
                    </span>
                    <span>Apply to multiple</span>
                </button>
            </div>
            <template v-if="isSearching">
                <div
                    @click="addSelected"
                    title="Add Competency as Property"
                    class="button is-outlined is-primary">
                    <span class="icon">
                        <i class="fa fa-check" />
                    </span>
                    <span>Add Selected</span>
                </div>
            </template>
        </template>
    </modal-template>
</template>
<script>
import AddProperty from '@/lode/components/AddProperty.vue';
import Search from '../framework/Search.vue';
import ModalTemplate from './ModalTemplate.vue';
export default {
    name: 'MultiEdit',
    components: {
        AddProperty,
        Search,
        ModalTemplate
    },
    props: {
        content: Object
    },
    data() {
        return {
            showErrorMessages: false,
            isProcessing: false,
            addedPropertiesAndValues: [{"property": "", "value": "", "range": []}],
            repo: window.repo,
            saveCount: 0,
            errorMessage: [],
            checkedOptions: [],
            changedItemsForUndo: [],
            isSearching: false
        };
    },
    computed: {
        profile: function() {
            return this.content.profile;
        },
        selectedCompetencies: function() {
            return this.content.selectedCompetencies;
        },
        disableApplyButton: function() {
            for (var i = 0; i < this.addedPropertiesAndValues.length; i++) {
                if (this.addedPropertiesAndValues[i].error) {
                    return true;
                }
            }
            return false;
        },
        removeAddingValueAtIndex: function() {
            return this.$store.getters['lode/removeAddingValueAtIndex'];
        },
        addingChecked: function() {
            return this.$store.getters['lode/addingChecked'];
        }
    },
    methods: {
        onCancel: function() {<commit_msg>Disable apply to multiple btn if no property selected or value entered<commit_after><template>
    <modal-template
        :active="true"
        type="info"
        @close="closeModal">
        <template slot="modal-header">
            Edit Multiple Competencies
        </template>
        <template
            v-if="isProcessing"
            slot="modal-body">
            <div class="section has-text-centered">
                <span class="icon is-large">
                    <i class="fa fa-spinner fa-2x fa-pulse" />
                </span>
            </div>
        </template>
        <template
            slot="modal-body"
            v-else-if="!isSearching">
            <div
                v-for="(item,idx) in addedPropertiesAndValues"
                :key="item">
                <AddProperty
                    :profile="profile"
                    :editingMultipleCompetencies="true"
                    @property-string-updated="propertyStringUpdated"
                    :idx="idx"
                    @is-searching="isSearching=true"
                    :addedPropertiesAndValuesFromSearching="item" />
                <span v-if="item['error']">
                    {{ item['error'] }}
                </span>
            </div>
            <p
                class="help is-danger"
                v-if="errorMessage !== []">
                {{ this.errorMessage[0] }}
            </p>
        </template>
        <template
            slot="modal-body"
            v-if="isSearching">
            <Search view="multi-edit" />
        </template>
        <template slot="modal-foot">
            <div class="buttons is-spaced">
                <button
                    @click="onCancel"
                    class="button is-outlined is-dark">
                    <span class="icon">
                        <i class="fa fa-times" />
                    </span>
                    <span>cancel</span>
                </button>
                <button
                    v-if="!isSearching"
                    class="button is-outlined is-success"
                    @click="applyToMultiple"
                    :disabled="disableApplyButton">
                    <span class="icon">
                        <i class="fa fa-save" />
                    </span>
                    <span>Apply to multiple</span>
                </button>
            </div>
            <template v-if="isSearching">
                <div
                    @click="addSelected"
                    title="Add Competency as Property"
                    class="button is-outlined is-primary">
                    <span class="icon">
                        <i class="fa fa-check" />
                    </span>
                    <span>Add Selected</span>
                </div>
            </template>
        </template>
    </modal-template>
</template>
<script>
import AddProperty from '@/lode/components/AddProperty.vue';
import Search from '../framework/Search.vue';
import ModalTemplate from './ModalTemplate.vue';
export default {
    name: 'MultiEdit',
    components: {
        AddProperty,
        Search,
        ModalTemplate
    },
    props: {
        content: Object
    },
    data() {
        return {
            showErrorMessages: false,
            isProcessing: false,
            addedPropertiesAndValues: [{"property": "", "value": "", "range": []}],
            repo: window.repo,
            saveCount: 0,
            errorMessage: [],
            checkedOptions: [],
            changedItemsForUndo: [],
            isSearching: false
        };
    },
    computed: {
        profile: function() {
            return this.content.profile;
        },
        selectedCompetencies: function() {
            return this.content.selectedCompetencies;
        },
        disableApplyButton: function() {
            for (var i = 0; i < this.addedPropertiesAndValues.length; i++) {
                if (this.addedPropertiesAndValues[i].error) {
                    return true;
                }
            }
            if (this.addedPropertiesAndValues && this.addedPropertiesAndValues[0]) {
                if (this.addedPropertiesAndValues[0].property.length === 0 || this.addedPropertiesAndValues[0].value.length === 0) {
                    return true;
                }
            }
            return false;
        },
        removeAddingValueAtIndex: function() {
            return this.$store.getters['lode/removeAddingValueAtIndex'];
        },
        addingChecked: function() {
            return this.$store.getters['lode/addingChecked'];
        }
    },
    methods: {
        onCancel: function() {
{'fraction_non_alphanumeric': 0.12018266874582312, 'fraction_numerical': 0.0014479839607930496, 'mean_word_length': 1.2537650602409638, 'pattern_counts': {'":': 6, '<': 111, '<?xml version=': 0, '>': 109, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '964712', 'n_tokens_mistral': 2280, 'n_tokens_neox': 2160, 'n_words': 419}