Skip to content

Commit e344081

Browse files
committed
feat: Add environment data route and service for fetching environment variables
1 parent 7bd30ec commit e344081

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
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": "1.6.13-beta-2",
3+
"version": "1.6.13-beta-3",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export const ROUTES = {
139139
CD_TRIGGER_POST: 'app/cd-pipeline/trigger',
140140
DELETE_RESOURCE: 'k8s/resource/delete',
141141
NODE_CAPACITY: 'k8s/capacity/node',
142+
ENVIRONMENT_DATA: 'global/environment-variables',
142143
}
143144

144145
export enum KEY_VALUE {

src/Shared/Services/common.service.ts

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

17-
import { getUrlWithSearchParams, post, ROUTES } from '../../Common'
18-
import { GetPolicyApiUrlProps, GetResourceApiUrlProps } from './types'
17+
import { get, getUrlWithSearchParams, post, ROUTES } from '../../Common'
18+
import { EnvironmentDataValuesDTO, GetPolicyApiUrlProps, GetResourceApiUrlProps } from './types'
1919

2020
export const getResourceApiUrl = <T>({ baseUrl, kind, version, suffix, queryParams }: GetResourceApiUrlProps<T>) =>
2121
getUrlWithSearchParams(`${baseUrl}/${kind}/${version}${suffix ? `/${suffix}` : ''}`, queryParams)
@@ -24,3 +24,5 @@ export const getPolicyApiUrl = <T>({ kind, version, queryParams, suffix }: GetPo
2424
getUrlWithSearchParams(`global/policy/${kind}/${version}${suffix ? `/${suffix}` : ''}`, queryParams)
2525

2626
export const saveCDPipeline = (request) => post(ROUTES.CD_CONFIG, request)
27+
28+
export const getEnvironmentData = () => get<EnvironmentDataValuesDTO>(ROUTES.ENVIRONMENT_DATA)

src/Shared/Services/types.ts

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

17+
import { MainContext } from '@Shared/Providers'
1718
import { getUrlWithSearchParams } from '../../Common'
1819
import { PolicyKindType, ResourceKindType, ResourceVersionType } from '../types'
1920

@@ -47,3 +48,10 @@ export interface GetResourceApiUrlProps<T> extends BaseGetApiUrlProps<T, Resourc
4748

4849
export interface GetPolicyApiUrlProps<T>
4950
extends Omit<BaseGetApiUrlProps<T, PolicyKindType, ResourceVersionType>, 'baseUrl'> {}
51+
52+
// TODO: On merging with pipeline rbac need to move from shared/types.ts to here itself
53+
export interface EnvironmentDataValuesDTO extends Pick<MainContext, 'featureGitOpsFlags'> {
54+
isAirGapEnvironment: boolean
55+
isManifestScanningEnabled: boolean
56+
canOnlyViewPermittedEnvOrgLevel: boolean
57+
}

0 commit comments

Comments
 (0)