<commit_before><script>
export default {
    props: ['mod', 'tab'],

    data: () => ({
        dropdown_active: false,
        open: false,
        tools: [],
        tools_built: false
    }),

    watch: {
        mod(new_mod) {
            this.mod = new_mod;
            this.tools_built = false;

            if(this.open) this.updateTools();
        }
    },

    methods: {
        showDetails() {
            vm.mod = this.mod;
            vm.page = 'details';
        },

        updateTools() {
            if(this.tools_built) return;
            this.tools_built = true;

            call(fs2mod.getModTools, this.mod.id, this.mod.version, (tools) => {
                this.tools = tools;
            });
        },

        launchTool(label) {
            fs2mod.runModTool(this.mod.id, this.mod.version, '', '', label);
        },

        uploadLog() {
            alert('Not yet implemented!');
        },

        uninstallMod() {
            fs2mod.uninstall(this.mod.id, this.mod.version, []);
        }
    }
};
</script>
<template>
    <div class="mod row">
        <div :class="{ 'mod-node': true, 'active': open }">
            <div class="mod-image">
                <img :src="mod.tile ? ('file://' + mod.tile) : 'images/modstock.jpg'" class="mod-stock">
                <div class="mod-logo-container">
                    <img class="mod-logo-legacy img-responsive" v-if="mod.logo" :src="(mod.logo.indexOf('://') === -1 ? 'file://' : '') + mod.logo">
                </div>
            </div>
            <div class="mod-installed" v-if="tab === 'explore' && mod.versions[0].installed">
                <div class="mod-banner">
                    <span>Installed!</span>
                </div>
            </div>
            <div class="mod-notifier" v-if="tab === 'home'">
                <img :src="'images/modnotify_' + (tab === 'home' ? mod.status : 'ready') + '.png'" class="notifier">
            </div>
            <div class="actions">
                <div class="btn-wrapper">
                    <kn-mod-buttons :tab="tab" :mod="mod"></kn-mod-buttons>

                    <button class="mod-btn btn-grey" v-if="tab !== 'develop'" v-on:click="showDetails">
                        <span class="btn-text">DETAILS</span>
                    </button>

                    <kn-dropdown v-if="tab === 'home'" @open="updateTools(); open = true" @close="open = false">
                        <button v-for="tool in tools" @click="launchTool(tool)">Run {{ tool }}</button>
                        <button @click="uploadLog">Upload Debug Log</button><commit_msg>Fix tile URLs in kn-mod.vue<commit_after><script>
export default {
    props: ['mod', 'tab'],

    data: () => ({
        dropdown_active: false,
        open: false,
        tools: [],
        tools_built: false
    }),

    watch: {
        mod(new_mod) {
            this.mod = new_mod;
            this.tools_built = false;

            if(this.open) this.updateTools();
        }
    },

    methods: {
        showDetails() {
            vm.mod = this.mod;
            vm.page = 'details';
        },

        updateTools() {
            if(this.tools_built) return;
            this.tools_built = true;

            call(fs2mod.getModTools, this.mod.id, this.mod.version, (tools) => {
                this.tools = tools;
            });
        },

        launchTool(label) {
            fs2mod.runModTool(this.mod.id, this.mod.version, '', '', label);
        },

        uploadLog() {
            alert('Not yet implemented!');
        },

        uninstallMod() {
            fs2mod.uninstall(this.mod.id, this.mod.version, []);
        }
    }
};
</script>
<template>
    <div class="mod row">
        <div :class="{ 'mod-node': true, 'active': open }">
            <div class="mod-image">
                <img :src="mod.tile ? ((mod.tile.indexOf('://') === -1 ? 'file://' : '') + mod.tile) : 'images/modstock.jpg'" class="mod-stock">
                <div class="mod-logo-container">
                    <img class="mod-logo-legacy img-responsive" v-if="mod.logo" :src="(mod.logo.indexOf('://') === -1 ? 'file://' : '') + mod.logo">
                </div>
            </div>
            <div class="mod-installed" v-if="tab === 'explore' && mod.versions[0].installed">
                <div class="mod-banner">
                    <span>Installed!</span>
                </div>
            </div>
            <div class="mod-notifier" v-if="tab === 'home'">
                <img :src="'images/modnotify_' + (tab === 'home' ? mod.status : 'ready') + '.png'" class="notifier">
            </div>
            <div class="actions">
                <div class="btn-wrapper">
                    <kn-mod-buttons :tab="tab" :mod="mod"></kn-mod-buttons>

                    <button class="mod-btn btn-grey" v-if="tab !== 'develop'" v-on:click="showDetails">
                        <span class="btn-text">DETAILS</span>
                    </button>

                    <kn-dropdown v-if="tab === 'home'" @open="updateTools(); open = true" @close="open = false">
                        <button v-for="tool in tools" @click="launchTool(tool)">Run {{ tool }}</button>
                        <button @click="uploadLog">Upload Debug Log</button>
{'fraction_non_alphanumeric': 0.18256390690576116, 'fraction_numerical': 0.002098435711560473, 'mean_word_length': 1.5827586206896551, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 73, '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': '4300438', 'n_tokens_mistral': 1616, 'n_tokens_neox': 1536, 'n_words': 283}