<div *ngIf="activateFromMenuButton" [matMenuTriggerFor]="experimentMenu"
     class="p-0 cell menu-button al-icon sm-md al-color blue-300 al-ico-bars-menu"
></div>
<div *ngIf="!activateFromMenuButton" #contextTrigger
     style="visibility: hidden; position: fixed"
     [style.left.px]="position.x"
     [style.top.px]="position.y"
     [matMenuTriggerFor]="experimentMenu">
</div>
<mat-menu #experimentMenu="matMenu" [hasBackdrop]="false" class="light-theme entity-context-menu">
  <button *ngIf="tableMode" mat-menu-item (click)="toggleDetails()">
    <i [class]="'al-icon '+ icons.DETAILS + ' sm-md'" data-id="detailsOption"></i>Details
  </button>
  <hr *ngIf="tableMode">
  <button mat-menu-item
        [matMenuTriggerFor]="tagMenu.matMenu"
        [disabled]="selectedDisableAvailable[menuItems.tags]?.disable"
        (menuOpened)="tagMenuOpened()"
        (menuClosed)="tagMenuClosed()">
    <i [class]="'al-icon ' + icons.TAG + ' sm-md'" data-id="addTagOption">
    </i><span>{{selectedDisableAvailable[menuItems.tags]?.available | menuItemText : 'Add Tag' : selectedDisableAvailableIsMultiple }}</span>
  </button>

  <button mat-menu-item (click)="restoreArchive(entityTypeEnum.dataset)"
          [disabled]="selectedDisableAvailable[menuItems.archive]?.disable">
    <i class="al-icon sm-md" [class]="isArchive ? icons.RESTORE : icons.ARCHIVE" data-id="archiveOption"></i>
    {{selectedDisableAvailable[menuItems.archive]?.available | menuItemText : isArchive ? 'Restore from Archive' : 'Archive' : selectedDisableAvailableIsMultiple}}
  </button>

  <button mat-menu-item (click)="deleteExperimentPopup(entityTypeEnum.dataset, true)"
          [disabled]="selectedDisableAvailable[menuItems.delete]?.disable" *ngIf="isArchive">
    <i [class]="'al-icon ' + icons.REMOVE + ' sm-md'" data-id="deleteOption"></i>
    {{selectedDisableAvailable[menuItems.delete]?.available | menuItemText : 'Delete' : selectedDisableAvailableIsMultiple}}
  </button>
</mat-menu>

<sm-tags-menu
  #tagMenu
  [tags]="experiment?.tags"
  [tagsFilterByProject]="tagsFilterByProject"
  [projectTags]="projectTags"
  [companyTags]="companyTags"
  (tagSelected)="tagSelected.emit($event)">
</sm-tags-menu>
