const moment = require('vendor/moment/v2.21');

const params = ChartEditor.getParams();
const tableResult = ChartEditor.getLoadedData().lunapark_api;
const person = tableResult.user

console.log('person', person)

console.log('data', tableResult)

const head = [
    {
        id: 'ticket',
        name: 'Тикет',
        type: 'text',
    },
    // {
    //     id: 'date',
    //     name: 'Дата',
    //     type: 'text'
    // },
    {
        id: 'jobs',
        name: 'Количество тестов',
        type: 'text'
    }
];

const rows = []

tableResult.tasks.forEach((task) => {
    rows.push({
        // values: [value, 2, 3]
        cells: [
            {
                value: task.task,
                link: {
                    href: 'https://st.yandex-team.ru/' + task,
                    newWindow: true
                }
            },
            // {value: 2},
            {
                value: task.jobs_amount,
                onClick: {
                    action: 'setParams',
                    args: {
                        taskId: task.task
                    },
                css: {color: 'blue'},
            }
            }
        ]

    })
});

module.exports = {head, rows};
