Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-barraza committed Jan 7, 2025
1 parent 8511b11 commit 081c535
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default defineComponent({
const baseAddressSchema = ref(addressSchema)
const mailingAddress = ref<HTMLFormElement | null>(null)
const canChangeAddress = computed(() => !currentUser?.roles?.includes(Role.ContactCentreStaff))
function updateAddress (address) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@

<!-- Remove User -->
<v-btn
v-can:REMOVE_TEAM_MEMBER.hide
v-show="canRemove(item)"
v-can:REMOVE_TEAM_MEMBER.hide
icon
aria-label="Remove Team Member"
title="Remove Team Member"
Expand Down Expand Up @@ -232,8 +232,8 @@
</template>

<script lang="ts">
import { Role } from '@/util/constants'
import { AccessType, LoginSource, Permission } from '@/util/constants'
import { AccessType, LoginSource, Permission, Role } from '@/util/constants'
import { Component, Emit, Prop, Vue } from 'vue-property-decorator'
import { Member, MembershipStatus, MembershipType, Organization, RoleInfo } from '@/models/Organization'
import { mapActions, mapState } from 'pinia'
Expand Down Expand Up @@ -416,8 +416,6 @@ export default class MemberDataTable extends Vue {
switch (this.currentMembership.membershipTypeCode) {
case MembershipType.Admin:
// if role = contact_centre_staff, then admin can't change the role of other users
// ...
// Owners can change roles of other users who are not owners
if (!this.isOwnMembership(memberBeingChanged)) {
return true
Expand Down Expand Up @@ -449,9 +447,6 @@ export default class MemberDataTable extends Vue {
return false
}
// if role = contact_centre_staff, then admin can't remove the user
// ...
// Coordinators can remove other coordinators.
if (
this.currentMembership.membershipTypeCode === MembershipType.Coordinator &&
Expand Down
9 changes: 5 additions & 4 deletions auth-web/src/components/auth/common/StaffAccountsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@
<v-list>
<v-list-item
v-if="canAccessBusinessRegistryDashboard"
@click="viewInBusinessRegistryDashboard(item)">
@click="viewInBusinessRegistryDashboard(item)"
>
<v-list-item-subtitle>
<v-icon style="font-size: 14px">mdi-view-dashboard</v-icon>
<span class="pl-2">Business Registry Dashboard</span>
Expand All @@ -303,8 +304,8 @@
</template>

<script lang="ts">
import { Role } from '@/util/constants'
import { AccessType, Account, AccountStatus, LoginSource, SessionStorageKeys } from '@/util/constants'
import { AccessType, Account, AccountStatus, LoginSource, Role, SessionStorageKeys } from '@/util/constants'
import {
DEFAULT_DATA_OPTIONS,
cachePageInfo,
Expand Down Expand Up @@ -436,7 +437,7 @@ export default defineComponent({
orgType: OrgAccountTypes.ALL,
statuses: [props.accountStatus]
} as OrgFilterParams,
canAccessBusinessRegistryDashboard: computed(() => !currentUser?.roles?.includes(Role.ContactCentreStaff)),
canAccessBusinessRegistryDashboard: computed(() => !currentUser?.roles?.includes(Role.ContactCentreStaff))
})
state.accountTypes = Array.from(Object.keys(state.accountTypeMap))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default defineComponent({
!currentUser?.roles?.includes(Role.ContactCentreStaff)),
canViewAccounts: computed(() => currentUser?.roles?.includes(Role.StaffViewAccounts)),
canSuspendAccounts: computed(() => currentUser?.roles?.includes(Role.StaffSuspendAccounts) ||
currentUser?.roles?.includes(Role.StaffViewAccounts)),
currentUser?.roles?.includes(Role.StaffViewAccounts))
})
onMounted(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,17 @@ import { useUserStore } from '@/stores/user'
export default defineComponent({
name: 'StaffPendingAccountInvitationsTable',
mixins: [PaginationMixin],
components: {
ModalDialog
},
mixins: [PaginationMixin],
setup () {
const { currentUser } = useUserStore()
const confirmActionDialog = ref<InstanceType<typeof ModalDialog>>()
const state = reactive({
orgToBeRemoved: null,
tableDataOptions: {},
canManageInvitations: computed(() => !currentUser?.roles?.includes(Role.ContactCentreStaff)),
canManageInvitations: computed(() => !currentUser?.roles?.includes(Role.ContactCentreStaff))
})
const { pendingInvitationOrgs, resendPendingOrgInvitation, syncPendingInvitationOrgs, deleteOrg } = useStaffStore()
Expand Down
54 changes: 27 additions & 27 deletions auth-web/src/composables/pagination-composable.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
import { ref, computed } from 'vue';
import ConfigHelper from '@/util/config-helper';
import { DataOptions } from 'vuetify';
import { SessionStorageKeys } from '@/util/constants';
import { computed, ref } from 'vue'
import ConfigHelper from '@/util/config-helper'
import { DataOptions } from 'vuetify'
import { SessionStorageKeys } from '@/util/constants'

export default function usePagination() {
const DEFAULT_ITEMS_PER_PAGE = 5;
const PAGINATION_COUNTER_STEP = 4;
export default function usePagination () {
const DEFAULT_ITEMS_PER_PAGE = 5
const PAGINATION_COUNTER_STEP = 4

const numberOfItems = ref(getNumberOfItemsFromSessionStorage() || DEFAULT_ITEMS_PER_PAGE);
const numberOfItems = ref(getNumberOfItemsFromSessionStorage() || DEFAULT_ITEMS_PER_PAGE)

function getNumberOfItemsFromSessionStorage(): number | undefined {
let items = +ConfigHelper.getFromSession(SessionStorageKeys.PaginationNumberOfItems);
return !isNaN(items) ? items : undefined;
function getNumberOfItemsFromSessionStorage (): number | undefined {
const items = +ConfigHelper.getFromSession(SessionStorageKeys.PaginationNumberOfItems)
return !isNaN(items) ? items : undefined
}

function saveItemsPerPage(val: number) {
ConfigHelper.addToSession(SessionStorageKeys.PaginationNumberOfItems, val.toString());
function saveItemsPerPage (val: number) {
ConfigHelper.addToSession(SessionStorageKeys.PaginationNumberOfItems, val.toString())
}

function cachePageInfo(tableDataOptions: Partial<DataOptions>) {
ConfigHelper.addToSession(SessionStorageKeys.PaginationOptions, JSON.stringify(tableDataOptions));
function cachePageInfo (tableDataOptions: Partial<DataOptions>) {
ConfigHelper.addToSession(SessionStorageKeys.PaginationOptions, JSON.stringify(tableDataOptions))
}

const hasCachedPageInfo = computed((): boolean => {
const paginationOptions = JSON.parse(ConfigHelper.getFromSession(SessionStorageKeys.PaginationOptions) || '{}');
return Object.keys(paginationOptions).length !== 0;
});
const paginationOptions = JSON.parse(ConfigHelper.getFromSession(SessionStorageKeys.PaginationOptions) || '{}')
return Object.keys(paginationOptions).length !== 0
})

function getAndPruneCachedPageInfo(): Partial<DataOptions> | undefined {
const paginationOptions = JSON.parse(ConfigHelper.getFromSession(SessionStorageKeys.PaginationOptions) || '{}');
function getAndPruneCachedPageInfo (): Partial<DataOptions> | undefined {
const paginationOptions = JSON.parse(ConfigHelper.getFromSession(SessionStorageKeys.PaginationOptions) || '{}')
if (Object.keys(paginationOptions).length !== 0) {
ConfigHelper.removeFromSession(SessionStorageKeys.PaginationOptions);
return paginationOptions;
ConfigHelper.removeFromSession(SessionStorageKeys.PaginationOptions)
return paginationOptions
}
return undefined;
return undefined
}

const getPaginationOptions = computed(() =>
Array.from({length: PAGINATION_COUNTER_STEP}, (_, index) => DEFAULT_ITEMS_PER_PAGE * (index + 1))
);
Array.from({ length: PAGINATION_COUNTER_STEP }, (_, index) => DEFAULT_ITEMS_PER_PAGE * (index + 1))
)

return {
numberOfItems,
Expand All @@ -47,5 +47,5 @@ export default function usePagination() {
hasCachedPageInfo,
getAndPruneCachedPageInfo,
getPaginationOptions
};
}
}
}

0 comments on commit 081c535

Please sign in to comment.