<commit_before>/*
 * Waltz - Enterprise Architecture
 * Copyright (C) 2016  Khartec Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
import _ from 'lodash';
import {CORE_API} from '../../common/services/core-api-utils';


const flowDiagramsWidget = {
    template: `
        <waltz-flow-diagrams-section parent-entity-ref="$ctrl.parentEntityRef"
                                     can-create="true"
                                     create-diagram-commands="$ctrl.createDiagramCommands">
        </waltz-flow-diagrams-section>`,
    id: 'flow-diagrams-widget',
    name: 'Flow Diagrams',
    icon: 'picture-o'
};


const entityNamedNoteWidget = {
    template: `
        <waltz-entity-named-notes-section parent-entity-ref="$ctrl.parentEntityRef">
        </waltz-entity-named-notes-section>`,
    id: 'entity-named-notes-widget',
    name: 'Notes',
    icon: 'sticky-note-o'
};


const changesWidget = {
    template: `
        <waltz-change-log-section parent-entity-ref="$ctrl.parentEntityRef">
        </waltz-change-log-section>`,
    id: 'changes-widget',
    icon: 'history',
    name: 'Changes'
};

const flowWidget = {
    template: `
        <waltz-data-flow-section parent-entity-ref="$ctrl.parentEntityRef">
        </waltz-data-flow-section>`,
    id: 'data-flow-widget',
    name: 'Data Flows',
    icon: 'random'
};

const bookmarkWidget = {
    template: `
        <waltz-bookmarks-section parent-entity-ref="$ctrl.parentEntityRef">
        </waltz-bookmarks-section>`,
    id: 'bookmark-widget',
    name: 'Bookmarks',
    icon: 'rocket'
};


const initData = {
    id: 134,
    parentEntityRef: {
        kind: 'APPLICATION',
        id: 25821
    },
    visibility: {
        flows: false
    },
    widgets: [],
    availableWidgets: [
        flowWidget,
        flowDiagramsWidget,
        bookmarkWidget,
        entityNamedNoteWidget,
        changesWidget]
};


function controller()
{
    const vm = Object.assign(this, initData);

    vm.$onInit = () => {
        vm.addWidget(bookmarkWidget)
    };

    vm.addWidget = w => {
        console.log('addWidget', w.id)
        vm.widgets =  _.reject(vm.widgets, x => x.id === w.id)
        vm.widgets.unshift(w);
    };
<commit_msg>Adding costs into nav demo #2499<commit_after>/*
 * Waltz - Enterprise Architecture
 * Copyright (C) 2016  Khartec Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
import _ from 'lodash';
import {CORE_API} from '../../common/services/core-api-utils';


const flowDiagramsWidget = {
    template: `
        <waltz-flow-diagrams-section parent-entity-ref="$ctrl.parentEntityRef"
                                     can-create="true"
                                     create-diagram-commands="$ctrl.createDiagramCommands">
        </waltz-flow-diagrams-section>`,
    id: 'flow-diagrams-widget',
    name: 'Flow Diagrams',
    icon: 'picture-o'
};


const costsWidget = {
    template: `
        <waltz-app-costs-section parent-entity-ref="$ctrl.parentEntityRef">
        </waltz-app-costs-section> `,
    id: 'app-costs-widget',
    name: 'Costs',
    icon: 'money'
};


const entityNamedNoteWidget = {
    template: `
        <waltz-entity-named-notes-section parent-entity-ref="$ctrl.parentEntityRef">
        </waltz-entity-named-notes-section>`,
    id: 'entity-named-notes-widget',
    name: 'Notes',
    icon: 'sticky-note-o'
};


const changesWidget = {
    template: `
        <waltz-change-log-section parent-entity-ref="$ctrl.parentEntityRef">
        </waltz-change-log-section>`,
    id: 'changes-widget',
    icon: 'history',
    name: 'Changes'
};

const flowWidget = {
    template: `
        <waltz-data-flow-section parent-entity-ref="$ctrl.parentEntityRef">
        </waltz-data-flow-section>`,
    id: 'data-flow-widget',
    name: 'Data Flows',
    icon: 'random'
};

const bookmarkWidget = {
    template: `
        <waltz-bookmarks-section parent-entity-ref="$ctrl.parentEntityRef"
                                 show-filter="true">
        </waltz-bookmarks-section>`,
    id: 'bookmark-widget',
    name: 'Bookmarks',
    icon: 'rocket'
};


const initData = {
    id: 134,
    parentEntityRef: {
        kind: 'APPLICATION',
        id: 25821
    },
    visibility: {
        flows: false
    },
    widgets: [],
    availableWidgets: [
        flowWidget,
        flowDiagramsWidget,
        bookmarkWidget,
        entityNamedNoteWidget,
        costsWidget,
        changesWidget]
};


function controller()
{
    const vm = Object.assign(this, initData);

    vm.$onInit = () => {
        vm.addWidget(bookmarkWidget)
    };

    vm.addWidget = w => {
        vm.widgets =  _.reject(vm.widgets, x => x.id === w.id)
        vm.widgets.unshift(w);
    };

{'fraction_non_alphanumeric': 0.12758099714621454, 'fraction_numerical': 0.005036091992613732, 'mean_word_length': 2.5150442477876105, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4759561', 'n_tokens_mistral': 1840, 'n_tokens_neox': 1795, 'n_words': 455}