Skip to content

Commit

Permalink
argoproj#46 Open side panels if checkbox changed to true.
Browse files Browse the repository at this point in the history
  • Loading branch information
wokeGit committed Oct 11, 2017
1 parent 83063f6 commit 05a30fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,12 @@ export class SetupJobNotificationsComponent implements OnInit {
this.notificationsList[index].validationMessages.missingRecipients.show = false;
}

public argoUsersAndGroupsCheckboxChange(notification) {
public argoUsersAndGroupsCheckboxChange(notification, index) {
notification.isArgoUsersAndGroupsVisible = !notification.isArgoUsersAndGroupsVisible;
if (!notification.isArgoUsersAndGroupsVisible) {
notification.rules.whom = notification.rules.whom.filter(recipient => (recipient.indexOf('@slack') !== -1 || recipient.indexOf('@user') !== -1)).sort();
} else {
this.openUserSelectorPanel(index);
}
}

Expand All @@ -171,10 +173,12 @@ export class SetupJobNotificationsComponent implements OnInit {
}
}

public slackChannelsCheckboxChange(notification) {
public slackChannelsCheckboxChange(notification, index) {
notification.isSlackChannelsVisible = !notification.isSlackChannelsVisible;
if (!notification.isSlackChannelsVisible) {
notification.rules.whom = notification.rules.whom.filter(recipient => (recipient.indexOf('@slack') === -1)).sort();
} else {
this.openSlackChannelPanel(index);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h5>{{ 'Select Recipients:' | uppercase }}</h5>
type="checkbox"
id="users_and_groups_{{ i }}"
[checked]="notification.isArgoUsersAndGroupsVisible"
(change)="argoUsersAndGroupsCheckboxChange(notification)">
(change)="argoUsersAndGroupsCheckboxChange(notification, i)">
<span><i class="fa fa-check"></i></span>
</div>
<label for="users_and_groups_{{ i }}">{{ 'Argo Users and Groups' | translate }}</label>
Expand Down Expand Up @@ -93,7 +93,7 @@ <h5>{{ 'Select Recipients:' | uppercase }}</h5>

<div class="notification-row__list-item">
<div class="ax-checkbox">
<input type="checkbox" id="slack_channels_{{ i }}" [checked]="notification.isSlackChannelsVisible" (change)="slackChannelsCheckboxChange(notification)">
<input type="checkbox" id="slack_channels_{{ i }}" [checked]="notification.isSlackChannelsVisible" (change)="slackChannelsCheckboxChange(notification, i)">
<span><i class="fa fa-check"></i></span>
</div>
<label for="slack_channels_{{ i }}">{{ 'Slack Channels' | translate }}</label>
Expand Down

0 comments on commit 05a30fc

Please sign in to comment.