<commit_before>@extends('_layouts.default')

@section('script')

<script>
$(function() {
    $('.jstree').jstree();
    $(".available_recipe").draggable({
        revert: "invalid",
        helper: "clone",
        cursor: "move"
    });
    $("#panel-available-run-list").droppable({
        accept: ".available_recipes > li",
        drop: function( event, ui ) {
            ui.draggable.appendTo($(this).children('ul'));
            $('#run_list')[0].value += ' ' + ui.draggable.children('p').text();
        },
        tolerance: "touch"
    });
    $("#panel-available-recipes").droppable({
        accept: ".run-list > li",
        drop: function( event, ui ) {
            ui.draggable.appendTo($(this).children('ul'));
        },
        tolerance: "touch"
    });

    var options = {
      valueNames: [ 'name' ]
    };

    var userList = new List('panel-available-recipes', options);
    });
</script>

@stop

@section('main')

<h2>{{ $node->name }}</h2>

Environment: {{ $node->chef_environment }}

<h3>Recipes</h3>
<h4 style="float:left">Available recipes:</h4>
<h4 style="float:right">Run list:</h4>

<br style="clear:both" />


<br style="clear:both" />

<div class="panel panel-primary" id="panel-available-recipes">
    <input class="search" placeholder="Search" />
    <ul class="available_recipes list">
        @foreach ($available_cookbooks as $cookbook)
        <li class="available_recipe">
            <p class="name">{{ $cookbook }}</p>
        </li>
        @endforeach
    </ul>
</div>


<div class="panel panel-primary" id="panel-available-run-list">
    <ul class="run-list">
        @foreach ($node->run_list['recipe'] as $cookbook)
        <li class="available_recipe">
            {{ $cookbook }}
        </li>
        @endforeach
    </ul>
</div>

{{ Form::open(['route' => ['nodes.store']]) }}

<div>
<button type="submit" class="btn btn-primary" style="float: right;">
    Save node
</button>
</div>

<br style="clear:both" />

<h3>Attributes</h3>

{{ Form::hidden('node_name', $node->name) }}
{{ Form::hidden('run_list', null, ['id' => 'run_list']) }}

<div class="panel panel-primary">
    <div class="panel-heading">
        <div class="panel-title">
            <a href="#collapse-override" data-toggle="collapse">
                <b>Override:</b>
            </a>
            <button type="submit" class="btn btn-primary navbar-right" style="position: relative;top: -8px;"><commit_msg>Print back the previous run_list, so it doesn't erase it when saving<commit_after>@extends('_layouts.default')

@section('script')

<script>
$(function() {
    $('.jstree').jstree();
    $(".available_recipe").draggable({
        revert: "invalid",
        helper: "clone",
        cursor: "move"
    });
    $("#panel-available-run-list").droppable({
        accept: ".available_recipes > li",
        drop: function( event, ui ) {
            ui.draggable.appendTo($(this).children('ul'));
            $('#run_list')[0].value += ' ' + ui.draggable.children('p').text();
        },
        tolerance: "touch"
    });
    $("#panel-available-recipes").droppable({
        accept: ".run-list > li",
        drop: function( event, ui ) {
            ui.draggable.appendTo($(this).children('ul'));
        },
        tolerance: "touch"
    });

    var options = {
      valueNames: [ 'name' ]
    };

    var userList = new List('panel-available-recipes', options);
    });
</script>

@stop

@section('main')

<h2>{{ $node->name }}</h2>

Environment: {{ $node->chef_environment }}

<h3>Recipes</h3>
<h4 style="float:left">Available recipes:</h4>
<h4 style="float:right">Run list:</h4>

<br style="clear:both" />


<br style="clear:both" />

<div class="panel panel-primary" id="panel-available-recipes">
    <input class="search" placeholder="Search" />
    <ul class="available_recipes list">
        @foreach ($available_cookbooks as $cookbook)
        <li class="available_recipe">
            <p class="name">{{ $cookbook }}</p>
        </li>
        @endforeach
    </ul>
</div>


<div class="panel panel-primary" id="panel-available-run-list">
    <ul class="run-list">
        @foreach ($node->run_list['recipe'] as $cookbook)
        <li class="available_recipe">
            {{ $cookbook }}
        </li>
        @endforeach
    </ul>
</div>

{{ Form::open(['route' => ['nodes.store']]) }}

<div>
<button type="submit" class="btn btn-primary" style="float: right;">
    Save node
</button>
</div>

<br style="clear:both" />

<h3>Attributes</h3>

{{ Form::hidden('node_name', $node->name) }}
{{ Form::hidden('run_list', implode(' ', $node->run_list['recipe']), ['id' => 'run_list']) }}

<div class="panel panel-primary">
    <div class="panel-heading">
        <div class="panel-title">
            <a href="#collapse-override" data-toggle="collapse">
                <b>Override:</b>
            </a>
            <button type="submit" class="btn btn-primary navbar-right" style="position: relative;top: -8px;">
{'fraction_non_alphanumeric': 0.20711974110032363, 'fraction_numerical': 0.0048543689320388345, 'mean_word_length': 2.9029202841357535, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 104, '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': '1337950', 'n_tokens_mistral': 1636, 'n_tokens_neox': 1629, 'n_words': 305}