Skip to content

Commit 53585c6

Browse files
authored
[ENG-6587] ownCloud setup (#2410)
- Ticket: [ENG-6587] - Feature flag: n/a ## Purpose - Allow users to add url when connecting an ownCloud account ## Summary of Changes - Update logic for when to show URL input box - Remove unused credentials format - Update language to make URL input more generic and less bound to ownCloud
1 parent f51aa4b commit 53585c6

File tree

7 files changed

+7
-18
lines changed

7 files changed

+7
-18
lines changed

app/models/external-service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export enum CredentialsFormat {
77
ACCESS_SECRET_KEYS = 'ACCESS_KEY_SECRET_KEY',
88
REPO_TOKEN = 'PERSONAL_ACCESS_TOKEN',
99
DATAVERSE_API_TOKEN = 'DATAVERSE_API_TOKEN',
10-
URL_USERNAME_PASSWORD = 'url_username_password',
1110
}
1211

1312
export enum ExternalServiceCapabilities {

lib/osf-components/addon/components/addons-service/addon-account-setup/component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default class AddonAccountSetupComponent extends Component<Args> {
5151

5252
@tracked selectedRepo?: string;
5353
@tracked otherRepo?: string;
54-
@tracked url?: string;
54+
@tracked url?: string = this.args.account?.apiBaseUrl;
5555
@tracked newAccount?: AllAuthorizedAccountTypes;
5656
@tracked pendingOauth = false;
5757
@tracked credentialsObject: AddonCredentialFields = {};
@@ -63,7 +63,7 @@ export default class AddonAccountSetupComponent extends Component<Args> {
6363
}
6464

6565
get showUrlField() {
66-
return this.args.provider.credentialsFormat === CredentialsFormat.URL_USERNAME_PASSWORD;
66+
return this.args.provider.configurableApiRoot;
6767
}
6868

6969
otherRepoLabel = this.intl.t('addons.accountCreate.other-repo-label');
@@ -106,7 +106,7 @@ export default class AddonAccountSetupComponent extends Component<Args> {
106106
const credentials = this.credentialsObject;
107107
const t = this.intl.t.bind(this.intl);
108108
switch (this.args.provider.credentialsFormat) {
109-
case CredentialsFormat.USERNAME_PASSWORD, CredentialsFormat.URL_USERNAME_PASSWORD: {
109+
case CredentialsFormat.USERNAME_PASSWORD: {
110110
const passwordPostText = t('addons.accountCreate.password-post-text');
111111
return [
112112
{

lib/osf-components/addon/components/addons-service/addon-account-setup/template.hbs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,13 @@
9393
{{t 'addons.accountCreate.url-label'}}
9494
</label>
9595
<div local-class='post-text'>
96-
{{t 'addons.accountCreate.owncloud-url-post-text' htmlSafe=true }}
96+
{{t 'addons.accountCreate.url-post-text' htmlSafe=true }}
9797
</div>
9898
<Input
9999
id={{url-id}}
100100
data-test-input='url'
101101
local-class='input'
102102
name='url'
103-
placeholder={{t 'addons.accountCreate.url-placeholder'}}
104103
@type='text'
105104
@value={{this.url}}
106105
/>

mirage/fixtures/external-storage-services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export default [
122122
{
123123
id: 'owncloud',
124124
displayName: 'ownCloud',
125-
credentialsFormat: CredentialsFormat.URL_USERNAME_PASSWORD,
125+
credentialsFormat: CredentialsFormat.USERNAME_PASSWORD,
126126
supportedFeatures: [
127127
ExternalServiceCapabilities.ADD_UPDATE_FILES,
128128
ExternalServiceCapabilities.DELETE_FILES,

mirage/views/addons.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -467,14 +467,6 @@ function fakeCheckCredentials(
467467
throw new Error('Username and password are required');
468468
}
469469
break;
470-
case CredentialsFormat.URL_USERNAME_PASSWORD:
471-
if (!attrs.apiBaseUrl || !credentials.username || !credentials.password) {
472-
throw new Error('URL, username, and password are required');
473-
}
474-
if (attrs.apiBaseUrl.indexOf('http') < 0) {
475-
throw new Error('Invalid URL');
476-
}
477-
break;
478470
default: // OAuth or OAuth2 should be authorized using the address found in authUrl. Faked below for mirage
479471
return false;
480472
}

tests/acceptance/settings/addons-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ module('Acceptance | settings | addons', hooks => {
9090
{
9191
id: 'owncloud',
9292
displayName: 'ownCloud',
93-
credentialsFormat: CredentialsFormat.URL_USERNAME_PASSWORD,
93+
credentialsFormat: CredentialsFormat.USERNAME_PASSWORD,
9494
supportedFeatures: [
9595
ExternalServiceCapabilities.ADD_UPDATE_FILES,
9696
ExternalServiceCapabilities.DELETE_FILES,

translations/en-us.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,7 @@ addons:
312312
display-name-placeholder: 'Account name'
313313
display-name-help: 'This is help text for the display name'
314314
url-label: 'Host URL'
315-
url-placeholder: 'owncloud.example.org'
316-
owncloud-url-post-text: 'Only ownCloud instances supporting <a href="https://doc.owncloud.com/">WebDAV</a> and <a href"https://www.freedesktop.org/wiki/Specifications/open-collaboration-services-1.7/">OCS v1.7</a> are supported.'
315+
url-post-text: 'Please include <i>http</i> or <i>https</i>'
317316
username-label: 'Username'
318317
password-label: 'Password'
319318
username-placeholder: 'Username'

0 commit comments

Comments
 (0)