"use strict";

/*
 * *******************************************************************************
 *  * Copyright (c) 2018 Edgeworx, Inc.
 *  *
 *  * This program and the accompanying materials are made available under the
 *  * terms of the Eclipse Public License v. 2.0 which is available at
 *  * http://www.eclipse.org/legal/epl-2.0
 *  *
 *  * SPDX-License-Identifier: EPL-2.0
 *  *******************************************************************************
 *
 */

ioAuthoring = ioAuthoring || {};

ioAuthoring.templates = ioAuthoring.templates || {};

ioAuthoring.templates.catalogElement = "\
    <% for(var i=0; i<catalogElements.length; i++) { %>\
        <% var name = catalogElements[i].name; %>\
        <% var dispName; %>\
    <% if (name.length > 19) { %>\
        <% dispName = name.substr(0,19) + '...'; %>\
    <% }else{ %> \
        <% dispName = name; %>\
    <% } %>\
    <div class='build-element-container' data-element-type-id='<%= catalogElements[i].ID %>' \
        data-element-type-name='<%= catalogElements[i].name %>' data-element-type-image='<%= catalogElements[i].picture %>'\
        data-element-type-description='<%= catalogElements[i].description %>'>\
        <img class='element-type-icon' src='/<%= catalogElements[i].picture %>? <%=  Date.now() %>'>\
        <p><strong><%= dispName %></strong></p>\
        <p class='pix12'>\
            <span id='element-type-hover-icon-<%= catalogElements[i].ID %>' class='hover-more-text' last='<%= catalogElements.length - 1 == i ? 1 : 0 %>'>\
                more\
            </span>\
        </p>\
        <div style='display:none;' id='element-type-description-<%= catalogElements[i].ID %>'>\
            <p class='hPad8'>\
                <%= catalogElements[i].name %>\
                <br><br><%= catalogElements[i].description %>\
                <br><br>Publisher: <%= catalogElements[i].publisher %>\
                <br>Runs on: <%= catalogElements[i].fogTypeName %>\
                <br>Category: <%= catalogElements[i].category %>\
                <br><br>Input type: <%= catalogElements[i].inputType %>\
                <br>Input format: <%= catalogElements[i].inputFormat %>\
                <br><br>Output type: <%= catalogElements[i].outputType %>\
                <br>Output format: <%= catalogElements[i].outputFormat %>\
            </p>\
        </div>\
    </div>\
    <% } %>\
";

ioAuthoring.templates.dataTracks = "\
    <% for(var i=0; i<dataTracks.length; i++) { %>\
        <option value='<%= dataTracks[i].id %>'\
            <%= dataTracks[i].isSelected ? ' selected' : '' %>\
            isactivated='<%= dataTracks[i].isActivated %> ' \
            completename='<%= dataTracks[i].name %>'>\
            <%= dataTracks[i].name %>\
        </option>\
    <% } %>\
";

ioAuthoring.templates.fogInstances = "\
    <% for(var i=0; i<fogInstances.length; i++) { %>\
        <option value='<%= fogInstances[i].UUID %>' \
            data-icon='/images/shared/<%= fogInstances[i].typeImage %>?<%= Date.now() %>'  \
            class='left circle'  \
            fogTypeId='<%= fogInstances[i].typeId %>' \
            completename='<%= fogInstances[i].Name %>'>\
            '<%= fogInstances[i].Name %>'\
        </option>\
    <% } %>\
";