-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into DDO-3418-workflows-dispatch-test
- Loading branch information
Showing
302 changed files
with
4,356 additions
and
1,555 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -34,6 +34,6 @@ | |
"check-dts": "^0.7.2", | ||
"jest": "^27.4.3", | ||
"typescript": "~5.1.6", | ||
"vite": "^4.3.9" | ||
"vite": "^4.5.2" | ||
} | ||
} |
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 |
---|---|---|
|
@@ -51,6 +51,6 @@ | |
"@types/node": "^20.6.2", | ||
"check-dts": "^0.7.2", | ||
"typescript": "~5.1.6", | ||
"vite": "^4.3.9" | ||
"vite": "^4.5.2" | ||
} | ||
} |
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,39 @@ | ||
import { h } from 'react-hyperscript-helpers'; | ||
import { asMockedFn, renderWithAppContexts } from 'src/testing/test-utils'; | ||
|
||
import { RequiredUpdateAlert } from './RequiredUpdateAlert'; | ||
import { useTimeUntilRequiredUpdate } from './version-alerts'; | ||
|
||
type VersionAlertsExports = typeof import('./version-alerts'); | ||
jest.mock('./version-alerts', (): VersionAlertsExports => { | ||
return { | ||
...jest.requireActual<VersionAlertsExports>('./version-alerts'), | ||
useTimeUntilRequiredUpdate: jest.fn(), | ||
}; | ||
}); | ||
|
||
describe('RequiredUpdateAlert', () => { | ||
it('renders nothing if no update is required', () => { | ||
// Arrange | ||
asMockedFn(useTimeUntilRequiredUpdate).mockReturnValue(undefined); | ||
|
||
// Act | ||
const { container } = renderWithAppContexts(h(RequiredUpdateAlert)); | ||
|
||
// Assert | ||
expect(container).toBeEmptyDOMElement(); | ||
}); | ||
|
||
it('renders time until required update', () => { | ||
// Arrange | ||
asMockedFn(useTimeUntilRequiredUpdate).mockReturnValue(90); | ||
|
||
// Act | ||
const { container } = renderWithAppContexts(h(RequiredUpdateAlert)); | ||
|
||
// Assert | ||
expect(container).toHaveTextContent( | ||
'A required update is available. Terra will automatically refresh your browser in 1 minute 30 seconds.' | ||
); | ||
}); | ||
}); |
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,51 @@ | ||
import { icon, useThemeFromContext } from '@terra-ui-packages/components'; | ||
import { formatDuration } from 'date-fns'; | ||
import { Fragment, ReactNode } from 'react'; | ||
import { div, h, span } from 'react-hyperscript-helpers'; | ||
|
||
import { useTimeUntilRequiredUpdate } from './version-alerts'; | ||
|
||
export const RequiredUpdateAlert = (): ReactNode => { | ||
const { colors } = useThemeFromContext(); | ||
|
||
const timeUntilRequiredUpdate = useTimeUntilRequiredUpdate(); | ||
|
||
if (timeUntilRequiredUpdate === undefined) { | ||
return null; | ||
} | ||
|
||
const minutesRemaining = Math.floor(timeUntilRequiredUpdate / 60); | ||
const secondsRemaining = timeUntilRequiredUpdate % 60; | ||
|
||
return div( | ||
{ | ||
role: 'alert', | ||
style: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
padding: '1rem 1.25rem', | ||
border: `2px solid ${colors.warning()}`, | ||
backgroundColor: colors.warning(0.15), | ||
color: colors.dark(), | ||
fontWeight: 'bold', | ||
fontSize: 12, | ||
}, | ||
}, | ||
[ | ||
icon('warning-standard', { size: 26, color: colors.warning(), style: { marginRight: '1ch' } }), | ||
'A required update is available. Terra will automatically refresh your browser ', | ||
timeUntilRequiredUpdate > 0 | ||
? h(Fragment, [ | ||
'in ', | ||
span({ role: 'timer', style: { marginLeft: '0.5ch' } }, [ | ||
formatDuration({ | ||
minutes: minutesRemaining, | ||
seconds: secondsRemaining, | ||
}), | ||
]), | ||
]) | ||
: 'now', | ||
'.', | ||
] | ||
); | ||
}; |
Oops, something went wrong.