Skip to content

Commit 80fcbf6

Browse files
authored
Merge pull request #2659 from devtron-labs/feat/info-bar-replacement
feat: Info bar replacement
2 parents e20fc7e + 2da38bb commit 80fcbf6

File tree

60 files changed

+569
-796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+569
-796
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ src/components/v2/values/chartValuesDiff/ProjectUpdateModal.tsx
384384
src/components/v2/values/common/chartValues.api.ts
385385
src/components/workflowEditor/CDSuccessModal.tsx
386386
src/components/workflowEditor/CreateWorkflow.tsx
387-
src/components/workflowEditor/DeprecatedPipelineWarning.tsx
388387
src/components/workflowEditor/DeprecatedWarningModal.tsx
389388
src/components/workflowEditor/EmptyWorkflow.tsx
390389
src/components/workflowEditor/NoGitOpsConfiguredWarning.tsx

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "1.11.0-pre-8",
7+
"@devtron-labs/devtron-fe-common-lib": "1.11.0-pre-9",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",

src/Pages/Applications/DevtronApps/Details/AppConfigurations/MainContent/DeploymentTemplate/GUIView/GUIView.component.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
GenericEmptyState,
2525
GUIViewError,
2626
HIDE_SUBMIT_BUTTON_UI_SCHEMA,
27-
InfoColourBar,
2827
joinObjects,
2928
OverrideMergeStrategyType,
3029
RJSFForm,
@@ -33,14 +32,13 @@ import {
3332
} from '@devtron-labs/devtron-fe-common-lib'
3433

3534
import { ReactComponent as ICArrow } from '@Icons/ic-arrow-forward.svg'
36-
import { ReactComponent as Help } from '@Icons/ic-help.svg'
3735
import { ReactComponent as ICWarningY5 } from '@Icons/ic-warning-y5.svg'
3836
import EmptyFolderImage from '@Images/empty-folder.webp'
3937
import { importComponentFromFELibrary } from '@Components/common'
4038

4139
import { DEPLOYMENT_TEMPLATE_LABELS_KEYS, GUI_VIEW_TEXTS } from '../constants'
4240
import { GUIViewProps, GUIViewState } from './types'
43-
import { getRenderActionButton } from './utils'
41+
import { GUIInfoBlock } from './utils'
4442

4543
const makeObjectFromJsonPathArray = importComponentFromFELibrary('makeObjectFromJsonPathArray', null, 'function')
4644
const ConfigurableGUIViewPanel = importComponentFromFELibrary('ConfigurableGUIViewPanel', null, 'function')
@@ -234,15 +232,7 @@ const GUIView = ({
234232
)}
235233
</div>
236234

237-
{!state.error && (
238-
<InfoColourBar
239-
message="To modify additional configurations"
240-
classname="dc__content-start ev-2 bw-1 dc__no-border-radius dc__no-bottom-border dc__no-left-border dc__no-right-border bcv-1 bcv-1 w-100 lh-20"
241-
Icon={Help}
242-
iconClass="fcv-5 icon-dim-20 dc__no-shrink"
243-
renderActionButton={getRenderActionButton({ handleChangeToYAMLMode })}
244-
/>
245-
)}
235+
{!state.error && <GUIInfoBlock handleChangeToYAMLMode={handleChangeToYAMLMode} />}
246236
</>
247237
)
248238
}

src/Pages/Applications/DevtronApps/Details/AppConfigurations/MainContent/DeploymentTemplate/GUIView/utils.tsx

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,40 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { InfoBlock } from '@devtron-labs/devtron-fe-common-lib'
18+
1719
import { GUIViewProps } from './types'
1820

19-
export const getRenderActionButton =
21+
const renderGUIText =
2022
({ handleChangeToYAMLMode }: Pick<GUIViewProps, 'handleChangeToYAMLMode'>) =>
2123
() => (
22-
<button
23-
type="button"
24-
className="dc__unset-button-styles"
25-
onClick={handleChangeToYAMLMode}
26-
data-testid="base-deployment-template-switchtoadvanced-button"
27-
>
28-
<span className="cb-5 cursor fw-6">Switch to Advanced</span>
29-
</button>
24+
<div className="flex left dc__gap-6">
25+
<span> To modify additional configurations</span>
26+
<button
27+
type="button"
28+
className="dc__unset-button-styles"
29+
onClick={handleChangeToYAMLMode}
30+
data-testid="base-deployment-template-switchtoadvanced-button"
31+
>
32+
<span className="cb-5 cursor fw-6">Switch to Advanced</span>
33+
</button>
34+
</div>
3035
)
36+
37+
export const GUIInfoBlock = ({ handleChangeToYAMLMode }: Pick<GUIViewProps, 'handleChangeToYAMLMode'>) => (
38+
<InfoBlock
39+
variant="help"
40+
description={renderGUIText({ handleChangeToYAMLMode })()}
41+
borderConfig={{
42+
left: false,
43+
right: false,
44+
top: false,
45+
}}
46+
borderRadiusConfig={{
47+
left: false,
48+
right: false,
49+
top: false,
50+
bottom: false,
51+
}}
52+
/>
53+
)

src/Pages/Applications/DevtronApps/Details/AppConfigurations/Navigation/EnvironmentOverrideRouter.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
DeleteConfirmationModal,
2323
EnvResourceType,
2424
getEnvironmentListMinPublic,
25-
InfoColourBar,
25+
InfoBlock,
2626
PopupMenu,
2727
Progressing,
2828
SelectPicker,
@@ -35,7 +35,6 @@ import { ReactComponent as ICStamp } from '@Icons/ic-stamp.svg'
3535

3636
import { ReactComponent as Add } from '../../../../../../assets/icons/ic-add.svg'
3737
import { ReactComponent as DeleteIcon } from '../../../../../../assets/icons/ic-delete-interactive.svg'
38-
import { ReactComponent as Help } from '../../../../../../assets/icons/ic-help.svg'
3938
import { ReactComponent as More } from '../../../../../../assets/icons/ic-more-option.svg'
4039
import warn from '../../../../../../assets/icons/ic-warning.svg'
4140
import { createClusterEnvGroup, usePrevious } from '../../../../../../components/common'
@@ -336,15 +335,7 @@ const EnvironmentOverrideRouter = ({
336335
)
337336
}
338337
if (!isJobView) {
339-
return (
340-
<InfoColourBar
341-
classname="question-bar no-env-overrides"
342-
message={<EnvOverridesHelpNote />}
343-
Icon={Help}
344-
iconClass="fcv-5"
345-
iconSize={16}
346-
/>
347-
)
338+
return <InfoBlock variant="help" description={<EnvOverridesHelpNote />} />
348339
}
349340
return null
350341
}

src/Pages/GlobalConfigurations/Authorization/APITokens/EditAPIToken.tsx

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ import { useHistory, useParams, useRouteMatch } from 'react-router-dom'
2020
import moment from 'moment'
2121

2222
import {
23+
ButtonStyleType,
24+
ButtonVariantType,
2325
ButtonWithLoader,
2426
ClipboardButton,
2527
CustomInput,
26-
InfoColourBar,
28+
InfoBlock,
2729
noop,
2830
Progressing,
2931
showError,
@@ -34,7 +36,6 @@ import {
3436
} from '@devtron-labs/devtron-fe-common-lib'
3537

3638
import { ReactComponent as Delete } from '../../../../assets/icons/ic-delete-interactive.svg'
37-
import { ReactComponent as InfoIcon } from '../../../../assets/icons/info-filled.svg'
3839
import { importComponentFromFELibrary } from '../../../../components/common'
3940
import { MomentDateFormat } from '../../../../config'
4041
import { API_COMPONENTS } from '../../../../config/constantMessaging'
@@ -90,21 +91,9 @@ const EditAPIToken = ({
9091
const [showDeleteConfirmation, setShowDeleteConfirmation] = useState(false)
9192
const [invalidDescription, setInvalidDescription] = useState(false)
9293

93-
const renderActionButton = () => (
94-
<span className="cr-5 cursor flexbox top fw-6" onClick={() => setShowRegeneratedModal(true)}>
95-
Regenerate token
96-
</span>
97-
)
98-
99-
const renderRegenerateInfoBar = () => (
100-
<InfoColourBar
101-
message="To set a new expiration date, you can regenerate this token. Any scripts or applications using this token will need to be updated."
102-
classname="info_bar"
103-
Icon={InfoIcon}
104-
iconClass="icon-dim-20"
105-
renderActionButton={renderActionButton}
106-
/>
107-
)
94+
const onClickShowRegenerateModal = () => {
95+
setShowRegeneratedModal(true)
96+
}
10897

10998
const redirectToTokenList = () => {
11099
history.push(`${match.path.split('edit')[0]}list`)
@@ -181,24 +170,38 @@ const EditAPIToken = ({
181170
const getExpirationText = () => {
182171
if (isTokenExpired(editData.expireAtInMs)) {
183172
return (
184-
<span className="cr-5">
173+
<span className="cr-5 fw-6">
185174
This token expired on&nbsp;
186175
{moment(editData.expireAtInMs).format(MomentDateFormat)}.
187176
</span>
188177
)
189178
}
190179
if (editData.expireAtInMs === 0) {
191-
return <span>This token has no expiration date.</span>
180+
return <span className="fw-6">This token has no expiration date.</span>
192181
}
193182

194183
return (
195-
<span>
184+
<span className="fw-6">
196185
This token expires on&nbsp;
197186
{moment(editData.expireAtInMs).format(MomentDateFormat)}.
198187
</span>
199188
)
200189
}
201190

191+
const renderRegenerateInfoBar = () => (
192+
<InfoBlock
193+
heading={getExpirationText()}
194+
description="Regenerate this token to set a new expiration date. Any scripts or applications using this token will need to be updated."
195+
buttonProps={{
196+
dataTestId: 'regenerate-token-button',
197+
text: 'Regenerate token',
198+
onClick: onClickShowRegenerateModal,
199+
variant: ButtonVariantType.text,
200+
style: ButtonStyleType.negative,
201+
}}
202+
/>
203+
)
204+
202205
if (isLoading || !editData) {
203206
return <Progressing pageLoader />
204207
}
@@ -259,17 +262,6 @@ const EditAPIToken = ({
259262
</div>
260263
</div>
261264
</label>
262-
<label className="form__row">
263-
<span className="form__label">Expiration</span>
264-
<div className="dc__align-left">
265-
{getExpirationText()}
266-
&nbsp;
267-
<span className="fw-4">To set a new expiration date you must</span>&nbsp;
268-
<span className="cb-5 cursor" onClick={() => setShowRegeneratedModal(true)}>
269-
regenerate the token.
270-
</span>
271-
</div>
272-
</label>
273265
<div className="dc__border-top" />
274266
<PermissionConfigurationForm showUserPermissionGroupSelector isAddMode={false} />
275267
</div>

src/Pages/GlobalConfigurations/Authorization/APITokens/ExpirationDate.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
/* eslint-disable react/prop-types */
1818
import moment from 'moment'
1919

20-
import { InfoColourBar, SelectPicker } from '@devtron-labs/devtron-fe-common-lib'
20+
import { InfoBlock, SelectPicker } from '@devtron-labs/devtron-fe-common-lib'
2121

22-
import { ReactComponent as Warn } from '../../../../assets/icons/ic-warning.svg'
2322
import { SingleDatePickerComponent } from '../../../../components/common'
2423
import { MomentDateFormat } from '../../../../config'
2524
import { getDateInMilliseconds, getOptions } from './apiToken.utils'
@@ -61,11 +60,9 @@ const ExpirationDate = ({ selectedExpirationDate, onChangeSelectFormData, handle
6160
</div>
6261
{selectedExpirationDate.label === 'No expiration' && (
6362
<div className="mt-16">
64-
<InfoColourBar
65-
classname="warn"
66-
Icon={Warn}
67-
message="Devtron strongly recommends that you set an expiration date for your token to help keep your information secure."
68-
iconClass="warning-icon"
63+
<InfoBlock
64+
variant="warning"
65+
description="Devtron strongly recommends that you set an expiration date for your token to help keep your information secure."
6966
/>
7067
</div>
7168
)}

src/Pages/GlobalConfigurations/Authorization/APITokens/RegenerateModal.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { useState } from 'react'
1818

19-
import { InfoColourBar, Progressing, showError, VisibleModal } from '@devtron-labs/devtron-fe-common-lib'
19+
import { InfoBlock, Progressing, showError, VisibleModal } from '@devtron-labs/devtron-fe-common-lib'
2020

2121
import { ReactComponent as Close } from '../../../../assets/icons/ic-close.svg'
2222
import { ReactComponent as Warn } from '../../../../assets/icons/ic-warning.svg'
@@ -122,11 +122,9 @@ const RegeneratedModal = ({
122122
<div className="modal__body w-600 flex column pt-0 pr-0 pl-0 pb-16">
123123
{renderModalHeader()}
124124
<div className="p-20 w-100">
125-
<InfoColourBar
126-
message="Submitting this form will generate a new token. Be aware that any scripts or applications using the current token will need to be updated."
127-
classname="warn"
128-
Icon={Warn}
129-
iconClass="warning-icon"
125+
<InfoBlock
126+
variant="warning"
127+
description="Submitting this form will generate a new token. Be aware that any scripts or applications using the current token will need to be updated."
130128
/>
131129
<div className="mt-20 mb-20">
132130
<ExpirationDate

src/Pages/GlobalConfigurations/Authorization/SSOLoginServices/SSOLogin.component.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {
3939
DEFAULT_SECRET_PLACEHOLDER,
4040
ErrorScreenManager,
4141
FeatureTitleWithInfo,
42-
InfoColourBar,
42+
InfoBlock,
4343
isCodeMirrorEnabled,
4444
MODES,
4545
noop,
@@ -51,7 +51,6 @@ import {
5151
YAMLStringify,
5252
} from '@devtron-labs/devtron-fe-common-lib'
5353

54-
import { ReactComponent as Help } from '@Icons/ic-help.svg'
5554
import { ReactComponent as InfoIcon } from '@Icons/ic-info-warn.svg'
5655
import Check from '@Icons/ic-selected-corner.png'
5756
import { ReactComponent as UsersIcon } from '@Icons/ic-users.svg'
@@ -809,14 +808,7 @@ class SSOLogin extends Component<SSOLoginProps, SSOLoginState> {
809808
/>
810809
))}
811810
</div>
812-
<div className="flex-grow-1 w-100">
813-
<InfoColourBar
814-
message={renderInfoText()}
815-
classname="question-bar w-100 dc__mw-600"
816-
iconClass="icon-dim-20 fcv-5"
817-
Icon={Help}
818-
/>
819-
</div>
811+
<InfoBlock variant="help" description={renderInfoText()} />
820812
<div className="flex-grow-1 w-100">
821813
<CustomInput
822814
value={this.state.ssoConfig.url || window.__ORCHESTRATOR_ROOT__}

src/Pages/GlobalConfigurations/Authorization/Shared/components/K8sObjectPermissions/K8sListItemCard.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
ComponentSizeType,
2727
EntityTypes,
2828
GVKType,
29-
InfoColourBar,
29+
InfoBlock,
3030
OptionType,
3131
ResourceListPayloadType,
3232
SelectPicker,
@@ -44,7 +44,6 @@ import {
4444

4545
import { ReactComponent as Clone } from '../../../../../../assets/icons/ic-copy.svg'
4646
import { ReactComponent as Delete } from '../../../../../../assets/icons/ic-delete-interactive.svg'
47-
import { ReactComponent as InfoIcon } from '../../../../../../assets/icons/info-filled.svg'
4847
import {
4948
convertToOptionsList,
5049
importComponentFromFELibrary,
@@ -497,12 +496,7 @@ const K8sListItemCard = ({
497496
size={ComponentSizeType.large}
498497
/>
499498
{K8S_PERMISSION_INFO_MESSAGE[k8sPermission?.kind?.label] && (
500-
<InfoColourBar
501-
message={K8S_PERMISSION_INFO_MESSAGE[k8sPermission.kind.label]}
502-
classname="info_bar mb-12"
503-
Icon={InfoIcon}
504-
iconClass="icon-dim-20"
505-
/>
499+
<InfoBlock description={K8S_PERMISSION_INFO_MESSAGE[k8sPermission.kind.label]} />
506500
)}
507501
<div className="w-300">
508502
<SelectPicker

0 commit comments

Comments
 (0)