Skip to content

Commit

Permalink
✨ feat(list-order): allow deleting of list orders
Browse files Browse the repository at this point in the history
  • Loading branch information
thrownullexception committed Apr 15, 2024
1 parent 66f70ce commit 397d017
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dashpress",
"version": "1.0.2",
"version": "1.0.4",
"license": "GPL-3.0-or-later",
"scripts": {
"dev": "next dev",
Expand All @@ -20,7 +20,6 @@
"lint:fix": "eslint --fix",
"verify": "node ./scripts/ci && npm run typecheck && npm run lint",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"prepare": "husky install"
},
"files": [
Expand Down
8 changes: 7 additions & 1 deletion src/backend/dashboard-widgets/dashboard-widgets.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,13 @@ return [actual[0], relative[0]];
await this._dashboardWidgetsPersistenceService.upsertItem(widgetId, widget);
}

async removeWidget(widgetId: string, dashboardId: string) {
async removeWidget({
dashboardId,
widgetId,
}: {
widgetId: string;
dashboardId: string;
}) {
await this._dashboardWidgetsPersistenceService.removeItem(widgetId);

await this._listOrderApiService.removeFromList(dashboardId, widgetId);
Expand Down
4 changes: 4 additions & 0 deletions src/backend/list-order/list-order.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export class ListOrderApiService {

await this.upsertOrder(listId, newListOrder);
}

async removeList(listId: string): Promise<void> {
await this._listOrderPersistenceService.removeItem(listId);
}
}

const listOrderPersistenceService =
Expand Down
1 change: 1 addition & 0 deletions src/frontend/components/SchemaForm/form-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import styled from "styled-components";
const Root = styled.div`
${gridRoot}
grid-auto-rows: auto;
align-items: end;
`;

const Container = styled.div`
Expand Down
8 changes: 4 additions & 4 deletions src/pages/api/dashboards/[dashboardId]/[widgetId]/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export default requestHandler(
{ _type: "requestQuery", options: "dashboardId" },
{ _type: "requestBody", options: {} },
]);
return await dashboardWidgetsApiService.removeWidget(
validatedRequest.requestBody.widgetId,
validatedRequest.requestQuery
);
return await dashboardWidgetsApiService.removeWidget({
widgetId: validatedRequest.requestBody.widgetId,
dashboardId: validatedRequest.requestQuery,
});
},
},
[
Expand Down

0 comments on commit 397d017

Please sign in to comment.