Skip to content

Commit a6452f7

Browse files
authored
Merge pull request #347 from zenml-io/dev
Dev
2 parents 6b827a0 + 1ebeae6 commit a6452f7

File tree

25 files changed

+482
-203
lines changed

25 files changed

+482
-203
lines changed

src/ui/components/forms/index.tsx

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ export const MakeSecretField = (
282282
borderRadius: '4px',
283283
boxShadow: 'var(--cardShadow)',
284284
width: '100%',
285-
285+
286286
height: '185px',
287287
overflowY: 'auto',
288288
overflowX: 'hidden',
@@ -348,12 +348,14 @@ export const MakeSecretField = (
348348

349349
export const EditField = (
350350
props: {
351+
filteredSecretId?: string;
351352
label: string;
352353
labelColor: any;
353354
placeholder: any;
354355
value: string;
355356
defaultValue?: string;
356357
optional: boolean;
358+
viewSecretDetail?: any;
357359
} & any,
358360
): JSX.Element => {
359361
return (
@@ -365,16 +367,48 @@ export const EditField = (
365367
optional={props.optional}
366368
labelColor={props.labelColor}
367369
InputComponent={
368-
<TextInput
369-
{...props}
370-
style={{
371-
backgroundColor: props.disabled && '#E9EAEC',
372-
borderWidth: props.disabled && '0px',
373-
}}
374-
defaultValue={props?.defaultValue}
375-
value={props.value}
376-
placeholder={props.placeholder}
377-
/>
370+
<>
371+
{props.filteredSecretId ? (
372+
<Box
373+
paddingLeft="md"
374+
style={{
375+
height: '40px',
376+
width: '30vw',
377+
backgroundColor: props.disabled && '#F6F7F7',
378+
borderWidth: props.disabled && '0px',
379+
borderRadius: '4px',
380+
justifyContent: 'flex-start',
381+
alignItems: 'center',
382+
display: 'flex',
383+
}}
384+
>
385+
<Paragraph
386+
onClick={() => props.viewSecretDetail()}
387+
style={{
388+
cursor: 'pointer',
389+
textAlign: 'center',
390+
fontSize: '16px',
391+
color: '#22BBDD',
392+
textDecorationLine: 'underline',
393+
}}
394+
>
395+
{props.defaultValue}
396+
</Paragraph>
397+
</Box>
398+
) : (
399+
<TextInput
400+
{...props}
401+
style={{
402+
backgroundColor: props.disabled && '#E9EAEC',
403+
borderWidth: props.disabled && '0px',
404+
}}
405+
filteredSecretId={props.filteredSecretId}
406+
defaultValue={props?.defaultValue}
407+
value={props.value}
408+
placeholder={props.placeholder}
409+
/>
410+
)}
411+
</>
378412
}
379413
/>
380414
{!props.disabled && (

src/ui/layouts/NonEditableConfig/index.tsx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ import {
99
import { ToggleField } from '../common/FormElement';
1010
import styles from './index.module.scss';
1111
import { useService } from './useService';
12+
import { routePaths } from '../../../routes/routePaths';
13+
import { useSelector } from 'react-redux';
14+
import { secretSelectors, workspaceSelectors } from '../../../redux/selectors';
15+
import { useHistory } from '../../hooks';
1216

1317
export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
18+
const secrets = useSelector(secretSelectors.mySecrets);
19+
const selectedWorkspace = useSelector(workspaceSelectors.selectedWorkspace);
20+
const history = useHistory();
1421
const { flavor } = useService({
1522
details,
1623
});
@@ -27,12 +34,26 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
2734

2835
const getFormElement: any = (elementName: any, elementSchema: any) => {
2936
if (flavor?.config_schema?.properties[elementName]?.type === 'string') {
37+
const extracted = elementSchema.split(/\./)[0];
38+
const secretName = extracted.replace(/{{|}}|\./g, '').trim();
39+
const filteredSecret = secrets?.filter(
40+
(item) => item.name === secretName,
41+
);
3042
return (
3143
<>
3244
{flavor?.config_schema?.properties[elementName].sensitive ? (
33-
<Box marginTop="lg" style={{ width: '417px' }}>
45+
<Box marginTop="lg" style={{ width: '30vw' }}>
3446
<EditField
3547
disabled
48+
viewSecretDetail={() => {
49+
history.push(
50+
routePaths.secret.configuration(
51+
filteredSecret[0]?.id,
52+
selectedWorkspace,
53+
),
54+
);
55+
}}
56+
filteredSecretId={filteredSecret[0]?.id}
3657
// onKeyDown={(e: any) => onPressEnter(e, 'string', elementName)}
3758
// onChangeText={(e: any) => onPressEnter(e, 'string', elementName)}
3859
label={titleCase(elementName) + ' (Secret)'}
@@ -44,7 +65,7 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
4465
/>
4566
</Box>
4667
) : (
47-
<Box marginTop="lg" style={{ width: '417px' }}>
68+
<Box marginTop="lg" style={{ width: '30vw' }}>
4869
<EditField
4970
disabled
5071
// onKeyDown={(e: any) => onPressEnter(e, 'string', elementName)}
@@ -75,7 +96,7 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
7596
<label htmlFor="key">{titleCase(elementName)}</label>
7697
</Paragraph>
7798
</Box>
78-
<FlexBox marginTop="sm" style={{ width: '417px' }}>
99+
<FlexBox marginTop="sm" style={{ width: '30vw' }}>
79100
<textarea
80101
disabled
81102
className={styles.textArea}
@@ -118,7 +139,7 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
118139
// }
119140
if (flavor?.config_schema?.properties[elementName]?.type === 'object') {
120141
return (
121-
<Box marginTop="lg" style={{ width: '417px' }}>
142+
<Box marginTop="lg" style={{ width: '30vw' }}>
122143
<Paragraph size="body" style={{ color: 'black' }}>
123144
<label htmlFor={elementName}>{titleCase(elementName)}</label>
124145
</Paragraph>
@@ -144,7 +165,10 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
144165
>
145166
<FlexBox.Row>
146167
<Box
147-
style={{ display: 'flex', alignItems: 'center' }}
168+
style={{
169+
display: 'flex',
170+
alignItems: 'center',
171+
}}
148172
marginTop="sm"
149173
>
150174
<div
@@ -228,7 +252,11 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
228252
{Object.entries(elementSchema).map(([key, value], index) => (
229253
<FlexBox.Row>
230254
<Box
231-
style={{ display: 'flex', alignItems: 'center' }}
255+
style={{
256+
display: 'flex',
257+
alignItems: 'center',
258+
width: '29.8vw',
259+
}}
232260
marginTop="sm"
233261
>
234262
<div
@@ -342,7 +370,7 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
342370
&#x27A4;
343371
</div>
344372

345-
<div className="form-group" style={{ width: '390px' }}>
373+
<div className="form-group" style={{ width: '28.3vw' }}>
346374
<EditField
347375
disabled
348376
className={styles.field}
@@ -454,7 +482,7 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
454482
<FlexBox.Column marginTop="xl" fullWidth>
455483
<FlexBox.Row flexDirection="column">
456484
{/* <Container> */}
457-
<Box style={{ width: '417px' }}>
485+
<Box style={{ width: '30vw' }}>
458486
<EditField
459487
disabled
460488
onChangeText={() => console.log('')}

src/ui/layouts/NonEditableConfig/useService.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
import { useDispatch } from 'react-redux';
1+
import { useDispatch, useSelector } from 'react-redux';
22
// import { stackComponentSelectors } from '../../../redux/selectors';
33

44
// import YAML from 'json2yaml';
55
import { useEffect, useState } from 'react';
66
// import { useLocationPath } from '../../hooks';
7-
import { flavorPagesActions, flavorsActions } from '../../../redux/actions';
7+
import {
8+
flavorPagesActions,
9+
flavorsActions,
10+
secretsActions,
11+
} from '../../../redux/actions';
12+
import { workspaceSelectors } from '../../../redux/selectors';
813

914
interface ServiceInterface {
1015
flavor: any;
@@ -13,7 +18,7 @@ interface ServiceInterface {
1318
export const useService = ({ details }: { details: any }): ServiceInterface => {
1419
// const locationPath = useLocationPath();
1520
const [flavor, setFlavor] = useState();
16-
// debugger;
21+
const selectedWorkspace = useSelector(workspaceSelectors.selectedWorkspace);
1722
const dispatch = useDispatch();
1823
useEffect(() => {
1924
setFetching(true);
@@ -28,6 +33,12 @@ export const useService = ({ details }: { details: any }): ServiceInterface => {
2833
onFailure: () => setFetching(false),
2934
}),
3035
);
36+
dispatch(
37+
secretsActions.getMy({
38+
size: 1000,
39+
workspace: selectedWorkspace,
40+
}),
41+
);
3142
// eslint-disable-next-line react-hooks/exhaustive-deps
3243
}, []);
3344

src/ui/layouts/common/layouts/AuthenticatedLayout/AuthenticatedSidebar/SideFooter/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const SideFooter: React.FC = () => {
1212
<Separator.LightNew />
1313
</Box>
1414

15-
<div style={{ marginBottom: '-11px' }}>
15+
<div style={{ marginBottom: '-11px', marginLeft: '-3.5px' }}>
1616
{/* <MenuItemExternal
1717
id="documentation"
1818
Icon={() => <icons.docs color={iconColors.white} size={iconSizes.md} />}

src/ui/layouts/pipelines/Header/index.module.scss

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@
66
box-shadow: 0px 4px 20px -2px rgba(0, 0, 0, 0.03);
77
}
88

9-
.iconStyle {
10-
background-color: #F4F4F4;
9+
.header2 {
10+
padding-bottom: 40px !important;
11+
box-shadow: 0px 4px 20px -2px rgba(0, 0, 0, 0.03) !important;
12+
}
13+
14+
.iconStyle {
15+
background-color: #f4f4f4;
1116
text-align: center;
12-
height: 35px;
17+
height: 35px;
1318
width: 40px;
1419
border-radius: 3px;
1520
cursor: pointer;
16-
}
21+
}
1722

1823
@media (max-width: $md-breakpoint) {
1924
.dynamicHeaderRight {

src/ui/layouts/pipelines/Header/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ const HeaderWithButtons: React.FC<{
5757
renderRight?: () => JSX.Element;
5858
}> = ({ breadcrumbs, renderRight, title }) => (
5959
<FlexBox
60+
marginTop="xl"
6061
alignItems="center"
6162
justifyContent="space-between"
62-
className={styles.header}
63+
className={styles.header2}
6364
>
6465
<FlexBox className="d-none d-md-flex">
6566
<Paragraph

src/ui/layouts/runs/Header/index.module.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
box-shadow: 0px 4px 20px -2px rgba(0, 0, 0, 0.03);
77
}
88

9-
.iconStyle {
10-
background-color: #F4F4F4;
9+
.iconStyle {
10+
background-color: #f4f4f4;
1111
text-align: center;
12-
height: 35px;
12+
height: 35px;
1313
width: 40px;
1414
border-radius: 3px;
1515
cursor: pointer;
16-
}
16+
}
1717

1818
@media (max-width: $md-breakpoint) {
1919
.dynamicHeaderRight {

src/ui/layouts/secrets/RegisterSecret/Register/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export const Register: React.FC<Props> = (state: any) => {
191191
updatedRouteState.state.inputData[
192192
state.state.secretKey
193193
] = `{{ ${secretName}.${inputFields[0].key} }}`;
194-
194+
updatedRouteState.state.secretId = id;
195195
history.push(state.state.pathName, updatedRouteState);
196196
} else if (state?.state?.routeFromEditComponent) {
197197
const updatedRouteState = {
@@ -201,6 +201,7 @@ export const Register: React.FC<Props> = (state: any) => {
201201
state.state.secretKey
202202
] = `{{ ${secretName}.${inputFields[0].key} }}`;
203203

204+
updatedRouteState.state.secretId = id;
204205
history.push(state.state.pathName, updatedRouteState);
205206
} else {
206207
history.push(routePaths.secret.configuration(id, selectedWorkspace));
@@ -259,7 +260,7 @@ export const Register: React.FC<Props> = (state: any) => {
259260
/>
260261
</Box> */}
261262

262-
<Box style={{ width: '329px' }}>
263+
<Box style={{ width: '30vw' }}>
263264
<FormTextField
264265
required={true}
265266
label={'Secret name'}
@@ -269,7 +270,7 @@ export const Register: React.FC<Props> = (state: any) => {
269270
onChange={(val: string) => setSecretName(val)}
270271
/>
271272
</Box>
272-
<Box marginTop="lg" style={{ width: '329px' }}>
273+
<Box marginTop="lg" style={{ width: '30vw' }}>
273274
<FormDropdownField
274275
label={'Scope'}
275276
labelColor="rgba(66, 66, 64, 0.5)"

src/ui/layouts/secrets/SecretDetail/Configuration/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const Configuration: React.FC<{
7474

7575
return (
7676
<FlexBox.Column marginLeft="xl">
77-
<Box marginTop="lg" style={{ width: '417px' }}>
77+
<Box marginTop="lg" style={{ width: '30vw' }}>
7878
<FormTextField
7979
label={'Secret name'}
8080
labelColor="rgba(66, 66, 64, 0.5)"
@@ -89,7 +89,7 @@ export const Configuration: React.FC<{
8989
}}
9090
/>
9191
</Box>
92-
<Box marginTop="lg" style={{ width: '417px' }}>
92+
<Box marginTop="lg" style={{ width: '30vw' }}>
9393
<FormDropdownField
9494
label={'Scope'}
9595
labelColor="rgba(66, 66, 64, 0.5)"
@@ -109,7 +109,7 @@ export const Configuration: React.FC<{
109109
</Box>
110110

111111
<Box marginTop="md">
112-
<SelectorDisabled inputFields={secret.values} width="417px" />
112+
<SelectorDisabled inputFields={secret.values} width="30vw" />
113113
</Box>
114114

115115
<FlexBox

0 commit comments

Comments
 (0)