Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update 1st feedback & userGroup markup 1st completed #5176

Merged
Changes from 1 commit
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
37 changes: 23 additions & 14 deletions apps/web/src/services/iam/store/user-group-page-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,36 @@ import type { UserGroupListItemType } from '@/schema/identity/user-group/type';

import type { ModalState } from '@/services/iam/types/user-group-type';

interface iState {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to align it by specifying the type using the store name!

loading: boolean;
userGroups: UserGroupListItemType[];
selectedUserGroup: UserGroupListItemType;
totalCount: number;
selectedIndices: number[];
pageStart: number;
pageLimit: number;
searchFilters: ConsoleFilter[];
modal: ModalState;
}

export const useUserGroupPageStore = defineStore('page-user-group', () => {
const state = reactive({
const state = reactive<iState>({
loading: true,
userGroups: [] as UserGroupListItemType[],
selectedUserGroup: {} as UserGroupListItemType,
userGroups: [],
selectedUserGroup: {},
totalCount: 0,
selectedIndices: [],
pageStart: 1,
pageLimit: 15,
searchFilters: [] as ConsoleFilter[],
searchFilters: [],
modal: {
type: '',
title: '',
themeColor: 'primary',
visible: undefined,
} as ModalState,
},
});
const getters = reactive({
selectedUserGroups: computed((): UserGroupListItemType[] => {
selectedUserGroups: computed<UserGroupListItemType[]>((): UserGroupListItemType[] => {
if (state.selectedIndices.length === 1 && !isEmpty(state.selectedUserGroup)) return [state.selectedUserGroup];
const userGroups: UserGroupListItemType[] = [];
state.selectedIndices.forEach((d:number) => {
Expand All @@ -39,32 +50,30 @@ export const useUserGroupPageStore = defineStore('page-user-group', () => {
const actions = {
reset() {
state.loading = true;
state.userGroups = [] as UserGroupListItemType[];
state.selectedUserGroup = {} as UserGroupListItemType;
state.userGroups = [];
state.selectedUserGroup = {};
state.totalCount = 0;
state.selectedIndices = [];
state.pageStart = 1;
state.pageLimit = 15;
state.searchFilters = [] as ConsoleFilter[];
state.searchFilters = [];
state.modal = {
type: '',
title: '',
themeColor: 'primary',
visiable: undefined,
} as ModalState;
};
},
async listUserGroups() {
// TODO: api connect
},
updateModalSettings({
type, title, themeColor, visible,
type, title, themeColor,
}: ModalState) {
state.modal = {
...state.modal,
type,
title,
themeColor,
visible: visible ?? undefined,
};
},
};
Expand Down