@devtron-labs/devtron-fe-common-lib 0.0.37 → 0.0.39
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/AppStatus/AppStatus.d.ts +3 -0
- package/dist/Common/AppStatus/constants.d.ts +51 -0
- package/dist/Common/AppStatus/index.d.ts +1 -0
- package/dist/Common/AppStatus/types.d.ts +12 -0
- package/dist/Common/AppStatus/utils.d.ts +1 -0
- package/dist/Common/Helper.d.ts +1 -0
- package/dist/Common/Hooks/UseClickOutside/UseClickOutside.d.ts +1 -0
- package/dist/Common/Hooks/index.d.ts +1 -0
- package/dist/Common/index.d.ts +1 -0
- package/dist/index.js +122 -2
- package/package.json +1 -1
- package/src/Common/AppStatus/AppStatus.tsx +64 -0
- package/src/Common/AppStatus/constants.ts +53 -0
- package/src/Common/AppStatus/index.ts +1 -0
- package/src/Common/AppStatus/types.ts +12 -0
- package/src/Common/AppStatus/utils.ts +14 -0
- package/src/Common/Helper.tsx +8 -0
- package/src/Common/Hooks/UseClickOutside/UseClickOutside.tsx +15 -0
- package/src/Common/Hooks/index.ts +1 -0
- package/src/Common/Security/scanVulnerabilities.css +2 -0
- package/src/Common/index.ts +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare const StatusConstants: {
|
|
2
|
+
NOT_DEPLOYED: {
|
|
3
|
+
noSpaceLower: string;
|
|
4
|
+
normalCase: string;
|
|
5
|
+
lowerCase: string;
|
|
6
|
+
};
|
|
7
|
+
APP_STATUS: {
|
|
8
|
+
noSpaceLower: string;
|
|
9
|
+
normalText: string;
|
|
10
|
+
};
|
|
11
|
+
PROJECT: {
|
|
12
|
+
pluralLower: string;
|
|
13
|
+
lowerCase: string;
|
|
14
|
+
};
|
|
15
|
+
CLUSTER: {
|
|
16
|
+
pluralLower: string;
|
|
17
|
+
lowerCase: string;
|
|
18
|
+
};
|
|
19
|
+
NAMESPACE: {
|
|
20
|
+
pluralLower: string;
|
|
21
|
+
lowerCase: string;
|
|
22
|
+
};
|
|
23
|
+
ENVIRONMENT: {
|
|
24
|
+
pluralLower: string;
|
|
25
|
+
lowerCase: string;
|
|
26
|
+
};
|
|
27
|
+
NOT_AVILABLE: {
|
|
28
|
+
normalCase: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare enum TIMELINE_STATUS {
|
|
32
|
+
DEPLOYMENT_INITIATED = "DEPLOYMENT_INITIATED",
|
|
33
|
+
GIT_COMMIT = "GIT_COMMIT",
|
|
34
|
+
GIT_COMMIT_FAILED = "GIT_COMMIT_FAILED",
|
|
35
|
+
KUBECTL_APPLY = "KUBECTL_APPLY",
|
|
36
|
+
KUBECTL_APPLY_STARTED = "KUBECTL_APPLY_STARTED",
|
|
37
|
+
KUBECTL_APPLY_SYNCED = "KUBECTL_APPLY_SYNCED",
|
|
38
|
+
HEALTHY = "HEALTHY",
|
|
39
|
+
APP_HEALTH = "APP_HEALTH",
|
|
40
|
+
DEPLOYMENT_FAILED = "FAILED",
|
|
41
|
+
FETCH_TIMED_OUT = "TIMED_OUT",
|
|
42
|
+
UNABLE_TO_FETCH_STATUS = "UNABLE_TO_FETCH_STATUS",
|
|
43
|
+
DEGRADED = "DEGRADED",
|
|
44
|
+
DEPLOYMENT_SUPERSEDED = "DEPLOYMENT_SUPERSEDED",
|
|
45
|
+
ABORTED = "ABORTED",
|
|
46
|
+
INPROGRESS = "INPROGRESS",
|
|
47
|
+
HELM_PACKAGE_GENERATED = "HELM_PACKAGE_GENERATED",
|
|
48
|
+
HELM_MANIFEST_PUSHED_TO_HELM_REPO = "HELM_MANIFEST_PUSHED_TO_HELM_REPO",
|
|
49
|
+
HELM_MANIFEST_PUSHED_TO_HELM_REPO_FAILED = "HELM_MANIFEST_PUSHED_TO_HELM_REPO_FAILED"
|
|
50
|
+
}
|
|
51
|
+
export declare const YET_TO_RUN = "Yet to run";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AppStatus } from './AppStatus';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface AppStatusType {
|
|
2
|
+
appStatus: string;
|
|
3
|
+
isDeploymentStatus?: boolean;
|
|
4
|
+
isJobView?: boolean;
|
|
5
|
+
isVirtualEnv?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Hide the status message if true and show status message in tooltip
|
|
8
|
+
*
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
hideStatusMessage?: boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const triggerStatus: (triggerDetailStatus: string) => string;
|
package/dist/Common/Helper.d.ts
CHANGED
|
@@ -51,4 +51,5 @@ export declare const closeOnEscKeyPressed: (e: any, actionClose: () => void) =>
|
|
|
51
51
|
*/
|
|
52
52
|
export declare function copyToClipboard(str: any, callback?: typeof noop): void;
|
|
53
53
|
export declare function useAsync<T>(func: (...rest: any[]) => Promise<T>, dependencyArray?: any[], shouldRun?: boolean, options?: AsyncOptions): [boolean, T, any | null, () => void, React.Dispatch<any>, any[]];
|
|
54
|
+
export declare const processDeployedTime: (lastDeployed: any, isArgoInstalled: any) => string;
|
|
54
55
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useClickOutside: (ref: any, callback: () => void) => void;
|
package/dist/Common/index.d.ts
CHANGED
|
@@ -39,3 +39,4 @@ export { default as DebouncedSearch } from './DebouncedSearch/DebouncedSearch';
|
|
|
39
39
|
export { default as Grid } from './Grid/Grid';
|
|
40
40
|
export { default as ClipboardButton } from './ClipboardButton/ClipboardButton';
|
|
41
41
|
export * from './Hooks';
|
|
42
|
+
export { AppStatus } from './AppStatus';
|
package/dist/index.js
CHANGED
|
@@ -10220,7 +10220,15 @@ function useAsync(func, dependencyArray, shouldRun, options) {
|
|
|
10220
10220
|
}
|
|
10221
10221
|
};
|
|
10222
10222
|
return [state.loading, state.result, state.error, reload, setResult, state.dependencies];
|
|
10223
|
-
}
|
|
10223
|
+
}
|
|
10224
|
+
var processDeployedTime = function (lastDeployed, isArgoInstalled) {
|
|
10225
|
+
if (lastDeployed) {
|
|
10226
|
+
return handleUTCTime(lastDeployed, true);
|
|
10227
|
+
}
|
|
10228
|
+
else {
|
|
10229
|
+
return isArgoInstalled ? '' : 'Not deployed';
|
|
10230
|
+
}
|
|
10231
|
+
};
|
|
10224
10232
|
|
|
10225
10233
|
function Progressing(_a) {
|
|
10226
10234
|
var pageLoader = _a.pageLoader, size = _a.size, theme = _a.theme, styles = _a.styles, fillColor = _a.fillColor;
|
|
@@ -22837,7 +22845,7 @@ var Toggle = function (_a) {
|
|
|
22837
22845
|
return (jsxRuntime.jsxs("label", __assign({}, props, { className: "".concat(rootClassName, " toggle__switch ").concat(disabled ? 'disabled' : ''), style: (_b = {}, _b['--color'] = color, _b) }, { children: [jsxRuntime.jsx("input", { type: "checkbox", checked: !!active, onChange: handleClick, className: "toggle__input" }), jsxRuntime.jsx("span", __assign({ className: "toggle__slider ".concat(Icon ? 'with-icon br-4 dc__border' : 'round'), "data-testid": dataTestId }, { children: Icon && jsxRuntime.jsx(Icon, { className: "icon-dim-20 br-4 p-2 ".concat(iconClass) }) }))] })));
|
|
22838
22846
|
};
|
|
22839
22847
|
|
|
22840
|
-
var css_248z$1 = ".modal-body--scan-details {\n position: fixed;\n top: 0;\n right: 0;\n background: var(--N000);\n width: 800px;\n}\n\n.security-tab__table {\n width: 100%;\n}\n\n.security-tab__table-header {\n border-bottom: solid 1px var(--N200);\n}\n\n.security-cell-header {\n font-size: 12px;\n font-weight: 600;\n line-height: 1.5;\n letter-spacing: normal;\n text-transform: uppercase;\n color: var(--N500);\n}\n\n.dc__security-tab__table-row {\n font-size: 13px;\n font-weight: normal;\n line-height: 1.54;\n letter-spacing: normal;\n color: var(--N900);\n box-shadow: inset 0 -1px 0 0 #f5f5f5;\n}\n\n.security-tab__cell-cve,\n.security-tab__cell-severity,\n.security-tab__cell-package,\n.security-tab__cell-current-ver,\n.security-tab__cell-fixed-ver,\n.security-tab__cell-policy {\n padding: 10px;\n}\n\n.security-tab__cell-cve {\n padding-left: 0px;\n text-align: left;\n width: 20%;\n}\n\n.security-tab__cell-policy {\n padding-right: 0px;\n}\n\n.security-tab__cell-policy--whitelist,\n.security-tab__cell-policy--whitelisted {\n color: var(--G500);\n text-transform: capitalize;\n}\n\n.security-tab__cell-policy--block {\n color: var(--R500);\n text-transform: capitalize;\n}\n\n.scanned-object__results {\n margin: 0 20px;\n}";
|
|
22848
|
+
var css_248z$1 = ".modal-body--scan-details {\n position: fixed;\n top: 0;\n right: 0;\n background: var(--N000);\n width: 800px;\n}\n\n.security-tab__table {\n width: 100%;\n}\n\n.security-tab__table-header {\n border-bottom: solid 1px var(--N200);\n}\n\n.security-cell-header {\n font-size: 12px;\n font-weight: 600;\n line-height: 1.5;\n letter-spacing: normal;\n text-transform: uppercase;\n color: var(--N500);\n}\n\n.dc__security-tab__table-row {\n font-size: 13px;\n font-weight: normal;\n line-height: 1.54;\n letter-spacing: normal;\n color: var(--N900);\n box-shadow: inset 0 -1px 0 0 #f5f5f5;\n}\n\n.security-tab__cell-cve,\n.security-tab__cell-severity,\n.security-tab__cell-package,\n.security-tab__cell-current-ver,\n.security-tab__cell-fixed-ver,\n.security-tab__cell-policy {\n padding: 10px;\n max-width: 120px;\n word-wrap: break-word;\n}\n\n.security-tab__cell-cve {\n padding-left: 0px;\n text-align: left;\n width: 20%;\n}\n\n.security-tab__cell-policy {\n padding-right: 0px;\n}\n\n.security-tab__cell-policy--whitelist,\n.security-tab__cell-policy--whitelisted {\n color: var(--G500);\n text-transform: capitalize;\n}\n\n.security-tab__cell-policy--block {\n color: var(--R500);\n text-transform: capitalize;\n}\n\n.scanned-object__results {\n margin: 0 20px;\n}";
|
|
22841
22849
|
styleInject(css_248z$1);
|
|
22842
22850
|
|
|
22843
22851
|
function ScanVulnerabilitiesTable(_a) {
|
|
@@ -23608,6 +23616,116 @@ var useSuperAdmin = function () {
|
|
|
23608
23616
|
return { isSuperAdmin: isSuperAdmin };
|
|
23609
23617
|
};
|
|
23610
23618
|
|
|
23619
|
+
var useClickOutside = function (ref, callback) {
|
|
23620
|
+
React.useEffect(function () {
|
|
23621
|
+
var handleClickOutside = function (e) {
|
|
23622
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && !ref.current.contains(e.target)) {
|
|
23623
|
+
callback();
|
|
23624
|
+
}
|
|
23625
|
+
};
|
|
23626
|
+
document.addEventListener('click', handleClickOutside);
|
|
23627
|
+
return function () {
|
|
23628
|
+
document.removeEventListener('click', handleClickOutside);
|
|
23629
|
+
};
|
|
23630
|
+
}, [ref, callback]);
|
|
23631
|
+
};
|
|
23632
|
+
|
|
23633
|
+
var StatusConstants = {
|
|
23634
|
+
NOT_DEPLOYED: {
|
|
23635
|
+
noSpaceLower: 'notdeployed',
|
|
23636
|
+
normalCase: 'Not deployed',
|
|
23637
|
+
lowerCase: 'not-deployed',
|
|
23638
|
+
},
|
|
23639
|
+
APP_STATUS: {
|
|
23640
|
+
noSpaceLower: 'appStatus',
|
|
23641
|
+
normalText: 'App status',
|
|
23642
|
+
},
|
|
23643
|
+
PROJECT: {
|
|
23644
|
+
pluralLower: 'projects',
|
|
23645
|
+
lowerCase: 'project',
|
|
23646
|
+
},
|
|
23647
|
+
CLUSTER: {
|
|
23648
|
+
pluralLower: 'clusters',
|
|
23649
|
+
lowerCase: 'cluster',
|
|
23650
|
+
},
|
|
23651
|
+
NAMESPACE: {
|
|
23652
|
+
pluralLower: 'namespaces',
|
|
23653
|
+
lowerCase: 'namespace',
|
|
23654
|
+
},
|
|
23655
|
+
ENVIRONMENT: {
|
|
23656
|
+
pluralLower: 'environments',
|
|
23657
|
+
lowerCase: 'environment',
|
|
23658
|
+
},
|
|
23659
|
+
NOT_AVILABLE: {
|
|
23660
|
+
normalCase: 'Not available',
|
|
23661
|
+
},
|
|
23662
|
+
};
|
|
23663
|
+
var TIMELINE_STATUS;
|
|
23664
|
+
(function (TIMELINE_STATUS) {
|
|
23665
|
+
TIMELINE_STATUS["DEPLOYMENT_INITIATED"] = "DEPLOYMENT_INITIATED";
|
|
23666
|
+
TIMELINE_STATUS["GIT_COMMIT"] = "GIT_COMMIT";
|
|
23667
|
+
TIMELINE_STATUS["GIT_COMMIT_FAILED"] = "GIT_COMMIT_FAILED";
|
|
23668
|
+
TIMELINE_STATUS["KUBECTL_APPLY"] = "KUBECTL_APPLY";
|
|
23669
|
+
TIMELINE_STATUS["KUBECTL_APPLY_STARTED"] = "KUBECTL_APPLY_STARTED";
|
|
23670
|
+
TIMELINE_STATUS["KUBECTL_APPLY_SYNCED"] = "KUBECTL_APPLY_SYNCED";
|
|
23671
|
+
TIMELINE_STATUS["HEALTHY"] = "HEALTHY";
|
|
23672
|
+
TIMELINE_STATUS["APP_HEALTH"] = "APP_HEALTH";
|
|
23673
|
+
TIMELINE_STATUS["DEPLOYMENT_FAILED"] = "FAILED";
|
|
23674
|
+
TIMELINE_STATUS["FETCH_TIMED_OUT"] = "TIMED_OUT";
|
|
23675
|
+
TIMELINE_STATUS["UNABLE_TO_FETCH_STATUS"] = "UNABLE_TO_FETCH_STATUS";
|
|
23676
|
+
TIMELINE_STATUS["DEGRADED"] = "DEGRADED";
|
|
23677
|
+
TIMELINE_STATUS["DEPLOYMENT_SUPERSEDED"] = "DEPLOYMENT_SUPERSEDED";
|
|
23678
|
+
TIMELINE_STATUS["ABORTED"] = "ABORTED";
|
|
23679
|
+
TIMELINE_STATUS["INPROGRESS"] = "INPROGRESS";
|
|
23680
|
+
TIMELINE_STATUS["HELM_PACKAGE_GENERATED"] = "HELM_PACKAGE_GENERATED";
|
|
23681
|
+
TIMELINE_STATUS["HELM_MANIFEST_PUSHED_TO_HELM_REPO"] = "HELM_MANIFEST_PUSHED_TO_HELM_REPO";
|
|
23682
|
+
TIMELINE_STATUS["HELM_MANIFEST_PUSHED_TO_HELM_REPO_FAILED"] = "HELM_MANIFEST_PUSHED_TO_HELM_REPO_FAILED";
|
|
23683
|
+
})(TIMELINE_STATUS || (TIMELINE_STATUS = {}));
|
|
23684
|
+
var YET_TO_RUN = 'Yet to run';
|
|
23685
|
+
|
|
23686
|
+
var triggerStatus = function (triggerDetailStatus) {
|
|
23687
|
+
var triggerStatus = triggerDetailStatus === null || triggerDetailStatus === void 0 ? void 0 : triggerDetailStatus.toUpperCase();
|
|
23688
|
+
if (triggerStatus === TIMELINE_STATUS.ABORTED || triggerStatus === TIMELINE_STATUS.DEGRADED) {
|
|
23689
|
+
return 'Failed';
|
|
23690
|
+
}
|
|
23691
|
+
else if (triggerStatus === TIMELINE_STATUS.HEALTHY) {
|
|
23692
|
+
return 'Succeeded';
|
|
23693
|
+
}
|
|
23694
|
+
else if (triggerStatus === TIMELINE_STATUS.INPROGRESS) {
|
|
23695
|
+
return 'Inprogress';
|
|
23696
|
+
}
|
|
23697
|
+
else {
|
|
23698
|
+
return triggerDetailStatus;
|
|
23699
|
+
}
|
|
23700
|
+
};
|
|
23701
|
+
|
|
23702
|
+
function AppStatus(_a) {
|
|
23703
|
+
var appStatus = _a.appStatus, _b = _a.isDeploymentStatus, isDeploymentStatus = _b === void 0 ? false : _b, _c = _a.isJobView, isJobView = _c === void 0 ? false : _c, isVirtualEnv = _a.isVirtualEnv, _d = _a.hideStatusMessage, hideStatusMessage = _d === void 0 ? false : _d;
|
|
23704
|
+
var status = appStatus;
|
|
23705
|
+
if (isDeploymentStatus) {
|
|
23706
|
+
status = triggerStatus(appStatus);
|
|
23707
|
+
}
|
|
23708
|
+
var appStatusLowerCase = status === null || status === void 0 ? void 0 : status.toLowerCase();
|
|
23709
|
+
var isNotDeployed = appStatusLowerCase === StatusConstants.NOT_DEPLOYED.noSpaceLower;
|
|
23710
|
+
var iconClass = isNotDeployed ? StatusConstants.NOT_DEPLOYED.lowerCase : appStatusLowerCase;
|
|
23711
|
+
var statusMessage = status || (isVirtualEnv ? StatusConstants.NOT_AVILABLE.normalCase : '-');
|
|
23712
|
+
var notDeployed = isJobView ? YET_TO_RUN : StatusConstants.NOT_DEPLOYED.normalCase;
|
|
23713
|
+
var textContent = isNotDeployed ? notDeployed : statusMessage;
|
|
23714
|
+
var renderIcon = function () {
|
|
23715
|
+
if (iconClass) {
|
|
23716
|
+
return jsxRuntime.jsx("span", { className: "dc__app-summary__icon icon-dim-16 ".concat(iconClass, " ").concat(iconClass, "--node") });
|
|
23717
|
+
}
|
|
23718
|
+
else if (isVirtualEnv) {
|
|
23719
|
+
return (jsxRuntime.jsx("span", { className: "dc__app-summary__icon icon-dim-16 ".concat(StatusConstants.NOT_DEPLOYED.lowerCase, " ").concat(StatusConstants.NOT_DEPLOYED.lowerCase, "--node") }));
|
|
23720
|
+
}
|
|
23721
|
+
else {
|
|
23722
|
+
return (jsxRuntime.jsx(Tippy, __assign({ className: "default-tt w-200", arrow: false, placement: "top", content: "To fetch app status for GitOps based deployments open the app detail page" }, { children: jsxRuntime.jsx(SvgIcInfoOutlined, { className: "icon-dim-16 fcn-6" }) })));
|
|
23723
|
+
}
|
|
23724
|
+
};
|
|
23725
|
+
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 }))] })));
|
|
23726
|
+
}
|
|
23727
|
+
|
|
23728
|
+
exports.AppStatus = AppStatus;
|
|
23611
23729
|
exports.BreadCrumb = BreadCrumb;
|
|
23612
23730
|
exports.BreadcrumbStore = Store;
|
|
23613
23731
|
exports.BuildStageVariable = BuildStageVariable;
|
|
@@ -23697,6 +23815,7 @@ exports.multiSelectStyles = multiSelectStyles;
|
|
|
23697
23815
|
exports.noop = noop$1;
|
|
23698
23816
|
exports.not = not;
|
|
23699
23817
|
exports.post = post;
|
|
23818
|
+
exports.processDeployedTime = processDeployedTime;
|
|
23700
23819
|
exports.put = put;
|
|
23701
23820
|
exports.setImageTags = setImageTags;
|
|
23702
23821
|
exports.showError = showError;
|
|
@@ -23706,6 +23825,7 @@ exports.toastAccessDenied = toastAccessDenied;
|
|
|
23706
23825
|
exports.trash = trash;
|
|
23707
23826
|
exports.useAsync = useAsync;
|
|
23708
23827
|
exports.useBreadcrumb = useBreadcrumb;
|
|
23828
|
+
exports.useClickOutside = useClickOutside;
|
|
23709
23829
|
exports.useEffectAfterMount = useEffectAfterMount;
|
|
23710
23830
|
exports.useForm = useForm;
|
|
23711
23831
|
exports.useSearchString = useSearchString;
|
package/package.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import Tippy from '@tippyjs/react'
|
|
2
|
+
import { ReactComponent as InfoIcon } from '../../Assets/Icon/ic-info-outlined.svg'
|
|
3
|
+
import { StatusConstants, YET_TO_RUN } from './constants'
|
|
4
|
+
import { AppStatusType } from './types'
|
|
5
|
+
import { triggerStatus } from './utils'
|
|
6
|
+
|
|
7
|
+
export default function AppStatus({
|
|
8
|
+
appStatus,
|
|
9
|
+
isDeploymentStatus = false,
|
|
10
|
+
isJobView = false,
|
|
11
|
+
isVirtualEnv,
|
|
12
|
+
hideStatusMessage = false,
|
|
13
|
+
}: AppStatusType) {
|
|
14
|
+
let status = appStatus
|
|
15
|
+
if (isDeploymentStatus) {
|
|
16
|
+
status = triggerStatus(appStatus)
|
|
17
|
+
}
|
|
18
|
+
const appStatusLowerCase = status?.toLowerCase()
|
|
19
|
+
const isNotDeployed = appStatusLowerCase === StatusConstants.NOT_DEPLOYED.noSpaceLower
|
|
20
|
+
const iconClass = isNotDeployed ? StatusConstants.NOT_DEPLOYED.lowerCase : appStatusLowerCase
|
|
21
|
+
const statusMessage = status || (isVirtualEnv ? StatusConstants.NOT_AVILABLE.normalCase : '-')
|
|
22
|
+
const notDeployed = isJobView ? YET_TO_RUN : StatusConstants.NOT_DEPLOYED.normalCase
|
|
23
|
+
const textContent = isNotDeployed ? notDeployed : statusMessage
|
|
24
|
+
|
|
25
|
+
const renderIcon = () => {
|
|
26
|
+
if (iconClass) {
|
|
27
|
+
return <span className={`dc__app-summary__icon icon-dim-16 ${iconClass} ${iconClass}--node`} />
|
|
28
|
+
} else if (isVirtualEnv) {
|
|
29
|
+
return (
|
|
30
|
+
<span
|
|
31
|
+
className={`dc__app-summary__icon icon-dim-16 ${StatusConstants.NOT_DEPLOYED.lowerCase} ${StatusConstants.NOT_DEPLOYED.lowerCase}--node`}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
} else {
|
|
35
|
+
return (
|
|
36
|
+
<Tippy
|
|
37
|
+
className="default-tt w-200"
|
|
38
|
+
arrow={false}
|
|
39
|
+
placement="top"
|
|
40
|
+
content="To fetch app status for GitOps based deployments open the app detail page"
|
|
41
|
+
>
|
|
42
|
+
<InfoIcon className="icon-dim-16 fcn-6" />
|
|
43
|
+
</Tippy>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return hideStatusMessage ? (
|
|
49
|
+
iconClass || isVirtualEnv ? (
|
|
50
|
+
<Tippy className="default-tt" arrow={false} placement="top" content={textContent}>
|
|
51
|
+
<div className="flex">{renderIcon()}</div>
|
|
52
|
+
</Tippy>
|
|
53
|
+
) : (
|
|
54
|
+
renderIcon()
|
|
55
|
+
)
|
|
56
|
+
) : (
|
|
57
|
+
<div className="flex left">
|
|
58
|
+
<div className="flex mr-6">{renderIcon()}</div>
|
|
59
|
+
<p data-testid={`${status}-app-status`} className="dc__truncate-text dc__first-letter-capitalize cn-6 m-0">
|
|
60
|
+
{textContent}
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const StatusConstants = {
|
|
2
|
+
NOT_DEPLOYED: {
|
|
3
|
+
noSpaceLower: 'notdeployed',
|
|
4
|
+
normalCase: 'Not deployed',
|
|
5
|
+
lowerCase: 'not-deployed',
|
|
6
|
+
},
|
|
7
|
+
APP_STATUS: {
|
|
8
|
+
noSpaceLower: 'appStatus',
|
|
9
|
+
normalText: 'App status',
|
|
10
|
+
},
|
|
11
|
+
PROJECT: {
|
|
12
|
+
pluralLower: 'projects',
|
|
13
|
+
lowerCase: 'project',
|
|
14
|
+
},
|
|
15
|
+
CLUSTER: {
|
|
16
|
+
pluralLower: 'clusters',
|
|
17
|
+
lowerCase: 'cluster',
|
|
18
|
+
},
|
|
19
|
+
NAMESPACE: {
|
|
20
|
+
pluralLower: 'namespaces',
|
|
21
|
+
lowerCase: 'namespace',
|
|
22
|
+
},
|
|
23
|
+
ENVIRONMENT: {
|
|
24
|
+
pluralLower: 'environments',
|
|
25
|
+
lowerCase: 'environment',
|
|
26
|
+
},
|
|
27
|
+
NOT_AVILABLE: {
|
|
28
|
+
normalCase: 'Not available',
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export enum TIMELINE_STATUS {
|
|
33
|
+
DEPLOYMENT_INITIATED = 'DEPLOYMENT_INITIATED',
|
|
34
|
+
GIT_COMMIT = 'GIT_COMMIT',
|
|
35
|
+
GIT_COMMIT_FAILED = 'GIT_COMMIT_FAILED',
|
|
36
|
+
KUBECTL_APPLY = 'KUBECTL_APPLY',
|
|
37
|
+
KUBECTL_APPLY_STARTED = 'KUBECTL_APPLY_STARTED',
|
|
38
|
+
KUBECTL_APPLY_SYNCED = 'KUBECTL_APPLY_SYNCED',
|
|
39
|
+
HEALTHY = 'HEALTHY',
|
|
40
|
+
APP_HEALTH = 'APP_HEALTH',
|
|
41
|
+
DEPLOYMENT_FAILED = 'FAILED',
|
|
42
|
+
FETCH_TIMED_OUT = 'TIMED_OUT',
|
|
43
|
+
UNABLE_TO_FETCH_STATUS = 'UNABLE_TO_FETCH_STATUS',
|
|
44
|
+
DEGRADED = 'DEGRADED',
|
|
45
|
+
DEPLOYMENT_SUPERSEDED = 'DEPLOYMENT_SUPERSEDED',
|
|
46
|
+
ABORTED = 'ABORTED',
|
|
47
|
+
INPROGRESS = 'INPROGRESS',
|
|
48
|
+
HELM_PACKAGE_GENERATED = 'HELM_PACKAGE_GENERATED',
|
|
49
|
+
HELM_MANIFEST_PUSHED_TO_HELM_REPO = 'HELM_MANIFEST_PUSHED_TO_HELM_REPO',
|
|
50
|
+
HELM_MANIFEST_PUSHED_TO_HELM_REPO_FAILED = 'HELM_MANIFEST_PUSHED_TO_HELM_REPO_FAILED',
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const YET_TO_RUN = 'Yet to run'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AppStatus } from './AppStatus'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface AppStatusType {
|
|
2
|
+
appStatus: string
|
|
3
|
+
isDeploymentStatus?: boolean
|
|
4
|
+
isJobView?: boolean
|
|
5
|
+
isVirtualEnv?: boolean
|
|
6
|
+
/**
|
|
7
|
+
* Hide the status message if true and show status message in tooltip
|
|
8
|
+
*
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
hideStatusMessage?: boolean
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TIMELINE_STATUS } from './constants'
|
|
2
|
+
|
|
3
|
+
export const triggerStatus = (triggerDetailStatus: string): string => {
|
|
4
|
+
let triggerStatus = triggerDetailStatus?.toUpperCase()
|
|
5
|
+
if (triggerStatus === TIMELINE_STATUS.ABORTED || triggerStatus === TIMELINE_STATUS.DEGRADED) {
|
|
6
|
+
return 'Failed'
|
|
7
|
+
} else if (triggerStatus === TIMELINE_STATUS.HEALTHY) {
|
|
8
|
+
return 'Succeeded'
|
|
9
|
+
} else if (triggerStatus === TIMELINE_STATUS.INPROGRESS) {
|
|
10
|
+
return 'Inprogress'
|
|
11
|
+
} else {
|
|
12
|
+
return triggerDetailStatus
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/Common/Helper.tsx
CHANGED
|
@@ -487,3 +487,11 @@ export function useAsync<T>(
|
|
|
487
487
|
|
|
488
488
|
return [state.loading, state.result, state.error, reload, setResult, state.dependencies]
|
|
489
489
|
}
|
|
490
|
+
|
|
491
|
+
export const processDeployedTime = (lastDeployed, isArgoInstalled) => {
|
|
492
|
+
if (lastDeployed) {
|
|
493
|
+
return handleUTCTime(lastDeployed, true)
|
|
494
|
+
} else {
|
|
495
|
+
return isArgoInstalled ? '' : 'Not deployed'
|
|
496
|
+
}
|
|
497
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
|
|
3
|
+
export const useClickOutside = (ref: any, callback: () => void) => {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
const handleClickOutside = (e: any) => {
|
|
6
|
+
if (ref?.current && !ref.current.contains(e.target)) {
|
|
7
|
+
callback()
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
document.addEventListener('click', handleClickOutside)
|
|
11
|
+
return () => {
|
|
12
|
+
document.removeEventListener('click', handleClickOutside)
|
|
13
|
+
}
|
|
14
|
+
}, [ref, callback])
|
|
15
|
+
}
|
package/src/Common/index.ts
CHANGED
|
@@ -39,3 +39,4 @@ export { default as DebouncedSearch } from './DebouncedSearch/DebouncedSearch'
|
|
|
39
39
|
export { default as Grid } from './Grid/Grid'
|
|
40
40
|
export { default as ClipboardButton } from './ClipboardButton/ClipboardButton'
|
|
41
41
|
export * from './Hooks'
|
|
42
|
+
export { AppStatus } from './AppStatus'
|