Remove placeholder in macro-tab
This commit is contained in:
committed by
József Farkas
parent
064d2eb29a
commit
8f930092df
@@ -1,13 +1,16 @@
|
||||
<div class="macro-selector">
|
||||
<b> Play macro: </b>
|
||||
<select2 [data]="macroOptions" [value]="macroOptions[selectedMacroIndex + 1].id" (valueChanged)="onChange($event)" [width]="'100%'"></select2>
|
||||
</div>
|
||||
<div class="macro-action-container" [class.inactive]="selectedMacroIndex === -1">
|
||||
<template [ngIf]="selectedMacroIndex >= 0">
|
||||
<div class="list-group">
|
||||
<macro-item *ngFor="let macroAction of macros[selectedMacroIndex].macroActions"
|
||||
[macroAction]="macroAction" [editable]="false">
|
||||
</macro-item>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<template [ngIf]="macroOptions.length === 0">
|
||||
<span> No macros are available to choose from. Create a macro first! </span>
|
||||
</template>
|
||||
<template [ngIf]="macroOptions.length > 0">
|
||||
<div class="macro-selector">
|
||||
<b> Play macro: </b>
|
||||
<select2 [data]="macroOptions" [value]="macroOptions[selectedMacroIndex].id" (valueChanged)="onChange($event)" [width]="'100%'"></select2>
|
||||
</div>
|
||||
<div class="macro-action-container">
|
||||
<div class="list-group">
|
||||
<macro-item *ngFor="let macroAction of macros[selectedMacroIndex].macroActions"
|
||||
[macroAction]="macroAction" [editable]="false">
|
||||
</macro-item>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -2,6 +2,10 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
> span {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.macro-selector {
|
||||
display: flex;
|
||||
margin-top: 2px;
|
||||
@@ -28,10 +32,6 @@
|
||||
border-radius: 4px;
|
||||
border: 1px solid #ddd;
|
||||
|
||||
&.inactive {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.list-group {
|
||||
margin-bottom: 0;
|
||||
border: 0;
|
||||
|
||||
@@ -31,21 +31,16 @@ export class MacroTabComponent implements OnInit, OnDestroy, Tab {
|
||||
this.subscription = store.let(getMacroEntities())
|
||||
.subscribe((macros: Macro[]) => this.macros = macros);
|
||||
this.macroOptions = [];
|
||||
this.selectedMacroIndex = -1;
|
||||
this.selectedMacroIndex = 0;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.macroOptions.push({
|
||||
id: '-1',
|
||||
text: 'Select macro'
|
||||
});
|
||||
|
||||
this.macroOptions = this.macroOptions.concat(this.macros.map(function (macro: Macro): Select2OptionData {
|
||||
this.macroOptions = this.macros.map(function (macro: Macro): Select2OptionData {
|
||||
return {
|
||||
id: macro.id.toString(),
|
||||
text: macro.name
|
||||
};
|
||||
}));
|
||||
});
|
||||
this.fromKeyAction(this.defaultKeyAction);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user