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

fix(wallet): transfer requests page should only show transfers #438

Merged
merged 2 commits into from
Nov 22, 2024
Merged
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
9 changes: 8 additions & 1 deletion apps/wallet/src/composables/request.composable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export type AvailableDomain = {
types: ListRequestsOperationType[];
};

export const useAvailableDomains = (): Ref<AvailableDomain[]> => {
export const useAvailableDomains = (
opts: { filterBy?: RequestDomains[] } = {},
): Ref<AvailableDomain[]> => {
const domains: Ref<AvailableDomain[]> = ref([]);
domains.value.push({
id: RequestDomains.All,
Expand Down Expand Up @@ -86,6 +88,11 @@ export const useAvailableDomains = (): Ref<AvailableDomain[]> => {
],
});

const filterBy = opts?.filterBy ?? [];
if (filterBy.length) {
domains.value = domains.value.filter(domain => filterBy.includes(domain.id));
}

return domains;
};

Expand Down
6 changes: 4 additions & 2 deletions apps/wallet/src/pages/RequestsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const props = withDefaults(defineProps<RequestsPageProps>(), {
const i18n = useI18n();
const pageTitle = computed(() => props.title || i18n.t('pages.requests.title'));
const station = useStationStore();
const availableDomains = useAvailableDomains();
const availableDomains = useAvailableDomains({ filterBy: props.domains });
const statuses = useRequestStatusItems();
const filterUtils = useFilterUtils();
const disableRefresh = ref(false);
Expand All @@ -200,7 +200,9 @@ const slideGroupIdIndex = ref<number>(
watch(
slideGroupIdIndex,
index => {
filters.value.groupBy = availableDomains.value[index].id ?? RequestDomains.All;
const fallbackDomain = props.domains.length ? props.domains[0] : RequestDomains.All;

filters.value.groupBy = availableDomains.value?.[index]?.id ?? fallbackDomain;
},
{ immediate: true },
);
Expand Down
2 changes: 1 addition & 1 deletion core/station/impl/src/core/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ lazy_static! {
pub static ref DEFAULT_PERMISSIONS: Vec<(Allow, Resource)> = vec![
// all authenticated users can read the capabilities of the canister
(
Allow::public(),
Allow::authenticated(),
Resource::System(SystemResourceAction::Capabilities),
),
// Admins can read the system info which includes the canister's version, cycles, etc.
Expand Down
Loading