Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/backend/effects/builtin/toggle-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const chat = {
</eos-container>

<eos-container header="Event" pad-top="true" ng-show="effect.selectedGroupName">
<dropdown-select options="eventOptions[effect.selectedGroupName]" selected="effect.selectedEventId"></dropdown-select>
<dropdown-select options="eventOptions[effect.selectedGroupName]" selected="effect.selectedEventId" value-mode="object"></dropdown-select>
</eos-container>

<eos-container header="Toggle Action" pad-top="true">
Expand All @@ -48,6 +48,11 @@ const chat = {

for (const groupEvent of groups[groupId].events) {
$scope.eventOptions[group.name][groupEvent.id] = groupEvent.name;

// Update the effect should the event set have been renamed
if ($scope.effect.selectedEventId === groupEvent.id) {
$scope.effect.selectedGroupName = group.name;
}
}
}

Expand All @@ -63,14 +68,14 @@ const chat = {
$scope.effect.toggleType = "disable";
}
},
optionsValidator: effect => {
optionsValidator: (effect) => {
const errors = [];
if (effect.selectedEventId == null) {
errors.push("Please select an event.");
}
return errors;
},
onTriggerEvent: async event => {
onTriggerEvent: async (event) => {
const { effect } = event;
const selectedEvent = eventAccess.getEvent(effect.selectedEventId);
const isActive = effect.toggleType === "toggle" ? !selectedEvent.active : effect.toggleType === "enable";
Expand Down
9 changes: 7 additions & 2 deletions src/gui/app/directives/controls/firebot-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
onUpdate: '&',
isDisabled: '<',
rightJustify: "<?",
ariaLabel: "@?"
ariaLabel: "@?",
valueMode: "@?"
},
template: `
<div class="btn-group" uib-dropdown>
Expand Down Expand Up @@ -73,8 +74,12 @@
};

function loadOptions() {
if (ctrl.valueMode === "string") {
ctrl.objectMode = false;
return;
}
const options = ctrl.options;
if (!Array.isArray(options) && options instanceof Object) {
if (ctrl.valueMode === "object" || !Array.isArray(options) && options instanceof Object) {
ctrl.objectMode = true;
}
}
Expand Down