diff --git a/src/assets/imgs/send.svg b/src/assets/imgs/send.svg index ae895fc4f..accc34059 100644 --- a/src/assets/imgs/send.svg +++ b/src/assets/imgs/send.svg @@ -1,3 +1,3 @@ - - - + + + diff --git a/src/components/repository/CreateRepository/CreateRepositoryForm.vue b/src/components/repository/CreateRepository/CreateRepositoryForm.vue index 002b76209..fd1a57685 100644 --- a/src/components/repository/CreateRepository/CreateRepositoryForm.vue +++ b/src/components/repository/CreateRepository/CreateRepositoryForm.vue @@ -13,29 +13,6 @@ @backModal="onChangeModalState(true)" /> -
-
-
-

- {{ $t("webapp.create_repository.repository_created_first") }}
- {{ $t("webapp.create_repository.repository_created_second") }} - -

-
- -
- - - {{ $t("webapp.create_repository.navigate_to_intelligence_button") }} - - -
-
-
-
- -
- - - - - + + + + + diff --git a/src/components/repository/home/HomeRepositoryCard.vue b/src/components/repository/home/HomeRepositoryCard.vue index 29c68c79e..e754d29cc 100644 --- a/src/components/repository/home/HomeRepositoryCard.vue +++ b/src/components/repository/home/HomeRepositoryCard.vue @@ -102,7 +102,7 @@
- +
@@ -517,6 +517,9 @@ export default { openCopyConfirm(intelligence) { this.selectedIntelligence = intelligence this.openConfirmModal = true + }, + deleteBase(repository) { + this.$emit('deleteBase', repository) } } }; diff --git a/src/locales/pt_br.json b/src/locales/pt_br.json index b0f959e92..6272be56f 100644 --- a/src/locales/pt_br.json +++ b/src/locales/pt_br.json @@ -340,7 +340,7 @@ "adjustments_modal_alert_discard": "Descartar alterações", "tests": "Teste bases de conhecimento", "tests_subtitle": "Teste a base de conhecimento fazendo perguntas e observando as respostas.", - "tests_placeholder": "Faça uma pergunta para a base de conhecimento...", + "tests_placeholder": "Mensagem", "api": "Integrar esta inteligência", "api_subtitle": "Nossa API é compatível com diversas plataformas via integração por APIs REST. Para saber mais, acesse a documentação e a API explorer.", "api_select": "Selecione a Base de Conhecimento:", @@ -372,12 +372,16 @@ "edit-base-delete": "Excluir", "edit-base-save": "Salvar", "edit-base-test": "Testar", - "edit-base_modal_delete_title": "Excluir a base", - "edit-base_modal_delete_text": "Excluir esta base removerá o texto nela inserido. Não é possível desfazer esta ação.", + "edit-base_modal_delete_title": "Excluir base de conteúdo", + "edit-base_modal_delete_text": "Tem certeza que deseja excluir a base de conteúdo {base}? Essa ação não poderá ser revertida.", "edit-base_modal_delete_placeholder": "Confirme o nome da base de conhecimento para removê-la.", - "edit-base_modal_delete_button_confirm": "Excluir base", + "edit-base_modal_delete_button_confirm": "Excluir", "edit-base_modal_delete_button_cancel": "Cancelar", - "edit-base_modal_delete_button_validation": "Digite ${this.knowledgeBase.title} para confirmar a exclusão" + "edit-base_modal_delete_button_validation": "Digite ${this.knowledgeBase.title} para confirmar a exclusão", + "edit-base_modal_alert_title": "Sair da base de conteúdo", + "edit-base_modal_alert_description": "Tem certeza que deseja sair da base de conteúdo agora? O conteúdo que não for salvo será descartado", + "edit-base_modal_alert_save": "Sair", + "edit-base_modal_alert_discard": "Cancelar" }, "copy-intelligence": "Copiar inteligência", "intelligence_filter": { diff --git a/src/views/Home.vue b/src/views/Home.vue index b140a26a6..3f78dcc43 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -95,6 +95,14 @@
+ + + +
@@ -103,6 +111,7 @@ import HomeTabNavigation from '@/components/repository/home/HomeTabNavigation'; import HomeIntelligenceFromProject from '@/components/repository/home/HomeIntelligenceFromProject'; import HomeIntelligenceFromCommunity from '../components/repository/home/HomeIntelligenceFromCommunity'; import HomeIntelligenceFromOrg from '../components/repository/home/HomeIntelligenceFromOrg'; +import CreateRepositoryForm from '../components/repository/CreateRepository/CreateRepositoryForm'; export default { name: 'Home', @@ -110,13 +119,15 @@ export default { HomeTabNavigation, HomeIntelligenceFromProject, HomeIntelligenceFromOrg, - HomeIntelligenceFromCommunity + HomeIntelligenceFromCommunity, + CreateRepositoryForm }, data() { return { howTabIsShown: 2, update: false, - loading: false + loading: false, + openModal: false }; }, methods: { @@ -125,9 +136,10 @@ export default { this.update = !this.update }, createNewIntelligence() { - this.$router.push({ - name: 'new', - }); + // this.$router.push({ + // name: 'new', + // }); + this.openModal = true }, } }; @@ -227,5 +239,9 @@ export default { .input.size-md { height: auto; } + + .unnnic-modal.type-default .container { + max-width: 750px; + } } diff --git a/src/views/repository/content/Bases.vue b/src/views/repository/content/Bases.vue index 18ac00049..24b62e2f6 100644 --- a/src/views/repository/content/Bases.vue +++ b/src/views/repository/content/Bases.vue @@ -28,9 +28,6 @@ class="repository-base__description__text markdown-body" />

-

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

- + {{ $t('webapp.home.bases.new_knowledge_base') }}
@@ -74,9 +71,41 @@ v-for="base in bases" :key="base.id" :repository-detail="base" + @deleteBase="openDeleteModal" /> + + +
+ + +
+ + {{ $t("webapp.home.cancel") }} + + + Criar base de conteúdo + +
@@ -87,6 +116,7 @@ import VueMarkdown from 'vue-markdown'; import RepositoryBase from '../Base'; import HomeRepositoryCard from '@/components/repository/home/HomeRepositoryCard'; import RepositoryContentNavigation from './Navigation'; +import Modal from '@/components/repository/CreateRepository/Modal'; export default { name: 'RepositoryBase', @@ -94,14 +124,20 @@ export default { RepositoryViewBase, VueMarkdown, HomeRepositoryCard, - RepositoryContentNavigation + RepositoryContentNavigation, + Modal }, extends: RepositoryBase, data() { return { repositoryUUID: null, - bases: [] + bases: [], + isDeleteModalOpen: false, + modalData: {}, + openModal: false, + title: '', + description: '' }; }, mounted() {}, @@ -127,7 +163,32 @@ export default { this.repositoryUUID = this.repository.uuid; }, - async repositoryUUID() { + repositoryUUID() { + this.fetchBases(); + } + }, + methods: { + ...mapActions(['getQAKnowledgeBases', 'deleteQAKnowledgeBase', 'createQAKnowledgeBase', 'editQAKnowledgeBase', 'createQAText']), + + async createNewBase() { + const { data } = await this.createQAKnowledgeBase({ + repositoryUUID: this.repositoryUUID, + title: this.title, + }); + + await this.createQAText({ + repositoryUUID: this.repositoryUUID, + title: this.title, + knowledgeBaseId: data.id, + text: this.description, + language: this.repository.language + }); + + this.openModal = false; + this.fetchBases(); + }, + async fetchBases() { + this.bases = []; const response = await this.getQAKnowledgeBases({ repositoryUUID: this.repositoryUUID, page: 0 @@ -142,16 +203,34 @@ export default { description }); }); - } - }, - methods: { - ...mapActions(['getQAKnowledgeBases']), + }, + openDeleteModal(repository) { + this.isDeleteModalOpen = true; + + this.modalData = { + icon: 'error', + scheme: 'feedback-red', + persistent: true, + title: this.$t('webapp.home.bases.edit-base_modal_delete_title'), + description: this.$tc('webapp.home.bases.edit-base_modal_delete_text', repository.name), + cancelText: this.$t('webapp.home.bases.edit-base_modal_delete_button_cancel'), + confirmText: this.$t('webapp.home.bases.edit-base_modal_delete_button_confirm'), + onConfirm: async (justClose, { setLoading }) => { + setLoading(true); + await this.deleteBase(repository.id); + setLoading(false); + justClose(); - createNewBase() { - this.$router.push({ - name: 'repository-content-bases-new' + this.fetchBases(); + } + }; + }, + async deleteBase(id) { + await this.deleteQAKnowledgeBase({ + repositoryUUID: this.repositoryUUID, + id }); - } + }, } }; @@ -194,6 +273,7 @@ export default { justify-content: space-between; grid-template-columns: repeat(4, 24%); margin-top: $unnnic-inset-md; + gap: $unnnic-spacing-sm; @media screen and (max-width: 1400px) { grid-template-columns: repeat(3, 32%); } @@ -259,6 +339,10 @@ export default { color: $unnnic-color-neutral-dark; text-decoration: underline; } + + .unnnic-modal-container-background-body-description-container { + padding-bottom: $unnnic-spacing-sm; + } } hr { diff --git a/src/views/repository/content/BasesForm.vue b/src/views/repository/content/BasesForm.vue index c6cbed1cc..12129d13f 100644 --- a/src/views/repository/content/BasesForm.vue +++ b/src/views/repository/content/BasesForm.vue @@ -1,5 +1,5 @@