Skip to content

Commit

Permalink
Merge pull request #274 from weni-ai/feature/wenigpt
Browse files Browse the repository at this point in the history
update content ai home view
  • Loading branch information
luishsf authored Dec 6, 2023
2 parents 04b104d + 7fa4fd7 commit 9e7a5a2
Show file tree
Hide file tree
Showing 7 changed files with 303 additions and 239 deletions.
39 changes: 32 additions & 7 deletions src/components/repository/home/HomeRepositoryCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>

<div class="unnnic-card-intelligence__header__buttons">
<div v-if="hasIntegrationDefined && !hasIntegrationCheckError">
<div v-if="type !== 'base' && hasIntegrationDefined && !hasIntegrationCheckError">
<unnnic-tool-tip
side="top"
:text="hasIntegration ?
Expand All @@ -33,8 +33,22 @@
</unnnic-tool-tip>
</div>

<div v-else>
<unnnic-tool-tip
side="top"
text="Teste rápido"
enabled
>
<unnnic-button
iconCenter="mode_comment"
size="small"
class="mr-2"
type="alternative"
/>
</unnnic-tool-tip>
</div>

<unnnic-dropdown
v-if="type === 'repository'"
position="bottom-left"
:open.sync="dropdownOpen"
>
Expand All @@ -48,7 +62,7 @@
/>
</div>

<div v-if=" repositoryDetail.repository_type === 'classifier'">
<div v-if="repositoryDetail.repository_type === 'classifier'">
<unnnic-dropdown-item @click="showDetailModal(intentModal)">
<div class="unnnic-card-intelligence__header__buttons__dropdown">
<unnnic-icon-svg size="sm" icon="graph-stats-1" />
Expand Down Expand Up @@ -87,7 +101,18 @@

</div>

<div v-else>
<div v-else-if="type === 'base'">
<unnnic-dropdown-item>
<div class="unnnic-card-intelligence__header__buttons__dropdown">
<unnnic-icon-svg size="sm" icon="delete" scheme="feedback-red"/>
<div :style="{color: '#E53E3E'}">
Excluir base
</div>
</div>
</unnnic-dropdown-item>
</div>

<div v-else-if="type === 'repository'">
<unnnic-dropdown-item>
<div class="unnnic-card-intelligence__header__buttons__dropdown">
<unnnic-icon-svg size="sm" icon="article" />
Expand Down Expand Up @@ -388,9 +413,9 @@ export default {
};
},
intelligenceForce() {
const scoreObject = this.repositoryDetail.repository_score;
const scoreResult = (scoreObject.evaluate_size_score
+ scoreObject.intents_balance_score + scoreObject.intents_size_score) / 3;
const scoreObject = this.repositoryDetail?.repository_score;
const scoreResult = (scoreObject?.evaluate_size_score
+ scoreObject?.intents_balance_score + scoreObject?.intents_size_score) / 3;
return scoreResult.toFixed(0);
},
},
Expand Down
3 changes: 0 additions & 3 deletions src/components/repository/sidebar/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -605,9 +605,6 @@ export default {
&__select {
z-index: 10;
padding-bottom: $unnnic-spacing-stack-sm;
.icon-right {
transform: translateY(110%)
}
.dropdown > div > input {
height: auto;
}
Expand Down
312 changes: 156 additions & 156 deletions src/layout/dashboard/DashboardLayout.vue
Original file line number Diff line number Diff line change
@@ -1,156 +1,156 @@
<template>
<div class="dashboard-layout">
<div
:class="[collapse
? 'dashboard-layout__main-panel'
: 'dashboard-layout__main-panel--collapsed',
basesNewOrBasesEdit ? 'none' : null]"
>
<side-bar v-if="!basesNewOrBasesEdit" @collapse="collapseHandle()" />
<router-view />
</div>
<tour
v-if="getFinalModal && getFinalMessage !== 'true'"
:step-count="1"
name="tutorial_button"
/>
</div>
</template>
<script>
import SideBar from '@/components/repository/sidebar/SideBar';
import UserAvatar from '@/components/user/UserAvatar';
import CustomIcon from '@/components/shared/CustomIcon';
import { mapActions, mapGetters } from 'vuex';
import Tour from '@/components/Tour';
import Analytics from '@/utils/plugins/analytics';
export default {
name: 'DashboardLayout',
components: {
SideBar,
UserAvatar,
CustomIcon,
Tour,
},
data() {
return {
collapse: true,
isLoading: false,
isFullPage: true,
profilyStyle: '',
beginnerTutorialModalOpen: false,
};
},
computed: {
...mapGetters([
'getCurrentRepository',
'myProfile',
'authenticated',
'versionEnabled',
'getFinalModal',
'getFinalMessage',
'getRequirements',
]),
hasLoaded() {
if (this.getCurrentRepository.params) return true;
return false;
},
warningsCount() {
if (!this.getCurrentRepository
|| !this.getCurrentRepository.selectedRepositoryselectedRepository) return 0;
return Object.keys(this.getRequirements.languages_warnings).length;
},
tutorialEnabled() {
return runtimeVariables.get('VUE_APP_BOTHUB_WEBAPP_TUTORIAL_ENABLED');
},
categoryIcon() {
if (!this.getCurrentRepository
|| !this.getCurrentRepository.categories_list
|| this.getCurrentRepository.categories_list.length < 1) return 'botinho';
return this.getCurrentRepository.categories_list[0].icon || 'botinho';
},
basesNewOrBasesEdit() {
return this.$route.name === 'repository-content-bases-new'
|| this.$route.name === 'repository-content-bases-edit'
},
},
destroyed(){
this.setRepository({})
this.resetRepositoryVersion()
},
methods: {
...mapActions([
'logout',
'getFirstFiveVersions',
'setTutorialMenuActive',
'setRepository',
'resetRepositoryVersion'
]),
openBeginnerTutorialModal() {
if (runtimeVariables.get('VUE_APP_BOTHUB_WEBAPP_TUTORIAL_ENABLED')) {
this.setTutorialMenuActive();
Analytics.send({ category: 'Tutorial', event: 'tutorial open event' });
}
},
collapseHandle() {
this.collapse = !this.collapse;
},
routerHandle(path) {
this.$router.push({
name: `${path}`,
});
},
openNewRepository() {
this.$router.push({
name: 'new',
});
},
signIn() {
this.$router.push({
name: 'signIn',
});
},
signUp() {
this.$router.push({
name: 'signUp',
});
},
},
};
</script>
<style lang="scss">
@import '~@/assets/scss/utilities.scss';
@import '~@/assets/scss/colors.scss';
@import '~@/assets/scss/variables.scss';
html{
overflow-y:auto
}
.dashboard-layout {
&__notification{
top: 0;
position: fixed;
z-index: 9;
}
&__main-panel {
width: calc( 100% - #{$menu-expanded-size - 30});
position: relative;
float: right;
padding: 0 1rem;
&--collapsed {
position: relative;
float: right;
width: calc( 100% - #{$menu-collapsed-size - 30});
}
}
}
.none {
width: 100%;
}
</style>
<template>
<div class="dashboard-layout">
<div
:class="[collapse
? 'dashboard-layout__main-panel'
: 'dashboard-layout__main-panel--collapsed',
basesNewOrBasesEdit ? 'none' : null]"
>
<side-bar v-if="!basesNewOrBasesEdit" @collapse="collapseHandle()" />
<router-view />
</div>
<tour
v-if="getFinalModal && getFinalMessage !== 'true'"
:step-count="1"
name="tutorial_button"
/>
</div>
</template>
<script>
import SideBar from '@/components/repository/sidebar/SideBar';
import UserAvatar from '@/components/user/UserAvatar';
import CustomIcon from '@/components/shared/CustomIcon';
import { mapActions, mapGetters } from 'vuex';
import Tour from '@/components/Tour';
import Analytics from '@/utils/plugins/analytics';
export default {
name: 'DashboardLayout',
components: {
SideBar,
UserAvatar,
CustomIcon,
Tour,
},
data() {
return {
collapse: true,
isLoading: false,
isFullPage: true,
profilyStyle: '',
beginnerTutorialModalOpen: false,
};
},
computed: {
...mapGetters([
'getCurrentRepository',
'myProfile',
'authenticated',
'versionEnabled',
'getFinalModal',
'getFinalMessage',
'getRequirements',
]),
hasLoaded() {
if (this.getCurrentRepository.params) return true;
return false;
},
warningsCount() {
if (!this.getCurrentRepository
|| !this.getCurrentRepository.selectedRepositoryselectedRepository) return 0;
return Object.keys(this.getRequirements.languages_warnings).length;
},
tutorialEnabled() {
return runtimeVariables.get('VUE_APP_BOTHUB_WEBAPP_TUTORIAL_ENABLED');
},
categoryIcon() {
if (!this.getCurrentRepository
|| !this.getCurrentRepository.categories_list
|| this.getCurrentRepository.categories_list.length < 1) return 'botinho';
return this.getCurrentRepository.categories_list[0].icon || 'botinho';
},
basesNewOrBasesEdit() {
return (this.$route.name === 'repository-content-bases-new'
|| this.$route.name === 'repository-content-bases-edit') || this.$route.name.includes('content')
},
},
destroyed(){
this.setRepository({})
this.resetRepositoryVersion()
},
methods: {
...mapActions([
'logout',
'getFirstFiveVersions',
'setTutorialMenuActive',
'setRepository',
'resetRepositoryVersion'
]),
openBeginnerTutorialModal() {
if (runtimeVariables.get('VUE_APP_BOTHUB_WEBAPP_TUTORIAL_ENABLED')) {
this.setTutorialMenuActive();
Analytics.send({ category: 'Tutorial', event: 'tutorial open event' });
}
},
collapseHandle() {
this.collapse = !this.collapse;
},
routerHandle(path) {
this.$router.push({
name: `${path}`,
});
},
openNewRepository() {
this.$router.push({
name: 'new',
});
},
signIn() {
this.$router.push({
name: 'signIn',
});
},
signUp() {
this.$router.push({
name: 'signUp',
});
},
},
};
</script>
<style lang="scss">
@import '~@/assets/scss/utilities.scss';
@import '~@/assets/scss/colors.scss';
@import '~@/assets/scss/variables.scss';
html{
overflow-y:auto
}
.dashboard-layout {
&__notification{
top: 0;
position: fixed;
z-index: 9;
}
&__main-panel {
width: calc( 100% - #{$menu-expanded-size - 30});
position: relative;
float: right;
padding: 0 1rem;
&--collapsed {
position: relative;
float: right;
width: calc( 100% - #{$menu-collapsed-size - 30});
}
}
}
.none {
width: 100%;
}
</style>
Loading

0 comments on commit 9e7a5a2

Please sign in to comment.