Skip to content

Commit

Permalink
chore: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
RitvikSardana committed Feb 3, 2025
1 parent a36c13b commit f37f094
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
24 changes: 5 additions & 19 deletions desk/src/components/ListViewBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
</template>

<script setup lang="ts">
import { reactive, provide, computed, h } from "vue";
import { reactive, provide, computed, h, ref } from "vue";
import {
createResource,
ListView,
Expand All @@ -102,7 +102,6 @@ import {
ListHeader,
ListHeaderItem,
ListSelectBanner,
Badge,
FeatherIcon,
Dropdown,
} from "frappe-ui";
Expand All @@ -118,7 +117,7 @@ import { dayjs } from "@/dayjs";
import ListRows from "./ListRows.vue";
import { useScreenSize } from "@/composables/screen";
import EmptyState from "./EmptyState.vue";
import { BadgeStatus, View } from "@/types";
import { View } from "@/types";
interface P {
options: {
Expand Down Expand Up @@ -200,8 +199,9 @@ const list = createResource({
});
return data;
},
onSuccess: () => {
onSuccess: (data) => {
list.params = defaultParams;
columns.value = data.columns;
},
});
Expand All @@ -213,7 +213,7 @@ const rows = computed(() => {
}
return list.data?.data;
});
const columns = computed(() => list.data?.columns);
const columns = ref([]);
function getGroupedByRows(listRows, groupByField) {
let groupedRows = [];
Expand Down Expand Up @@ -383,20 +383,6 @@ provide("listViewActions", {
reload,
});
function toggleFilter(filter) {
const currentFilterColumns = Object.keys(defaultParams.filters);
const selectedFilter = Object.keys(filter)[0];
const isFilterApplied = currentFilterColumns.includes(selectedFilter);
if (!isFilterApplied) {
applyFilters(filter);
} else {
// remove filter
const newFilters = { ...defaultParams.filters };
delete newFilters[selectedFilter];
applyFilters(newFilters);
}
}
function applyFilters(filters) {
defaultParams.filters = { ...filters };
list.submit({ ...defaultParams });
Expand Down
6 changes: 0 additions & 6 deletions desk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,6 @@ export interface Category {
children?: Article[];
}

// Badge
export interface BadgeStatus {
label: string;
theme: string;
}

export interface View {
view_type: string;
group_by_field: string;
Expand Down

0 comments on commit f37f094

Please sign in to comment.