@devtron-labs/devtron-fe-common-lib 0.0.9-beta-6 → 0.0.9-beta-8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.9-beta-6",
3
+ "version": "0.0.9-beta-8",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -33,6 +33,7 @@
33
33
  "@svgr/rollup": "6.5.1",
34
34
  "@rollup/plugin-url": "8.0.1",
35
35
  "@rollup/plugin-commonjs": "24.0.1",
36
+ "moment": "^2.29.4",
36
37
  "typescript": "^4.9.4",
37
38
  "react-toastify": "^8.2.0",
38
39
  "@tippyjs/react": "^4.2.0",
@@ -5,6 +5,7 @@ import * as Sentry from '@sentry/browser'
5
5
  import { toastAccessDenied } from './ToastBody'
6
6
  import { ERROR_EMPTY_SCREEN, TOKEN_COOKIE_NAME } from './Constants'
7
7
  import { ReactComponent as FormError } from '../Assets/Icon/ic-warning.svg'
8
+ import moment from 'moment';
8
9
 
9
10
  toast.configure({
10
11
  autoClose: 3000,
@@ -331,3 +332,17 @@ export function CustomInput({
331
332
  </div>
332
333
  )
333
334
  }
335
+
336
+ export function handleUTCTime(ts: string, isRelativeTime = false) {
337
+ let timestamp = "";
338
+ try {
339
+ if (ts && ts.length) {
340
+ let date = moment(ts);
341
+ if (isRelativeTime) timestamp = date.fromNow();
342
+ else timestamp = date.format("ddd DD MMM YYYY HH:mm:ss");
343
+ }
344
+ } catch (error) {
345
+ console.error("Error Parsing Date:", ts);
346
+ }
347
+ return timestamp;
348
+ }
@@ -0,0 +1,51 @@
1
+ import { VariableType } from "./CIPipeline.Types"
2
+
3
+ export enum ApplyPolicyToStage {
4
+ PRE_CI = 'PRE_CI',
5
+ POST_CI = 'POST_CI',
6
+ PRE_OR_POST_CI = 'PRE_OR_POST_CI',
7
+ }
8
+
9
+ export enum PluginRequiredStage {
10
+ PRE_CI = 'preBuildStage',
11
+ POST_CI = 'postBuildStage',
12
+ PRE_OR_POST_CI = 'PRE_OR_POST_CI',
13
+ }
14
+
15
+ export interface DefinitionSourceType {
16
+ projectName: string
17
+ isDueToProductionEnvironment: boolean
18
+ isDueToLinkedPipeline: boolean
19
+ policyName: string
20
+ appName?: string
21
+ clusterName?: string
22
+ environmentName?: string
23
+ branchNames?: string[]
24
+ ciPipelineName?: string
25
+ }
26
+ export interface MandatoryPluginDetailType {
27
+ id: number
28
+ name: string
29
+ description?: string
30
+ requiredIn: PluginRequiredStage
31
+ applied?: boolean
32
+ inputVariables?: VariableType[]
33
+ outputVariables?: VariableType[]
34
+ definitionSources?: DefinitionSourceType[]
35
+ }
36
+ export interface MandatoryPluginDataType {
37
+ pluginData: MandatoryPluginDetailType[]
38
+ isValidPre: boolean
39
+ isValidPost: boolean
40
+ }
41
+
42
+ export enum ConsequenceAction {
43
+ BLOCK = 'BLOCK',
44
+ ALLOW_UNTIL_TIME = 'ALLOW_UNTIL_TIME',
45
+ ALLOW_FOREVER = 'ALLOW_FOREVER',
46
+ }
47
+
48
+ export interface ConsequenceType {
49
+ action: ConsequenceAction
50
+ metadataField: string
51
+ }
@@ -2,6 +2,7 @@ import React, { useRef, useState } from 'react'
2
2
  import Tippy from '@tippyjs/react'
3
3
  import { ReactComponent as CloseIcon } from '../Assets/Icon/ic-cross.svg'
4
4
  import { ReactComponent as QuestionFilled } from '../Assets/Icon/ic-help.svg'
5
+ import { ReactComponent as Question } from '../Assets/Icon/ic-help-outline.svg'
5
6
  import 'tippy.js/animations/shift-toward-subtle.css'
6
7
  import { TippyCustomizedProps, TippyTheme } from './Types'
7
8
  import { not } from './Helper'
@@ -82,7 +83,7 @@ export function TippyCustomized(props: TippyCustomizedProps) {
82
83
  {heading && <span className={`fs-14 fw-6 lh-20 ${showCloseButton ? 'mr-6' : ''}`}>{heading}</span>}
83
84
  {headingInfo && (
84
85
  <div className="icon-dim-20 cursor" onClick={toggleHeadingInfo}>
85
- <QuestionFilled className="icon-dim-20" />
86
+ <Question className="icon-dim-20" />
86
87
  </div>
87
88
  )}
88
89
  {showCloseButton && (
@@ -1,6 +1,5 @@
1
1
  import { ReactNode, CSSProperties } from 'react'
2
2
  import { Placement } from 'tippy.js'
3
- import { VariableType } from './CIPipeline.Types'
4
3
  export interface ResponseType {
5
4
  code: number
6
5
  status: string
@@ -326,43 +325,4 @@ export interface CDMaterialResponseType {
326
325
  materials: any[]
327
326
  userApprovalConfig: UserApprovalConfigType
328
327
  requestedUserId: number
329
- }
330
-
331
- export enum ApplyPolicyToStage {
332
- PRE_CI = 'PRE_CI',
333
- POST_CI = 'POST_CI',
334
- PRE_OR_POST_CI = 'PRE_OR_POST_CI',
335
- }
336
-
337
- export enum PluginRequiredStage {
338
- PRE_CI = 'preBuildStage',
339
- POST_CI = 'postBuildStage',
340
- PRE_OR_POST_CI = 'PRE_OR_POST_CI',
341
- }
342
-
343
- export interface DefinitionSourceType {
344
- projectName: string
345
- isDueToProductionEnvironment: boolean
346
- isDueToLinkedPipeline: boolean
347
- policyName: string
348
- appName?: string
349
- clusterName?: string
350
- environmentName?: string
351
- branchName?: string
352
- ciPipelineName?: string
353
- }
354
- export interface MandatoryPluginDetailType {
355
- id: number
356
- name: string
357
- description?: string
358
- requiredIn: PluginRequiredStage
359
- applied?: boolean
360
- inputVariables?: VariableType[]
361
- outputVariables?: VariableType[]
362
- definitionSources?: DefinitionSourceType[]
363
- }
364
- export interface MandatoryPluginDataType {
365
- pluginData: MandatoryPluginDetailType[]
366
- isValidPre: boolean
367
- isValidPost: boolean
368
- }
328
+ }
@@ -30,4 +30,5 @@ export { default as Toggle } from './Toggle/Toggle'
30
30
  export { default as ScanVulnerabilitiesTable } from './Security/ScanVulnerabilitiesTable'
31
31
  export { default as StyledRadioGroup } from './RadioGroup/RadioGroup'
32
32
  export * from './CIPipeline.Types'
33
+ export * from './Policy.Types'
33
34
  export { default as DeleteComponent } from './DeleteComponentModal/DeleteComponent'