Skip to content

Commit

Permalink
better save disable checking
Browse files Browse the repository at this point in the history
 * Responding to code review, improve disableSaveButton check

 * Responding to code review, {{#if}} around the entire FileManager
  • Loading branch information
felliott committed Dec 31, 2024
1 parent 16d326a commit 3d4eaf3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class ConfiguredAddonEdit extends Component<Args> {
}

get disableSave() {
return this.hasRootFolder && (!this.selectedFolder || this.invalidDisplayName || this.args.onSave.isRunning);
return this.invalidDisplayName || this.args.onSave.isRunning || (this.hasRootFolder && !this.selectedFolder);
}

get onSaveArgs() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
</span>
{{/if}}
</div>
<AddonsService::FileManager
@configuredAddon={{@configuredAddon}}
@authorizedAccount={{@authorizedAccount}}
@defaultKwargs={{this.defaultKwargs}}
@startingFolderId={{this.selectedFolder}}
as |fileManager|
>
{{#if this.hasRootFolder }}
{{#if this.hasRootFolder }}
<AddonsService::FileManager
@configuredAddon={{@configuredAddon}}
@authorizedAccount={{@authorizedAccount}}
@defaultKwargs={{this.defaultKwargs}}
@startingFolderId={{this.selectedFolder}}
as |fileManager|
>
<div local-class='current-path'>
<Button
data-test-go-to-root
Expand Down Expand Up @@ -127,25 +127,25 @@
{{/if}}
</tbody>
</table>
{{/if}}
<div local-class='footer-buttons-wrapper'>
<Button
data-test-root-folder-save
data-analytics-name='Save selected folder'
@type='primary'
disabled={{this.disableSave}}
{{on 'click' (fn @onSave this.onSaveArgs)}}
>
{{t 'general.save'}}
</Button>
<Button
data-test-root-folder-cancel
data-analytics-name='Cancel'
@type='secondary'
{{on 'click' @onCancel}}
>
{{t 'general.cancel'}}
</Button>
</div>
</AddonsService::FileManager>
</AddonsService::FileManager>
{{/if}}
<div local-class='footer-buttons-wrapper'>
<Button
data-test-root-folder-save
data-analytics-name='Save selected folder'
@type='primary'
disabled={{this.disableSave}}
{{on 'click' (fn @onSave this.onSaveArgs)}}
>
{{t 'general.save'}}
</Button>
<Button
data-test-root-folder-cancel
data-analytics-name='Cancel'
@type='secondary'
{{on 'click' @onCancel}}
>
{{t 'general.cancel'}}
</Button>
</div>
</div>

0 comments on commit 3d4eaf3

Please sign in to comment.