Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 6bd78e65

Přidáno uživatelem Jakub Hlaváč před více než 3 roky(ů)

Re #8915 - Zapracování požadavků ze schůzky

  • all unit actions under one button

Zobrazit rozdíly:

src/app/dashboard/components/dashboard.component.html
9 9
            <div class="col-md-6 text-right">
10 10
              <p-button label="Sensors graph" icon="pi pi-chart-line" [routerLink]="['/dashboard/unit', unit.unit.unitId]"></p-button>
11 11
              <div class="dashboard-button-separator"></div>
12
              <p-button label="Add sensor" icon="pi pi-plus-circle" styleClass="p-button-success" (onClick)="insertSensorPopup($event, unit.unit)"></p-button>
13
              <p-splitButton *ngIf="loggedUser?.userInfo?.rightsId == 0 || loggedUser?.userInfo?.rightsId == 1" (onClick)="showItems($event, unit.unit)"
14
                             icon="pi pi-cog" (onDropdownClick)="showItems($event, unit.unit)" [model]="items" styleClass="p-button-warning"></p-splitButton>
12
              <p-button icon="pi pi-cog" styleClass="p-button-warning" (click)="showItems($event, unit.unit); menu.toggle($event)"></p-button>
13
              <p-menu #menu [popup]="true" [model]="items" [appendTo]="'body'" [baseZIndex]="50"></p-menu>
15 14
            </div>
16 15
          </div>
17 16
        </p-header>
src/app/dashboard/components/dashboard.component.ts
74 74
  }
75 75

  
76 76
  editUnitPopup($event: MouseEvent, unit: Unit) {
77
    $event.stopPropagation();
78 77
    this.editedUnit = unit;
79 78
    this.showEditUnitPopup = true;
80 79
  }
81 80

  
82 81
  insertSensorPopup($event: any, unit: Unit) {
83
    $event.stopPropagation();
84 82
    this.showInsertSensorPopup = true;
85 83
    this.editedUnit = unit;
86 84
  }
87 85

  
88 86
  deleteUnit($event: any, unit: Unit) {
89
    $event.stopPropagation();
90 87
    this.confirmationService.confirm({
91 88
      message: 'Do you want to delete this unit?',
92 89
      header: 'Delete Unit Confirmation',
......
121 118
    $event.stopPropagation();
122 119
    this.items = [
123 120
      {label: 'Edit unit', icon: 'pi pi-cog', command: () => {
124
          event.stopPropagation();
125 121
          this.editUnitPopup($event, unit);
126 122
        }},
127 123
      {label: 'Insert position', icon: 'pi pi-cog', command: () => {
128
          event.stopPropagation();
129 124
          this.insertPosition($event, unit);
130 125
        }},
131 126
      {label: 'Delete unit', icon: 'pi pi-times', command: () => {
132
          event.stopPropagation();
133 127
          this.deleteUnit($event, unit);
128
        }},
129
      {label: 'Add sensor', icon: 'pi pi-cog', command: () => {
130
          this.insertSensorPopup($event, unit);
134 131
        }}
135 132
    ]
136 133
  }
src/app/dashboard/dashboard.module.ts
14 14
import {ConfirmDialogModule} from 'primeng/confirmdialog';
15 15
import {SplitButtonModule} from 'primeng/splitbutton';
16 16
import { PositionInsertPopupComponent } from './components/position-insert-popup/position-insert-popup.component';
17
import {MenuModule} from 'primeng/menu';
17 18

  
18 19

  
19 20

  
20 21
@NgModule({
21
  declarations: [DashboardComponent, SensorsComponent, UnitPopupComponent, SensorPopupComponent, SensorInsertPopupComponent, PositionInsertPopupComponent],
22
  imports: [
23
    CommonModule,
24
    NavBarModule,
25
    RouterModule,
26
    ButtonModule,
27
    AccordionModule,
28
    DialogModule,
29
    ReactiveFormsModule,
30
    ConfirmDialogModule,
31
    SplitButtonModule
32
  ]
22
  declarations: [DashboardComponent, SensorsComponent, UnitPopupComponent, SensorPopupComponent, SensorInsertPopupComponent,
23
    PositionInsertPopupComponent],
24
    imports: [
25
        CommonModule,
26
        NavBarModule,
27
        RouterModule,
28
        ButtonModule,
29
        AccordionModule,
30
        DialogModule,
31
        ReactiveFormsModule,
32
        ConfirmDialogModule,
33
        SplitButtonModule,
34
        MenuModule
35
    ]
33 36
})
34 37
export class DashboardModule { }

Také k dispozici: Unified diff