Skip to content

Commit

Permalink
Addons/update disable addon flow (#2221)
Browse files Browse the repository at this point in the history
-   Ticket: [ENG-5626]
-   Feature flag: `gravy_waffle`

## Purpose

Update the addon-card to not have the disable addon workflow anymore. Also perform miscellaneous fixes.

## Summary of Changes

1. Remove the disable addon workflow from project addons page
2. Update the disconnect addon dialog box to match mockups
3. Make the 'add another location' button do something
4. Ensure we have authorized accounts for account adding another location
  • Loading branch information
brianjgeiger committed May 20, 2024
1 parent b03be1b commit 513e06e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 82 deletions.
26 changes: 23 additions & 3 deletions app/guid-node/addons/index/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@
data-test-add-another-location-button
data-analytics-name='Add another location'
local-class='add-location-button'
{{on 'click' (action manager.beginAccountSetup this.currentProvider)}}
{{on 'click' (queue
(perform provider.getAuthorizedAccounts)
(action manager.beginAccountSetup manager.selectedProvider)
)}}
>
{{t 'addons.list.add-another-location'}}
</Button>
Expand All @@ -202,8 +205,24 @@
@onClose={{action (mut manager.confirmRemoveConnectedLocation) false}}
as |dialog|
>
<dialog.heading>
{{t 'addons.list.disconnect'}} {{provider.provider.name}}
</dialog.heading>
<dialog.main>
{{t 'addons.list.confirm-remove-connected-location'}}
<div local-class='configured-addon-display-name'>
{{manager.selectedConfiguration.displayName}}
</div>
<div>
{{#if manager.selectedConfiguration.rootFolder}}
{{manager.selectedConfiguration.rootFolder}}
{{else}}
{{t 'addons.list.root-folder-not-set'}}
{{/if}}
</div>
<div>
{{t 'addons.list.connected-to-account'}} {{manager.selectedConfiguration.baseAccount.displayName}}
</div>
</dialog.main>
<dialog.footer>
<div local-class='float-right'>
Expand All @@ -212,14 +231,15 @@
data-analytics-name='Cancel remove connected location'
{{on 'click' (action (mut manager.confirmRemoveConnectedLocation) false)}}
>
{{t 'general.cancel'}}
{{t 'general.back'}}
</Button>
<Button
data-test-confirm-remove-connected-location-button
data-analytics-name='Confirm remove connected location'
@type='destroy'
{{on 'click' (perform provider.removeConfiguredAddon manager.selectedConfiguration)}}
>
{{t 'general.confirm'}}
{{t 'addons.list.disconnect'}}
</Button>
</div>
</dialog.footer>
Expand Down
19 changes: 0 additions & 19 deletions lib/osf-components/addon/components/addon-card/component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import { action } from '@ember/object';
import { waitFor } from '@ember/test-waiters';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { task } from 'ember-concurrency';
import { taskFor } from 'ember-concurrency-ts';

import Provider from 'ember-osf-web/packages/addons-service/provider';
import AddonsServiceManagerComponent from 'osf-components/components/addons-service/manager/component';
Expand All @@ -14,20 +9,6 @@ interface Args {
}

export default class AddonsCardComponent extends Component<Args> {
@tracked deleteModalOpen = false;

@action
closeDeleteModal() {
this.deleteModalOpen = false;
}

@task
@waitFor
async disableAddon() {
const { addon } = this.args;
await taskFor(addon.disableProjectAddon).perform();
this.closeDeleteModal();
}

get assetLogo() {
return this.args.addon.provider.iconUrl;
Expand Down
49 changes: 3 additions & 46 deletions lib/osf-components/addon/components/addon-card/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,64 +19,21 @@
<div local-class='buttons-wrapper'>
{{#if this.addonIsConfigured}}
<Button
data-test-addon-card-edit
data-analytics-name='Edit'
data-test-addon-card-configure
data-analytics-name='Configure'
{{on 'click' (fn @manager.listProviderConfigurations @addon)}}
>
{{t 'osf-components.addon-card.configure'}}
</Button>
<Button
data-test-addon-card-disconnect
data-analytics-name='Disconnect'
local-class='disconnect'
{{on 'click' (action (mut this.deleteModalOpen) true)}}
>
{{t 'osf-components.addon-card.disable'}}
</Button>
{{else}}
<Button
data-test-addon-card-connect
data-analytics-name='Connect'
{{on 'click' (fn @manager.beginAccountSetup @addon)}}
>
{{t 'osf-components.addon-card.enable'}}
{{t 'osf-components.addon-card.connect'}}
</Button>
{{/if}}
</div>
</div>
{{#if this.addonIsConfigured}}
<OsfDialog
@isOpen={{this.deleteModalOpen}}
@onClose={{action this.closeDeleteModal}}
as |dialog|
>
<dialog.heading>
{{t 'osf-components.addon-card.disconnect-modal-header'}}
</dialog.heading>
<dialog.main>
<p>
{{t 'osf-components.addon-card.disconnect-modal-body'}}
</p>
</dialog.main>
<dialog.footer data-analytics-scope='Disconnect addon modal'>
<Button
data-test-addon-disconnect-cancel
data-analytics-name='Cancel'
@type='secondary'
{{on 'click' dialog.close}}
>
{{t 'general.cancel'}}
</Button>
<Button
data-test-addon-disconnect-modal-confirm
data-analytics-name='Confirm Disconnect'
@type='destroy'
disabled={{this.disableAddon.isRunning}}
{{on 'click' (perform this.disableAddon)}}
>
{{t 'osf-components.addon-card.disconnect'}}
</Button>
</dialog.footer>
</OsfDialog>
{{/if}}

12 changes: 3 additions & 9 deletions tests/integration/components/addon-card/component-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ module('Integration | Component | addon-card', hooks => {
provider: {
id: 'box',
name: 'Test Addon',
displayName: 'Test Addon',
iconUrl: 'https://some.url/from/addons/service/box.png',
},
disableProjectAddon: { perform: sinon.stub() },
Expand Down Expand Up @@ -100,17 +101,10 @@ module('Integration | Component | addon-card', hooks => {
);
assert.dom('[data-test-addon-card-logo]').hasAttribute('alt', 'Test Addon logo', 'Alt text is correct');
assert.dom('[data-test-addon-card-title]').hasText('Test Addon');
assert.dom('[data-test-addon-card-edit]').exists();
assert.dom('[data-test-addon-card-disconnect]').exists();
assert.dom('[data-test-addon-card-configure]').exists();
assert.dom('[data-test-addon-card-connect]').doesNotExist();

await click('[data-test-addon-card-edit]');
await click('[data-test-addon-card-configure]');
assert.ok(this.manager.listProviderConfigurations.calledOnce);
await click('[data-test-addon-card-disconnect]');
assert.dom('[data-test-addon-disconnect-modal-confirm]').exists();
assert.dom('#osf-dialog-heading').hasText('Disable Add-on');
assert.dom('[data-test-dialog] main').containsText('Are you sure you want to disable this add-on?');
await click('[data-test-addon-disconnect-modal-confirm]');
assert.ok(addonObj.disableProjectAddon.perform.calledOnce);
});
});
7 changes: 2 additions & 5 deletions translations/en-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ addons:
connected-locations: 'Connected locations'
add-another-location: 'Add another location'
all-addons: 'All Add-ons'
confirm-remove-connected-location: 'Are you sure you want to disconnect this addon?'
confirm-remove-connected-location: 'You are about to disconnect the addon below from the project.'
connected-to-account: 'Connected to account'
root-folder-not-set: 'Root folder not set'
sync-details-1: 'Sync your projects with external services to help stay connected and organized. Select a category and browse the options.'
Expand All @@ -246,6 +246,7 @@ addons:
no-results: 'No results found'
no-authorized-accounts: 'No authorized accounts'
connect: 'Connect'
disconnect: 'Disconnect'
reconnect: 'Reconnect'
configure: 'Configure'
disable: 'Disable'
Expand Down Expand Up @@ -2161,13 +2162,9 @@ routes:
email: Email
osf-components:
addon-card:
enable: Enable
connect: Connect
disable: Disable
configure: Configure
provider-logo-alt: '{provider} logo'
disconnect-modal-header: 'Disable Add-on'
disconnect-modal-body: 'Are you sure you want to disable this add-on?'
search-result-card:
show_additional_metadata: 'Show additional metadata'
hide_additional_metadata: 'Hide additional metadata'
Expand Down

0 comments on commit 513e06e

Please sign in to comment.