diff --git a/.github/workflows/build-ia-frontend-dispatch-shared.yaml b/.github/workflows/build-ia-frontend-dispatch-shared.yaml index a7f7331c8..75f0462b5 100644 --- a/.github/workflows/build-ia-frontend-dispatch-shared.yaml +++ b/.github/workflows/build-ia-frontend-dispatch-shared.yaml @@ -97,7 +97,7 @@ jobs: verlt(){ [ "$1" = "$2" ] && return 1 || verlte $1 $2 } - export PROJECT_DIR="inteligencia-artificial" PATCH_TARGET="deployment-platform-frontend.json" + export PROJECT_DIR="platform-frontend" PATCH_TARGET="deployment-platform-frontend.json" ENV_DIR=$( find kubernetes-manifests/${PROJECT_DIR}/ -maxdepth 1 -mindepth 1 -type d \ | egrep -v -e '.git' -e '/base$' \ diff --git a/.github/workflows/build-ia-frontend-push-tag-shared.yaml b/.github/workflows/build-ia-frontend-push-tag-shared.yaml index 814e8d0dd..277f2e951 100644 --- a/.github/workflows/build-ia-frontend-push-tag-shared.yaml +++ b/.github/workflows/build-ia-frontend-push-tag-shared.yaml @@ -1,11 +1,11 @@ -name: Build IA Platform Frontend (Push Tag) +name: Build IA Platform Frontend (Push Branch) on: push: - tags: - - 'v*.*.*-develop*' - - 'v*.*.*-staging*' - - 'v*.*.*' + branches: + - develop + - staging + - production jobs: docker: @@ -15,7 +15,7 @@ jobs: - name: Set variables run: | TAG=$(echo $GITHUB_REF|cut -d"/" -f3) - if $(echo $TAG|grep --silent -e 'v*.*.*-develop*') + if $(echo $TAG|grep --silent -e 'develop') then echo "Found environment: DEVELOP - $TAG" echo "MANIFESTS_ENVIRONMENT=develop" >> $GITHUB_ENV @@ -27,9 +27,7 @@ jobs: echo "VERSION=$VERSION" echo "COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV echo "COMMIT_SHA=$GITHUB_SHA" - echo "IMAGE_TAG=bothubit/platform-frontend:$TAG" >> $GITHUB_ENV - echo "IMAGE_TAG=bothubit/platform-frontend:$TAG" - elif $(echo $TAG|grep --silent -e 'v*.*.*-staging*') + elif $(echo $TAG|grep --silent -e 'staging') then echo "Found environment: STAGING - $TAG" echo "MANIFESTS_ENVIRONMENT=staging" >> $GITHUB_ENV @@ -41,9 +39,7 @@ jobs: echo "VERSION=$VERSION" echo "COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV echo "COMMIT_SHA=$GITHUB_SHA" - echo "IMAGE_TAG=bothubit/platform-frontend:$TAG" >> $GITHUB_ENV - echo "IMAGE_TAG=bothubit/platform-frontend:$TAG" - elif $(echo $TAG|grep --silent -e 'v*.*.*') + elif $(echo $TAG|grep --silent -e 'production') then echo "No environment found, assuming: PRODUCTION - $TAG" echo "MANIFESTS_ENVIRONMENT=production" >> $GITHUB_ENV @@ -55,12 +51,12 @@ jobs: echo "VERSION=$VERSION" echo "COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV echo "COMMIT_SHA=$GITHUB_SHA" - echo "IMAGE_TAG=bothubit/platform-frontend:$TAG" >> $GITHUB_ENV - echo "IMAGE_TAG=bothubit/platform-frontend:$TAG" else echo 'Not a valid tag. Skipping...' exit 1 fi + echo "IMAGE_TAG=bothubit/platform-frontend:$TAG-${GITHUB_SHA::7}" >> $GITHUB_ENV + echo "IMAGE_TAG=bothubit/platform-frontend:$TAG-${GITHUB_SHA::7}" - name: Check out the repo uses: actions/checkout@v2 @@ -138,14 +134,15 @@ jobs: verlt(){ [ "$1" = "$2" ] && return 1 || verlte $1 $2 } - export PROJECT_DIR="inteligencia-artificial" PATCH_TARGET="deployment-platform-frontend.json" - ENV_DIR=$( - find kubernetes-manifests/${PROJECT_DIR}/ -maxdepth 1 -mindepth 1 -type d \ - | egrep -v -e '.git' -e '/base$' \ - | while read dirname ; do - test -r "${dirname}/kustomization.yaml" && echo "${dirname}" - done - ) + export PROJECT_DIR="platform-frontend" PATCH_TARGET="deployment-platform-frontend.json" + # ENV_DIR=$( + # find kubernetes-manifests/${PROJECT_DIR}/ -maxdepth 1 -mindepth 1 -type d \ + # | egrep -v -e '.git' -e '/base$' \ + # | while read dirname ; do + # test -r "${dirname}/kustomization.yaml" && echo "${dirname}" + # done + # ) + ENV_DIR="${MANIFESTS_ENVIRONMENT}" for e in ${ENV_DIR}; do echo "Update ${e}:" if [ ! -d "${e}" ] ; then @@ -185,7 +182,7 @@ jobs: with: github_token: ${{ secrets.DEVOPS_GITHUB_PERMANENT_TOKEN }} repository: Ilhasoft/kubernetes-manifests-artificial-intelligence - directory: ./kubernetes-manifests/ + directory: ./platform-frontend/ branch: main message: "From IA Frontend Build (Push-Tag)" diff --git a/package.json b/package.json index f0b833af9..049b4e283 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@mdi/font": "^5.2.45", "@sentry/browser": "^5.29.2", "@sentry/integrations": "^5.29.2", - "@weni/unnnic-system": "1.1.58", + "@weni/unnnic-system": "1.5.6", "ansi-regex": "5.0.1", "axios": "0.21.2", "buefy": "^0.9.4", diff --git a/public/config.js b/public/config.js index 46ff83e6a..dc8eff638 100644 --- a/public/config.js +++ b/public/config.js @@ -21,6 +21,8 @@ const runtimeVariables = (() => ({ VUE_APP_HELPHERO_ID: 'm7dO0to4OK', VUE_APP_HELPHERO_TOUR: 'ZlUBE8O2Ik', VUE_APP_QA_FLOW_CHANNEL: '4c46585b-8393-415b-856a-280c7d9ca9af', + VUE_APP_LOGROCKET_ID: 'weni/develop', + VUE_APP_LOGROCKET_PARENT_DOMAIN: 'https://dash-develop.weni.ai/', get(name) { return this[name]; diff --git a/src/App.vue b/src/App.vue index cffc692f1..14f7f0dca 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,6 @@ @@ -67,7 +64,6 @@ export default { margin-bottom: 3rem; &__badge { - min-width: 130px; height: 41px !important; margin: .4rem .5rem 0 0; padding: 0 1rem 0 1rem; @@ -81,11 +77,6 @@ export default { } } - &__style{ - background-color: $color-primary; - color: $color-white; - } - } diff --git a/src/components/repository/CreateBadgesCard.vue b/src/components/repository/CreateBadgesCard.vue index 4ebd1b9e6..73fef8372 100644 --- a/src/components/repository/CreateBadgesCard.vue +++ b/src/components/repository/CreateBadgesCard.vue @@ -1,37 +1,69 @@ diff --git a/src/components/repository/EntitiesList.vue b/src/components/repository/EntitiesList.vue index a763f101d..14e92facc 100644 --- a/src/components/repository/EntitiesList.vue +++ b/src/components/repository/EntitiesList.vue @@ -1,5 +1,5 @@ @@ -57,6 +129,10 @@ export default { type: Object, default: () => {}, }, + selectedItems: { + type: Array, + default: null, + }, }, data() { return { @@ -65,6 +141,9 @@ export default { allEntities: [], errors: {}, entitySelected: '', + deleteDialog: null, + openModal: false, + newEntityName: '', }; }, computed: { @@ -81,7 +160,7 @@ export default { }, watch: { entitySelected() { - this.entitySelected = (formatters.bothubItemKey()(this.entitySelected)); + this.entitySelected = formatters.bothubItemKey()(this.entitySelected); this.$emit('update:entityName', this.entitySelected); }, }, @@ -90,31 +169,26 @@ export default { this.getSelectedEntity(); }, methods: { - ...mapActions([ - 'editEntityName', - 'setUpdateRepository', - ]), + ...mapActions(['editEntityName', 'setUpdateRepository', 'deleteExample']), getEntityClass() { - const color = getEntityColor( - this.entitySelected, - this.allEntities, - ); + const color = getEntityColor(this.entitySelected, this.allEntities); return `entity-${color}`; }, async getEntitiesName() { const allEntitiesName = await this.repository.entities.map( - entityValue => entityValue.value, + (entityValue) => entityValue.value ); this.allEntities = allEntitiesName; }, async getSelectedEntity() { const entity = await this.repositoryList.entities.find( - entityValue => entityValue.id === Number(this.entityId), + (entityValue) => entityValue.id === Number(this.entityId) ); this.entitySelected = entity.value; }, editOptionsEntity() { - this.editSentences = !this.editSentences; + // this.editSentences = !this.editSentences; + this.openModal = true; }, async saveEdition() { try { @@ -123,10 +197,12 @@ export default { repository: this.repositoryList.uuid, }, entityId: this.entityId, - value: this.entitySelected, + value: this.newEntityName, repositoryVersion: this.repositoryVersion, }); this.$emit('saveEdition'); + this.entitySelected = this.newIntentName; + this.openModal = false; } catch (error) { if (error.response.data.non_field_errors !== undefined) { this.$buefy.toast.open({ @@ -140,77 +216,121 @@ export default { }); } } - this.editOptionsEntity(); + // this.editOptionsEntity(); + }, + deleteSelectedItems() { + this.deleteDialog = this.$buefy.dialog.confirm({ + title: this.$t('webapp.trainings.delete_title'), + message: this.$t('webapp.trainings.delete_phrase_modal'), + confirmText: this.$t('webapp.trainings.delete_button'), + cancelText: this.$t('webapp.trainings.cancel_button'), + inputAttrs: { + textAlign: 'center', + }, + type: 'is-danger', + onConfirm: async () => { + this.selectedItems.forEach((item) => { + this.deleteExample({ id: item.id }); + this.$emit('itemDeleted'); + }); + }, + }); + }, + goToSummary() { + this.$router.push( + `/dashboard/${this.$route.params.ownerNickname}/${this.$route.params.slug}/` + ); }, }, }; diff --git a/src/components/repository/EntityEdit.vue b/src/components/repository/EntityEdit.vue index 890d43d4e..5cf2ee7cd 100644 --- a/src/components/repository/EntityEdit.vue +++ b/src/components/repository/EntityEdit.vue @@ -1,76 +1,41 @@ diff --git a/src/components/repository/IntentsList.vue b/src/components/repository/IntentsList.vue index 15a4dd86d..3d679fa30 100644 --- a/src/components/repository/IntentsList.vue +++ b/src/components/repository/IntentsList.vue @@ -2,32 +2,69 @@
-

{{ $t('webapp.intent.title') }}

-

- " {{ intentSelected }} " -

- - - +
+ +
+

+ {{ $t("webapp.intent.title") }} + "{{ intentSelected }}" +

- {{ $t('webapp.intent.edit_button') }} - {{ $t('webapp.intent.save_button') }} + @click="editOptionsIntent()" + class="mr-2" + type="secondary" + size="large" + :text="$t('webapp.intent.edit_button')" + /> +
-
-

{{ $tc('webapp.intent.description', totalSentences) }}

+
+

{{ $tc("webapp.intent.description", totalSentences) }}

+ + +
+ + + +
+ + {{ $t("webapp.home.cancel") }} + + + {{ $t("webapp.intent.edit_intent_button_label") }} + +
@@ -46,6 +83,10 @@ export default { type: Object, default: () => {}, }, + selectedItems: { + type: Array, + default: null, + }, }, data() { return { @@ -53,6 +94,9 @@ export default { intentId: this.$route.params.intent, errors: {}, intentSelected: '', + deleteDialog: null, + openModal: false, + newIntentName: '' }; }, computed: { @@ -69,24 +113,21 @@ export default { }, watch: { intentSelected() { - this.intentSelected = (formatters.bothubItemKey()(this.intentSelected)); + this.intentSelected = formatters.bothubItemKey()(this.intentSelected); }, }, mounted() { this.getSelectedIntent(); }, methods: { - ...mapActions([ - 'editIntentName', - 'setUpdateRepository', - ]), + ...mapActions(['editIntentName', 'setUpdateRepository', 'deleteExample']), editOptionsIntent() { - this.editSentences = !this.editSentences; - this.$emit('setAllEntities', this.allEntities); + // this.editSentences = !this.editSentences; + this.openModal = true }, async getSelectedIntent() { const intent = await this.repository.intents.find( - intentValue => intentValue.id === Number(this.intentId), + (intentValue) => intentValue.id === Number(this.intentId) ); this.intentSelected = intent.value; }, @@ -94,101 +135,140 @@ export default { try { await this.editIntentName({ intentId: this.intentId, - text: this.intentSelected, + text: this.newIntentName, repositoryVersion: this.repositoryVersion, }); this.$emit('saveEdition'); + this.intentSelected = this.newIntentName + this.openModal = false } catch (error) { this.$buefy.toast.open({ message: this.$t('webapp.intent.error_intent'), type: 'is-danger', }); } - this.editOptionsIntent(); + this.$emit('setAllEntities', this.allEntities); + }, + deleteSelectedItems() { + this.deleteDialog = this.$buefy.dialog.confirm({ + title: this.$t('webapp.trainings.delete_title'), + message: this.$t('webapp.trainings.delete_phrase_modal'), + confirmText: this.$t('webapp.trainings.delete_button'), + cancelText: this.$t('webapp.trainings.cancel_button'), + inputAttrs: { + textAlign: 'center', + }, + type: 'is-danger', + onConfirm: async () => { + this.selectedItems.forEach((item) => { + this.deleteExample({ id: item.id }); + this.$emit('itemDeleted'); + }); + }, + }); }, + goToSummary() { + this.$router.push(`/dashboard/${this.$route.params.ownerNickname}/${this.$route.params.slug}/`) + } }, }; diff --git a/src/components/repository/SentencesIntentTable.vue b/src/components/repository/SentencesIntentTable.vue new file mode 100644 index 000000000..7e2f219ce --- /dev/null +++ b/src/components/repository/SentencesIntentTable.vue @@ -0,0 +1,277 @@ + + + + + diff --git a/src/components/repository/SummaryInformation.vue b/src/components/repository/SummaryInformation.vue index 26c676b65..cabf49a4c 100644 --- a/src/components/repository/SummaryInformation.vue +++ b/src/components/repository/SummaryInformation.vue @@ -1,11 +1,19 @@ @@ -67,4 +84,9 @@ export default { font-family: $font-family; } + /deep/ .unnnic-tag { + display: inline-flex; + color: inherit; + } + diff --git a/src/components/repository/repository-evaluate/example/IntentTag.vue b/src/components/repository/repository-evaluate/example/IntentTag.vue index 0ff70a804..a4c0dde45 100644 --- a/src/components/repository/repository-evaluate/example/IntentTag.vue +++ b/src/components/repository/repository-evaluate/example/IntentTag.vue @@ -1,5 +1,5 @@ + + diff --git a/src/components/shared/NumbersCard.vue b/src/components/shared/NumbersCard.vue index af603a664..d39b545f8 100644 --- a/src/components/shared/NumbersCard.vue +++ b/src/components/shared/NumbersCard.vue @@ -1,11 +1,11 @@ + + diff --git a/src/components/shared/accordion/EntityAccordion.vue b/src/components/shared/accordion/EntityAccordion.vue new file mode 100644 index 000000000..2ff295ce6 --- /dev/null +++ b/src/components/shared/accordion/EntityAccordion.vue @@ -0,0 +1,232 @@ + + + + + + diff --git a/src/components/shared/accordion/ExampleInfo.vue b/src/components/shared/accordion/ExampleInfo.vue index b3aeb9522..12ddae94d 100644 --- a/src/components/shared/accordion/ExampleInfo.vue +++ b/src/components/shared/accordion/ExampleInfo.vue @@ -109,6 +109,7 @@ export default { } &-entities { + display: inline-flex; &__wrapper { margin: 0 0 0 0.8rem; diff --git a/src/locales/en.json b/src/locales/en.json index 540332196..82dadda01 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -260,14 +260,14 @@ "home": { "description": "Description", "no_description": "There is no description for this repository", - "intents_list": "Intents List", - "entities_list": "Entity Groups", + "intents_list": "Intents", + "entities_list": "Entities", "entities_label": "This intelligence has {n} entity group | This intelligence has {n} entity groups", "non-grouped_entities": "and {n} non-grouped entity. | and {n} non-grouped entities.", "only_non-grouped_entities": "This intelligence has {n} non-grouped entitie. | This intelligence has {n} non-grouped entities.", "bot_has_x_intents": "This bot has {intents} intents", - "labeled": "{n} entities grouped as {label_value} | {n} entity grouped as {label_value} | {n} entities grouped as {label_value}", - "unlabeled": "{n} ungrouped entities | {n} ungrouped entity | {n} ungrouped entities", + "labeled": "Group {label_value} ({n})", + "unlabeled": "Ungrouped entities ({n})", "all_categories": "All categories", "all_languages": "All languages", "no_repo": "No repositories found.", @@ -276,6 +276,8 @@ "finish_editing": "Finish editing", "enter": "Enter", "create_new_group": "Create new group", + "drag_new": "Drag entities to change their group or to this gray area to create a new one.", + "edit_group_name": "Change name", "new_group_named": "New entity group named {name}", "delete_entity": "Delete Entity", "delete_entity_message": "Are you sure you want to delete entity named \"{entity}\"?", @@ -283,6 +285,16 @@ "delete_group_message": "Are you sure you want to delete entity group named \"{group}\"?", "delete": "Delete", "cancel": "Cancel", + "edit_group_modal_title": "Change group name", + "edit_group_modal_subtitle": "What new name do you want to give the group {group}?", + "edit_group_field_title": "Group name", + "edit_group_field_label": "Choose a new name for the group", + "edit_group_button_label": "Change name", + "save_changes": "Save", + "create_group_modal_title": "Set the group name", + "create_group_modal_subtitle": "You have created a new group, what will its name be?", + "create_group_field_label": "Choose a name for the group", + "create_group_field_title": "Group name", "remove_integrate": "Remove from project", "integrate": "Integrate into the project", "integrate_modal_title": "Integrate \"{intelligence}\" intelligence to the project? ", @@ -359,12 +371,15 @@ "information_language": "Languages | Language | Languages", "information_contributors": "Contributors | Contributor | Contributors", "information_integrations": "Integrations | Integration | Integrations", - "intent_question": "INTENT is what the chatbot will detect as being the user's intention when sending a specific message. For example: when sending \"thank you\", the user's intention is to show gratitude. So the intent for that sentece could be \"thanks\".", + "intent_question": "INTENT is what the chatbot will detect as being the user's intention when sending a specific message. For example: when sending \"thank you\", the user's intention is to show gratitude. So the intent for that sentence could be \"thanks\".", "entity_question": "ENTITY is the noun related to the desire that was detected by the chatbot. For example: If the user-submitted phrase is \"generate new report,\" the entity could be \"report\" or \"new report\"", + "entity_groups_info": "Noun related to desire that was detected by intelligence. For example: if the phrase sent by the user is “generate new report”, the entity can be “report” or “new report”.", + "intents_list_info": "The desire that intelligence perceives that the user has when sending a message. For example: when sending “thank you” the user's intent is to show gratitude. Thus, the intent could be “thanks”.", "intelligence_force": "Intelligence force", "intelligence_force_low": "Low", "intelligence_force_regular": "Regular", "intelligence_force_high": "High", + "intelligence_force_info": "There are 3 levels of strength: weak, regular and strong. The greater the number of phrases per intent, the balance between the intents and the number of test phrases, the greater your strength, which represents how well the intelligence is trained.", "integrate": "Integrate to Flows", "remove_integrate": "Remove from Flows" }, diff --git a/src/locales/es.json b/src/locales/es.json index b97e93a28..c54e45c71 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -277,6 +277,8 @@ "finish_editing": "Edición completa", "enter": "Mandar", "create_new_group": "Crea un grupo", + "drag_new": "Arrastre entidades para cambiar su grupo o a esta área gris para crear una nueva.", + "edit_group_name": "Cambiar nombre", "new_group_named": "Nuevo grupo de entidades: {name}", "delete_entity": "Eliminar entidad", "delete_entity_message": "¿Está seguro de que desea eliminar la entidad \"{entity}\"?", @@ -284,6 +286,16 @@ "delete_group_message": "¿Está seguro de que desea eliminar el grupo de entidades \"{group}\"?", "delete": "Borrar", "cancel": "Cancelar", + "edit_group_modal_title": "Cambiar nombre de grupo", + "edit_group_modal_subtitle": "¿Qué nombre nuevo quieres darle al grupo {group}?", + "edit_group_field_title": "Nombre del grupo", + "edit_group_field_label": "Elige un nuevo nombre para el grupo", + "edit_group_button_label": "Cambiar nombre", + "save_changes": "Guardar", + "create_group_modal_title": "Establece el nombre del grupo", + "create_group_modal_subtitle": "Has creado un nuevo grupo, ¿cuál será su nombre?", + "create_group_field_label": "Elige un nombre para el grupo", + "create_group_field_title": "Nombre del grupo", "remove_integrate": "Eliminar del proyecto", "integrate": "Integrar al proyecto", "integrate_modal_title": "Integrar la inteligencia \"{intelligence}\" al proyecto?", @@ -363,10 +375,13 @@ "information_integrations": "Integraciones | Integración | Integraciones", "intent_question": "La INTENCIÓN es el deseo de que la inteligencia se dé cuenta de que el usuario tiene al enviar un mensaje específico. Por ejemplo: al enviar un \"gracias\", la intención del usuario es agradecer. Por lo tanto, la intención de la frase podría ser \"gracias\".", "entity_question": "La ENTIDAD es el sustantivo relacionado con el deseo que fue detectado por la inteligencia. Por ejemplo: si el usuario envió \"generar nuevo informe\", la entidad puede ser \"informe\" o \"nuevo informe\".", + "entity_groups_info": "sustantivo relacionado con el deseo que fue detectado por la inteligencia. Por ejemplo: si la frase enviada por el usuario es “generar un nuevo informe”, la entidad puede ser “informe” o “nuevo informe”.", + "Intents_list_info": "El deseo de que la inteligencia perciba que el usuario tiene al enviar un mensaje. Por ejemplo: al enviar “gracias” la intención del usuario es mostrar gratitud. Por lo tanto, la intención podría ser “gracias”.", "intelligence_force": "Fuerza de inteligencia", "intelligence_force_low": "Bajo", "intelligence_force_regular": "Regular", "intelligence_force_high": "Elevado", + "intelligence_force_info": "There are 3 levels of strength: weak, regular and strong. The greater the number of phrases per intent, the balance between the intents and the number of test phrases, the greater your strength, which represents how well the intelligence is trained.", "integrate": "Flujo", "remove_integrate": "Eliminar de los Flujos" }, diff --git a/src/locales/pt_br.json b/src/locales/pt_br.json index 081cb7f35..2fef02e16 100644 --- a/src/locales/pt_br.json +++ b/src/locales/pt_br.json @@ -21,7 +21,7 @@ "error_to_retrieve_bot": "Erro ao trazer sua inteligência", "yes": "Sim", "no": "Não", - "items_total": "{n} item no total | {n} itens no total", + "items_total": "1-{perPage} de {total}", "type_here": "Digite aqui...", "support": "Ajuda do Bothub", "search_bots": "Procurar inteligências", @@ -259,16 +259,16 @@ "error": "Houve um erro ao buscar as frases" }, "home": { - "description": "Descrição", + "description": "Descrição da Inteligência", "no_description": "Não há descrição para essa inteligência", - "intents_list": "Lista de Intenções", - "entities_list": "Grupos de entidades", + "intents_list": "Intenções", + "entities_list": "Entidades", "entities_label": "Esta inteligência possui {n} grupo de entidade | Esta inteligência possui {n} grupos de entidade", "non-grouped_entities":"e {n} entidade não agrupada. | e {n} entidades não agrupadas.", "only_non-grouped_entities":"Esta inteligência possui {n} entidade não agrupada. | Esta inteligência possui {n} entidades não agrupadas.", "bot_has_x_intents": "Essa inteligência tem {intents} intenções", - "labeled": "{n} entidades agrupadas sob {label_value} | {n} entidade agrupada sob {label_value} | {n} entidades agrupadas sob {label_value}", - "unlabeled": "{n} entidades não agrupadas | {n} entidade não agrupada | {n} entidades não agrupadas", + "labeled": "Grupo {label_value} ({n})", + "unlabeled": "Entidades desagrupadas ({n})", "all_categories": "Todas as categorias", "all_languages": "Todos os idiomas", "no_repo": "Nenhum repositório encontrado.", @@ -277,13 +277,25 @@ "finish_editing": "Concluir edição", "enter": "Enviar", "create_new_group": "Criar grupo", - "new_group_named": "Novo grupo de entidades: {name}", + "drag_new": "Arraste as entidades para alterar o seu grupo ou para
esta área em cinza para criar um novo.", + "edit_group_name": "Alterar nome", + "new_group_named": "Novo grupo", "delete_entity": "Deletar entidade", "delete_entity_message": "Tem certeza que deseja remover a entidade \"{entity}\"?", - "delete_group": "Deletar grupo de entidades", - "delete_group_message": "Tem certeza que deseja remover o grupo de entidades \"{group}\"?", + "delete_group": "Excluir grupo", + "delete_group_message": "Deseja mesmo excluir o grupo \"{group}\"? Uma vez realizada a ação, não será possível revertê-la.", "delete": "Deletar", "cancel": "Cancelar", + "save_changes": "Salvar e fechar", + "create_group_modal_title": "Defina o nome do grupo", + "create_group_modal_subtitle": "Você criou um novo grupo, qual será o nome dele?", + "create_group_field_label": "Escolha um nome para o grupo", + "create_group_field_title": "Nome do grupo", + "edit_group_modal_title": "Alterar nome do grupo", + "edit_group_modal_subtitle": "Qual o nome novo que você quer dar para o grupo {group}?", + "edit_group_field_title": "Nome do grupo", + "edit_group_field_label": "Escolha um novo nome para o grupo", + "edit_group_button_label": "Alterar nome", "remove_integrate": "Remover do projeto", "integrate": "Integrar ao projeto", "integrate_modal_title": "Integrar a inteligência \"{intelligence}\" ao projeto ?", @@ -362,10 +374,13 @@ "information_integrations": "Integrações | Integração | Integrações", "intent_question": "INTENÇÃO é o desejo que a inteligência vai perceber que o usuário tem ao enviar uma mensagem específica. Por exemplo: ao enviar um \"obrigado\" a intenção do usuário é agradecer. Assim, a intenção para a frase poderia ser \"agradecimento\".", "entity_question": "ENTIDADE é o substantivo relacionado ao desejo que foi detectado pela inteligência. Por exemplo: Se a frase enviada pelo usuário for \"gerar novo relatório\", a entidade pode ser \"relatório\" ou \"novo relatório\".", + "entity_groups_info": "Substantivo relacionado ao desejo que foi detectado pela inteligência. Por exemplo: se a frase enviada pelo usuário for “gerar novo relatório” a entidade pode ser “relatório” ou “novo relatório”.", + "intents_list_info": "Desejo que a inteligência percebe que o usuário tem ao enviar uma mensagem. Por exemplo: ao enviar “obrigado” a intenção do usuário é agradecer. Assim, a intenção poderia ser “agradecimento”.", "intelligence_force" : "Força da inteligência", - "intelligence_force_low": "Baixa", + "intelligence_force_low": "Fraca", "intelligence_force_regular": "Regular", - "intelligence_force_high": "Alta", + "intelligence_force_high": "Forte", + "intelligence_force_info": "Há 3 níveis de força: fraca, regular e forte. Quanto maior a quantidade de frases por intenções, balanceamento entre as intenções e quantidade de frases de testes, maior será a sua força, que representa o quão bem a inteligência está treinada.", "integrate": "Integrar ao Fluxos", "remove_integrate": "Remover do Fluxos" }, @@ -380,13 +395,17 @@ "see_more": "Saiba mais" }, "intent":{ - "title": "Intenção", - "description": "Essa intenção contém {n} frase | Essa intenção contém {n} frases.", - "edit_button": "Editar intenção", + "title": "Frases da intenção", + "description": "Essa intenção possui {n} frase | Essa intenção possui {n} frases no total.", + "edit_button": "Mudar nome da intenção", "save_button": "Salvar", "no_sentences": "Nenhuma frase.", "error_intent": "Algo de errado aconteceu, tente novamente mais tarde.", - "error_intent_exists": "Intenção já existe" + "edit_intent_modal_title": "Alterar nome da intenção", + "edit_intent_modal_subtitle": "Qual o novo nome que você quer dar para a intenção {intent}?", + "edit_intent_field_title": "Nome da intenção", + "edit_intent_field_label": "Escolha um novo nome para a intenção", + "edit_intent_button_label": "Alterar nome" }, "settings": { "title_edit_repository": "Editar Inteligência", @@ -744,13 +763,18 @@ "entities": "Entidade | Entidades" }, "entity":{ - "title": "Entidade", - "description": "Essa entidade contém {n} frase | Essa entidade contém {n} frases.", - "edit_button": "Editar Entidade", + "title": "Frases da entidade", + "description": "Essa entidade possui {n} frase | Essa entidade possui {n} frases.", + "edit_button": "Mudar nome da entidade", "save_button": "Salvar", "no_sentences": "Nenhuma senteça.", "error_entity": "Algo de errado aconteceu, tente novamente mais tarde.", - "error_entity_exists": "Entidade já existe" + "error_entity_exists": "Entidade já existe", + "edit_entity_modal_title": "Alterar nome da entidade", + "edit_entity_modal_subtitle": "Qual o novo nome que você quer dar para a entidade {entity}?", + "edit_entity_field_title": "Nome da entidade", + "edit_entity_field_label": "Escolha um novo nome para a entidade", + "edit_entity_button_label": "Alterar nome" }, "payment": { "options": { diff --git a/src/models/repository.js b/src/models/repository.js index 5ac09602f..4b49f3170 100644 --- a/src/models/repository.js +++ b/src/models/repository.js @@ -49,6 +49,7 @@ class Repository extends ModelBase { groups: [], groups_list: [], other_group: {}, + new_group: {}, authorization: null, available_request_authorization: null, request_authorization: null, @@ -85,6 +86,7 @@ class Repository extends ModelBase { groups: Object, groups_list: Object, other_group: Object, + new_group: Object, authorization: Object, available_request_authorization: Boolean, request_authorization: Object, diff --git a/src/utils/entitiesColors.js b/src/utils/entitiesColors.js index c42d2158b..3d7f80b1f 100644 --- a/src/utils/entitiesColors.js +++ b/src/utils/entitiesColors.js @@ -34,6 +34,16 @@ export const getEntityColor = (entity) => { return colorsList[i]; }; +export const getRandomColor = () => { + const opacity = '0.16'; + let color = 'rgba('; + for (let i = 0; i < 3; i++) { + color += `${Math.floor(Math.random() * 255)},`; + } + color += `${opacity})`; + return color; +}; + // export const getEntityColor = (entity, entities, flexibleEntities) => { // const entitiesList = getEntitiesList(entities, flexibleEntities); // const i = entitiesList.indexOf(entity.entity || entity) % colorsList.length; diff --git a/src/views/repository/Entity.vue b/src/views/repository/Entity.vue index 4697b260c..6d59a746e 100644 --- a/src/views/repository/Entity.vue +++ b/src/views/repository/Entity.vue @@ -10,8 +10,31 @@ :entities-list="examplesList" :repository="repository" :entity-name.sync="entitySelected" - @saveEdition="onItemSave()"/> - +
+
+ +
+ Frases exibidas por página: + + + +
+
+ + @itemSave="onItemSave()" + />

{{ $t('webapp.entity.no_sentences') }}

@@ -62,9 +86,12 @@ import EntitiesList from '@/components/repository/EntitiesList'; import PaginatedList from '@/components/shared/PaginatedList'; import RepositoryViewBase from '@/components/repository/RepositoryViewBase'; import SentencesEntityList from '@/components/repository/SentencesEntityList'; +import SentencesIntentTable from '@/components/repository/SentencesIntentTable'; import RequestAuthorizationModal from '@/components/repository/RequestAuthorizationModal'; import Loading from '@/components/shared/Loading'; import RepositoryBase from './Base'; +import IntentPagination from '@/components/shared/IntentPagination'; + export default { name: 'Entity', @@ -76,12 +103,14 @@ export default { SentencesEntityList, EntitiesList, Loading, + SentencesIntentTable, + IntentPagination }, extends: RepositoryBase, props: { perPage: { type: Number, - default: 12, + default: 10, }, update: { type: Boolean, @@ -98,9 +127,17 @@ export default { }, entitySelected: '', query: {}, - sentencesEntities: SentencesEntityList, + sentencesEntities: SentencesIntentTable, requestAuthorizationModalOpen: false, querySchema: {}, + selectedItems: [], + options: [ + { value: 10 }, + { value: 25 }, + { value: 50 }, + ], + selectedOption: `${this.perPage}`, + searchSentence: '', }; }, computed: { @@ -122,6 +159,10 @@ export default { entitySearch() { this.updateExamples(true); }, + selectedOption() { + this.perPage = +this.selectedOption + this.updateExamples(true) + } }, mounted() { this.updateExamples(); @@ -159,6 +200,9 @@ export default { }); this.updateRepository(false); }, + updateSelected(params) { + this.selectedItems = params + }, }, }; @@ -166,6 +210,8 @@ export default { diff --git a/src/views/repository/Home.vue b/src/views/repository/Home.vue index 2410868fe..5e1e983ec 100644 --- a/src/views/repository/Home.vue +++ b/src/views/repository/Home.vue @@ -3,96 +3,141 @@
- {{ $t("webapp.home.description") }} +
- - {{ category }} - + +

+

+ {{ + $t("webapp.home.no_description") + }} +

+
+
+
+ +
+
+ + {{ $t("webapp.summary.remove_integrate") }} + + + {{ $t("webapp.summary.integrate") }} + +
- - {{ $t("webapp.summary.remove_integrate") }} - - - {{ $t("webapp.summary.integrate") }} - -
- -
- -

-

- {{ $t("webapp.home.no_description") }} -

+
+ -
-
-

- {{ $t("webapp.home.intents_list") }} -

-
- - - + + + + + +

{{ repositoryVersion }}

+ + + + + {{ $t("webapp.home.cancel") }} + + + {{ $t("webapp.home.save_changes") }} + + + @@ -123,7 +204,7 @@ export default { VueMarkdown, EntityEdit, SummaryInformation, - IntegrationModal + IntegrationModal, }, extends: RepositoryBase, data() { @@ -147,15 +228,28 @@ export default { newLabels: [], integrateModal: false, hasIntegration: null, - integrationError: null + integrationError: null, + openModal: false, + newGroupName: '', + loading: false, }; }, computed: { - ...mapGetters(['getCurrentRepository', 'getProjectSelected', 'getOrgSelected']), + ...mapGetters([ + 'getCurrentRepository', + 'getProjectSelected', + 'getOrgSelected', + 'getSelectedVersion', + 'getSelectedVersionRepository', + ]), unlabeled() { if (!this.repository || !this.repository.other_group) return []; return this.repository.other_group.entities; }, + newGroup() { + if (!this.repository || !this.repository.new_group) return []; + return this.repository.new_group.entities; + }, hasIntegrationDefined() { return this.hasIntegration !== null; }, @@ -166,12 +260,17 @@ export default { return this.repository.intents_list.length > 0; }, repositoryIcon() { - return (this.repository.categories[0] && this.repository.categories[0].icon) || 'botinho'; + return ( + (this.repository.categories[0] && this.repository.categories[0].icon) + || 'botinho' + ); }, getAllCategories() { - const categories = this.repository.categories_list.map(category => category.name); + const categories = this.repository.categories_list.map( + (category) => category.name + ); return categories; - } + }, }, watch: { edit() { @@ -181,17 +280,17 @@ export default { if (this.getCurrentRepository) { this.checkIfHasIntegration(); } - } + }, }, methods: { - ...mapActions(['getIntegrationRepository']), + ...mapActions(['getIntegrationRepository', 'addGroup', 'editEntity']), async checkIfHasIntegration() { try { const { data } = await this.getIntegrationRepository({ repository_version: this.getCurrentRepository.repository_version_id, repository_uuid: this.getCurrentRepository.uuid, project_uuid: this.getProjectSelected, - organization: this.getOrgSelected + organization: this.getOrgSelected, }); this.hasIntegration = data.in_project; } catch (err) { @@ -203,16 +302,19 @@ export default { }, updatedGroup({ groupId, entities }) { const groupIndex = this.getGroupIndex(groupId); - if (groupIndex >= 0) this.repository.groups[groupIndex].entities = entities; + if (groupIndex >= 0) { this.repository.groups[groupIndex].entities = entities; } }, updateUngrouped({ entities }) { this.repository.other_group.entities = entities; }, + updateNewGroup({ entities }) { + this.repository.new_group.entities = entities; + }, changeIntegrateModalState(value) { if (this.integrationError !== null && value) { this.$buefy.toast.open({ message: this.integrationError.detail, - type: 'is-danger' + type: 'is-danger', }); return; } @@ -224,8 +326,10 @@ export default { if (groupIndex < 0) return; - const removeIndex = this.repository.groups[groupIndex].entities.findIndex( - listEntity => listEntity.entity_id === entity.entity_id + const removeIndex = this.repository.groups[ + groupIndex + ].entities.findIndex( + (listEntity) => listEntity.entity_id === entity.entity_id ); if (removeIndex < 0) return; @@ -233,7 +337,7 @@ export default { this.repository.groups[groupIndex].entities.splice(removeIndex, 1); } else { const removeIndex = this.repository.other_group.entities.findIndex( - listEntity => listEntity.entity_id === entity.entity_id + (listEntity) => listEntity.entity_id === entity.entity_id ); if (removeIndex < 0) return; this.repository.other_group.entities.splice(removeIndex, 1); @@ -251,9 +355,64 @@ export default { this.repository.groups.push(group); }, getGroupIndex(groupId) { - return this.repository.groups.findIndex(group => group.group_id === groupId); - } - } + return this.repository.groups.findIndex( + (group) => group.group_id === groupId + ); + }, + editGroups() { + if (this.repository.new_group.entities.length > 0) { + this.openModal = true; + } + }, + async createGroup() { + if (!this.newGroupName || this.newGroupName.length === 0) return; + this.loading = true; + try { + const newGroup = await this.addGroup({ + name: this.newGroupName, + repositoryId: this.getSelectedVersionRepository, + version: this.getSelectedVersion, + }); + this.addedGroup({ + ...newGroup.data, + entities: this.repository.new_group.entities, + group_id: newGroup.data.id, + }); + this.repository.new_group.entities.forEach((entity) => { + this.editEntity({ + entityId: entity.entity_id, + name: entity.value, + repositoryVersion: this.getSelectedVersion, + repositoryId: this.repositoryUuid, + groupId: newGroup.data.id, + }); + }); + this.openModal = false; + this.repository.new_group.entities = []; + } catch (e) { + this.showError(e); + } finally { + this.loading = false; + } + }, + showError(error) { + let message = this.$t('webapp.home.default_error'); + + if ( + error.response + && error.response.data + && error.response.data.non_field_errors + && error.response.data.non_field_errors.length > 0 + ) { + message = error.response.data.non_field_errors.join(', '); + } + + this.$buefy.toast.open({ + message, + type: 'is-danger', + }); + }, + }, }; @@ -282,9 +441,12 @@ export default { margin-bottom: 1rem; &__tag { - margin: 0.8rem 0.5rem 2.188rem 0; - padding: 0 2rem; - font-size: 15px; + margin: 0.5rem 2rem 1rem 0; + font-size: 12px; + font-family: $unnnic-font-family-secondary; + color: $unnnic-color-neutral-cloudy; + background: $unnnic-color-neutral-lightest; + display: inline-flex; } } @@ -295,15 +457,18 @@ export default { display: flex; justify-content: space-between; align-items: flex-start; + flex-direction: column; &__integrate { background-color: $color-primary-soft; + margin-left: auto; } &__remove-integrate { border: 1px solid $unnnic-color-feedback-red; color: $unnnic-color-feedback-red; background-color: $color-white; transition: 0.1s; + margin-left: auto; &:hover { border: 1px solid $unnnic-color-feedback-red; @@ -314,10 +479,20 @@ export default { } &__text { + margin: $unnnic-spacing-stack-sm 0; + font-family: $unnnic-font-family-secondary; + font-size: $unnnic-font-size-body-gt; + color: $unnnic-color-neutral-dark; ul li { list-style-type: disc; } } + + &__tags-wrapper { + display: flex; + width: 100%; + justify-content: space-between; + } } &__intents-list { @@ -330,6 +505,15 @@ export default { align-items: center; } } + + &__divider { + border-bottom: $unnnic-border-width-thinner solid $unnnic-color-neutral-soft; + margin: $unnnic-spacing-stack-md 0; + } + + &__tabs { + margin-top: $unnnic-spacing-stack-lg; + } } .tooltipStyle::after { font-size: 12px; @@ -353,4 +537,18 @@ export default { border-bottom: 1px solid $color-primary; } } +.modal-header { + text-align: left; + margin-top: 2rem; +} +/deep/ .tab-head > .unnnic-tooltip { + margin-left: 10px; + + & > .unnnic-tooltip-label { + max-width: 360px; + } +} +/deep/ .tab-head > .unnnic-tooltip-label { + max-width: 360px; +} diff --git a/src/views/repository/Intent.vue b/src/views/repository/Intent.vue index 181ff0f82..4e7fd627b 100644 --- a/src/views/repository/Intent.vue +++ b/src/views/repository/Intent.vue @@ -9,15 +9,40 @@ - +
+
+ +
+ Frases exibidas por página: + + + +
+
+ + @itemSave="onItemSave()" + @onUpdateSelected="updateSelected" + />

{{ $t('webapp.entity.no_sentences') }}

@@ -60,9 +85,11 @@ import IntentsList from '@/components/repository/IntentsList'; import PaginatedList from '@/components/shared/PaginatedList'; import RepositoryViewBase from '@/components/repository/RepositoryViewBase'; import SentencesIntentList from '@/components/repository/SentencesIntentList'; +import SentencesIntentTable from '@/components/repository/SentencesIntentTable'; import RequestAuthorizationModal from '@/components/repository/RequestAuthorizationModal'; import Loading from '@/components/shared/Loading'; import RepositoryBase from './Base'; +import IntentPagination from '@/components/shared/IntentPagination'; export default { name: 'Intent', @@ -72,14 +99,16 @@ export default { RequestAuthorizationModal, PaginatedList, SentencesIntentList, + SentencesIntentTable, IntentsList, Loading, + IntentPagination }, extends: RepositoryBase, props: { perPage: { type: Number, - default: 12, + default: 10, }, update: { type: Boolean, @@ -95,9 +124,17 @@ export default { intent_id: this.$route.params.intent, }, query: {}, - sentencesIntenties: SentencesIntentList, + sentencesIntenties: SentencesIntentTable, requestAuthorizationModalOpen: false, querySchema: {}, + selectedItems: [], + options: [ + { value: 10 }, + { value: 25 }, + { value: 50 }, + ], + selectedOption: `${this.perPage}`, + searchSentence: '' }; }, computed: { @@ -119,6 +156,10 @@ export default { intentSearch() { this.updateExamples(true); }, + selectedOption() { + this.perPage = +this.selectedOption + this.updateExamples(true) + } }, mounted() { this.updateExamples(); @@ -156,6 +197,9 @@ export default { }); this.updateRepository(false); }, + updateSelected(params) { + this.selectedItems = params + }, }, }; @@ -163,6 +207,9 @@ export default {