Skip to content

Commit 47128b8

Browse files
Merge pull request #230 from devtron-labs/feat/spog-1
feat: add network status interface URL
2 parents d99d7f7 + a768488 commit 47128b8

File tree

11 files changed

+73
-19
lines changed

11 files changed

+73
-19
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Assets/Img/delete-medium.svg

Lines changed: 9 additions & 13 deletions
Loading

src/Common/CodeEditor/CodeEditor.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
126126
},
127127
})
128128

129+
monaco.editor.defineTheme(CodeEditorThemesKeys.networkStatusInterface, {
130+
base: 'vs-dark',
131+
inherit: true,
132+
rules: [
133+
// @ts-ignore
134+
{ background: '#1A1A1A' },
135+
],
136+
colors: {
137+
'editor.background': '#1A1A1A',
138+
},
139+
})
140+
129141
monaco.editor.defineTheme(CodeEditorThemesKeys.deleteDraft, {
130142
base: 'vs',
131143
inherit: true,

src/Common/CodeEditor/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export enum CodeEditorThemesKeys {
8484
deleteDraft = 'delete-draft',
8585
unpublished = 'unpublished',
8686
vs = 'vs',
87+
networkStatusInterface = 'network-status-interface',
8788
}
8889

8990
export interface CodeEditorInitialValueType {

src/Common/Constants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export const URLS = {
6262
GLOBAL_CONFIG_DOCKER: '/global-config/docker',
6363
DEPLOYMENT_HISTORY_CONFIGURATIONS: '/configuration',
6464
GLOBAL_CONFIG_SCOPED_VARIABLES: '/global-config/scoped-variables',
65+
NETWORK_STATUS_INTERFACE: '/network-status-interface',
6566
}
6667

6768
export const ROUTES = {
@@ -96,6 +97,9 @@ export const ROUTES = {
9697
CONFIG_CD_PIPELINE: 'config/cd-pipeline',
9798
MODULE_CONFIGURED: 'module/config',
9899
RESOURCE_HISTORY_DEPLOYMENT: 'resource/history/deployment',
100+
ATTRIBUTES: 'attributes',
101+
ATTRIBUTES_CREATE: 'attributes/create',
102+
ATTRIBUTES_UPDATE: 'attributes/update',
99103
APP_LIST_MIN: 'app/min',
100104
CLUSTER_LIST_MIN: 'cluster/autocomplete',
101105
PLUGIN_GLOBAL_LIST_DETAIL_V2: 'plugin/global/list/detail/v2',

src/Common/SearchBar/SearchBar.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const SearchBar = ({
125125
}
126126

127127
return (
128-
<div className={containerClassName}>
128+
<div className={`search-bar-container ${containerClassName || ''}`}>
129129
<div
130130
className={`search-bar ${noBackgroundAndBorder ? 'dc__no-border dc__no-background dc__hover-n50' : 'bc-n50 en-2 dc__hover-border-n300'} focus-within-border-b5 dc__block w-100 min-w-200 dc__position-rel br-4 bw-1 ${getSearchBarHeightFromSize(size)}`}
131131
>

src/Common/SortableTableHeaderCell/SortableTableHeaderCell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ const SortableTableHeaderCell = ({
5252
if (isSorted) {
5353
return (
5454
<SortArrowDown
55-
className={`icon-dim-12 mw-12 scn-7 dc__transition--transform ${sortOrder === SortingOrder.DESC ? 'dc__flip-180' : ''}`}
55+
className={`icon-dim-12 mw-12 scn-7 dc__no-shrink dc__transition--transform ${sortOrder === SortingOrder.DESC ? 'dc__flip-180' : ''}`}
5656
/>
5757
)
5858
}
5959

60-
return <SortIcon className="icon-dim-12 mw-12 scn-7" />
60+
return <SortIcon className="icon-dim-12 mw-12 scn-7 dc__no-shrink" />
6161
}
6262

6363
return (

src/Shared/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,14 @@ export interface scrollableInterface {
637637
autoBottomScroll: boolean
638638
}
639639

640+
export enum URLProtocolType {
641+
HTTP = 'http:',
642+
HTTPS = 'https:',
643+
SSH = 'ssh:',
644+
SMTP = 'smtp:',
645+
S3 = 's3:',
646+
}
647+
640648
export type BaseFilterQueryParams<T> = {
641649
/**
642650
* Offset for the list result

src/Shared/validations.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { URLProtocolType } from './types'
18+
1719
export interface ValidationResponseType {
1820
isValid: boolean
1921
message?: string
@@ -197,6 +199,35 @@ export const validateURL = (url: string, allowBase64Url: boolean = true): Valida
197199
}
198200
}
199201

202+
export const validateProtocols = (
203+
url: string,
204+
protocols: URLProtocolType[],
205+
isRequired?: boolean,
206+
): ValidationResponseType => {
207+
if (isRequired && !url) {
208+
return {
209+
isValid: false,
210+
message: 'This field is required',
211+
}
212+
}
213+
214+
try {
215+
const { protocol } = new URL(url)
216+
if (protocol && protocols.includes(protocol as URLProtocolType)) {
217+
return {
218+
isValid: true,
219+
}
220+
}
221+
} catch (error) {
222+
// Do nothing
223+
}
224+
225+
return {
226+
isValid: false,
227+
message: `Invalid URL/protocol. Supported protocols are: ${protocols.join(', ')}`,
228+
}
229+
}
230+
200231
export const validateIfImageExist = (url: string): Promise<ValidationResponseType> =>
201232
new Promise<ValidationResponseType>((resolve) => {
202233
const img = new Image()

0 commit comments

Comments
 (0)