<?php
namespace zin;

global $lang, $app;
$serverPairs  = $app->control->loadModel('pipeline')->getPairs('gitfox', true);
$serverPairs += $app->control->loadModel('pipeline')->getPairs('gitlab', true);

$serviceList = array();
foreach($serverPairs as $server => $name) $serviceList[] = array('text' => $name, 'value' => $server);

$server = data('server');
query('#servers')->replaceWith(picker
    (
        setClass('ml-3'),
        width('200px'),
        on::change('selectServer'),
        set::name('servers'),
        set::id('servers'),
        set::placeholder($lang->repo->importServer),
        set::items($serviceList),
        set::value($server->id)
    )
);
