Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions configs/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,47 @@ const wayf = {
] as { name: string, entityID: string }[],
}

/**
* These are due to temporary constraints
* in the future, all features will be enabled and the settings will be deleted.
*/
const features = {
/** repositories feature flags */
repositories: {
/**
* If true, the search will be performed on the server side.
* If false, the search will be performed on the client (browser) side.
*/
'server-search': false,

/** Whether to allow sorting columns */
'sort-columns': false,
},
/** groups feature flags */
groups: {
/** Whether to allow sorting columns */
'sort-columns': false,
},
/** users feature flags */
users: {
/** Whether to allow filters to be applied at the same time for both roles and groups */
'filter-by-both-role-group': false,
/** Whether to allow the last modified filter */
'filter-by-last-modified': false,
/** Whether to allow the search by username only */
'search-only-username': true,
/** Whether to allow sorting columns */
'sort-columns': false,
/** Whether to display file upload button */
'file-upload': false,
},
/** history feature flags */
history: {
/** Whether to display history upload tab */
upload: false,
},
}

export default {
/** Server hostname of this application */
serverName,
Expand All @@ -192,4 +233,10 @@ export default {
polling,
/** WAYF (Embedded DS) configuration */
wayf,
/**
* Feature flags configuration. \
* These are due to temporary constraints
* in the future, all features will be enabled and the settings will be deleted.
*/
features,
}
12 changes: 12 additions & 0 deletions configs/server.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,15 @@ url = "amqp://guest:guest@rabbitmq:5672//"

# user name of the developer account.
# user_name = ""


# Feature flags for enabling or disabling application features.
# These are due to temporary constraints
# in the future, all features will be enabled and the settings will be deleted.
[features]
# Whether user search by user name only in users.
# If false, Enable search by username, email, or ePPN.
search_only_username = true

# Whether mAP Core API bulk operation is enabled or disabled.
enable_bulk_operation = false
9 changes: 7 additions & 2 deletions src/app/components/group/GroupForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const emit = defineEmits<{
'cancel': []
}>()

const { table: { pageSize } } = useAppConfig()
const {
table: { pageSize },
features: { repositories: { 'server-search': serverSearch } },
} = useAppConfig()
const { schema, getMaxIdLength } = useGroupSchema(() => properties.mode)
const { handleFormError } = useFormError()

Expand Down Expand Up @@ -51,6 +54,7 @@ const {
label: repository.serviceName,
value: repository.id,
}),
server: serverSearch,
})
setupRepoScroll(repositorySelect)

Expand Down Expand Up @@ -96,7 +100,8 @@ const onCancel = () => {
v-model="state.repository as { label: string, value: string }"
v-model:search-term="repoSearchTerm" size="xl"
:placeholder="$t('group.placeholder.repository')"
:items="repositoryNames" :loading="repoSearchStatus === 'pending'" ignore-filter
:items="repositoryNames" :loading="repoSearchStatus === 'pending'"
:ignore-filter="serverSearch"
:ui="{ base: 'w-full' }" :disabled="mode !== 'new'"
@update:open="onRepoOpen"
/>
Expand Down
5 changes: 4 additions & 1 deletion src/app/components/history/HistoryFilter.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script setup lang="ts">
const { features: { repositories: { 'server-search': serverSearch } } } = useAppConfig()

const {
tab,
criteria: {
Expand Down Expand Up @@ -106,7 +108,8 @@ const { repositoryFilter, groupFilter, userFilter, operatorFilter }
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mt-4">
<USelectMenu
ref="repositorySelect"
v-model:search-term="repositoryFilter.searchTerm.value" ignore-filter
v-model:search-term="repositoryFilter.searchTerm.value"
:ignore-filter="serverSearch"
:placeholder="repositoryFilter.placeholder"
:icon="repositoryFilter.icon" :items="repositoryFilter.items"
:multiple="repositoryFilter.multiple" :loading="repositoryFilter.loading" clear
Expand Down
9 changes: 7 additions & 2 deletions src/app/components/user/UserForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const emit = defineEmits<{
'cancel': []
}>()

const { table: { pageSize } } = useAppConfig()
const {
table: { pageSize },
features: { repositories: { 'server-search': serverSearch } },
} = useAppConfig()
const { currentUser } = useAuth()
const { schema } = useUserSchema(() => properties.mode)
const { preferredLanguageOptions, userRoleOptions } = useUserFormOptions()
Expand Down Expand Up @@ -52,6 +55,7 @@ const {
label: repository.serviceName,
value: repository.id,
}),
server: serverSearch,
})
setupRepoScroll(repositorySelect)

Expand Down Expand Up @@ -353,7 +357,8 @@ const isSelf = computed(() =>
v-model="state.repositoryRoles[index] as { label: string, value: string }"
v-model:search-term="repoSearchTerm" size="xl"
:placeholder="$t('user.placeholder.repository-name')"
:items="repositoryNames" :loading="repoSearchStatus === 'pending'" ignore-filter
:items="repositoryNames" :loading="repoSearchStatus === 'pending'"
:ignore-filter="serverSearch"
class="flex-2"
@update:open="onRepoOpen"
/>
Expand Down
5 changes: 4 additions & 1 deletion src/app/composables/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const useSelectMenuInfiniteScroll = <T>(
debounce = 300,
scrollDistance = 10,
query = {},
server = true,
} = options

const page = ref(1)
Expand All @@ -41,10 +42,11 @@ const useSelectMenuInfiniteScroll = <T>(
...query,
q: searchTermDebounced.value || undefined,
p: page.value,
l: limit,
l: server ? limit : -1,
})),
lazy: true,
immediate: false,
watch: false,
})

watch(data, (newData) => {
Expand All @@ -57,6 +59,7 @@ const useSelectMenuInfiniteScroll = <T>(
})

watch(searchTermDebounced, () => {
if (!server) return
page.value = 1
hasMore.value = true
execute()
Expand Down
24 changes: 19 additions & 5 deletions src/app/composables/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ const useGroupsTable = () => {
const { t: $t } = useI18n()
const { copy } = useClipboard()

const { table: { pageSize: pageSizeConfig } } = useAppConfig()
const {
table: { pageSize: pageSizeConfig },
features: { groups: { 'sort-columns': sortColumns },
repositories: { 'server-search': serverSearch } },
} = useAppConfig()

const query = computed<GroupsSearchQuery>(() => normalizeGroupsQuery(route.query))
const updateQuery = async (newQuery: Partial<GroupsSearchQuery>) => {
Expand Down Expand Up @@ -170,11 +174,15 @@ const useGroupsTable = () => {
},
{
accessorKey: 'id',
header: () => sortableHeader('id'),
header: () => sortColumns
? sortableHeader('id')
: h('span', { class: 'text-xs text-default font-medium' }, columnNames.value.id),
},
{
accessorKey: 'displayName',
header: () => sortableHeader('displayName'),
header: () => sortColumns
? sortableHeader('displayName')
: h('span', { class: 'text-xs text-default font-medium' }, columnNames.value.displayName),
cell: ({ row }) => {
const name: string = row.original.displayName
return h(ULink, {
Expand All @@ -188,14 +196,19 @@ const useGroupsTable = () => {
},
{
accessorKey: 'public',
header: () => sortableHeader('public'),
header: () => sortColumns
? sortableHeader('public')
: h('span', { class: 'text-xs text-default font-medium' }, columnNames.value.public),
cell: ({ row }) => (
publicStatus.value[`${row.original.public}`]
),
},
{
accessorKey: 'memberListVisibility',
header: () => sortableHeader('memberListVisibility'),
header: () => sortColumns
? sortableHeader('memberListVisibility')
: h('span', { class: 'text-xs text-default font-medium' },
columnNames.value.memberListVisibility),
cell: ({ row }) => (
visibilityStatus.value[row.original.memberListVisibility]
),
Expand Down Expand Up @@ -315,6 +328,7 @@ const useGroupsTable = () => {
} = useSelectMenuInfiniteScroll<RepositorySummary>({
url: repositorySelect.url,
limit: pageSizeConfig.repositories[0],
server: serverSearch,
transform: repository => ({
label: repository.serviceName,
value: repository.id,
Expand Down
20 changes: 16 additions & 4 deletions src/app/composables/repositories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { UButton, UDropdownMenu, UIcon, ULink } from '#components'

import type { ButtonProps, DropdownMenuItem, TableColumn, TableRow } from '@nuxt/ui'

const { features: { repositories: { 'sort-columns': sortColumns } } } = useAppConfig()

/** Composable for managing repositories table */
const useRepositoriesTable = () => {
const route = useRoute()
Expand Down Expand Up @@ -68,12 +70,17 @@ const useRepositoriesTable = () => {
const columns = computed<RepositoryTableColumn[]>(() => [
{
accessorKey: 'id',
header: () => sortableHeader('id'),
header: () => sortColumns
? sortableHeader('id')
: h('span', { class: 'text-xs text-default font-medium' }, columnNames.value.id),
cell: ({ row }) => row.original.spConnectorId,
enableGlobalFilter: false,
},
{
accessorKey: 'serviceName',
header: () => sortableHeader('serviceName'),
header: () => sortColumns
? sortableHeader('serviceName')
: h('span', { class: 'text-xs text-default font-medium' }, columnNames.value.serviceName),
cell: ({ row }) => {
const name: string = row.original.serviceName
return h(ULink, {
Expand All @@ -87,7 +94,9 @@ const useRepositoriesTable = () => {
},
{
accessorKey: 'serviceUrl',
header: () => sortableHeader('serviceUrl'),
header: () => sortColumns
? sortableHeader('serviceUrl')
: h('span', { class: 'text-xs text-default font-medium' }, columnNames.value.serviceUrl),
cell: ({ row }) => {
const url: string = row.original.serviceUrl
return url
Expand All @@ -109,7 +118,10 @@ const useRepositoriesTable = () => {
},
{
accessorKey: 'entityIds',
header: () => sortableHeader('entityIds'),
accessorFn: row => row.entityIds?.[0],
header: () => sortColumns
? sortableHeader('entityIds')
: h('span', { class: 'text-xs text-default font-medium' }, columnNames.value.entityIds),
cell: ({ row }) => row.original.entityIds?.[0],
meta: {
class: {
Expand Down
6 changes: 5 additions & 1 deletion src/app/composables/useHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@ const useHistory = () => {
}

const useHistoryFilter = () => {
const { table: { pageSize: pageSizeConfig } } = useAppConfig()
const {
table: { pageSize: pageSizeConfig },
features: { repositories: { 'server-search': serverSearch } },
} = useAppConfig()
const { t: $t } = useI18n()

const { query, updateQuery, tab } = useHistory()
Expand Down Expand Up @@ -416,6 +419,7 @@ const useHistoryFilter = () => {
} = useSelectMenuInfiniteScroll<RepositorySummary>({
url: repositorySelect.url,
limit: pageSizeConfig.repositories[0],
server: serverSearch,
transform: repository => ({
label: repository.serviceName,
value: repository.id,
Expand Down
Loading
Loading