@devtron-labs/devtron-fe-common-lib 0.0.41-beta-2 → 0.0.41-beta-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Common/RJSF/common/FieldRow.d.ts +4 -1
- package/dist/Common/RJSF/constants.d.ts +2 -0
- package/dist/Common/Types.d.ts +3 -0
- package/dist/index.js +18 -10
- package/package.json +1 -1
- package/src/Common/Common.service.ts +3 -0
- package/src/Common/RJSF/common/FieldRow.tsx +6 -3
- package/src/Common/RJSF/constants.ts +5 -0
- package/src/Common/RJSF/templates/ArrayFieldTemplate.tsx +2 -1
- package/src/Common/RJSF/templates/ObjectFieldTemplate.tsx +7 -1
- package/src/Common/Types.ts +3 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FieldRowProps } from './types';
|
|
3
|
-
|
|
3
|
+
import { DO_NOT_SHOW_LABEL } from '../constants';
|
|
4
|
+
export declare const FieldRowWithLabel: ({ showLabel, label, required, children, id, shouldAlignCenter, }: Omit<FieldRowProps, "label"> & {
|
|
5
|
+
label: FieldRowProps['label'] | typeof DO_NOT_SHOW_LABEL;
|
|
6
|
+
}) => JSX.Element;
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -231,6 +231,9 @@ export interface CDMaterialType {
|
|
|
231
231
|
imageReleaseTags?: ReleaseTag[];
|
|
232
232
|
artifactStatus?: string;
|
|
233
233
|
filterState: FilterStates;
|
|
234
|
+
registryType?: string;
|
|
235
|
+
imagePath?: string;
|
|
236
|
+
registryName?: string;
|
|
234
237
|
scanToolId?: number;
|
|
235
238
|
appliedFiltersTimestamp?: string;
|
|
236
239
|
appliedFilters?: FilterConditionsListType[];
|
package/dist/index.js
CHANGED
|
@@ -22759,7 +22759,7 @@ var cdMaterialListModal = function (artifacts, offset, artifactId, artifactStatu
|
|
|
22759
22759
|
var startIndex = offset;
|
|
22760
22760
|
var isImageMarked = false;
|
|
22761
22761
|
var materials = artifacts.map(function (material, index) {
|
|
22762
|
-
var _a, _b, _c, _d, _e, _f;
|
|
22762
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
22763
22763
|
var artifactStatusValue = '';
|
|
22764
22764
|
var filterState = (_a = material.filterState) !== null && _a !== void 0 ? _a : exports.FilterStates.ALLOWED;
|
|
22765
22765
|
if (artifactId && artifactStatus && material.id === artifactId) {
|
|
@@ -22825,6 +22825,9 @@ var cdMaterialListModal = function (artifacts, offset, artifactId, artifactStatu
|
|
|
22825
22825
|
appliedFiltersState: (_d = material.appliedFiltersState) !== null && _d !== void 0 ? _d : exports.FilterStates.ALLOWED,
|
|
22826
22826
|
createdTime: (_e = material.createdTime) !== null && _e !== void 0 ? _e : '',
|
|
22827
22827
|
dataSource: (_f = material.data_source) !== null && _f !== void 0 ? _f : '',
|
|
22828
|
+
registryType: (_g = material.registryType) !== null && _g !== void 0 ? _g : '',
|
|
22829
|
+
imagePath: (_h = material.image) !== null && _h !== void 0 ? _h : '',
|
|
22830
|
+
registryName: (_j = material.registryName) !== null && _j !== void 0 ? _j : '',
|
|
22828
22831
|
};
|
|
22829
22832
|
});
|
|
22830
22833
|
return materials;
|
|
@@ -23863,11 +23866,20 @@ function AppStatus(_a) {
|
|
|
23863
23866
|
return hideStatusMessage ? (iconClass || isVirtualEnv ? (jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", arrow: false, placement: "top", content: textContent }, { children: jsxRuntime.jsx("div", __assign({ className: "flex" }, { children: renderIcon() })) }))) : (renderIcon())) : (jsxRuntime.jsxs("div", __assign({ className: "flex left" }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex mr-6" }, { children: renderIcon() })), jsxRuntime.jsx("p", __assign({ "data-testid": "".concat(status, "-app-status"), className: "dc__truncate-text dc__first-letter-capitalize cn-6 m-0" }, { children: textContent }))] })));
|
|
23864
23867
|
}
|
|
23865
23868
|
|
|
23869
|
+
var PLACEHOLDERS = {
|
|
23870
|
+
SELECT: 'Please select an option',
|
|
23871
|
+
INPUT: 'Please enter an input',
|
|
23872
|
+
OBJECT_KEY: 'Please enter a value for the key',
|
|
23873
|
+
};
|
|
23874
|
+
var DEFAULT_FIELD_TITLE = 'Key not available';
|
|
23875
|
+
// Using symbol to ensure uniqueness across the fields
|
|
23876
|
+
var DO_NOT_SHOW_LABEL = Symbol('Do not show label');
|
|
23877
|
+
|
|
23866
23878
|
var FieldRowWithLabel = function (_a) {
|
|
23867
23879
|
var showLabel = _a.showLabel, label = _a.label, required = _a.required, children = _a.children, id = _a.id, _b = _a.shouldAlignCenter, shouldAlignCenter = _b === void 0 ? true : _b;
|
|
23868
23880
|
return (jsxRuntime.jsxs("div", __assign({ className: showLabel
|
|
23869
23881
|
? "display-grid dc__gap-12 rjsf-form-template__field ".concat(shouldAlignCenter ? 'flex-align-center' : '')
|
|
23870
|
-
: '' }, { children: [showLabel && (jsxRuntime.jsx("label", __assign({ className: "cn-7 fs-13 lh-32 fw-4 flexbox mb-0", htmlFor: id }, { children:
|
|
23882
|
+
: '' }, { children: [showLabel && (jsxRuntime.jsx("label", __assign({ className: "cn-7 fs-13 lh-32 fw-4 flexbox mb-0", htmlFor: id }, { children: label !== DO_NOT_SHOW_LABEL && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", __assign({ className: "dc__ellipsis-right" }, { children: label || DEFAULT_FIELD_TITLE })), required && jsxRuntime.jsx("span", __assign({ className: "cr-5" }, { children: "\u00A0*" }))] })) }))), children] })));
|
|
23871
23883
|
};
|
|
23872
23884
|
|
|
23873
23885
|
var ActionButton = function (_a) {
|
|
@@ -23883,7 +23895,7 @@ var ArrayFieldTemplate = function (_a) {
|
|
|
23883
23895
|
return (jsxRuntime.jsx("fieldset", __assign({ className: className, id: idSchema.$id }, { children: items.length ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [items.map(function (_a, index) {
|
|
23884
23896
|
var key = _a.key, itemProps = __rest(_a, ["key"]);
|
|
23885
23897
|
// Show the title as the label for the first field
|
|
23886
|
-
var children = __assign(__assign({}, itemProps.children), { props: __assign(__assign({}, itemProps.children.props), { name: index === 0 ? label :
|
|
23898
|
+
var children = __assign(__assign({}, itemProps.children), { props: __assign(__assign({}, itemProps.children.props), { name: index === 0 ? label : DO_NOT_SHOW_LABEL }) });
|
|
23887
23899
|
return (jsxRuntime.jsx(ArrayFieldItemTemplate, __assign({}, itemProps, { children: children }), key));
|
|
23888
23900
|
}), jsxRuntime.jsx(ActionButton, { canAdd: canAdd, onAddClick: onAddClick, disabled: disabled, readonly: readonly, uiSchema: uiSchema, registry: registry })] })) : (jsxRuntime.jsx(FieldRowWithLabel, __assign({ label: label, required: required, showLabel: true, id: idSchema.$id }, { children: jsxRuntime.jsx(ActionButton, { canAdd: canAdd, onAddClick: onAddClick, disabled: disabled, readonly: readonly, uiSchema: uiSchema, registry: registry }) }))) })));
|
|
23889
23901
|
};
|
|
@@ -23894,12 +23906,6 @@ var ArrayFieldItemTemplate = function (_a) {
|
|
|
23894
23906
|
return (jsxRuntime.jsxs("div", __assign({ className: "display-grid rjsf-form-template__array-field-item flex-align-center dc__gap-8 mb-12" }, { children: [children, hasToolbar && hasRemove && (jsxRuntime.jsx(RemoveButton, { disabled: disabled || readonly, onClick: onDropIndexClick(index), uiSchema: uiSchema, registry: registry }))] })));
|
|
23895
23907
|
};
|
|
23896
23908
|
|
|
23897
|
-
var PLACEHOLDERS = {
|
|
23898
|
-
SELECT: 'Please select an option',
|
|
23899
|
-
INPUT: 'Please enter an input',
|
|
23900
|
-
OBJECT_KEY: 'Please enter a value for the key',
|
|
23901
|
-
};
|
|
23902
|
-
|
|
23903
23909
|
var BaseInputTemplate = RJSF.getDefaultRegistry().templates.BaseInputTemplate;
|
|
23904
23910
|
var BaseInput = function (_a) {
|
|
23905
23911
|
var placeholder = _a.placeholder, props = __rest(_a, ["placeholder"]);
|
|
@@ -23970,7 +23976,9 @@ var ObjectFieldTemplate = function (props) {
|
|
|
23970
23976
|
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, options);
|
|
23971
23977
|
var hasAdditionalProperties = !!schema.additionalProperties;
|
|
23972
23978
|
var showTitle = title && !hasAdditionalProperties;
|
|
23973
|
-
return (jsxRuntime.jsxs("fieldset", __assign({ id: idSchema.$id }, { children: [showTitle && (jsxRuntime.jsx(TitleFieldTemplate, { id: utils.titleId(idSchema), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry })), jsxRuntime.jsx("div", __assign({ className: schema.properties && idSchema.$id !== 'root'
|
|
23979
|
+
return (jsxRuntime.jsxs("fieldset", __assign({ id: idSchema.$id }, { children: [showTitle && (jsxRuntime.jsx(TitleFieldTemplate, { id: utils.titleId(idSchema), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry })), jsxRuntime.jsx("div", __assign({ className: schema.properties && !hasAdditionalProperties && idSchema.$id !== 'root'
|
|
23980
|
+
? 'dc__border-left pl-5'
|
|
23981
|
+
: '' }, { children: jsxRuntime.jsx(Field, __assign({}, props)) }))] })));
|
|
23974
23982
|
};
|
|
23975
23983
|
|
|
23976
23984
|
var TitleField = function (_a) {
|
package/package.json
CHANGED
|
@@ -162,6 +162,9 @@ const cdMaterialListModal = (artifacts: any[], offset: number, artifactId?: numb
|
|
|
162
162
|
appliedFiltersState: material.appliedFiltersState ?? FilterStates.ALLOWED,
|
|
163
163
|
createdTime: material.createdTime ?? '',
|
|
164
164
|
dataSource: material.data_source ?? '',
|
|
165
|
+
registryType: material.registryType ?? '',
|
|
166
|
+
imagePath: material.image ?? '',
|
|
167
|
+
registryName: material.registryName ?? '',
|
|
165
168
|
}
|
|
166
169
|
})
|
|
167
170
|
return materials
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { FieldRowProps } from './types'
|
|
3
|
+
import { DEFAULT_FIELD_TITLE, DO_NOT_SHOW_LABEL } from '../constants'
|
|
3
4
|
|
|
4
5
|
export const FieldRowWithLabel = ({
|
|
5
6
|
showLabel,
|
|
@@ -8,7 +9,9 @@ export const FieldRowWithLabel = ({
|
|
|
8
9
|
children,
|
|
9
10
|
id,
|
|
10
11
|
shouldAlignCenter = true,
|
|
11
|
-
}: FieldRowProps
|
|
12
|
+
}: Omit<FieldRowProps, 'label'> & {
|
|
13
|
+
label: FieldRowProps['label'] | typeof DO_NOT_SHOW_LABEL
|
|
14
|
+
}) => (
|
|
12
15
|
<div
|
|
13
16
|
className={
|
|
14
17
|
showLabel
|
|
@@ -19,9 +22,9 @@ export const FieldRowWithLabel = ({
|
|
|
19
22
|
{showLabel && (
|
|
20
23
|
<label className="cn-7 fs-13 lh-32 fw-4 flexbox mb-0" htmlFor={id}>
|
|
21
24
|
{/* The check is added here intentionally for proper layout for array type field */}
|
|
22
|
-
{
|
|
25
|
+
{label !== DO_NOT_SHOW_LABEL && (
|
|
23
26
|
<>
|
|
24
|
-
<span className="dc__ellipsis-right">{label}</span>
|
|
27
|
+
<span className="dc__ellipsis-right">{label || DEFAULT_FIELD_TITLE}</span>
|
|
25
28
|
{required && <span className="cr-5"> *</span>}
|
|
26
29
|
</>
|
|
27
30
|
)}
|
|
@@ -3,3 +3,8 @@ export const PLACEHOLDERS = {
|
|
|
3
3
|
INPUT: 'Please enter an input',
|
|
4
4
|
OBJECT_KEY: 'Please enter a value for the key',
|
|
5
5
|
}
|
|
6
|
+
|
|
7
|
+
export const DEFAULT_FIELD_TITLE = 'Key not available'
|
|
8
|
+
|
|
9
|
+
// Using symbol to ensure uniqueness across the fields
|
|
10
|
+
export const DO_NOT_SHOW_LABEL = Symbol('Do not show label')
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { getTemplate, getUiOptions, ArrayFieldTemplateProps, ArrayFieldTemplateItemType } from '@rjsf/utils'
|
|
3
3
|
import { FieldRowWithLabel } from '../common/FieldRow'
|
|
4
|
+
import { DO_NOT_SHOW_LABEL } from '../constants'
|
|
4
5
|
|
|
5
6
|
const ActionButton = ({ canAdd, onAddClick, disabled, readonly, uiSchema, registry }) => {
|
|
6
7
|
const {
|
|
@@ -42,7 +43,7 @@ export const ArrayFieldTemplate = ({
|
|
|
42
43
|
...itemProps.children,
|
|
43
44
|
props: {
|
|
44
45
|
...itemProps.children.props,
|
|
45
|
-
name: index === 0 ? label :
|
|
46
|
+
name: index === 0 ? label : DO_NOT_SHOW_LABEL,
|
|
46
47
|
},
|
|
47
48
|
}
|
|
48
49
|
return (
|
|
@@ -91,7 +91,13 @@ export const ObjectFieldTemplate = (props: ObjectFieldTemplateProps) => {
|
|
|
91
91
|
/>
|
|
92
92
|
)}
|
|
93
93
|
{/* Not adding the border and padding for non-objects and root schema */}
|
|
94
|
-
<div
|
|
94
|
+
<div
|
|
95
|
+
className={
|
|
96
|
+
schema.properties && !hasAdditionalProperties && idSchema.$id !== 'root'
|
|
97
|
+
? 'dc__border-left pl-5'
|
|
98
|
+
: ''
|
|
99
|
+
}
|
|
100
|
+
>
|
|
95
101
|
<Field {...props} />
|
|
96
102
|
</div>
|
|
97
103
|
</fieldset>
|
package/src/Common/Types.ts
CHANGED
|
@@ -256,6 +256,9 @@ export interface CDMaterialType {
|
|
|
256
256
|
imageReleaseTags?: ReleaseTag[]
|
|
257
257
|
artifactStatus?: string
|
|
258
258
|
filterState: FilterStates
|
|
259
|
+
registryType?: string;
|
|
260
|
+
imagePath?: string
|
|
261
|
+
registryName?: string
|
|
259
262
|
// Not even coming from API but required in CDMaterials for Security which makes its own api call but stores data in CDMaterials
|
|
260
263
|
scanToolId?: number
|
|
261
264
|
appliedFiltersTimestamp?: string
|