forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v3' into PMM-12910-popup-new-version-available
- Loading branch information
Showing
51 changed files
with
239 additions
and
1,531 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const grafanaConfig = require('./jest.config'); | ||
|
||
module.exports = { | ||
...grafanaConfig, | ||
roots: [ | ||
'<rootDir>/public/app/percona', | ||
'<rootDir>/public/app/plugins/datasource/pmm-pt-summary-datasource', | ||
'<rootDir>/public/app/plugins/panel/pmm-check', | ||
'<rootDir>/public/app/plugins/panel/pmm-pt-summary-panel', | ||
'<rootDir>/public/app/plugins/panel/pmm-update', | ||
], | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const Messages = { | ||
upgrade: 'Upgrade', | ||
upgradeTo: (version: string) => `Upgrade to ${version}`, | ||
}; |
17 changes: 0 additions & 17 deletions
17
public/app/plugins/panel/pmm-update/UpdatePanel.service.ts
This file was deleted.
Oops, something went wrong.
43 changes: 22 additions & 21 deletions
43
public/app/plugins/panel/pmm-update/UpdatePanel.styles.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 |
---|---|---|
@@ -1,26 +1,27 @@ | ||
import { css } from '@emotion/css'; | ||
|
||
export const panel = css` | ||
display: flex; | ||
flex-direction: column; | ||
position: relative; | ||
height: 100%; | ||
export const styles = { | ||
panel: css` | ||
display: flex; | ||
flex-direction: column; | ||
position: relative; | ||
height: 100%; | ||
p { | ||
margin-bottom: 0; | ||
} | ||
@media (max-width: 1281px) { | ||
#pmm-update-widget h2 { | ||
font-size: 1.55rem; | ||
margin-bottom: 0.1rem; | ||
p { | ||
margin-bottom: 0; | ||
} | ||
} | ||
`; | ||
export const middleSectionWrapper = css` | ||
align-items: center; | ||
display: flex; | ||
flex: 1; | ||
justify-content: center; | ||
`; | ||
@media (max-width: 1281px) { | ||
#pmm-update-widget h2 { | ||
font-size: 1.55rem; | ||
margin-bottom: 0.1rem; | ||
} | ||
} | ||
`, | ||
middleSectionWrapper: css` | ||
align-items: center; | ||
display: flex; | ||
flex: 1; | ||
justify-content: center; | ||
`, | ||
}; |
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 |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import { format } from 'date-fns'; | ||
import { enUS } from 'date-fns/locale'; | ||
|
||
import { ISOTimestamp } from './types'; | ||
|
||
export const formatDateWithTime = (timestamp: ISOTimestamp) => { | ||
export const formatDateWithTime = (timestamp: string) => { | ||
const date = new Date(timestamp); | ||
return `${format(date.valueOf() + date.getTimezoneOffset() * 60 * 1000, 'MMMM dd, H:mm', { locale: enUS })} UTC`; | ||
}; | ||
|
||
export const formatDateWithYear = (timestamp: ISOTimestamp) => { | ||
export const formatDateWithYear = (timestamp: string) => { | ||
const date = new Date(timestamp); | ||
return `${format(date.valueOf() + date.getTimezoneOffset() * 60 * 1000, 'MMMM dd, yyyy', { locale: enUS })} UTC`; | ||
}; |
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
27 changes: 14 additions & 13 deletions
27
public/app/plugins/panel/pmm-update/components/AvailableUpdate/AvailableUpdate.test.tsx
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 |
---|---|---|
@@ -1,38 +1,39 @@ | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
import React from 'react'; | ||
|
||
import { LatestInformation } from 'app/percona/shared/core/reducers/updates'; | ||
|
||
import { AvailableUpdate } from './AvailableUpdate'; | ||
|
||
const nextFullVersion = 'x.y.z-rc.j+1234567890'; | ||
const nextVersion = 'x.y.z'; | ||
const version = 'x.y.z'; | ||
const tag = 'percona/pmm-server:x.y.z-rc.j+1234567890'; | ||
const newsLink = 'https://percona.com'; | ||
const nextVersionDate = '23 Jun'; | ||
const timestamp = '2024-06-23T00:00:00.000Z'; | ||
|
||
const nextVersionDetails = { | ||
nextVersionDate, | ||
nextVersion, | ||
nextFullVersion, | ||
newsLink, | ||
const nextVersion: LatestInformation = { | ||
version, | ||
tag, | ||
timestamp, | ||
}; | ||
|
||
describe('AvailableUpdate::', () => { | ||
it('should show only the short version by default', () => { | ||
render(<AvailableUpdate nextVersionDetails={nextVersionDetails} />); | ||
render(<AvailableUpdate nextVersion={nextVersion} newsLink={newsLink} />); | ||
|
||
expect(screen.getByTestId('update-latest-version').textContent).toEqual(nextVersion); | ||
expect(screen.getByTestId('update-latest-version')).toHaveTextContent(version); | ||
}); | ||
|
||
it('should show the news link if present', () => { | ||
render(<AvailableUpdate nextVersionDetails={nextVersionDetails} />); | ||
render(<AvailableUpdate nextVersion={nextVersion} newsLink={newsLink} />); | ||
|
||
expect(screen.getByTestId('update-news-link')).toBeTruthy(); | ||
}); | ||
|
||
it('should show the full version on alt-click', () => { | ||
render(<AvailableUpdate nextVersionDetails={nextVersionDetails} />); | ||
render(<AvailableUpdate nextVersion={nextVersion} newsLink={newsLink} />); | ||
|
||
fireEvent.click(screen.getByTestId('update-latest-section'), { altKey: true }); | ||
|
||
expect(screen.getByTestId('update-latest-version').textContent).toEqual(nextFullVersion); | ||
expect(screen.getByTestId('update-latest-version')).toHaveTextContent(tag); | ||
}); | ||
}); |
Oops, something went wrong.