<modal-dialog>
    <div class="modal-header">
        <h3 class="modal-title" ng-if="!stream" translate>Create image stream</h3>
        <h3 class="modal-title" ng-if="stream" translate>Change image stream</h3>
    </div>
    <div class="modal-body">
        <table class="form-table-ct">
            <tr>
                <td>
                    <label class="control-label" for="imagestream-modify-name"
                        translate>Name</label>
                </td>
                <td>
                    <input id="imagestream-modify-name" class="form-control" type="text"
                        ng-if="!stream" ng-model="fields.name" placeholder="{{ placeholder }}" autofocus>
                    <span id="imagestream-modify-name" ng-if="stream">{{ fields.name }}</span>
                </td>
            </tr>
            <tr>
                <td class="top">
                    <label class="control-label" for="imagestream-modify-project-text"
                        translate>Project</label>
                </td>
                <td>
                    <div ng-if="!stream" id="imagestream-modify-project" class="input-group input-combo">
                        <input class="form-control" id="imagestream-modify-project-text" type="text"
                            ng-model="fields.project">
                        <span class="input-group-btn" dropdown>
                            <button class="btn btn-default dropdown-toggle" dropdown-toggle type="button">
                                <span class="caret"></span>
                            </button>
                            <ul dropdown-menu class="dropdown-menu" role="menu">
                                <li ng-repeat="name in projects() track by name"
                                    ng-class="{ checked: name == fields.project }">
                                    <a ng-click="fields.project = name" value="{{name}}">{{ name }}</a>
                                </li>
                            </ul>
                        </span>
                    </div>
                    <span id="imagestream-modify-project" ng-if="stream">{{ fields.project }}</span>
                </td>
            </tr>
            <tr>
                <td class="top">
                    <label class="control-label" for="imagestream-modify-populate"
                        translate>Populate</label>
                </td>
                <td>
                    <div class="btn-group bootstrap-select form-control" dropdown
                        id="imagestream-modify-populate">
                        <button class="btn btn-default dropdown-toggle" dropdown-toggle>
                            <span class="pull-left">{{ labels.populate[fields.populate] }}</span>
                            <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu">
                            <li ng-repeat="(value, label) in labels.populate"
                                ng-class="{checked: value == fields.populate}">
                                <a ng-click="fields.populate = value" value="{{value}}">{{ label }}</a>
                            </li>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr ng-show="fields.populate != 'none'">
                <td class="top">
                    <label class="control-label" for="imagestream-modify-pull"
                        translate>Pull from</label>
                </td>
                <td>
                    <input id="imagestream-modify-pull" class="form-control" type="text"
                        ng-model="fields.pull" placeholder="eg: docker.io/library/fedora">
                </td>
            </tr>
            <tr ng-show="fields.populate == 'tags'">
                <td class="top">
                    <label class="control-label" for="imagestream-modify-tags"
                        translate>Tags</label>
                </td>
                <td>
                    <div image-tag-editor id="imagestream-modify-tags" tags="fields.tags">
                    </div>
                </td>
            </tr>
            <tr ng-show="fields.populate == 'tags'">
                <td></td>
                <td>
                    <label>
                        <input type="checkbox" ng-checked="hasInsecureTag(stream.spec)" ng-model="fields.insecure">
                        <span translate>Remote registry is insecure</span>
                    </label>
                </td>
            </tr>
        </table>
    </div>
    <div class="modal-footer">
        <button class="btn btn-default btn-cancel" translate>Cancel</button>
        <button class="btn btn-primary" ng-if="stream" ng-click="complete(performModify())">Change</button>
        <button class="btn btn-primary" ng-if="!stream" ng-click="complete(performCreate())">Create</button>
    </div>
</modal-dialog>
