Skip to content

Commit f5f5c6f

Browse files
authored
Merge pull request #113 from podaac/release/1.1.0
Release/1.1.0
2 parents f9d4de2 + 0ea155f commit f5f5c6f

27 files changed

+1528
-498
lines changed

.github/workflows/build.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on:
3131
commit:
3232
type: string
3333
description: Custom commit hash
34-
34+
3535
env:
3636
REGISTRY: ghcr.io
3737
IMAGE_NAME: ${{ github.repository }}
@@ -58,11 +58,14 @@ jobs:
5858
- name: Initial checkout ${{ github.ref }}
5959
if: github.event.inputs.commit == ''
6060
uses: actions/checkout@v4
61+
with:
62+
token: ${{ steps.podaac-cicd.outputs.token }}
6163
- name: Adjust to proper commit hash ${{ github.event.inputs.commit }}
6264
if: github.event.inputs.commit != ''
6365
uses: actions/checkout@v4
6466
with:
6567
ref: ${{ github.event.inputs.commit }}
68+
token: ${{ steps.podaac-cicd.outputs.token }}
6669
- name: get-npm-version
6770
id: package-version
6871
uses: martinbeentjes/[email protected]
@@ -121,7 +124,7 @@ jobs:
121124
echo "deploy_env=${{ env.TARGET_ENV }}" >> $GITHUB_OUTPUT
122125
VENUE=$(echo "${{ env.TARGET_ENV }}" | tr '[:upper:]' '[:lower:]')
123126
echo "deploy_env_lower=$VENUE" >> $GITHUB_OUTPUT
124-
## Build
127+
## Build
125128
- uses: hashicorp/setup-terraform@v2
126129
with:
127130
terraform_version: ${{ env.TERRAFORM_VERSION }}
@@ -167,17 +170,26 @@ jobs:
167170
with:
168171
name: build
169172
path: build/*
173+
- name: Generate GitHub App Token
174+
id: generate_token
175+
uses: actions/create-github-app-token@v1
176+
with:
177+
app-id: ${{ secrets.GH_APP_ID }}
178+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
170179
- name: Commit Version Bump
171180
# If building an alpha, release candidate, or release then we commit the version bump back to the repo
172181
if: |
173182
steps.alpha.conclusion == 'success' ||
174183
steps.rc.conclusion == 'success' ||
175184
steps.release.conclusion == 'success'
176185
run: |
177-
git config user.name "${GITHUB_ACTOR}"
186+
git config user.name "PODAAC-CICD"
178187
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
188+
echo "machine github.com login x-access-token password ${{ steps.generate_token.outputs.token }}" > ~/.netrc
179189
git commit -am "/version ${{ env.software_version }}"
180190
git push
191+
env:
192+
GH_APP_TOKEN: ${{ steps.generate_token.outputs.token }}
181193
- name: Push Tag
182194
if: |
183195
steps.alpha.conclusion == 'success' ||

CHANGE

-10
This file was deleted.

CHANGELOG.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
### Added
10+
11+
## [1.1.0]
12+
13+
### Added
14+
- Feature/swodlr UI 102 - refactor spatial search validation (#111)
15+
- Feature/swodlr UI sci orbit message (#112)
16+
- Feature/swodlr UI 107 - gray out some product customization options (#110)
17+
- Feature/demo uwg june2024 - bug fixes (#109)
18+
- Feature/swodlr UI 70 - add filtering to my data page and re-generation button (#105)
19+
- Feature/swodlr UI 101 - add file name to granule footprint (#103)
20+
- Issues/swodlr UI 92 - fix tutorial bugs (#99)
21+
- Feature/swodlr UI 71 - add pagination to my data page (#98)
22+
- Feature/swodlr UI cps verification (#100)
23+
24+

package-lock.json

+45-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "swodlr-ui",
3-
"version": "1.0.1",
3+
"version": "1.1.0-rc.2",
44
"private": true,
55
"engines": {
66
"node": ">=18.0.0"
@@ -22,6 +22,7 @@
2222
"array-buffer-to-hex": "^1.0.0",
2323
"bootstrap": "^5.2.3",
2424
"dotenv": "^16.3.1",
25+
"formik": "^2.4.6",
2526
"graphql": "^16.6.0",
2627
"graphql-request": "^6.1.0",
2728
"leaflet": "^1.9.3",

src/components/app/App.css

+32-3
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ CUSTOMIZE PRODUCT CONTAINER
229229
left: 0;
230230
z-index: 1000;
231231
padding-top: 125px;
232-
padding-bottom: 58px
232+
padding-bottom: 58px;
233+
/* overflow-y: auto; */
233234
}
234235

235236
.sidebar-resize {
@@ -310,10 +311,31 @@ tfoot {
310311
}
311312

312313
.table-responsive-generatedProducts {
313-
max-height: 75vh;
314+
max-height: 62vh;
314315
overflow-y: auto;
315316
}
316317

318+
.table-filter {
319+
background-color:#1a2535;
320+
border: solid white 1px
321+
}
322+
323+
.center {
324+
width:100%;
325+
display: flex;
326+
justify-content: center;
327+
}
328+
329+
.pagination-link-item {
330+
background-color: #1A2535;
331+
border-color: #1A2535;
332+
}
333+
334+
.pagination-link-item:active {
335+
background-color: #1A2535;
336+
border-color: #1A2535;
337+
}
338+
317339
.dark-mode-table {
318340
color: #FAF9F6;
319341
border: #FAF9F6 solid 1px;
@@ -398,7 +420,14 @@ ABOUT PAGE
398420

399421
.about-page {
400422
max-height: 82vh;
401-
overflow-y: auto;
423+
background-color: #3d5d82;
424+
overflow-y: scroll;
425+
}
426+
427+
.my-data-page {
428+
max-height: 82vh;
429+
background-color: #3d5d82;
430+
/* overflow-y: scroll; */
402431
}
403432

404433
.about-card {

src/components/app/App.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const App = () => {
6464
navigate(`/customizeProduct/configureOptions${search}`)
6565
}
6666
else if (stepTarget === '#added-scenes' && action === 'update') {
67-
navigate(`/customizeProduct/selectScenes?cyclePassScene=9_515_130&showUTMAdvancedOptions=true`)
67+
navigate(`/customizeProduct/selectScenes?cyclePassScene=12_468_45&showUTMAdvancedOptions=true`)
6868
} else if (stepTarget === '#customization-tab' && action === 'start') {
6969
navigate('/customizeProduct/selectScenes')
7070
} else if (action === 'next' && stepTarget === '#my-data-page') {
@@ -75,6 +75,7 @@ const App = () => {
7575
dispatch(deleteProduct(addedProducts.map(product => product.granuleId)))
7676
navigate(`/customizeProduct/selectScenes`)
7777
}
78+
// TODO: Make condition to load previous page when clicking previous before trying to target component to highlight. Use conditions "stepTarget === '#alert-messages' && action === 'prev' && lifecycle === 'init'"
7879
};
7980

8081
useEffect(() => {
@@ -122,6 +123,9 @@ const App = () => {
122123
showProgress
123124
continuous
124125
scrollToFirstStep
126+
locale={{
127+
last:"Exit Tutorial",
128+
}}
125129
/>
126130
<Routes>
127131
<Route path="/" element={ getPageWithFormatting(<Welcome />, false) } />
+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import { Col, Pagination, Row, Spinner } from "react-bootstrap";
2+
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
3+
import { setUserProducts } from "../sidebar/actions/productSlice";
4+
import { productsPerPage } from "../../constants/rasterParameterConstants";
5+
import { useState } from "react";
6+
7+
8+
const DataPagination = (props: {totalNumberOfProducts: number, totalNumberOfFilteredProducts: number, }) => {
9+
const {totalNumberOfProducts, totalNumberOfFilteredProducts} = props
10+
const dispatch = useAppDispatch()
11+
const userProducts = useAppSelector((state) => state.product.userProducts)
12+
const allUserProducts = useAppSelector((state) => state.product.allUserProducts)
13+
const [noNextPage, setNoNextPage] = useState<boolean>(false)
14+
const [noPreviousPage, setNoPreviousPage] = useState<boolean>(true)
15+
const [waitingForPagination, setWaitingForPagination] = useState<boolean>(false)
16+
const [currentPageNumber, setCurrentPageNumber] = useState<number>(1)
17+
const numberOfTotalPages = Math.ceil(allUserProducts.length / parseInt(productsPerPage))
18+
19+
const handleSelectPage = async (pageNumber: number) => {
20+
const firstNumber = (pageNumber-1) * parseInt(productsPerPage)
21+
const lastNumber = firstNumber + parseInt(productsPerPage)
22+
dispatch(setUserProducts(allUserProducts.slice(firstNumber, lastNumber)))
23+
setCurrentPageNumber(pageNumber)
24+
if(pageNumber === 1) {
25+
setNoPreviousPage(true)
26+
setNoNextPage(false)
27+
} else if (pageNumber === numberOfTotalPages) {
28+
setNoPreviousPage(false)
29+
setNoNextPage(true)
30+
} else {
31+
setNoPreviousPage(false)
32+
setNoNextPage(false)
33+
}
34+
}
35+
36+
const waitingForPaginationSpinner = () => {
37+
return (
38+
<div>
39+
<Spinner animation="border" role="status">
40+
<span className="visually-hidden">Loading...</span>
41+
</Spinner>
42+
</div>
43+
)
44+
}
45+
46+
const getPaginationItemsWithEllipsis = () => {
47+
let numberOfSlotsFreeLeft = 0
48+
if(currentPageNumber >= numberOfTotalPages-4) {
49+
numberOfSlotsFreeLeft = 4 - (numberOfTotalPages - currentPageNumber)
50+
}
51+
52+
let numberOfSlotsFreeRight = 0
53+
if(currentPageNumber <= 4) {
54+
numberOfSlotsFreeRight = 5 - currentPageNumber
55+
}
56+
const pagesAllowed = [currentPageNumber-2, currentPageNumber-1, currentPageNumber, currentPageNumber+1, currentPageNumber+2]
57+
const pagesAllowedToLeftOfCurrent: number[] = []
58+
for(let index=0; index<numberOfTotalPages; index++) {
59+
if(numberOfSlotsFreeLeft !== 0 && index+1 <= numberOfTotalPages - 3) {
60+
// let another number go on right
61+
pagesAllowedToLeftOfCurrent.push(currentPageNumber - index - 3)
62+
numberOfSlotsFreeLeft -= 1
63+
}
64+
if(numberOfSlotsFreeRight !== 0 && index+1 > currentPageNumber + 3) {
65+
// let another number go on left
66+
pagesAllowed.push(index)
67+
numberOfSlotsFreeRight -= 1
68+
}
69+
}
70+
71+
pagesAllowed.unshift(...pagesAllowedToLeftOfCurrent.reverse())
72+
const pagesAllowedFiltered = pagesAllowed.filter(value => value > 1)
73+
const pagesToShow = []
74+
for(let pageIndex = 1; pageIndex < numberOfTotalPages-1; pageIndex++) {
75+
const pageNumberOfIndex = pageIndex + 1
76+
if(pagesAllowedFiltered.includes(pageNumberOfIndex)) {
77+
pagesToShow.push( <Pagination.Item key={`${pageNumberOfIndex}-pagination-item`} active={currentPageNumber === pageNumberOfIndex} onClick={() => handleSelectPage(pageNumberOfIndex)}>{pageNumberOfIndex}</Pagination.Item>)
78+
}
79+
}
80+
81+
if(pagesAllowed[0] > 2) pagesToShow.unshift(<Pagination.Ellipsis />)
82+
if(pagesAllowed[pagesAllowed.length-1] < numberOfTotalPages-1) pagesToShow.push(<Pagination.Ellipsis />)
83+
return pagesToShow
84+
}
85+
86+
return waitingForPagination ? waitingForPaginationSpinner() : (
87+
<Row>
88+
<Col xs={2}></Col>
89+
<Col xs={7}>
90+
{
91+
totalNumberOfFilteredProducts !== 0 ?
92+
<Pagination data-bs-theme='dark' style={{paddingTop: '15px'}} className="center">
93+
<Pagination.Prev onClick={() => handleSelectPage(currentPageNumber-1)} disabled={noPreviousPage} />
94+
<Pagination.Item active={currentPageNumber === 1} onClick={() => handleSelectPage(1)}>1</Pagination.Item>
95+
{getPaginationItemsWithEllipsis()}
96+
{numberOfTotalPages > 1 ? <Pagination.Item active={currentPageNumber === numberOfTotalPages} onClick={() => handleSelectPage(numberOfTotalPages)}>{numberOfTotalPages}</Pagination.Item> : null}
97+
<Pagination.Next onClick={() => handleSelectPage(currentPageNumber+1)} disabled={userProducts.length < parseInt(productsPerPage) || noNextPage} />
98+
</Pagination>
99+
: null
100+
}
101+
</Col>
102+
<Col xs={3} style={{paddingTop: '15px'}}><h6><b>{totalNumberOfProducts}</b> Total Generated Products</h6></Col>
103+
</Row>
104+
)
105+
}
106+
107+
export default DataPagination;
108+

0 commit comments

Comments
 (0)