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
4 changes: 3 additions & 1 deletion app/models/authorized-citation-account.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { AsyncBelongsTo, attr, belongsTo } from '@ember-data/model';

import ExternalCitationServiceModel from './external-citation-service';
import { AddonCredentialFields } from './authorized-storage-account';
import UserReferenceModel from './user-reference';
import OsfModel from './osf-model';

export default class AuthorizedCitationAccountModel extends OsfModel {
@attr('fixstring') externalUserId!: string;
@attr('fixstring') externalUserDisplayName!: string;
@attr('fixstringarray') scopes!: string[];
@attr('object') credentials?: AddonCredentialFields; // write-only

@belongsTo('external-citation-service')
externalCitationService!: AsyncBelongsTo<ExternalCitationServiceModel> & ExternalCitationServiceModel;
citationService!: AsyncBelongsTo<ExternalCitationServiceModel> & ExternalCitationServiceModel;

@belongsTo('user-reference', { inverse: 'authorizedCitationAccounts' })
configuringUser!: AsyncBelongsTo<UserReferenceModel> & UserReferenceModel;
Expand Down
4 changes: 3 additions & 1 deletion app/models/authorized-computing-account.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { AsyncBelongsTo, attr, belongsTo } from '@ember-data/model';

import ExternalComputingService from './external-computing-service';
import { AddonCredentialFields } from './authorized-storage-account';
import UserReferenceModel from './user-reference';
import OsfModel from './osf-model';

export default class AuthorizedComputingAccount extends OsfModel {
@attr('fixstring') externalUserId!: string;
@attr('fixstring') externalUserDisplayName!: string;
@attr('fixstringarray') scopes!: string[];
@attr('object') credentials?: AddonCredentialFields; // write-only

@belongsTo('external-computing-service')
externalComputingService!: AsyncBelongsTo<ExternalComputingService> & ExternalComputingService;
computingService!: AsyncBelongsTo<ExternalComputingService> & ExternalComputingService;

@belongsTo('user-reference', { inverse: 'authorizedComputingAccounts' })
configuringUser!: AsyncBelongsTo<UserReferenceModel> & UserReferenceModel;
Expand Down
1 change: 1 addition & 0 deletions app/models/authorized-storage-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class AuthorizedStorageAccountModel extends OsfModel {
@attr('fixstring') externalUserId!: string;
@attr('fixstring') externalUserDisplayName!: string;
@attr('fixstringarray') scopes!: string[];
@attr('object') credentials?: AddonCredentialFields; // write-only

@belongsTo('external-storage-service')
storageProvider!: AsyncBelongsTo<ExternalStorageServiceModel> & ExternalStorageServiceModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export default class AddonsServiceManagerComponent extends Component<Args> {
.createAccountForNodeAddon).perform(this.credentialsObject);
await taskFor(this.selectedProvider.providerMap!.createConfiguredAddon).perform(newAccount);
}
this.clearCredentials();
this.pageMode = PageMode.CONFIGURE;
} catch (e) {
const errorMessage = this.intl.t('addons.accountCreate.error');
Expand Down Expand Up @@ -185,9 +186,23 @@ export default class AddonsServiceManagerComponent extends Component<Args> {
cancelSetup() {
this.pageMode = undefined;
this.selectedProvider = undefined;
this.clearCredentials();
this.selectedAccount = undefined;
}

@action
clearCredentials() {
this.credentialsObject = {
url: '',
username: '',
password: '',
token: '',
accessKey: '',
secretKey: '',
repo: '',
};
}

@action
save() {
this.cancelSetup();
Expand Down