mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-11 09:51:30 +00:00
refactor: update deprecation messages for Presets and Post Response Vars (#6230)
* refactor: update DeprecationWarning component to accept children and enhance deprecation messages for Presets and Post Response Vars * refactor: update DeprecationWarning component to use props for feature names and links, enhancing deprecation messages across various components
This commit is contained in:
committed by
lohit-bruno
parent
172479edad
commit
536b7393db
@@ -9,7 +9,6 @@ import DeprecationWarning from 'components/DeprecationWarning';
|
||||
const PresetsSettings = ({ collection }) => {
|
||||
const dispatch = useDispatch();
|
||||
const initialPresets = { requestType: 'http', requestUrl: '' };
|
||||
const deprecationWarningMessage = 'Presets is deprecated and will be removed in v3.0.0';
|
||||
|
||||
// Get presets from draft.brunoConfig if it exists, otherwise from brunoConfig
|
||||
const currentPresets = collection.draft?.brunoConfig
|
||||
@@ -37,7 +36,7 @@ const PresetsSettings = ({ collection }) => {
|
||||
|
||||
return (
|
||||
<StyledWrapper className="h-full w-full">
|
||||
<DeprecationWarning message={deprecationWarningMessage} />
|
||||
<DeprecationWarning featureName="Presets" learnMoreUrl="https://github.com/usebruno/bruno/discussions/6234" />
|
||||
<div className="text-xs mb-4 mt-4 text-muted">
|
||||
These presets will be used as the default values for new requests in this collection.
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,6 @@ const Vars = ({ collection }) => {
|
||||
const requestVars = collection.draft?.root ? get(collection, 'draft.root.request.vars.req', []) : get(collection, 'root.request.vars.req', []);
|
||||
const responseVars = collection.draft?.root ? get(collection, 'draft.root.request.vars.res', []) : get(collection, 'root.request.vars.res', []);
|
||||
const handleSave = () => dispatch(saveCollectionSettings(collection.uid));
|
||||
const deprecationWarningMessage = 'Post response vars is deprecated and will be removed in v3.0.0';
|
||||
|
||||
return (
|
||||
<StyledWrapper className="w-full flex flex-col">
|
||||
@@ -21,7 +20,7 @@ const Vars = ({ collection }) => {
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<div className="mt-1 mb-1 title text-xs">Post Response</div>
|
||||
<DeprecationWarning message={deprecationWarningMessage} />
|
||||
<DeprecationWarning featureName="Post Response Variables" learnMoreUrl="https://github.com/usebruno/bruno/discussions/6231" />
|
||||
<VarsTable collection={collection} vars={responseVars} varType="response" />
|
||||
</div>
|
||||
<div className="mt-6">
|
||||
|
||||
@@ -26,6 +26,15 @@ const StyledWrapper = styled.div`
|
||||
font-size: 14px;
|
||||
line-height: 17px;
|
||||
color: ${(props) => props.theme.deprecationWarning.text};
|
||||
|
||||
a {
|
||||
color: ${(props) => props.theme.textLink};
|
||||
text-decoration: underline;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -2,12 +2,16 @@ import React from 'react';
|
||||
import IconAlertTriangleFilled from '../Icons/IconAlertTriangleFilled';
|
||||
import StyledWrapper from './StyledWrapper';
|
||||
|
||||
const DeprecationWarning = ({ message }) => {
|
||||
const DeprecationWarning = ({ featureName, learnMoreUrl }) => {
|
||||
return (
|
||||
<StyledWrapper>
|
||||
<div className="deprecation-warning">
|
||||
<IconAlertTriangleFilled className="warning-icon" size={16} />
|
||||
<span className="warning-text">{message}</span>
|
||||
<span className="warning-text">
|
||||
{featureName} will be removed in <strong>v3.0.0</strong>. They are deprecated and will no longer be supported. Learn more in{' '}
|
||||
<a href={learnMoreUrl} target="_blank" rel="noreferrer">this post</a> or contact us at{' '}
|
||||
<a href="mailto:support@usebruno.com">support@usebruno.com</a> with questions.
|
||||
</span>
|
||||
</div>
|
||||
</StyledWrapper>
|
||||
);
|
||||
|
||||
@@ -11,7 +11,6 @@ const Vars = ({ collection, folder }) => {
|
||||
const requestVars = folder.draft ? get(folder, 'draft.request.vars.req', []) : get(folder, 'root.request.vars.req', []);
|
||||
const responseVars = folder.draft ? get(folder, 'draft.request.vars.res', []) : get(folder, 'root.request.vars.res', []);
|
||||
const handleSave = () => dispatch(saveFolderRoot(collection.uid, folder.uid));
|
||||
const deprecationWarningMessage = 'Post response vars is deprecated and will be removed in v3.0.0';
|
||||
|
||||
return (
|
||||
<StyledWrapper className="w-full flex flex-col">
|
||||
@@ -21,7 +20,7 @@ const Vars = ({ collection, folder }) => {
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<div className="mt-1 mb-1 title text-xs">Post Response</div>
|
||||
<DeprecationWarning message={deprecationWarningMessage} />
|
||||
<DeprecationWarning featureName="Post Response Variables" learnMoreUrl="https://github.com/usebruno/bruno/discussions/6231" />
|
||||
<VarsTable folder={folder} collection={collection} vars={responseVars} varType="response" />
|
||||
</div>
|
||||
<div className="mt-6">
|
||||
|
||||
@@ -7,7 +7,6 @@ import DeprecationWarning from 'components/DeprecationWarning';
|
||||
const Vars = ({ item, collection }) => {
|
||||
const requestVars = item.draft ? get(item, 'draft.request.vars.req') : get(item, 'request.vars.req');
|
||||
const responseVars = item.draft ? get(item, 'draft.request.vars.res') : get(item, 'request.vars.res');
|
||||
const deprecationWarningMessage = 'Post response vars is deprecated and will be removed in v3.0.0';
|
||||
|
||||
return (
|
||||
<StyledWrapper className="w-full flex flex-col">
|
||||
@@ -17,7 +16,7 @@ const Vars = ({ item, collection }) => {
|
||||
</div>
|
||||
<div>
|
||||
<div className="mt-1 mb-1 title text-xs">Post Response</div>
|
||||
<DeprecationWarning message={deprecationWarningMessage} />
|
||||
<DeprecationWarning featureName="Post Response Variables" learnMoreUrl="https://github.com/usebruno/bruno/discussions/6231" />
|
||||
<VarsTable item={item} collection={collection} vars={responseVars} varType="response" />
|
||||
</div>
|
||||
</StyledWrapper>
|
||||
|
||||
Reference in New Issue
Block a user