Skip to content

Commit 40f0d3f

Browse files
added default sorting arrow visualization.
1 parent c2be0f3 commit 40f0d3f

File tree

25 files changed

+86
-131
lines changed

25 files changed

+86
-131
lines changed

src/ui/layouts/pipelines/PipelineDetail/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export const PipelineDetail: React.FC = () => {
123123
</Paragraph>
124124
</Box>
125125
<Box>
126-
<Paragraph style={headStyle}>CREATED AT</Paragraph>
126+
<Paragraph style={headStyle}>CREATED</Paragraph>
127127
<Paragraph style={{ color: '#515151', marginTop: '10px' }}>
128128
{formatDateForOverviewBar(pipeline.created)}
129129
</Paragraph>

src/ui/layouts/pipelines/Pipelines/List/ForSorting/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export type Sorting =
44
| 'status'
55
| 'user.name'
66
| 'datasourceCommit'
7-
| 'created';
7+
| 'created'
8+
| 'createdAt';
89

910
export type SortingDirection = 'ASC' | 'DESC';

src/ui/layouts/pipelines/Pipelines/List/getHeaderCols.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export const GetHeaderCols = ({
241241
activeSortingDirection={activeSortingDirection}
242242
>
243243
<Paragraph size="small" color="black" style={{ fontSize: '12px' }}>
244-
CREATED
244+
CREATED AT
245245
</Paragraph>
246246
</SortingHeader>
247247
),

src/ui/layouts/pipelines/Pipelines/List/useService.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const useService = (
4141
}[],
4242
): ServiceInterface => {
4343
const [activeSorting, setActiveSorting] = React.useState<Sorting | null>(
44-
null,
44+
'created',
4545
);
4646
const [
4747
activeSortingDirection,
@@ -58,19 +58,11 @@ export const useService = (
5858
const pipelines = useSelector(pipelineSelectors.myPipelines);
5959

6060
useEffect(() => {
61-
console.log('activeSorting', activeSorting);
62-
console.log('activeSorting', activeSortingDirection);
63-
64-
let orderedPipelines =
65-
activeSorting === null
66-
? _.sortBy(pipelines, (pipeline: TPipeline) =>
67-
new Date(pipeline.created).getTime(),
68-
).reverse()
69-
: _.orderBy(
70-
pipelines,
71-
[activeSorting],
72-
[activeSortingDirection === 'DESC' ? 'desc' : 'asc'],
73-
);
61+
let orderedPipelines = _.orderBy(
62+
pipelines,
63+
[activeSorting],
64+
[activeSortingDirection === 'DESC' ? 'desc' : 'asc'],
65+
);
7466

7567
const isValidFilter = filter.map((f) => f.value).join('');
7668
if (isValidFilter) {

src/ui/layouts/pipelines/RunDetail/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export const RunDetail: React.FC = () => {
171171
</Paragraph>
172172
</Box>
173173
<Box>
174-
<Paragraph style={headStyle}>CREATED AT</Paragraph>
174+
<Paragraph style={headStyle}>CREATED</Paragraph>
175175
<Paragraph style={{ color: '#515151', marginTop: '10px' }}>
176176
{formatDateForOverviewBar(run.created)}
177177
</Paragraph>

src/ui/layouts/pipelines/RunsTable/HeaderCols/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ export const useHeaderCols = ({
169169
{
170170
render: () => (
171171
<SortingHeader
172-
sorting="createdAt"
173-
sortMethod={sortMethod('createdAt', {
172+
sorting="created"
173+
sortMethod={sortMethod('created', {
174174
asc: (runs: TRun[]) =>
175175
_.orderBy(
176176
runs,
@@ -192,7 +192,7 @@ export const useHeaderCols = ({
192192
color="black"
193193
style={{ fontSize: '12px' }}
194194
>
195-
CREATED AT
195+
CREATED
196196
</Paragraph>
197197
</SortingHeader>
198198
),
@@ -499,8 +499,8 @@ export const useHeaderCols = ({
499499
{
500500
render: () => (
501501
<SortingHeader
502-
sorting="createdAt"
503-
sortMethod={sortMethod('createdAt', {
502+
sorting="created"
503+
sortMethod={sortMethod('created', {
504504
asc: (runs: TRun[]) =>
505505
_.orderBy(
506506
runs,

src/ui/layouts/pipelines/RunsTable/useService.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const useService = ({
3939
}): ServiceInterface => {
4040
const dispatch = useDispatch();
4141
const [activeSorting, setActiveSorting] = React.useState<Sorting | null>(
42-
null,
42+
'created',
4343
);
4444

4545
const [
@@ -53,22 +53,11 @@ export const useService = ({
5353
: useSelector(runSelectors.forRunIds(runIds));
5454

5555
useEffect(() => {
56-
// let orderedRuns = _.sortBy(runs, (run: TRun) =>
57-
// new Date(run.created).getTime(),
58-
// ).reverse();
59-
console.log('activeSorting', activeSorting);
60-
console.log('activeSorting', activeSortingDirection);
61-
62-
let orderedRuns =
63-
activeSorting === null
64-
? _.sortBy(runs, (run: TRun) =>
65-
new Date(run.created).getTime(),
66-
).reverse()
67-
: _.orderBy(
68-
runs,
69-
[activeSorting],
70-
[activeSortingDirection === 'DESC' ? 'desc' : 'asc'],
71-
);
56+
let orderedRuns = _.orderBy(
57+
runs,
58+
[activeSorting],
59+
[activeSortingDirection === 'DESC' ? 'desc' : 'asc'],
60+
);
7261

7362
const isValidFilter = filter?.map((f) => f.value).join('');
7463
if (isValidFilter) {

src/ui/layouts/runs/RunDetail/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export const RunDetail: React.FC = () => {
157157
</Paragraph>
158158
</Box>
159159
<Box>
160-
<Paragraph style={headStyle}>CREATED AT</Paragraph>
160+
<Paragraph style={headStyle}>CREATED</Paragraph>
161161
<Paragraph style={{ color: '#515151', marginTop: '10px' }}>
162162
{formatDateForOverviewBar(run.created)}
163163
</Paragraph>

src/ui/layouts/runs/RunsTable/HeaderCols/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ export const useHeaderCols = ({
166166
{
167167
render: () => (
168168
<SortingHeader
169-
sorting="createdAt"
170-
sortMethod={sortMethod('createdAt', {
169+
sorting="created"
170+
sortMethod={sortMethod('created', {
171171
asc: (runs: TRun[]) =>
172172
_.orderBy(runs, (run: TRun) => new Date(run.created).getTime(), [
173173
'asc',
@@ -181,7 +181,7 @@ export const useHeaderCols = ({
181181
activeSortingDirection={activeSortingDirection}
182182
>
183183
<Paragraph size="small" color="black">
184-
CREATED ATaaaa
184+
CREATED
185185
</Paragraph>
186186
</SortingHeader>
187187
),

src/ui/layouts/runs/RunsTable/useService.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface ServiceInterface {
2121
export const useService = ({ runIds }: { runIds: TId[] }): ServiceInterface => {
2222
const dispatch = useDispatch();
2323
const [activeSorting, setActiveSorting] = React.useState<Sorting | null>(
24-
'createdAt',
24+
'created',
2525
);
2626
const [
2727
activeSortingDirection,
@@ -32,11 +32,13 @@ export const useService = ({ runIds }: { runIds: TId[] }): ServiceInterface => {
3232
const runs = useSelector(runSelectors.forRunIds(runIds));
3333

3434
useEffect(() => {
35-
const orderedRuns = _.sortBy(runs, (run: TRun) =>
36-
new Date(run.created).getTime(),
37-
).reverse();
35+
const orderedRuns = _.orderBy(
36+
runs,
37+
[activeSorting],
38+
[activeSortingDirection === 'DESC' ? 'desc' : 'asc'],
39+
);
3840

39-
setSortedRuns(orderedRuns);
41+
setSortedRuns(orderedRuns as TRun[]);
4042
}, []);
4143

4244
const setSelectedRunIds = (runIds: TId[]) => {

0 commit comments

Comments
 (0)