Skip to content

Commit

Permalink
use format error message
Browse files Browse the repository at this point in the history
Signed-off-by: nabim777 <[email protected]>
  • Loading branch information
nabim777 committed Feb 10, 2025
1 parent b7cf2e4 commit f704008
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
{{ authMethodsLabel.OIDC }}
</NcCheckboxRadioSwitch>
<p v-if="!isOIDCAppInstalledAndEnabled" class="oidc-app-check-description" v-html="getOIDCAppNotInstalledHintText" /> <!-- eslint-disable-line vue/no-v-html -->
<ErrorLabel v-if="isOIDCAppInstalledAndEnabled && !state.user_oidc_supported" :error="errorMessages.userOidcVersionUnsupported" />
<ErrorLabel v-if="isOIDCAppInstalledAndEnabled && !state.user_oidc_supported" :error="errorMessages.appNotSupported('User_Oidc', state.user_oidc_minimum_version)" />
</div>
</div>
<div v-else>
Expand Down Expand Up @@ -530,7 +530,7 @@ import SettingsTitle from '../components/settings/SettingsTitle.vue'
import { F_MODES, FORM, USER_SETTINGS, AUTH_METHOD, AUTH_METHOD_LABEL } from '../utils.js'
import TermsOfServiceUnsigned from './admin/TermsOfServiceUnsigned.vue'
import dompurify from 'dompurify'
import { error as errorMessages } from '../constants/messages.js'
import { messagesFmt as errorMessages } from '../constants/messages.js'
import ErrorLabel from './ErrorLabel.vue'
export default {
name: 'AdminSettings',
Expand Down
7 changes: 4 additions & 3 deletions src/constants/messages.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { translate as t } from '@nextcloud/l10n'
import APP_ID from './appID.js'
import { loadState } from '@nextcloud/initial-state'
const state = loadState('integration_openproject', 'admin-config')

export const error = {
featureNotAvailable: t(APP_ID, 'This feature is not available for this user account'),
opConnectionUnauthorized: t(APP_ID, 'Unauthorized to connect to OpenProject'),
userOidcVersionUnsupported: t(APP_ID, 'USER_OIDC app not supported. Minimum required version: {userOidcMinimumVersion}', { userOidcMinimumVersion: state.user_oidc_minimum_version }),
}

export const messagesFmt = {
appNotSupported: (app, userOidcMinimumVersion) => t(APP_ID, '"app" app not supported. Minimum required version: "{userOidcMinimumVersion}"', { app, userOidcMinimumVersion }),
}

0 comments on commit f704008

Please sign in to comment.