This repository was archived by the owner on Apr 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
PMM-8509 Disable check updates #1253
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a2eb6db
PMM-8509 Disable check updates
tiagomotasantos 2ea80c4
Merge branch 'main' into PMM-8509-check-updates
tiagomotasantos 8410142
PMM-8509 Disable updates when offline
tiagomotasantos b496cd4
PMM-8509 Add not online messages
tiagomotasantos e1b670f
PMM-8509 Fix jest import
tiagomotasantos c9dad76
Merge branch 'main' into PMM-8509-check-updates
JiriCtvrtka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
| export const PMM_ADVANCED_SETTINGS_URL = '/graph/settings/advanced-settings'; |
This file contains hidden or 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
31 changes: 21 additions & 10 deletions
31
pmm-app/src/pmm-update/components/InfoBox/InfoBox.styles.ts
This file contains hidden or 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,12 +1,23 @@ | ||
| import { css } from 'emotion'; | ||
| import { GrafanaTheme } from '@grafana/data'; | ||
|
|
||
| export const infoBox = css` | ||
| margin: 10px 0; | ||
| display: flex; | ||
| flex-direction: column; | ||
| flex: 1; | ||
| justify-content: center; | ||
| align-items: center; | ||
| box-sizing: border-box; | ||
| border: 2px solid #292929; | ||
| `; | ||
| export const getStyles = ({ colors, spacing }: GrafanaTheme) => ({ | ||
| infoBox: css` | ||
| margin: 10px 0; | ||
| display: flex; | ||
| flex-direction: column; | ||
| flex: 1; | ||
| justify-content: center; | ||
| align-items: center; | ||
| box-sizing: border-box; | ||
| border: 2px solid #292929; | ||
| text-align: center; | ||
| padding: ${spacing.xs}; | ||
| `, | ||
| link: css` | ||
| color: ${colors.linkExternal}; | ||
| &:hover { | ||
| color: ${colors.textBlue}; | ||
| } | ||
| `, | ||
| }); |
This file contains hidden or 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 hidden or 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,18 +1,39 @@ | ||
| import React, { FC } from 'react'; | ||
|
|
||
| import { useStyles } from '@grafana/ui'; | ||
| import { InfoBoxProps } from 'pmm-update/types'; | ||
| import { Messages } from './InfoBox.messages'; | ||
| import * as styles from './InfoBox.styles'; | ||
| import { getStyles } from './InfoBox.styles'; | ||
| import { PMM_ADVANCED_SETTINGS_URL } from './InfoBox.constants'; | ||
|
|
||
| export const InfoBox: FC<InfoBoxProps> = ({ | ||
| upToDate = false, | ||
| hasNoAccess, | ||
| updatesDisabled, | ||
| isOnline = true, | ||
| }) => { | ||
| const styles = useStyles(getStyles); | ||
|
|
||
| export const InfoBox: FC<InfoBoxProps> = ({ upToDate = false }) => ( | ||
| <section className={styles.infoBox}> | ||
| {upToDate ? ( | ||
| <p>{Messages.upToDate}</p> | ||
| ) : ( | ||
| <> | ||
| <p>{Messages.noUpdates}</p> | ||
| <p>{Messages.updatesNotice}</p> | ||
| </> | ||
| )} | ||
| </section> | ||
| ); | ||
| return ( | ||
| <section data-qa="updates-info" className={styles.infoBox}> | ||
| {hasNoAccess ? ( | ||
| <p>{Messages.noAccess}</p> | ||
| ) : !isOnline ? ( | ||
| <p>{Messages.notOnline}</p> | ||
| ) : updatesDisabled ? ( | ||
| <p> | ||
| {Messages.updatesDisabled} | ||
| <a className={styles.link} href={PMM_ADVANCED_SETTINGS_URL}> | ||
| {Messages.pmmSettings} | ||
| </a> | ||
| </p> | ||
| ) : upToDate ? ( | ||
| <p>{Messages.upToDate}</p> | ||
| ) : ( | ||
| <> | ||
| <p>{Messages.noUpdates}</p> | ||
| <p>{Messages.updatesNotice}</p> | ||
| </> | ||
| )} | ||
| </section> | ||
| ); | ||
| }; |
This file contains hidden or 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 hidden or 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,15 @@ | ||
| import { apiRequest } from 'shared/components/helpers/api'; | ||
| import { API } from './constants'; | ||
| import { Settings, SettingsAPIResponse, SettingsPayload } from './types'; | ||
|
|
||
| export const SettingsService = { | ||
| async getSettings(disableNotifications = false): Promise<Settings> { | ||
| const { settings } = await apiRequest.post(API.SETTINGS, {}, disableNotifications) as SettingsAPIResponse; | ||
|
|
||
| return toModel(settings); | ||
| }, | ||
| }; | ||
|
|
||
| const toModel = (response: SettingsPayload): Settings => ({ | ||
| updatesDisabled: response.updates_disabled, | ||
| }); |
This file contains hidden or 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,7 @@ | ||
| import { Settings } from '../types'; | ||
|
|
||
| export const SettingsService = { | ||
| async getSettings(): Promise<Settings> { | ||
| return Promise.resolve({ updatesDisabled: false }); | ||
| }, | ||
| }; |
This file contains hidden or 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,2 +1,3 @@ | ||
| export * from './constants'; | ||
| export * from './types'; | ||
| export * from './Settings.service'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.