-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KNOWAGE-8123] Added usage tab and changed error message
- Loading branch information
Showing
8 changed files
with
165 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/modules/managers/rolesManagement/tabs/DomainCategoryTab/DomainCategoryTab.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...modules/managers/rolesManagement/tabs/RolesManagementUsageTab/RolesManagementUsageTab.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<template> | ||
<q-banner v-if="noUsage" class="bg-grey-3 q-ma-sm text-center"> | ||
<template v-slot:avatar> | ||
<q-icon name="info" color="primary" /> | ||
</template> | ||
<span>{{ $t('managers.rolesManagement.noUsages') }}</span> | ||
</q-banner> | ||
<div class="rolesManagementUsage"> | ||
<template v-for="category in descriptor.categories"> | ||
<div class="card q-pa-none" v-if="elements[category.name] && elements[category.name].length > 0"> | ||
<q-toolbar class="kn-toolbar kn-toolbar--secondary"> | ||
<q-toolbar-title shrink> | ||
{{ $t(category.label) }} | ||
</q-toolbar-title> | ||
</q-toolbar> | ||
<q-list dense separator class="overflow-auto" style="height: 250px"> | ||
<q-item v-for="element in elements[category.name]"> | ||
<q-item-section> {{ element }} </q-item-section> | ||
</q-item> | ||
</q-list> | ||
</div> | ||
</template> | ||
</div> | ||
</template> | ||
<script lang="ts" setup> | ||
import { ref, onMounted, onUpdated, computed } from 'vue' | ||
import descriptor from './RolesManagementUsageTabDescriptor.json' | ||
import axios from '@/axios.js' | ||
const props = defineProps(['id']) | ||
const tempId = ref<number | undefined>() | ||
const elements = ref<any>({}) | ||
onMounted(async () => { | ||
if (props.id) { | ||
loadElements(props.id) | ||
} | ||
}) | ||
onUpdated(async () => { | ||
if (props.id != tempId.value) { | ||
loadElements(props.id) | ||
} | ||
}) | ||
const noUsage = computed(() => { | ||
let count = 0 | ||
descriptor.categories.forEach((cat) => { | ||
if (elements[cat.name] && elements[cat.name].length > 0) count++ | ||
}) | ||
return count === 0 | ||
}) | ||
async function loadElements(id) { | ||
tempId.value = id | ||
await axios.get(`${import.meta.env.VITE_KNOWAGE_CONTEXT}/knowage/restful-services/2.0/roles/${props.id}/allElement`).then((response) => { | ||
elements.value = response.data | ||
}) | ||
} | ||
</script> | ||
<style lang="scss" scoped> | ||
.rolesManagementUsage { | ||
display: grid; | ||
margin: 8px; | ||
grid-template-columns: repeat(3, 1fr); | ||
gap: 8px; | ||
.card { | ||
border: 1px solid var(--kn-color-borders); | ||
} | ||
} | ||
.q-toolbar__title { | ||
font-size: inherit; | ||
} | ||
@media all and (max-width: 1200px) { | ||
.rolesManagementUsage { | ||
grid-template-columns: repeat(2, 1fr); | ||
} | ||
} | ||
@media all and (max-width: 800px) { | ||
.rolesManagementUsage { | ||
grid-template-columns: repeat(1, 1fr); | ||
} | ||
} | ||
</style> |
32 changes: 32 additions & 0 deletions
32
...agers/rolesManagement/tabs/RolesManagementUsageTab/RolesManagementUsageTabDescriptor.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"categories": [ | ||
{ | ||
"label": "managers.rolesManagement.usageCategories.metaModel", | ||
"name": "roleMetaModelCategories" | ||
}, | ||
{ | ||
"label": "managers.rolesManagement.usageCategories.functionalities", | ||
"name": "roleFunctionalities" | ||
}, | ||
{ | ||
"label": "managers.rolesManagement.usageCategories.drivers", | ||
"name": "roleAnaliticalDrivers" | ||
}, | ||
{ | ||
"label": "managers.rolesManagement.usageCategories.news", | ||
"name": "roleNews" | ||
}, | ||
{ | ||
"label": "managers.rolesManagement.usageCategories.layers", | ||
"name": "roleLayers" | ||
}, | ||
{ | ||
"label": "managers.rolesManagement.usageCategories.users", | ||
"name": "roleUsers" | ||
}, | ||
{ | ||
"label": "managers.rolesManagement.usageCategories.menu", | ||
"name": "roleMenu" | ||
} | ||
] | ||
} |