Skip to content

Commit

Permalink
Fix build issues and run unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>
  • Loading branch information
SagarGi committed Jul 2, 2024
1 parent b8f4df9 commit ec53542
Show file tree
Hide file tree
Showing 19 changed files with 91 additions and 107 deletions.
41 changes: 20 additions & 21 deletions src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ import axios from '@nextcloud/axios'
import { loadState } from '@nextcloud/initial-state'
import { generateUrl } from '@nextcloud/router'
import { showSuccess, showError } from '@nextcloud/dialogs'
import '@nextcloud/dialogs/styles/toast.scss'
import CheckBoldIcon from 'vue-material-design-icons/CheckBold.vue'
import PencilIcon from 'vue-material-design-icons/Pencil.vue'
import { NcLoadingIcon, NcCheckboxRadioSwitch, NcButton } from '@nextcloud/vue'
Expand Down Expand Up @@ -764,7 +763,7 @@ export default {
await this.clearOPOAuthClientValues()
}
},
true
true,
)
},
async clearOPOAuthClientValues() {
Expand Down Expand Up @@ -794,7 +793,7 @@ export default {
await this.resetAllAppValues()
}
},
true
true,
)
},
async resetAllAppValues() {
Expand All @@ -820,7 +819,7 @@ export default {
this.openProjectNotReachableErrorMessageDetails = null
this.openProjectNotReachableErrorMessage = t(
'integration_openproject',
'Please introduce a valid OpenProject hostname'
'Please introduce a valid OpenProject hostname',
)
if (response.data.result === true) {
this.isOpenProjectInstanceValid = true
Expand All @@ -834,30 +833,30 @@ export default {
)
this.openProjectNotReachableErrorMessageDetails = t(
'integration_openproject',
'The URL should have the form "https://openproject.org"'
'The URL should have the form "https://openproject.org"',
)
break
case 'not_valid_body':
this.openProjectNotReachableErrorMessage = t(
'integration_openproject',
'There is no valid OpenProject instance listening at that URL, please check the Nextcloud logs'
'There is no valid OpenProject instance listening at that URL, please check the Nextcloud logs',
)
break
case 'client_exception': {
this.openProjectNotReachableErrorMessage = t(
'integration_openproject',
'There is no valid OpenProject instance listening at that URL, please check the Nextcloud logs'
'There is no valid OpenProject instance listening at that URL, please check the Nextcloud logs',
)
this.openProjectNotReachableErrorMessageDetails = t(
'integration_openproject',
'Response:'
'Response:',
) + ' "' + response.data.details + '"'
break
}
case 'server_exception': {
this.openProjectNotReachableErrorMessage = t(
'integration_openproject',
'Server replied with an error message, please check the Nextcloud logs'
'Server replied with an error message, please check the Nextcloud logs',
)
this.openProjectNotReachableErrorMessageDetails = response.data.details
break
Expand All @@ -868,14 +867,14 @@ export default {
this.openProjectNotReachableErrorMessage = t(
'integration_openproject',
'Accessing OpenProject servers with local addresses is not allowed.'
'Accessing OpenProject servers with local addresses is not allowed.',
)
this.openProjectNotReachableErrorMessageDetails = t(
'integration_openproject',
'To be able to use an OpenProject server with a local address, enable the `allow_local_remote_servers` setting. {htmlLink}.',
{ htmlLink },
null,
{ escape: false, sanitize: false }
{ escape: false, sanitize: false },
)
break
}
Expand All @@ -885,7 +884,7 @@ export default {
this.openProjectNotReachableErrorMessage = t(
'integration_openproject',
'The given URL redirects to \'{location}\'. Please do not use a URL that leads to a redirect.',
{ location }
{ location },
)
break
}
Expand All @@ -895,7 +894,7 @@ export default {
default: {
this.openProjectNotReachableErrorMessage = t(
'integration_openproject',
'Could not connect to the given URL, please check the Nextcloud logs'
'Could not connect to the given URL, please check the Nextcloud logs',
)
this.openProjectNotReachableErrorMessageDetails = response.data.details
break
Expand Down Expand Up @@ -965,7 +964,7 @@ export default {
this.projectFolderSetupError = error.response.data.error
}
showError(
t('integration_openproject', 'Failed to save OpenProject admin options')
t('integration_openproject', 'Failed to save OpenProject admin options'),
)
}
this.notifyAboutOPOAuthTokenRevoke()
Expand All @@ -986,17 +985,17 @@ export default {
switch (this.oPOAuthTokenRevokeStatus) {
case 'connection_error':
showError(
t('integration_openproject', 'Failed to perform revoke request due to connection error with the OpenProject server')
t('integration_openproject', 'Failed to perform revoke request due to connection error with the OpenProject server'),
)
break
case 'other_error':
showError(
t('integration_openproject', 'Failed to revoke some users\' OpenProject OAuth access tokens')
t('integration_openproject', 'Failed to revoke some users\' OpenProject OAuth access tokens'),
)
break
case 'success':
showSuccess(
t('integration_openproject', 'Successfully revoked users\' OpenProject OAuth access tokens')
t('integration_openproject', 'Successfully revoked users\' OpenProject OAuth access tokens'),
)
break
default:
Expand All @@ -1019,7 +1018,7 @@ export default {
this.createNCOAuthClient()
}
},
true
true,
)
},
async completeIntegrationWithoutProjectFolderSetUp() {
Expand Down Expand Up @@ -1057,7 +1056,7 @@ export default {
await this.createNewAppPassword()
}
},
true
true,
)
},
async createNewAppPassword() {
Expand All @@ -1077,7 +1076,7 @@ export default {
}).catch((error) => {
showError(
t('integration_openproject', 'Failed to create Nextcloud OAuth client')
+ ': ' + error.response.request.responseText
+ ': ' + error.response.request.responseText,
)
})
},
Expand All @@ -1094,7 +1093,7 @@ export default {
}).catch(error => {
showError(
t('integration_openproject', 'Failed to save default user configuration')
+ ': ' + error.response.request.responseText
+ ': ' + error.response.request.responseText,
)
})
},
Expand Down
3 changes: 1 addition & 2 deletions src/components/OAuthConnectButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs'
import { getCurrentUser } from '@nextcloud/auth'
import { translate as t } from '@nextcloud/l10n'
import '@nextcloud/dialogs/styles/toast.scss'
import { NcButton } from '@nextcloud/vue'
import OpenInNewIcon from 'vue-material-design-icons/OpenInNew.vue'
import dompurify from 'dompurify'
Expand Down Expand Up @@ -89,7 +88,7 @@ export default {
.catch((error) => {
showError(
t('integration_openproject', 'Failed to redirect to OpenProject')
+ ': ' + error.message
+ ': ' + error.message,
)
})
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/PersonalSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default {
: error.response?.request?.responseText
showError(
t('integration_openproject', 'Failed to save OpenProject options')
+ ': ' + msg
+ ': ' + msg,
)
})
.finally(() => {
Expand Down
1 change: 0 additions & 1 deletion src/components/admin/TextInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
<script>
import { translate as t } from '@nextcloud/l10n'
import { showSuccess } from '@nextcloud/dialogs'
import '@nextcloud/dialogs/styles/toast.scss'
import { NcButton, NcPopover } from '@nextcloud/vue'
import ClippyIcon from '../icons/ClippyIcon.vue'
import dompurify from 'dompurify'
Expand Down
1 change: 0 additions & 1 deletion src/components/tab/SearchInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import { generateUrl } from '@nextcloud/router'
import { NcSelect, NcButton } from '@nextcloud/vue'
import WorkPackage from './WorkPackage.vue'
import { showError, showSuccess } from '@nextcloud/dialogs'
import '@nextcloud/dialogs/styles/toast.scss'
import { workpackageHelper } from '../../utils/workpackageHelper.js'
import { NO_OPTION_TEXT_STATE, STATE, WORKPACKAGES_SEARCH_ORIGIN } from '../../utils.js'
import { translate as t } from '@nextcloud/l10n'
Expand Down
2 changes: 1 addition & 1 deletion src/components/tab/WorkPackage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default {
try {
const contrast = this.contrastRatio(
this.wpStatusFontColor,
this.getWPStatusColor()
this.getWPStatusColor(),
)
if (contrast <= 2) {
this.wpStatusFontColor = '#000000'
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export function checkOauthConnectionResult(oauthConnectionResult, oauthConnectio
showError(
t(
'integration_openproject',
'OAuth access token could not be obtained:'
) + ' ' + oauthConnectionErrorMessage
'OAuth access token could not be obtained:',
) + ' ' + oauthConnectionErrorMessage,
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/workpackageHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const workpackageHelper = {
showSuccess(successMessage)
} catch (e) {
showError(
t('integration_openproject', 'Failed to link file to work package')
t('integration_openproject', 'Failed to link file to work package'),
)
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/views/CreateWorkPackageModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export default {
'This type has mandatory fields which cannot be filled here. Please, create work packages of this type directly in {htmlLink}.',
{ htmlLink },
null,
{ escape: false, sanitize: false }
{ escape: false, sanitize: false },
)
return dompurify.sanitize(message, { ADD_ATTR: ['target'] })
},
Expand Down
6 changes: 3 additions & 3 deletions src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,16 @@ export default {
},
onMarkAsRead(item) {
const url = generateUrl(
'/apps/integration_openproject/work-packages/' + item.id + '/notifications'
'/apps/integration_openproject/work-packages/' + item.id + '/notifications',
)
axios.delete(url).then((response) => {
showSuccess(
t('integration_openproject', 'Notifications associated with Work package marked as read')
t('integration_openproject', 'Notifications associated with Work package marked as read'),
)
this.fetchNotifications()
}).catch((error) => {
showError(
t('integration_openproject', 'Failed to mark notifications as read')
t('integration_openproject', 'Failed to mark notifications as read'),
)
console.debug(error)
})
Expand Down
4 changes: 2 additions & 2 deletions src/views/LinkMultipleFilesModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default {
if (progressPercentage === 100) {
this.closeRequestModal()
showSuccess(
t('integration_openproject', 'Links to work package created successfully for selected files!')
t('integration_openproject', 'Links to work package created successfully for selected files!'),
)
}
return progressPercentage
Expand All @@ -158,7 +158,7 @@ export default {
await workpackageHelper.linkMultipleFilesToWorkPackageWithChunking(remainingFilesToChunk, selectedWorkPackage, true, this)
if (this.getTotalNoOfFilesAlreadyLinkedInChunking !== remainingFilesToChunk.length) {
showError(
t('integration_openproject', 'Failed to link selected files to work package')
t('integration_openproject', 'Failed to link selected files to work package'),
)
}
},
Expand Down
7 changes: 3 additions & 4 deletions src/views/ProjectsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { showSuccess, showError } from '@nextcloud/dialogs'
import '@nextcloud/dialogs/styles/toast.scss'
import { translate as t } from '@nextcloud/l10n'
import { loadState } from '@nextcloud/initial-state'
import { workpackageHelper } from '../utils/workpackageHelper.js'
Expand Down Expand Up @@ -176,7 +175,7 @@ export default {
unlink(workpackageId, fileId) {
OC.dialogs.confirmDestructive(
t('integration_openproject',
'Are you sure you want to unlink the work package?'
'Are you sure you want to unlink the work package?',
),
t('integration_openproject', 'Confirm unlink'),
{
Expand All @@ -192,13 +191,13 @@ export default {
showSuccess(t('integration_openproject', 'Work package unlinked'))
}).catch((error) => {
showError(
t('integration_openproject', 'Failed to unlink work package')
t('integration_openproject', 'Failed to unlink work package'),
)
this.checkForErrorCode(error.response.status)
})
}
},
true
true,
)
},
async unlinkWorkPackage(workpackageId, fileId) {
Expand Down
Loading

0 comments on commit ec53542

Please sign in to comment.