-
-
Notifications
You must be signed in to change notification settings - Fork 354
feat: Use Environment variables for secrets capabilities #1702 #1877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SrinivasanTarget
wants to merge
8
commits into
appium:main
Choose a base branch
from
SrinivasanTarget:environmentSecrets
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d7d9dde
Introduce environment tabs for secrets
SrinivasanTarget 5f3e163
Maintain environment variables state
SrinivasanTarget 9b2688f
fix review comments
SrinivasanTarget fc17cb3
add unit tests and fix lint issues
SrinivasanTarget 9e8f5a4
Fixed review comments
SrinivasanTarget 26a67d7
Merge branch 'main' into environmentSecrets
saikrishna321 f8d5a9c
Fix unit tests
SrinivasanTarget 3497162
making prettier happy
SrinivasanTarget 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
93 changes: 93 additions & 0 deletions
93
app/common/renderer/components/Inspector/EnvironmentVariables.jsx
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,93 @@ | ||
| import {PlusOutlined, DeleteOutlined} from '@ant-design/icons'; | ||
| import {Button, Input, Space, Table, Tooltip} from 'antd'; | ||
| import {useState} from 'react'; | ||
| import {useDispatch, useSelector} from 'react-redux'; | ||
SrinivasanTarget marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| import {setEnvironmentVariables, addEnvironmentVariable, deleteEnvironmentVariable} from '../../actions/Inspector'; | ||
SrinivasanTarget marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| import styles from './EnvironmentVariables.module.css'; | ||
SrinivasanTarget marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| const EnvironmentVariables = ({t}) => { | ||
| const dispatch = useDispatch(); | ||
| const envVars = useSelector(state => state.inspector.environmentVariables || []); | ||
| const [newVar, setNewVar] = useState({key: '', value: ''}); | ||
|
|
||
| const columns = [ | ||
| { | ||
| title: t('Variable Name'), | ||
| dataIndex: 'key', | ||
| key: 'key', | ||
| width: '40%', | ||
| }, | ||
| { | ||
| title: t('Value'), | ||
| dataIndex: 'value', | ||
| key: 'value', | ||
| width: '40%', | ||
| render: (text) => <Input.Password value={text} readOnly />, | ||
| }, | ||
| { | ||
| title: t('Actions'), | ||
| key: 'action', | ||
| width: '20%', | ||
| render: (_, record) => ( | ||
| <Tooltip title={t('Delete Variable')}> | ||
| <Button | ||
| type="text" | ||
| danger | ||
| icon={<DeleteOutlined />} | ||
| onClick={() => { | ||
| dispatch(deleteEnvironmentVariable(record.key)); | ||
| }} | ||
| /> | ||
| </Tooltip> | ||
SrinivasanTarget marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ), | ||
| }, | ||
| ]; | ||
|
|
||
| const handleAddVariable = () => { | ||
| if (!newVar.key || !newVar.value) return; | ||
|
|
||
| // Check for duplicate keys | ||
| if (envVars.some((v) => v.key === newVar.key)) { | ||
| return; | ||
| } | ||
|
|
||
| dispatch(addEnvironmentVariable(newVar.key, newVar.value)); | ||
| setNewVar({key: '', value: ''}); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className={styles.container}> | ||
| <div className={styles.addForm}> | ||
| <Space.Compact style={{width: '100%'}}> | ||
| <Input | ||
| placeholder={t('Variable Name')} | ||
| value={newVar.key} | ||
| onChange={(e) => setNewVar({...newVar, key: e.target.value})} | ||
| /> | ||
| <Input.Password | ||
| placeholder={t('Value')} | ||
| value={newVar.value} | ||
| onChange={(e) => setNewVar({...newVar, value: e.target.value})} | ||
| /> | ||
| <Button | ||
| type="primary" | ||
| icon={<PlusOutlined />} | ||
| onClick={handleAddVariable} | ||
| disabled={!newVar.key || !newVar.value} | ||
| > | ||
| {t('Add')} | ||
| </Button> | ||
| </Space.Compact> | ||
| </div> | ||
| <Table | ||
| columns={columns} | ||
| dataSource={envVars} | ||
| pagination={false} | ||
| rowKey="key" | ||
| size="small" | ||
| /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default EnvironmentVariables; | ||
9 changes: 9 additions & 0 deletions
9
app/common/renderer/components/Inspector/EnvironmentVariables.module.css
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,9 @@ | ||
| .container { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 16px; | ||
| } | ||
|
|
||
| .addForm { | ||
| padding: 8px 0; | ||
| } |
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,4 +1,4 @@ | ||
| import { | ||
| CheckCircleOutlined, | ||
| CloseCircleOutlined, | ||
| CodeOutlined, | ||
|
|
@@ -15,6 +15,7 @@ | |
| import {Button, Card, Modal, Space, Spin, Switch, Tabs, Tooltip} from 'antd'; | ||
| import {debounce} from 'lodash'; | ||
| import {useEffect, useRef, useState} from 'react'; | ||
| import styles from './Inspector.module.css'; | ||
| import {useNavigate} from 'react-router'; | ||
|
|
||
| import {BUTTON} from '../../constants/antd-types'; | ||
|
|
@@ -30,7 +31,6 @@ | |
| import Commands from './Commands.jsx'; | ||
| import GestureEditor from './GestureEditor.jsx'; | ||
| import HeaderButtons from './HeaderButtons.jsx'; | ||
| import InspectorStyles from './Inspector.module.css'; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of the changes in this file are renaming and can be omitted in this PR
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is still not resolved |
||
| import Recorder from './Recorder.jsx'; | ||
| import SavedGestures from './SavedGestures.jsx'; | ||
| import Screenshot from './Screenshot.jsx'; | ||
|
|
@@ -221,7 +221,7 @@ | |
| }, [showKeepAlivePrompt]); | ||
|
|
||
| const screenShotControls = ( | ||
| <div className={InspectorStyles['screenshot-controls']}> | ||
| <div className={styles['screenshot-controls']}> | ||
| <Space size="middle"> | ||
| <Tooltip | ||
| title={t(showCentroids ? 'Hide Element Handles' : 'Show Element Handles')} | ||
|
|
@@ -263,22 +263,22 @@ | |
| ); | ||
|
|
||
| const main = ( | ||
| <div className={InspectorStyles['inspector-main']}> | ||
| <div className={styles['inspector-main']}> | ||
| <div | ||
| id="screenshotContainer" | ||
| className={InspectorStyles['screenshot-container']} | ||
| className={styles['screenshot-container']} | ||
| ref={screenshotContainerEl} | ||
| > | ||
| {screenShotControls} | ||
| {showScreenshot && <Screenshot {...props} scaleRatio={scaleRatio} />} | ||
| {screenshotError && t('couldNotObtainScreenshot', {screenshotError})} | ||
| {!showScreenshot && ( | ||
| <Spin size="large" spinning={true}> | ||
| <div className={InspectorStyles.screenshotBox} /> | ||
| <div className={styles.screenshotBox} /> | ||
| </Spin> | ||
| )} | ||
| </div> | ||
| <div id="sourceTreeContainer" className={InspectorStyles['interaction-tab-container']}> | ||
| <div id="sourceTreeContainer" className={styles['interaction-tab-container']}> | ||
| <Tabs | ||
| activeKey={selectedInspectorTab} | ||
| size="small" | ||
|
|
@@ -331,15 +331,15 @@ | |
| </div> | ||
| <div | ||
| id="selectedElementContainer" | ||
| className={`${InspectorStyles['interaction-tab-container']} ${InspectorStyles['element-detail-container']} action-col`} | ||
| className={`${styles['interaction-tab-container']} ${styles['element-detail-container']} action-col`} | ||
| > | ||
| <Card | ||
| title={ | ||
| <span> | ||
| <TagOutlined /> {t('selectedElement')} | ||
| </span> | ||
| } | ||
| className={InspectorStyles['selected-element-card']} | ||
| className={styles['selected-element-card']} | ||
| > | ||
| {selectedElement.path && <SelectedElement {...props} />} | ||
| {!selectedElement.path && <i>{t('selectElementInSource')}</i>} | ||
|
|
@@ -359,7 +359,7 @@ | |
| <ThunderboltOutlined /> {t('Execute Commands')} | ||
| </span> | ||
| } | ||
| className={InspectorStyles['interaction-tab-card']} | ||
| className={styles['interaction-tab-card']} | ||
| > | ||
| <Commands {...props} /> | ||
| </Card> | ||
|
|
@@ -376,7 +376,7 @@ | |
| <HighlightOutlined /> {t('Gesture Builder')} | ||
| </span> | ||
| } | ||
| className={InspectorStyles['interaction-tab-card']} | ||
| className={styles['interaction-tab-card']} | ||
| > | ||
| <GestureEditor {...props} /> | ||
| </Card> | ||
|
|
@@ -387,7 +387,7 @@ | |
| <HighlightOutlined /> {t('Saved Gestures')} | ||
| </span> | ||
| } | ||
| className={InspectorStyles['interaction-tab-card']} | ||
| className={styles['interaction-tab-card']} | ||
| > | ||
| <SavedGestures {...props} /> | ||
| </Card> | ||
|
|
@@ -410,7 +410,7 @@ | |
| <InfoCircleOutlined /> {t('Session Information')} | ||
| </span> | ||
| } | ||
| className={InspectorStyles['interaction-tab-card']} | ||
| className={styles['interaction-tab-card']} | ||
| > | ||
| <SessionInfo {...props} /> | ||
| </Card> | ||
|
|
@@ -423,7 +423,7 @@ | |
| ); | ||
|
|
||
| return ( | ||
| <div className={InspectorStyles['inspector-container']}> | ||
| <div className={styles['inspector-container']}> | ||
| <HeaderButtons quitCurrentSession={quitCurrentSession} {...props} /> | ||
| {main} | ||
| <Modal | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This specific key is not used anymore