Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c835a12d

Přidáno uživatelem Jakub Hlaváč před téměř 4 roky(ů)

Re #XXXX - Podpora týmu

+ dropdown menu for actions

Zobrazit rozdíly:

src/app/dashboard/components/dashboard.component.ts
8 8
import {DataService} from '../../shared/api/endpoints/services/data.service';
9 9
import {Phenomenon} from '../../shared/api/endpoints/models/phenomenon';
10 10
import {SensorsService} from '../../shared/api/endpoints/services/sensors.service';
11
import {ConfirmationService, MessageService} from 'primeng/api';
11
import {ConfirmationService, MenuItem, MessageService} from 'primeng/api';
12 12
import {ManagementService} from '../../shared/api/endpoints/services/management.service';
13 13
import {InsertUnit} from '../../shared/api/endpoints/models/insert-unit';
14 14
import {ToastService} from '../../shared/services/toast.service';
......
22 22
})
23 23
export class DashboardComponent implements OnInit {
24 24

  
25
  items: MenuItem[] = [];
25 26
  position: 'bottom';
26 27
  groups: Group[];
27 28
  units: Array<{ drivers?: Drivers; generalInfo?: GeneralInfo; holder?: any; lastpos?: Lastpos; sensors?: Array<Sensor>; unit?: Unit }>;
......
97 98
      })
98 99
    ).toPromise().then().catch(err => this.toastService.showError(err.error.message));
99 100
  }
101

  
102
  showItems($event: any, unit: Unit) {
103
    $event.stopPropagation();
104
    this.items = [
105
      {label: 'Add sensor', icon: 'pi pi-refresh', command: () => {
106
          event.stopPropagation();
107
          this.insertSensorPopup($event, unit);
108
        }},
109
      {label: 'Delete unit', icon: 'pi pi-times', command: () => {
110
          event.stopPropagation();
111
          this.deleteUnit($event, unit);
112
        }}
113
    ]
114
  }
100 115
}
src/app/dashboard/dashboard.module.ts
13 13
import {ReactiveFormsModule} from '@angular/forms';
14 14
import { SensorInsertPopupComponent } from './components/sensor-insert-popup/sensor-insert-popup.component';
15 15
import {ConfirmDialogModule} from 'primeng/confirmdialog';
16
import {SplitButtonModule} from 'primeng/splitbutton';
16 17

  
17 18

  
18 19

  
......
27 28
    AccordionModule,
28 29
    DialogModule,
29 30
    ReactiveFormsModule,
30
    ConfirmDialogModule
31
    ConfirmDialogModule,
32
    SplitButtonModule
31 33
  ]
32 34
})
33 35
export class DashboardModule { }

Také k dispozici: Unified diff