@@ -3,9 +3,12 @@ import styled from '@emotion/styled';
3
3
4
4
import { addSuccessMessage } from 'sentry/actionCreators/indicator' ;
5
5
import { openModal } from 'sentry/actionCreators/modal' ;
6
+ import Feature from 'sentry/components/acl/feature' ;
7
+ import FeatureDisabled from 'sentry/components/acl/featureDisabled' ;
6
8
import { Button } from 'sentry/components/core/button' ;
7
9
import { ButtonBar } from 'sentry/components/core/button/buttonBar' ;
8
10
import { DropdownMenu } from 'sentry/components/dropdownMenu' ;
11
+ import { Hovercard } from 'sentry/components/hovercard' ;
9
12
import { IconChevron } from 'sentry/icons' ;
10
13
import { t } from 'sentry/locale' ;
11
14
import { space } from 'sentry/styles/space' ;
@@ -77,52 +80,72 @@ function SegmentedIssueViewSaveButton({
77
80
} ;
78
81
79
82
return (
80
- < ButtonBar merged >
81
- < PrimarySaveButton
82
- priority = { buttonPriority }
83
- data-test-id = { hasUnsavedChanges ? 'save-button-unsaved' : 'save-button' }
84
- onClick = { ( ) => {
85
- if ( canEdit ) {
86
- saveView ( ) ;
87
- } else {
88
- openCreateIssueViewModal ( ) ;
83
+ < Feature
84
+ features = { [ 'organizations:issue-views' ] }
85
+ hookName = "feature-disabled:issue-views"
86
+ renderDisabled = { props => (
87
+ < Hovercard
88
+ body = {
89
+ < FeatureDisabled
90
+ features = { props . features }
91
+ hideHelpToggle
92
+ featureName = { t ( 'Multiple Project Selection' ) }
93
+ />
89
94
}
90
- } }
91
- disabled = { isSaving }
92
- >
93
- { canEdit ? t ( 'Save' ) : t ( 'Save As' ) }
94
- </ PrimarySaveButton >
95
- < DropdownMenu
96
- items = { [
97
- {
98
- key : 'reset' ,
99
- label : t ( 'Reset' ) ,
100
- disabled : ! hasUnsavedChanges ,
101
- onAction : ( ) => {
102
- discardUnsavedChanges ( ) ;
103
- } ,
104
- } ,
105
- {
106
- key : 'save-as' ,
107
- label : t ( 'Save as new view' ) ,
108
- onAction : ( ) => {
109
- openCreateIssueViewModal ( ) ;
110
- } ,
111
- hidden : ! canEdit ,
112
- } ,
113
- ] }
114
- trigger = { props => (
115
- < DropdownTrigger
116
- { ...props }
117
- disabled = { isSaving }
118
- icon = { < IconChevron direction = "down" /> }
119
- aria-label = { t ( 'More save options' ) }
95
+ >
96
+ { typeof props . children === 'function' ? props . children ( props ) : props . children }
97
+ </ Hovercard >
98
+ ) }
99
+ >
100
+ { ( { hasFeature} ) => (
101
+ < ButtonBar merged >
102
+ < PrimarySaveButton
120
103
priority = { buttonPriority }
104
+ data-test-id = { hasUnsavedChanges ? 'save-button-unsaved' : 'save-button' }
105
+ onClick = { ( ) => {
106
+ if ( canEdit ) {
107
+ saveView ( ) ;
108
+ } else {
109
+ openCreateIssueViewModal ( ) ;
110
+ }
111
+ } }
112
+ disabled = { ! hasFeature || isSaving }
113
+ >
114
+ { canEdit ? t ( 'Save' ) : t ( 'Save As' ) }
115
+ </ PrimarySaveButton >
116
+ < DropdownMenu
117
+ items = { [
118
+ {
119
+ key : 'reset' ,
120
+ label : t ( 'Reset' ) ,
121
+ disabled : ! hasUnsavedChanges ,
122
+ onAction : ( ) => {
123
+ discardUnsavedChanges ( ) ;
124
+ } ,
125
+ } ,
126
+ {
127
+ key : 'save-as' ,
128
+ label : t ( 'Save as new view' ) ,
129
+ onAction : ( ) => {
130
+ openCreateIssueViewModal ( ) ;
131
+ } ,
132
+ hidden : ! canEdit ,
133
+ } ,
134
+ ] }
135
+ trigger = { props => (
136
+ < DropdownTrigger
137
+ { ...props }
138
+ disabled = { isSaving }
139
+ icon = { < IconChevron direction = "down" /> }
140
+ aria-label = { t ( 'More save options' ) }
141
+ priority = { buttonPriority }
142
+ />
143
+ ) }
144
+ position = "bottom-end"
121
145
/>
122
- ) }
123
- position = "bottom-end"
124
- />
125
- </ ButtonBar >
146
+ </ ButtonBar >
147
+ ) }
148
+ </ Feature >
126
149
) ;
127
150
}
128
151
0 commit comments