<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

<div style="margin: 15px; padding: 15px; background-color: white">
  <div nz-row [nzGutter]="16">
    <div nz-col [nzSpan]="6">
      <nz-input-group style="width: 100%;" [nzPrefix]="preffixIcon">
        <input type="text" nz-input placeholder="{{ 'Search by model name' | translate }}..." (keyup)="searchModel($event)" />
      </nz-input-group>
      <ng-template #preffixIcon>
        <i nz-icon nzType="search"></i>
      </ng-template>
    </div>
    <div nz-col [nzSpan]="6">
      <nz-select nzMode="multiple" [nzCustomTemplate]="multipleTemplate" style="width: 100%;" nzPlaceHolder="{{ 'Filter by tags' | translate }}" [(ngModel)]="listOfChosenTags" (ngModelChange)="filterByTags()">
        <nz-option *ngFor="let option of listOfTagsOption" [nzLabel]="option.label" [nzValue]="option.value" nzCustomContent>
          <submarine-model-tag [tag]="option.label" [type]="'default'"></submarine-model-tag>
        </nz-option>
        <ng-template #multipleTemplate let-selected nzBorderless>
          <submarine-model-tag [tag]="selected.nzLabel" [type]="'selection'"></submarine-model-tag>
        </ng-template>
      </nz-select>

    </div>
    <div nz-col [nzOffset]="12" align="right">
      <button
        nz-button
        nzType="primary"
        (click)="form.initModal()"
      >
        <i nz-icon nzType="plus"></i>
        {{ 'Create model registry' | translate }}
      </button>
    </div>
  </div>
  <model-form #form [fetchModelCards]="fetchModelCards"></model-form>
  <nz-divider></nz-divider>
  <submarine-model-cards [modelCards]="onDisplayModelCards" [isLoading]="isModelCardsLoading" [fetchModelCards]="fetchModelCards"></submarine-model-cards>
</div>
