From e09d683d89dcf5bdd037e8e4fb7a62c7da687f64 Mon Sep 17 00:00:00 2001 From: Damien Nicolleau Date: Thu, 27 Feb 2025 16:06:28 +0100 Subject: [PATCH] ref #850 Added translations and btns add and delete with icons and actions related --- DisplayObjects/mobile/assets/i18n/en.json | 30 +- DisplayObjects/mobile/assets/i18n/es.json | 30 +- DisplayObjects/mobile/assets/i18n/fr.json | 32 +- DisplayObjects/mobile/assets/i18n/it.json | 32 +- _c8oProject/mobileApplication.yaml | 2 +- .../adminDashboardUsersWithinGroups.yaml | 677 +++++++----------- .../addUserToGroupForm.yaml | 2 +- .../admin_user_post_in_group_bulk.yaml | 64 ++ .../sequences/admin_users_get_by_group.yaml | 12 +- c8oProject.yaml | 1 + project.md | 30 + 11 files changed, 491 insertions(+), 421 deletions(-) create mode 100644 _c8oProject/sequences/admin_user_post_in_group_bulk.yaml diff --git a/DisplayObjects/mobile/assets/i18n/en.json b/DisplayObjects/mobile/assets/i18n/en.json index f3fa3152..be83c393 100644 --- a/DisplayObjects/mobile/assets/i18n/en.json +++ b/DisplayObjects/mobile/assets/i18n/en.json @@ -13,11 +13,19 @@ "user_create_sucessfull": "User has been created successfully. The user will receive an email at the following address: {{userName}} to reset their password.", "user_alreaydy_exists": "The email {{userName}} is already registered to another user.", "user_create_failed": "User creation failed.", + "group_create_successful": "Group has been created successfully.", + "group_already_exists": "The group {{groupName}} is already registered to another user.", + "group_create_failed": "Group creation failed.", + "all_users": "All users", + "any_group": "No group", "loading_data": "Loading data...", "Update": "Update", - "add_selected_users_to_group": "Add to Group", - "remove_selected_users_from_group": "Remove from Group", - "move_selected_users_to_group": "Move to Group", + "remove_group": "Delete group", + "add_group": "Add group", + "group_name": "Group name", + "add_selected_users_to_group": "Add to group", + "remove_selected_users_from_group": "Remove from group", + "move_selected_users_to_group": "Move to group", "update_rights_rows_error": "An error occurred while modifying the users' rights", "sure_update_rights_edition_rows": "Are you sure you want to allow edition for the {{countlines}} selected users?", "update_rights_edition_confirm": "The {{countlines}} users now have access to edition", @@ -31,6 +39,22 @@ "update_rights_admin_confirm": "The {{countlines}} users are now administrators", "sure_revoke_rights_admin_rows": "Are you sure you want to revoke administrator rights for the {{countlines}} selected users?", "revoke_rights_admin_confirm": "The {{countlines}} users are no longer administrators", + "group_update_rights_rows_error": "An error occurred while updating user group permissions", + "group_sure_update_rights_edition_rows": "Are you sure you want to grant edit access to the selected {{countlines}} user groups?", + "group_update_rights_edition_confirm": "The selected {{countlines}} user groups now have edit access", + "group_sure_revoke_rights_edition_rows": "Are you sure you want to revoke edit access for the selected {{countlines}} user groups?", + "group_revoke_rights_edition_confirm": "The selected {{countlines}} user groups no longer have edit access", + "group_sure_update_rights_nocode_rows": "Are you sure you want to grant access to the no-code base for the selected {{countlines}} user groups?", + "group_update_rights_nocode_confirm": "The selected {{countlines}} user groups now have access to the no-code base", + "group_sure_revoke_rights_nocode_rows": "Are you sure you want to revoke access to the no-code base for the selected {{countlines}} user groups?", + "group_revoke_rights_nocode": "The selected {{countlines}} user groups no longer have access to the no-code base", + "group_sure_update_rights_admin_rows": "Are you sure you want to grant admin rights to the selected {{countlines}} user groups?", + "group_update_rights_admin_confirm": "The selected {{countlines}} user groups are now administrators", + "group_sure_revoke_rights_admin_rows": "Are you sure you want to revoke admin rights for the selected {{countlines}} user groups?", + "group_revoke_rights_admin_confirm": "The selected {{countlines}} user groups are no longer administrators", + "group_sure_delete_rows": "Are you sure you want to delete the selected {{countlines}} user groups?", + "group_delete_row_confirm": "The selected {{countlines}} user groups have been successfully deleted", + "group_delete_row_error": "An error occurred while deleting the user groups", "Confirmation": "Confirmation", "sure_delete_rows": "Are you sure you want to delete the {{countlines}} selected {{resType}}?", "delete_row_confirm": "The {{countlines}} users have been successfully deleted", diff --git a/DisplayObjects/mobile/assets/i18n/es.json b/DisplayObjects/mobile/assets/i18n/es.json index 783a5d30..6b7949a5 100644 --- a/DisplayObjects/mobile/assets/i18n/es.json +++ b/DisplayObjects/mobile/assets/i18n/es.json @@ -15,9 +15,12 @@ "user_create_failed": "Error al crear el usuario.", "loading_data": "Cargando datos...", "Update": "Actualización", - "add_selected_users_to_group": "Añadir al Grupo", - "remove_selected_users_from_group": "Eliminar del Grupo", - "move_selected_users_to_group": "Mover al Grupo", + "group_name": "Nombre del grupo", + "remove_group": "Eliminar un grupo", + "add_group": "Añadir un grupo", + "add_selected_users_to_group": "Añadir al grupo", + "remove_selected_users_from_group": "Eliminar del grupo", + "move_selected_users_to_group": "Mover al grupo", "update_rights_rows_error": "Ocurrió un error al modificar los derechos de los usuarios", "sure_update_rights_edition_rows": "¿Estás seguro de que deseas permitir la edición para los {{countlines}} usuarios seleccionados?", "update_rights_edition_confirm": "Los {{countlines}} usuarios ahora tienen acceso a la edición", @@ -31,6 +34,27 @@ "update_rights_admin_confirm": "Los {{countlines}} usuarios ahora son administradores", "sure_revoke_rights_admin_rows": "¿Estás seguro de que deseas revocar los derechos de administrador para los {{countlines}} usuarios seleccionados?", "revoke_rights_admin_confirm": "Los {{countlines}} usuarios ya no son administradores", + "group_update_rights_rows_error": "Se produjo un error al actualizar los permisos de los grupos de usuarios", + "group_sure_update_rights_edition_rows": "¿Está seguro de que desea conceder acceso de edición a los {{countlines}} grupos de usuarios seleccionados?", + "group_update_rights_edition_confirm": "Los {{countlines}} grupos de usuarios seleccionados ahora tienen acceso de edición", + "group_sure_revoke_rights_edition_rows": "¿Está seguro de que desea revocar el acceso de edición a los {{countlines}} grupos de usuarios seleccionados?", + "group_revoke_rights_edition_confirm": "Los {{countlines}} grupos de usuarios seleccionados ya no tienen acceso de edición", + "group_sure_update_rights_nocode_rows": "¿Está seguro de que desea conceder acceso a la base no-code a los {{countlines}} grupos de usuarios seleccionados?", + "group_update_rights_nocode_confirm": "Los {{countlines}} grupos de usuarios seleccionados ahora tienen acceso a la base no-code", + "group_sure_revoke_rights_nocode_rows": "¿Está seguro de que desea revocar el acceso a la base no-code a los {{countlines}} grupos de usuarios seleccionados?", + "group_revoke_rights_nocode": "Los {{countlines}} grupos de usuarios seleccionados ya no tienen acceso a la base no-code", + "group_sure_update_rights_admin_rows": "¿Está seguro de que desea otorgar derechos de administrador a los {{countlines}} grupos de usuarios seleccionados?", + "group_update_rights_admin_confirm": "Los {{countlines}} grupos de usuarios seleccionados ahora son administradores", + "group_sure_revoke_rights_admin_rows": "¿Está seguro de que desea revocar los derechos de administrador a los {{countlines}} grupos de usuarios seleccionados?", + "group_revoke_rights_admin_confirm": "Los {{countlines}} grupos de usuarios seleccionados ya no son administradores", + "group_sure_delete_rows": "¿Está seguro de que desea eliminar los {{countlines}} grupos de usuarios seleccionados?", + "group_delete_row_confirm": "Los {{countlines}} grupos de usuarios seleccionados se han eliminado con éxito", + "group_delete_row_error": "Se produjo un error al eliminar los grupos de usuarios", + "group_create_successful": "El grupo se ha creado con éxito.", + "group_already_exists": "El grupo {{groupName}} ya está registrado para otro usuario.", + "group_create_failed": "La creación del grupo ha fallado.", + "all_users": "Todos los usuarios", + "any_group": "Ningún grupo", "Confirmation": "Confirmación", "groups": "grupos", "group": "grupo", diff --git a/DisplayObjects/mobile/assets/i18n/fr.json b/DisplayObjects/mobile/assets/i18n/fr.json index 94132604..3da44aa9 100644 --- a/DisplayObjects/mobile/assets/i18n/fr.json +++ b/DisplayObjects/mobile/assets/i18n/fr.json @@ -15,9 +15,11 @@ "user_create_failed": "La création de l'utilisateur a échoué.", "loading_data": "Chargement des données en cours...", "Update": "Mettre à jour", - "add_selected_users_to_group": "Ajouter au Groupe", - "remove_selected_users_from_group": "Retirer du Groupe", - "move_selected_users_to_group": "Déplacer vers un Groupe", + "remove_group": "Supprimer un groupe", + "add_group": "Ajouter un groupe", + "add_selected_users_to_group": "Ajouter au groupe", + "remove_selected_users_from_group": "Retirer du groupe", + "move_selected_users_to_group": "Déplacer vers un groupe", "update_rights_rows_error": "Une erreur s'est produite lors de la modification des droits des utilisateurs", "sure_update_rights_edition_rows": "Souhaitez-vous vraiment autoriser l'édition pour les {{countlines}} utilisateurs sélectionnés ?", "update_rights_edition_confirm": "Les {{countlines}} utilisateurs ont désormais accès à l'édition", @@ -31,11 +33,33 @@ "update_rights_admin_confirm": "Les {{countlines}} utilisateurs sont désormais administrateurs", "sure_revoke_rights_admin_rows": "Souhaitez-vous vraiment révoquer le droit administrateur pour les {{countlines}} utilisateurs sélectionnés ?", "revoke_rights_admin_confirm": "Les {{countlines}} utilisateurs ne sont désormais plus administrateurs", - "Confirmation": "Confirmation", + "group_update_rights_rows_error": "Une erreur s'est produite lors de la modification des droits des groupes d'utilisateurs", + "group_sure_update_rights_edition_rows": "Souhaitez-vous vraiment autoriser l'édition pour les {{countlines}} groupes d'utilisateurs sélectionnés ?", + "group_update_rights_edition_confirm": "Les {{countlines}} groupes d'utilisateurs ont désormais accès à l'édition", + "group_sure_revoke_rights_edition_rows": "Souhaitez-vous vraiment révoquer le droit d'édition pour les {{countlines}} groupes d'utilisateurs sélectionnés ?", + "group_revoke_rights_edition_confirm": "Les {{countlines}} groupes d'utilisateurs n'ont désormais plus accès à l'édition", + "group_sure_update_rights_nocode_rows": "Souhaitez-vous vraiment autoriser l'accès à la base no-code pour les {{countlines}} groupes d'utilisateurs sélectionnés ?", + "group_update_rights_nocode_confirm": "Les {{countlines}} groupes d'utilisateurs ont désormais accès à la base no-code", + "group_sure_revoke_rights_nocode_rows": "Souhaitez-vous vraiment révoquer l'accès à la base no-code pour les {{countlines}} groupes d'utilisateurs sélectionnés ?", + "group_revoke_rights_nocode": "Les {{countlines}} groupes d'utilisateurs n'ont désormais plus accès à la base no-code", + "group_sure_update_rights_admin_rows": "Souhaitez-vous vraiment définir comme administrateurs les {{countlines}} groupes d'utilisateurs sélectionnés ?", + "group_update_rights_admin_confirm": "Les {{countlines}} groupes d'utilisateurs sont désormais administrateurs", + "group_sure_revoke_rights_admin_rows": "Souhaitez-vous vraiment révoquer le droit d'administrateur pour les {{countlines}} groupes d'utilisateurs sélectionnés ?", + "group_revoke_rights_admin_confirm": "Les {{countlines}} groupes d'utilisateurs ne sont désormais plus administrateurs", + "group_sure_delete_rows": "Souhaitez-vous vraiment supprimer les {{countlines}} groupes d'utilisateurs sélectionnés ?", + "group_delete_row_confirm": "Les {{countlines}} groupes d'utilisateurs ont été supprimés avec succès", + "group_delete_row_error": "Une erreur s'est produite lors de la suppression des groupes d'utilisateurs", + "group_create_successful": "Le groupe a été créé avec succès.", + "group_already_exists": "Le groupe {{groupName}} est déjà enregistré pour un autre utilisateur.", + "group_create_failed": "La création du groupe a échoué.", + "Confirmation": "Confirmation", + "all_users": "Tous les utilisateurs", + "any_group": "Aucun groupe", "groups": "groupes", "group": "groupe", "users": "utilisateurs", "user": "utilisateur", + "group_name": "Nom du groupe", "sure_delete_rows": "Souhaitez-vous vraiment supprimer les {{countlines}} {{resType}} sélectionnés ?", "delete_row_confirm": "Les {{countlines}} utilisateurs ont été supprimés avec succès", "delete_row_error": "Une erreur s'est produite lors de la suppression des utilisateurs", diff --git a/DisplayObjects/mobile/assets/i18n/it.json b/DisplayObjects/mobile/assets/i18n/it.json index 56fcf4e4..0306e940 100644 --- a/DisplayObjects/mobile/assets/i18n/it.json +++ b/DisplayObjects/mobile/assets/i18n/it.json @@ -15,9 +15,11 @@ "user_create_failed": "Creazione dell'utente fallita.", "loading_data": "Caricamento dei dati in corso...", "Update": "Aggiornamento", - "add_selected_users_to_group": "Aggiungi al Gruppo", - "remove_selected_users_from_group": "Rimuovi dal Gruppo", - "move_selected_users_to_group": "Sposta nel Gruppo", + "remove_group": "Elimina un gruppo", + "add_group": "Aggiungi un gruppo", + "add_selected_users_to_group": "Aggiungi al gruppo", + "remove_selected_users_from_group": "Rimuovi dal gruppo", + "move_selected_users_to_group": "Sposta nel gruppo", "update_rights_rows_error": "Si è verificato un errore durante la modifica dei diritti degli utenti", "sure_update_rights_edition_rows": "Sei sicuro di voler consentire la modifica per gli {{countlines}} utenti selezionati?", "update_rights_edition_confirm": "Gli {{countlines}} utenti hanno ora accesso alla modifica", @@ -31,7 +33,29 @@ "update_rights_admin_confirm": "Gli {{countlines}} utenti sono ora amministratori", "sure_revoke_rights_admin_rows": "Sei sicuro di voler revocare i diritti di amministratore per gli {{countlines}} utenti selezionati?", "revoke_rights_admin_confirm": "Gli {{countlines}} utenti non sono più amministratori", - "Confirmation": "Conferma", + "group_update_rights_rows_error": "Si è verificato un errore durante la modifica dei permessi dei gruppi di utenti", + "group_sure_update_rights_edition_rows": "Sei sicuro di voler concedere l'accesso alla modifica ai {{countlines}} gruppi di utenti selezionati?", + "group_update_rights_edition_confirm": "I {{countlines}} gruppi di utenti selezionati ora hanno accesso alla modifica", + "group_sure_revoke_rights_edition_rows": "Sei sicuro di voler revocare l'accesso alla modifica ai {{countlines}} gruppi di utenti selezionati?", + "group_revoke_rights_edition_confirm": "I {{countlines}} gruppi di utenti selezionati non hanno più accesso alla modifica", + "group_sure_update_rights_nocode_rows": "Sei sicuro di voler concedere l'accesso alla base no-code ai {{countlines}} gruppi di utenti selezionati?", + "group_update_rights_nocode_confirm": "I {{countlines}} gruppi di utenti selezionati ora hanno accesso alla base no-code", + "group_sure_revoke_rights_nocode_rows": "Sei sicuro di voler revocare l'accesso alla base no-code ai {{countlines}} gruppi di utenti selezionati?", + "group_revoke_rights_nocode": "I {{countlines}} gruppi di utenti selezionati non hanno più accesso alla base no-code", + "group_sure_update_rights_admin_rows": "Sei sicuro di voler concedere i diritti di amministratore ai {{countlines}} gruppi di utenti selezionati?", + "group_update_rights_admin_confirm": "I {{countlines}} gruppi di utenti selezionati ora sono amministratori", + "group_sure_revoke_rights_admin_rows": "Sei sicuro di voler revocare i diritti di amministratore ai {{countlines}} gruppi di utenti selezionati?", + "group_revoke_rights_admin_confirm": "I {{countlines}} gruppi di utenti selezionati non sono più amministratori", + "group_sure_delete_rows": "Sei sicuro di voler eliminare i {{countlines}} gruppi di utenti selezionati?", + "group_delete_row_confirm": "I {{countlines}} gruppi di utenti selezionati sono stati eliminati con successo", + "group_delete_row_error": "Si è verificato un errore durante l'eliminazione dei gruppi di utenti", + "group_create_successful": "Il gruppo è stato creato con successo.", + "group_already_exists": "Il gruppo {{groupName}} è già registrato a un altro utente.", + "group_create_failed": "La creazione del gruppo non è riuscita.", + "all_users": "Tutti gli utenti", + "any_group": "Nessun gruppo", + "Confirmation": "Conferma", + "group_name": "Nome del gruppo", "groups": "gruppi", "group": "gruppo", "users": "utenti", diff --git a/_c8oProject/mobileApplication.yaml b/_c8oProject/mobileApplication.yaml index 2c82b3f1..ba931a7d 100644 --- a/_c8oProject/mobileApplication.yaml +++ b/_c8oProject/mobileApplication.yaml @@ -1469,8 +1469,8 @@ useClickForTap: true ↓adminDashboardHome [ngx.components.PageComponent-1739812122335]: 🗏 mobilePages/adminDashboardHome.yaml ↓adminDashboardUsers [ngx.components.PageComponent-1739883222193]: 🗏 mobilePages/adminDashboardUsers.yaml ↓adminDashboardUsersListGroups [ngx.components.PageComponent-1740392392548]: 🗏 mobilePages/adminDashboardUsersListGroups.yaml -↓Page [ngx.components.PageComponent-1740044585512]: 🗏 mobilePages/Page.yaml ↓adminDashboardUsersWithinGroups [ngx.components.PageComponent-1740488756530]: 🗏 mobilePages/adminDashboardUsersWithinGroups.yaml +↓Page [ngx.components.PageComponent-1740044585512]: 🗏 mobilePages/Page.yaml ↓Theme [ngx.components.UITheme-1491635018260]: comment: Global color themes can be customized here styleContent: diff --git a/_c8oProject/mobilePages/adminDashboardUsersWithinGroups.yaml b/_c8oProject/mobilePages/adminDashboardUsersWithinGroups.yaml index cec8b1b9..97bb7f11 100644 --- a/_c8oProject/mobilePages/adminDashboardUsersWithinGroups.yaml +++ b/_c8oProject/mobilePages/adminDashboardUsersWithinGroups.yaml @@ -24,8 +24,7 @@ scriptContent: this.local.overlayLoading = ''''+this.translate.instant(''loading_data'')+''''; /*End_c8o_PageConstructor*/ /*Begin_c8o_PageFunction*/ - public async loadGridData(pageEvent: string = "", restype: string = "userGroups") { - if (restype == "userGroups") { + public async loadGridData(pageEvent: string = "") { try { this.local.loading = true; if(this.myaggrid?.agGrid?.api){ @@ -167,166 +166,75 @@ scriptContent: } this.ref.markForCheck(); } - } else { - try { - this.local.loading = true; - if(this.myaggrid?.agGrid?.api){ - this.myaggrid.agGrid.api.showLoadingOverlay(); - } - var data = await this.c8o.callJsonObject("C8Oforms.admin_groups_get", {}).async(); - if (data.error) { - this.local.error = true; - } - else { - if (data.data.labels) { - var translations = this.translate.translations[this.translate.currentLang]; - let finKeyByValue = (value) => { - for (const key in translations) { - if (translations[key] === value) { - return key; - } - } - } - data.data.labels = data.data.labels.map((x) => { - x.headerName = this.translate.instant(x.headerName); - // if it''''s a checkbox then add support for non boolean checkbox - if (x?.cellRenderer == "agCheckboxCellRenderer") { - if (x?.c8o_type == "stringboolean") { - x.valueGetter = (params) => { - return !(params.data[x.field] === ''false''); - }, - x.valueSetter = (params) => { - params.data[x.field] = params.newValue ? ''true'' : ''false''; - return true; - } - } - else { - x.valueGetter = (params) => { - return params.data[x.field] === true; - }, - x.valueSetter = (params) => { - params.data[x.field] = params.newValue; - return true; - } - } + } - } - if (x?.valueGetter == "lang") { - x.cellEditorParams.values = x.cellEditorParams.values.map((x) => { - x = this.translate.instant(x); - return x; - }) - x.valueGetter = (params) => { - if (params?.data?.[x.field]) { - return this.translate.instant(params.data[x.field]); - } - else { - return params?.data?.[x.field] ?? ""; - } + // public async performDeleteGroupBulk() {} + // public async performUpdateGroup() {} + // public async performDeleteUsersGroup() {} + // public async performUpdateUsersGroup() {} - }, - x.valueSetter = (params) => { - params.data[x.field] = finKeyByValue(params.newValue); - return true; - } - } - return x; - }) - } - this.local.data = data; - } - } catch (e) { - this.local.error = true; - this.c8o.log.error("An error occured : \n" + JSON.stringify(e)); - } - finally { - this.local.loading = false; - if(this.myaggrid?.agGrid?.api){ - this.myaggrid.agGrid.api.hideOverlay(); - } - this.ref.markForCheck(); + public async performBulk(bulkOperation: "deleteGroup" | "updateGroup" | "deleteUsersGroup" | "updateUsersGroup", confirmMsg: string, successMsg: string, errorMsg: string, cancelMsgBtn: string, confirmMsgBtn, right?: string, value?: any) { + try { + let docs; + if (bulkOperation == "updateGroup" || bulkOperation == "deleteGroup") { + // todo : format data structure here (args) + docs = this.myaggrid?.agGrid.api?.getSelectedNodes().map((node) => { return (bulkOperation == "deleteGroup") ? { "group": node.data.group} : {"oldGroup": node.data.group, newGroup:value.newGroup} }); + } else { + docs = this.myaggrid2?.agGrid?.api?.getSelectedNodes(); } - } - - } + var type = this.translate.instant("groups"); + const performOperation = await this.showConfirmationAlert( + this.translate.instant("Confirmation"), + this.translate.instant(confirmMsg, { countlines: docs.length, resType: type }), + this.translate.instant(cancelMsgBtn), + this.translate.instant(confirmMsgBtn) + ); - public async performBulk(bulkOperation: "delete" | "update", confirmMsg: string, successMsg: string, errorMsg: string, cancelMsgBtn: string, confirmMsgBtn, right?: string, value?: any, restype: string = "userGroups") { - if (restype == "userGroups") { - try { - let docs = this.lib_extendedcomponents_ui_ngx_aggrid?.agGrid?.api?.getSelectedNodes().map((node) => { return (bulkOperation == "delete") ? { "group": node.data.group} : {"oldGroup": node.data.group, newGroup:value.newGroup} }); - this.popoverActions.dismiss(); - var type = this.translate.instant("users"); - const performOperation = await this.showConfirmationAlert( - this.translate.instant("Confirmation"), - this.translate.instant(confirmMsg, { countlines: docs.length, resType: type }), - this.translate.instant(cancelMsgBtn), - this.translate.instant(confirmMsgBtn) - ); - - if (performOperation) { - var args: any = {docs: JSON.stringify(docs)}; - var sequence; - if(bulkOperation == "delete"){ - sequence = "C8Oforms.admin_users_delete"; - } - else{ - sequence = "C8Oforms.admin_users_patch"; - args = {...args, "right": right, "value": value}; - } - var deleted = await this.c8o.callJsonObject(sequence, args).async(); - this.loadGridData(); - if (deleted?.result?.success) { - await this.presentToast(this.translate.instant(successMsg, { countlines: docs.length }), ''toastSuccess''); - } - else { - await this.presentToast(this.translate.instant(errorMsg), ''toastError''); - } + if (performOperation) { + var args: any = (bulkOperation != "updateUsersGroup" && bulkOperation != "deleteUsersGroup") ? {docs: JSON.stringify(docs)} : {meta: ""}; + var sequence; + if (bulkOperation == "updateUsersGroup" || bulkOperation == "deleteUsersGroup") { + // todo : format data structure here (args) } - - } catch (e) { - this.loadGridData(); - await this.presentToast(this.translate.instant(errorMsg), ''toastError''); - } - - } else { - try { - let docs = this.lib_extendedcomponents_ui_ngx_aggrid?.agGrid?.api?.getSelectedNodes().map((node) => { return (bulkOperation == "delete") ? { "group": node.data.group} : {"oldGroup": node.data.group, newGroup:value.newGroup} }); - this.popoverActions.dismiss(); - let resType = this.translate.instant("groups"); - const performOperation = await this.showConfirmationAlert( - this.translate.instant("Confirmation"), - this.translate.instant(confirmMsg, { countlines: docs.length, resType: resType }), - this.translate.instant(cancelMsgBtn), - this.translate.instant(confirmMsgBtn) - ); - - if (performOperation) { - for(let i = 0; i < docs.length;i++) { - var args: any = {meta: JSON.stringify(docs[i])}; - var sequence; - if(bulkOperation == "delete"){ - sequence = "C8Oforms.admin_groups_delete"; - } - else{ - sequence = "C8Oforms.admin_groups_patch"; - args = {...args, "right": right, "value": value}; - } - + console.log(bulkOperation); + if(bulkOperation == "deleteGroup"){ + console.log(docs); + for(let i = 0; i < docs.length;i++) { + args = {meta: JSON.stringify(docs[i])}; + sequence = "C8Oforms.admin_groups_delete"; var deleted = await this.c8o.callJsonObject(sequence, args).async(); this.loadGridData(); - if (deleted?.data?.success) { + if (deleted?.success || deleted?.success == ''true'') { await this.presentToast(this.translate.instant(successMsg, { countlines: docs.length }), ''toastSuccess''); } else { await this.presentToast(this.translate.instant(errorMsg), ''toastError''); } } + return; } - - } catch (e) { + else if(bulkOperation == "updateGroup") { + return; + } + else if(bulkOperation == "deleteUsersGroup"){ + sequence = "C8Oforms.admin_users_delete_from_group"; + } + else if(bulkOperation == "updateUsersGroup") { + sequence = "C8Oforms.admin_users_move_in_group"; + args = {...args, "right": right, "value": value}; + } + var deleted = await this.c8o.callJsonObject(sequence, args).async(); this.loadGridData(); - await this.presentToast(this.translate.instant(errorMsg), ''toastError''); + if (deleted?.result?.success) { + await this.presentToast(this.translate.instant(successMsg, { countlines: docs.length }), ''toastSuccess''); + } + else { + await this.presentToast(this.translate.instant(errorMsg), ''toastError''); + } } + } catch (e) { + this.loadGridData(); + await this.presentToast(this.translate.instant(errorMsg), ''toastError''); } } @@ -362,6 +270,7 @@ scriptContent: }); }); } + async presentToast(message: string, cssClass: string = '''') { const toast = await this.toastController.create({ message: message, @@ -372,9 +281,9 @@ scriptContent: await toast.present(); } - async showModal(){ + async showModal(grid = "userToGroup"){ const modal = await this.modalController.create({ - component: C8Oforms_AddUserToGroupForm, + component: (grid == "userToGroup") ? C8Oforms_AddUserToGroupForm : C8Oforms_AddGroupForm, cssClass: "modalAddGroup" }); @@ -385,186 +294,6 @@ scriptContent: }) return await modal.present(); } - - /* - public async loadGridData() { - try { - this.local.loading = true; - if(this.myaggrid?.agGrid?.api){ - this.myaggrid.agGrid.api.showLoadingOverlay(); - } - var data = await this.c8o.callJsonObject("C8Oforms.admin_groups_get", {}).async(); - if (data.error) { - this.local.error = true; - } - else { - if (data.data.labels) { - var translations = this.translate.translations[this.translate.currentLang]; - let finKeyByValue = (value) => { - for (const key in translations) { - if (translations[key] === value) { - return key; - } - } - } - data.data.labels = data.data.labels.map((x) => { - x.headerName = this.translate.instant(x.headerName); - // if it''''s a checkbox then add support for non boolean checkbox - if (x?.cellRenderer == "agCheckboxCellRenderer") { - if (x?.c8o_type == "stringboolean") { - x.valueGetter = (params) => { - return !(params.data[x.field] === ''false''); - }, - x.valueSetter = (params) => { - params.data[x.field] = params.newValue ? ''true'' : ''false''; - return true; - } - } - else { - x.valueGetter = (params) => { - return params.data[x.field] === true; - }, - x.valueSetter = (params) => { - params.data[x.field] = params.newValue; - return true; - } - } - - } - if (x?.valueGetter == "lang") { - x.cellEditorParams.values = x.cellEditorParams.values.map((x) => { - x = this.translate.instant(x); - return x; - }) - x.valueGetter = (params) => { - if (params?.data?.[x.field]) { - return this.translate.instant(params.data[x.field]); - } - else { - return params?.data?.[x.field] ?? ""; - } - - }, - x.valueSetter = (params) => { - params.data[x.field] = finKeyByValue(params.newValue); - return true; - } - } - return x; - }) - } - this.local.data = data; - } - } catch (e) { - this.local.error = true; - this.c8o.log.error("An error occured : \n" + JSON.stringify(e)); - } - finally { - this.local.loading = false; - if(this.myaggrid?.agGrid?.api){ - this.myaggrid.agGrid.api.hideOverlay(); - } - this.ref.markForCheck(); - } - } - - public async performBulk(bulkOperation: "delete" | "update", confirmMsg: string, successMsg: string, errorMsg: string, cancelMsgBtn: string, confirmMsgBtn, right?: string, value?: any) { - try { - let docs = this.lib_extendedcomponents_ui_ngx_aggrid?.agGrid?.api?.getSelectedNodes().map((node) => { return (bulkOperation == "delete") ? { "group": node.data.group} : {"oldGroup": node.data.group, newGroup:value.newGroup} }); - this.popoverActions.dismiss(); - let resType = this.translate.instant("groups"); - const performOperation = await this.showConfirmationAlert( - this.translate.instant("Confirmation"), - this.translate.instant(confirmMsg, { countlines: docs.length, resType: resType }), - this.translate.instant(cancelMsgBtn), - this.translate.instant(confirmMsgBtn) - ); - - if (performOperation) { - for(let i = 0; i < docs.length;i++) { - var args: any = {meta: JSON.stringify(docs[i])}; - var sequence; - if(bulkOperation == "delete"){ - sequence = "C8Oforms.admin_groups_delete"; - } - else{ - sequence = "C8Oforms.admin_groups_patch"; - args = {...args, "right": right, "value": value}; - } - - var deleted = await this.c8o.callJsonObject(sequence, args).async(); - this.loadGridData(); - if (deleted?.data?.success) { - await this.presentToast(this.translate.instant(successMsg, { countlines: docs.length }), ''toastSuccess''); - } - else { - await this.presentToast(this.translate.instant(errorMsg), ''toastError''); - } - } - } - - } catch (e) { - this.loadGridData(); - await this.presentToast(this.translate.instant(errorMsg), ''toastError''); - } - } - - public async showConfirmationAlert(header: string, message: string, cancelLabel: string, confirmLabel: string, confirmRed: boolean = true, cancelRed: boolean = false): Promise { - const alert = await this.alertController.create({ - header: header, - message: message, - backdropDismiss: false, - cssClass: ''styleAlertHeight'', - buttons: [ - { - cssClass: cancelRed ? "button-danger" : "", - text: cancelLabel, - role: ''cancel'', - handler: () => { - return false; - } - }, - { - cssClass: confirmRed ? "button-danger" : "", - text: confirmLabel, - handler: () => { - return true; - } - } - ] - }); - - await alert.present(); - return new Promise((resolve) => { - alert.onDidDismiss().then((data) => { - resolve(!(data.role == ''cancel'')); - }); - }); - } - async presentToast(message: string, cssClass: string = '''') { - const toast = await this.toastController.create({ - message: message, - duration: 3000, - position: ''bottom'', - cssClass: cssClass, - }); - - await toast.present(); - } - async showModal(){ - const modal = await this.modalController.create({ - component: C8Oforms_AddGroupForm, - cssClass: "modalAddGroup" - }); - - modal.onDidDismiss().then((value)=>{ - if(value?.data?.refresh){ - this.loadGridData(); - } - }) - return await modal.present(); - } - */ /*End_c8o_PageFunction*/ ' segment: admin/dashboard-user/groups @@ -1039,6 +768,7 @@ title: Title for adminDashboardUsersWithinGroups ' ↓ButtonVisibilityHidden [ngx.components.UIDynamicElement-1740563102342]: beanData: '{"ionBean":"Button","Disabled":"script:true"}' + isEnabled: false tagName: ion-button ↓Label [ngx.components.UIDynamicElement-1740563102345]: beanData: '{"ionBean":"Label"}' @@ -1096,6 +826,81 @@ title: Title for adminDashboardUsersWithinGroups //--transition //Transition of the button visibility: hidden !important; ' + ↓Directive [ngx.components.UIControlDirective-1740652690835]: + directiveName: If + directiveSource: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType + - MobileSmartSourceType: script:(this.groupSelected != undefined && this.groupSelected.indexOf(this.translate.instant('any_group')) == -1) && (this.groupSelected != undefined && this.groupSelected.indexOf(this.translate.instant('all_users')) == -1) + ↓ButtonRemoveGroup [ngx.components.UIDynamicElement-1740652003649]: + beanData: | + '{ + "ionBean": "Button", + "IonColor": "plain:danger", + "IonFill": "plain:clear" + }' + tagName: ion-button + ↓Icon [ngx.components.UIDynamicElement-1740667212932]: + beanData: | + '{ + "ionBean": "Icon", + "IonColor": "plain:danger", + "IconName": "source:{\"filter\":\"Icon\",\"project\":\"C8Oforms\",\"input\":\"\",\"model\":{\"data\":[{\"icon\":\"''trash''\"}],\"path\":\"\",\"prefix\":\"\",\"suffix\":\"\",\"custom\":\"\",\"useCustom\":false}}" + }' + tagName: ion-icon + ↓Label [ngx.components.UIDynamicElement-1740652003652]: + beanData: '{"ionBean":"Label"}' + tagName: ion-label + ↓Text [ngx.components.UIText-1740652003655]: + i18n: true + textValue: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType + - MobileSmartSourceType: plain:remove_group + ↓Event [ngx.components.UIControlEvent-1740652003658]: + ↓deleteRows [ngx.components.UICustomAsyncAction-1740652003661]: + actionValue: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.common.FormatedContent + - com.twinsoft.convertigo.beans.common.FormatedContent: + →: | + page.performBulk("deleteGroup", "group_sure_delete_rows","group_delete_row_confirm", "group_delete_row_error", "cancel_pwamsg", "Supprimer"); + + ↓ButtonAddGroup [ngx.components.UIDynamicElement-1740652781569]: + beanData: '{"ionBean":"Button","IonFill":"plain:clear"}' + tagName: ion-button + ↓Icon [ngx.components.UIDynamicElement-1740667509631]: + beanData: | + '{ + "ionBean": "Icon", + "IonColor": "plain:primary", + "IconName": "source:{\"filter\":\"Icon\",\"project\":\"C8Oforms\",\"input\":\"\",\"model\":{\"data\":[{\"icon\":\"''add''\"}],\"path\":\"\",\"prefix\":\"\",\"suffix\":\"\",\"custom\":\"\",\"useCustom\":false}}" + }' + tagName: ion-icon + ↓Label [ngx.components.UIDynamicElement-1740652781572]: + beanData: '{"ionBean":"Label"}' + tagName: ion-label + ↓Text [ngx.components.UIText-1740652781575]: + i18n: true + textValue: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType + - MobileSmartSourceType: plain:add_group + ↓Event [ngx.components.UIControlEvent-1740652781578]: + ↓showModalGroup [ngx.components.UICustomAsyncAction-1740652781581]: + actionValue: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.common.FormatedContent + - com.twinsoft.convertigo.beans.common.FormatedContent: + →: | + try { + page.showModal("group"); + } catch (e) { + console.error("error showing addUser", e); + } finally { + return; + } + ↓ButtonAddUser [ngx.components.UIDynamicElement-1740563102354]: beanData: '{"ionBean":"Button"}' isEnabled: false @@ -1564,6 +1369,21 @@ title: Title for adminDashboardUsersWithinGroups attrName: (RowSelected) comment: Fired when a row is selected. Data will be the agGrid event eventName: RowSelected + ↓CustomAsyncAction [ngx.components.UICustomAsyncAction-1740666426464]: + actionValue: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.common.FormatedContent + - com.twinsoft.convertigo.beans.common.FormatedContent: + →: | + ' try { + page.local.selected2 = page.myaggrid2?.agGrid?.api?.getSelectedNodes({ startRow: 0, endRow: 1 }).length > 0; + page.global.selectedUsers = page.myaggrid2?.agGrid?.api?.getSelectedNodes(); + page.ref.detectChanges(); + return; + } catch (e) { + + } + ' ↓Event3 [ngx.components.UIControlEvent-1740488756854]: attrName: (SortChanged) comment: Fired when a a column is sorted. Data will be the agGrid event @@ -1576,47 +1396,61 @@ title: Title for adminDashboardUsersWithinGroups attrName: (CellValueChanged) comment: Fired when A Cell is edited changed. Data will be the agGrid event eventName: CellValueChanged - ↓updateValue [ngx.components.UICustomAsyncAction-1740488756863]: - actionValue: - - xmlizable: - - ↑classname: com.twinsoft.convertigo.beans.common.FormatedContent - - com.twinsoft.convertigo.beans.common.FormatedContent: - →: | - ' try { - page.c8o.log.debug(''[MB] ''+ props.actionFunction +'': ''+ props.actionName); - console.log("cell value changed", event); - var data = event.data; - delete data[''~c8oAcl'']; - var data = await page.c8o.callJsonObject("C8Oforms.admin_user_patch", {meta:JSON.stringify(data)}).async(); - if(data.success == true){ - return {success:true, "id": data._id }; - } - else{ - return false; - } - } catch (e) { - console.error("err",e); - return false; - } - ' - isEnabled: false - ↓IfElse [ngx.components.UIDynamicIf-1740488756866]: - beanData: '{"ionBean":"IfElseAction","condition":"script:parent.out.success"}' - ↓Toast [ngx.components.UIDynamicAction-1740488756869]: - beanData: | - '{ - "ionBean": "ToastAction", - "message": "plain:L''utilisateur a été mis à jour avec succés", - "cssClass": "plain:toastSuccess" - }' - ↓Else_Handler [ngx.components.UIActionElseEvent-1740488756872]: - ↓Toast [ngx.components.UIDynamicAction-1740488756875]: + ↓IfElse [ngx.components.UIDynamicIf-1740652403069]: + beanData: '{"ionBean":"IfElseAction","condition":"script:(this.groupSelected != undefined && this.groupSelected.indexOf(this.translate.instant(''any_group'')) == -1) && (this.groupSelected != undefined && this.groupSelected.indexOf(this.translate.instant(''all_users'')) == -1)"}' + ↓updateValue [ngx.components.UICustomAsyncAction-1740652102273]: + actionValue: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.common.FormatedContent + - com.twinsoft.convertigo.beans.common.FormatedContent: + →: | + ' try { + page.c8o.log.debug(''[MB] ''+ props.actionFunction +'': ''+ props.actionName); + console.log("cell value changed", event); + // console.log(page.global); + var meta = {oldGroup: event.oldValue, newGroup: event.data.group}; + // delete data[''~c8oAcl'']; + var data = await page.c8o.callJsonObject("C8Oforms.admin_groups_patch", {meta:JSON.stringify(meta)}).async(); + // console.log(data); + if(data.group != undefined){ + return {success:true, "group": event.data.group }; + } + else{ + return false; + } + } catch (e) { + console.error("err",e); + return false; + } + ' + ↓IfElse [ngx.components.UIDynamicIf-1740652102276]: + beanData: '{"ionBean":"IfElseAction","condition":"script:parent.out.success"}' + ↓Toast [ngx.components.UIDynamicAction-1740652102279]: beanData: | '{ "ionBean": "ToastAction", - "message": "plain:Une erreur s''est produite pendant la mise à jour de l''utilisateur", - "cssClass": "plain:toastError" + "message": "plain:Le groupe a été mis à jour avec succés", + "cssClass": "plain:toastSuccess" }' + ↓Else_Handler [ngx.components.UIActionElseEvent-1740652102282]: + ↓Toast [ngx.components.UIDynamicAction-1740652102285]: + beanData: | + '{ + "ionBean": "ToastAction", + "message": "plain:Une erreur s''est produite pendant la mise à jour du groupe", + "cssClass": "plain:toastError" + }' + ↓Else_Handler [ngx.components.UIActionElseEvent-1740652422155]: + ↓logEvent [ngx.components.UICustomAction-1740652543224]: + actionValue: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.common.FormatedContent + - com.twinsoft.convertigo.beans.common.FormatedContent: + →: | + ' page.c8o.log.debug(''[MB] ''+ props.actionFunction +'': ''+ props.actionName); + console.log(event); + resolve(); + ' ↓Event6 [ngx.components.UIControlEvent-1740488756878]: attrName: (RowDoubleClicked) comment: Fired when A Cell is edited changed. Data will be the agGrid event @@ -1625,22 +1459,21 @@ title: Title for adminDashboardUsersWithinGroups attrName: (SelectionChanged) comment: Fired when selectionChange. Data will be the agGrid event eventName: SelectionChanged - ↓CustomAsyncAction [ngx.components.UICustomAsyncAction-1740488756884]: + ↓CustomAsyncAction [ngx.components.UICustomAsyncAction-1740652270671]: actionValue: - xmlizable: - ↑classname: com.twinsoft.convertigo.beans.common.FormatedContent - com.twinsoft.convertigo.beans.common.FormatedContent: →: | - try { - page.local.selected = page.lib_extendedcomponents_ui_ngx_aggrid?.agGrid?.api?.getSelectedNodes()?.length > 0; - // page.ref.detectChanges(); + ' try { + page.local.selected2 = page.myaggrid2?.agGrid?.api?.getSelectedNodes({ startRow: 0, endRow: 1 }).length > 0; + page.global.selectedUsers = page.myaggrid2?.agGrid?.api?.getSelectedNodes(); + page.ref.detectChanges(); + return; } catch (e) { - } finally { - return; } - - isEnabled: false + ' ↓Event8 [ngx.components.UIControlEvent-1740488756887]: attrName: (GridReady) comment: Fired when the Grid is ready. Data will be the agGrid event @@ -2057,42 +1890,66 @@ title: Title for adminDashboardUsersWithinGroups directiveSource: - xmlizable: - ↑classname: com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType - - MobileSmartSourceType: script:this.groupSelected != undefined && this.groupSelected.indexOf('Aucun groupe') == -1 - ↓ButtonRemoveUsersFromGroup [ngx.components.UIDynamicElement-1740592291275]: - beanData: | - '{ - "ionBean": "Button", - "IonColor": "plain:danger", - "IonFill": "plain:clear" - }' - tagName: ion-button - ↓Label [ngx.components.UIDynamicElement-1740592291278]: - beanData: '{"ionBean":"Label"}' - tagName: ion-label - ↓Text [ngx.components.UIText-1740592291281]: - i18n: true - textValue: - - xmlizable: - - ↑classname: com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType - - MobileSmartSourceType: plain:remove_selected_users_from_group - ↓Event [ngx.components.UIControlEvent-1740592291284]: - ↓deleteRows [ngx.components.UICustomAsyncAction-1740592291287]: - actionValue: - - xmlizable: - - ↑classname: com.twinsoft.convertigo.beans.common.FormatedContent - - com.twinsoft.convertigo.beans.common.FormatedContent: - →: | - page.performBulk("delete", "sure_delete_rows","delete_row_confirm", "delete_row_error", "cancel_pwamsg", "Supprimer"); - - isEnabled: false + - MobileSmartSourceType: script:(this.groupSelected != undefined && this.groupSelected.indexOf(this.translate.instant('any_group')) == -1) + ↓Directive [ngx.components.UIControlDirective-1740668669991]: + directiveName: If + directiveSource: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType + - MobileSmartSourceType: script:this.groupSelected.indexOf(this.translate.instant('all_users')) == -1 + ↓ButtonRemoveUsersFromGroup [ngx.components.UIDynamicElement-1740592291275]: + beanData: | + '{ + "ionBean": "Button", + "Disabled": "script:!this.local.selected", + "IonColor": "plain:danger", + "IonFill": "plain:clear" + }' + tagName: ion-button + ↓Icon [ngx.components.UIDynamicElement-1740667594100]: + beanData: | + '{ + "ionBean": "Icon", + "IonColor": "plain:danger", + "IconName": "source:{\"filter\":\"Icon\",\"project\":\"C8Oforms\",\"input\":\"\",\"model\":{\"data\":[{\"icon\":\"''trash''\"}],\"path\":\"\",\"prefix\":\"\",\"suffix\":\"\",\"custom\":\"\",\"useCustom\":false}}" + }' + tagName: ion-icon + ↓Label [ngx.components.UIDynamicElement-1740592291278]: + beanData: '{"ionBean":"Label"}' + tagName: ion-label + ↓Text [ngx.components.UIText-1740592291281]: + i18n: true + textValue: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType + - MobileSmartSourceType: plain:remove_selected_users_from_group + ↓Event [ngx.components.UIControlEvent-1740592291284]: + ↓deleteRows [ngx.components.UICustomAsyncAction-1740592291287]: + actionValue: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.common.FormatedContent + - com.twinsoft.convertigo.beans.common.FormatedContent: + →: | + page.performBulk("delete", "sure_delete_rows","delete_row_confirm", "delete_row_error", "cancel_pwamsg", "Supprimer"); + + isEnabled: false ↓ButtonMoveUsersGroup [ngx.components.UIDynamicElement-1740592291290]: beanData: | '{ "ionBean": "Button", - "IonColor": "plain:danger", + "Disabled": "script:!this.local.selected", + "IonColor": "plain:dark", "IonFill": "plain:clear" }' tagName: ion-button + ↓Icon [ngx.components.UIDynamicElement-1740667607119]: + beanData: | + '{ + "ionBean": "Icon", + "IonColor": "plain:dark", + "IconName": "source:{\"filter\":\"Icon\",\"project\":\"C8Oforms\",\"input\":\"\",\"model\":{\"data\":[{\"icon\":\"''arrow-back''\"}],\"path\":\"\",\"prefix\":\"\",\"suffix\":\"\",\"custom\":\"\",\"useCustom\":false}}" + }' + tagName: ion-icon ↓Label [ngx.components.UIDynamicElement-1740592291293]: beanData: '{"ionBean":"Label"}' tagName: ion-label @@ -2116,10 +1973,19 @@ title: Title for adminDashboardUsersWithinGroups beanData: | '{ "ionBean": "Button", + "Disabled": "script:!this.local.selected", "IonColor": "plain:primary", "IonFill": "plain:clear" }' tagName: ion-button + ↓Icon [ngx.components.UIDynamicElement-1740667653907]: + beanData: | + '{ + "ionBean": "Icon", + "IonColor": "plain:primary", + "IconName": "source:{\"filter\":\"Icon\",\"project\":\"C8Oforms\",\"input\":\"\",\"model\":{\"data\":[{\"icon\":\"''add''\"}],\"path\":\"\",\"prefix\":\"\",\"suffix\":\"\",\"custom\":\"\",\"useCustom\":false}}" + }' + tagName: ion-icon ↓Label [ngx.components.UIDynamicElement-1740592291308]: beanData: '{"ionBean":"Label"}' tagName: ion-label @@ -2537,6 +2403,13 @@ title: Title for adminDashboardUsersWithinGroups "Property": "plain:selectedUsers", "Value": "script:[]" }' + ↓selectedGroups [ngx.components.UIDynamicAction-1740652223868]: + beanData: | + '{ + "ionBean": "SetGlobalAction", + "Property": "plain:selectedGroups", + "Value": "script:[]" + }' ↓resetInnerScrollPadding [ngx.components.UIStyle-1740590709068]: styleContent: - xmlizable: diff --git a/_c8oProject/mobileSharedComponents/addUserToGroupForm.yaml b/_c8oProject/mobileSharedComponents/addUserToGroupForm.yaml index 1d0b7719..9b11b5d5 100644 --- a/_c8oProject/mobileSharedComponents/addUserToGroupForm.yaml +++ b/_c8oProject/mobileSharedComponents/addUserToGroupForm.yaml @@ -189,7 +189,7 @@ scriptContent: textValue: - xmlizable: - ↑classname: com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType - - MobileSmartSourceType: plain:add_user + - MobileSmartSourceType: plain:add_selected_users_to_group ↓Button [ngx.components.UIDynamicElement-1740568196918]: beanData: | '{ diff --git a/_c8oProject/sequences/admin_user_post_in_group_bulk.yaml b/_c8oProject/sequences/admin_user_post_in_group_bulk.yaml new file mode 100644 index 00000000..7ec9aa89 --- /dev/null +++ b/_c8oProject/sequences/admin_user_post_in_group_bulk.yaml @@ -0,0 +1,64 @@ +accessibility: Hidden +authenticatedContextRequired: true +comment: Updates a user's information, requires admin privileges. +↓checkAdminRights [steps.SimpleStep-1740648965090]: + expression: include("js/isAdmin.js"); +↓Sequence_admin_user_post [steps.SimpleStep-1740648965093]: + expression: | + ' + try { + let meta = JSON.parse(meta); + } + catch(e){ + meta = {}; + } + + var bulkObj = { + groups: { + complex: meta?.groups + } + };' +↓Call_Sequence [steps.SequenceStep-1740650371620]: + output: true + sourceSequence: lib_FullSyncGrp.SetUserInGroupBulk + ↓bulkOBj [variables.StepMultiValuedVariable-1740650429580]: +↓groups [steps.JsonToXmlStep-1740649338308]: + isEnabled: false + key: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.steps.SmartType + - SmartType: + - ↑mode: PLAIN + - →→: groups +↓object [steps.JsonToXmlStep-1740648965096]: + isEnabled: false + jsonObject: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.steps.SmartType + - SmartType: + - ↑mode: JS + - →→: doc.ok == true + key: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.steps.SmartType + - SmartType: + - ↑mode: PLAIN + - →→: success +↓success [steps.JsonFieldStep-1740650423985]: + key: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.steps.SmartType + - SmartType: + - ↑mode: PLAIN + - →→: success + value: + - xmlizable: + - ↑classname: com.twinsoft.convertigo.beans.steps.SmartType + - SmartType: + - ↑mode: SOURCE + - com.twinsoft.convertigo.beans.common.XMLVector: + - java.lang.String: + - ↑value: 1740650371620 + - java.lang.String: + - ↑value: ./document +↓meta [variables.RequestableVariable-1740648965099]: \ No newline at end of file diff --git a/_c8oProject/sequences/admin_users_get_by_group.yaml b/_c8oProject/sequences/admin_users_get_by_group.yaml index 8d1d69e3..0ca171ea 100644 --- a/_c8oProject/sequences/admin_users_get_by_group.yaml +++ b/_c8oProject/sequences/admin_users_get_by_group.yaml @@ -34,7 +34,7 @@ comment: Retrieves multiple user's information, requires admin privileges. .map(item => item.value) .join('', ''); if (x.doc[''group''].length == 0) { - x.doc[''group''] = "Aucun groupe"; + x.doc[''group''] = "any_group"; } return x.doc; }); @@ -51,7 +51,13 @@ comment: Retrieves multiple user's information, requires admin privileges. }, { headerName: "DisplayName", - field: "displayName" + field: "displayName", + editable: false + }, + { + headerName: "group_name", + field: "group", + hide: true } // { // headerName: "Name", @@ -147,7 +153,7 @@ comment: Retrieves multiple user's information, requires admin privileges. let item = filtered[i]; let children = response.values.filter(it => it.group.indexOf(item["group"][''text'']) != -1); obj[''group''] = item["group"]["text"]; - obj[''user''] = (item["group"]["text"] != "Aucun groupe") ? item["group"][''attr''][''users''] : children.length + obj[''user''] = (item["group"]["text"] != "any_group") ? item["group"][''attr''][''users''] : children.length obj[''children''] = (item["group"]["text"] == "all_users") ? valuesRows : children; values.push(obj); obj = {}; diff --git a/c8oProject.yaml b/c8oProject.yaml index c20add4f..a4eb854c 100644 --- a/c8oProject.yaml +++ b/c8oProject.yaml @@ -25,6 +25,7 @@ ↓admin_stats_home [sequences.GenericSequence]: 🗏 sequences/admin_stats_home.yaml ↓admin_user_patch [sequences.GenericSequence]: 🗏 sequences/admin_user_patch.yaml ↓admin_user_post [sequences.GenericSequence]: 🗏 sequences/admin_user_post.yaml + ↓admin_user_post_in_group_bulk [sequences.GenericSequence]: 🗏 sequences/admin_user_post_in_group_bulk.yaml ↓admin_users_delete [sequences.GenericSequence]: 🗏 sequences/admin_users_delete.yaml ↓admin_users_get [sequences.GenericSequence]: 🗏 sequences/admin_users_get.yaml ↓admin_users_get_by_group [sequences.GenericSequence]: 🗏 sequences/admin_users_get_by_group.yaml diff --git a/project.md b/project.md index 886a80d4..758c750f 100644 --- a/project.md +++ b/project.md @@ -3800,6 +3800,36 @@ comment

+
admin_user_post_in_group_bulk : Updates a user's information, requires admin privileges

+ + +## ![](https://github.com/convertigo/convertigo/blob/develop/engine/src/com/twinsoft/convertigo/beans/sequences/images/genericsequence_color_16x16.png?raw=true "GenericSequence") admin_user_post_in_group_bulk + +Updates a user's information, requires admin privileges. + +Variables + + + + + + + + + + +
+name + +comment +
+RequestableVariable meta + + +
+ +

+
admin_users_delete : Deletes multiple users, requires admin privileges