-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI v2] feat: Adds Runs list to deployment runs tab
- Loading branch information
1 parent
1881252
commit 5167332
Showing
5 changed files
with
292 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
ui-v2/src/components/flow-runs/flow-runs-list/use-flow-runs-selected-rows.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useState } from "react"; | ||
|
||
export const useFlowRunsSelectedRows = () => { | ||
const [selectedRows, setSelectedRows] = useState<Set<string>>(new Set()); | ||
|
||
const addRow = (id: string) => | ||
setSelectedRows((curr) => new Set(curr).add(id)); | ||
|
||
const removeRow = (id: string) => | ||
setSelectedRows((curr) => { | ||
const newValue = new Set(curr); | ||
newValue.delete(id); | ||
return newValue; | ||
}); | ||
|
||
const onSelectRow = (id: string, checked: boolean) => { | ||
if (checked) { | ||
addRow(id); | ||
} else { | ||
removeRow(id); | ||
} | ||
}; | ||
|
||
const clearSet = () => setSelectedRows(new Set()); | ||
|
||
const utils = { | ||
addRow, | ||
removeRow, | ||
onSelectRow, | ||
clearSet, | ||
}; | ||
|
||
return [selectedRows, setSelectedRows, utils] as const; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters