Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookworm rebased #554

Closed
wants to merge 5 commits into from
Closed
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
6 changes: 3 additions & 3 deletions app/src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ export default {
const api = this

function reconnect(n) {
api
.get('logout', {}, { key: 'reconnecting' })
store
.dispatch('GET_YUNOHOST_INFOS')
.then(resolve)
.catch((err) => {
if (err.name === 'APIUnauthorizedError') {
resolve()
reject(err)
} else if (n < 1) {
reject(err)
} else {
Expand Down
35 changes: 14 additions & 21 deletions app/src/helpers/yunohostArguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,13 @@ function addEvaluationGetter(prop, obj, expr, ctx, nested) {
* @return {Object} an formated argument containing formItem props, validation and base value.
*/
export function formatYunoHostArgument(arg) {
let value =
arg.value !== undefined
? arg.value
: arg.current_value !== undefined
? arg.current_value
: null
let value = arg.value !== undefined ? arg.value : null
const validation = {}
const error = { message: null }
arg.ask = formatI18nField(arg.ask)
const field = {
is: arg.readonly ? 'ReadOnlyField' : 'FormField',
visible: [undefined, true, '"true"'].includes(arg.visible),
visible: arg.visible,
props: {
label: arg.ask,
component: undefined,
Expand Down Expand Up @@ -168,11 +163,11 @@ export function formatYunoHostArgument(arg) {
name: 'InputItem',
props: defaultProps.concat(['type', 'min', 'max', 'step']),
callback: function () {
if (!isNaN(parseInt(arg.min))) {
validation.minValue = validators.minValue(parseInt(arg.min))
if (arg.min !== undefined) {
validation.minValue = validators.minValue(arg.min)
}
if (!isNaN(parseInt(arg.max))) {
validation.maxValue = validators.maxValue(parseInt(arg.max))
if (arg.max !== undefined) {
validation.maxValue = validators.maxValue(arg.max)
}
validation.numValue = validators.integer
},
Expand Down Expand Up @@ -277,11 +272,12 @@ export function formatYunoHostArgument(arg) {
]

// Default type management if no one is filled
if (arg.choices && arg.choices.length) {
arg.type = 'select'
}
if (arg.type === undefined) {
arg.type = 'string'
if (arg.choices && arg.choices.length) {
arg.type = 'select'
} else {
arg.type = 'string'
}
}

// Search the component bind to the type
Expand Down Expand Up @@ -328,9 +324,6 @@ export function formatYunoHostArgument(arg) {
}

// Default value if still `null`
if (value === null && arg.current_value) {
value = arg.current_value
}
if (value === null && arg.default) {
value = arg.default
}
Expand Down Expand Up @@ -433,12 +426,12 @@ export function formatYunoHostConfigPanels(data) {
const section = {
id: _section.id,
isActionSection: _section.is_action_section,
visible: [undefined, true, '"true"'].includes(_section.visible),
visible: _section.visible
}
if (_section.help) section.help = formatI18nField(_section.help)
if (_section.name) section.name = formatI18nField(_section.name)
if (_section.visible && ![false, '"false"'].includes(_section.visible)) {
addEvaluationGetter('visible', section, _section.visible, result.forms)
if (typeof _section.visible === "string") {
addEvaluationGetter('visible', section, section.visible, result.forms)
}

const { form, fields, validations, errors } = formatYunoHostArguments(
Expand Down
2 changes: 1 addition & 1 deletion app/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"unknown": "Connection with the server has been closed for unknown reasons.",
"upgrade_system": "Connection with the server has been closed due to YunoHost upgrade. Waiting for the server to be reachable again…"
},
"success": "The server is now reachable! You can try to login",
"session_expired": "The server is now reachable! But it looks like your session expired, please login.",
"title": "Trying to communicate with the server..."
}
},
Expand Down
3 changes: 1 addition & 2 deletions app/src/store/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,9 @@ export default {
return api.get('logout')
},

TRY_TO_RECONNECT({ commit, dispatch }, args = {}) {
TRY_TO_RECONNECT({ commit }, args = {}) {
// FIXME This is very ugly arguments forwarding, will use proper component way of doing this when switching to Vue 3 (teleport)
commit('SET_RECONNECTING', args)
dispatch('RESET_CONNECTED')
},

GET_YUNOHOST_INFOS({ commit }) {
Expand Down
14 changes: 9 additions & 5 deletions app/src/views/_partials/ReconnectingDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
</div>
</template>

<template v-if="status === 'success'">
<BAlert variant="success" v-t="'api.reconnecting.success'" />
<template v-if="status === 'expired'">
<BAlert variant="success" v-t="'api.reconnecting.session_expired'" />

<LoginView force-reload />
</template>
Expand Down Expand Up @@ -66,10 +66,14 @@ export default {
api
.tryToReconnect({ ...this.reconnecting, initialDelay })
.then(() => {
this.status = 'success'
this.$store.commit('SET_RECONNECTING', null)
})
.catch(() => {
this.status = 'failed'
.catch((err) => {
if (err.name === 'APIUnauthorizedError') {
this.status = 'expired'
} else {
this.status = 'failed'
}
})
},
},
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
yunohost (12.0.0) unstable; urgency=low

- Tmp changelog to prepare Bookworm

-- Tagada <[email protected]> Fri, 12 May 2023 16:20:28 +0000

yunohost-admin (11.2.4.1) stable; urgency=low

- [i18n] Translations updated for Arabic, Basque, Catalan, Chinese (Simplified), English, French, Galician, German, Italian, Kabyle, Korean, Occitan, Spanish, Ukrainian
Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TMPDIR = $$(pwd)/debian/yunohost-admin
override_dh_auto_build:
/usr/bin/curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null
/usr/bin/curl -s https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/trusted.gpg.d/yarn.gpg >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_14.x bullseye main' > /etc/apt/sources.list.d/nodesource.list
echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_14.x bookworm main' > /etc/apt/sources.list.d/nodesource.list
echo "deb [signed-by=/etc/apt/trusted.gpg.d/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
/usr/bin/apt update
/usr/bin/apt install nodejs yarn -y
Expand Down
Loading