mirror of
https://github.com/harness/drone.git
synced 2025-05-10 15:32:51 +08:00
feat: [CDE-129]: added flag gitspace_enabled (#2214)
* feat: [CDE-129]: fixed lint * feat: [CDE-129]: fixed lint * feat: [CDE-129]: updated flag gitspace_enabled * feat: [CDE-129]: updated webpack * feat: [CDE-129]: updated webpack * feat: [CDE-129]: added flag gitspace_enabled
This commit is contained in:
parent
6f7d1079d9
commit
0a5ed06f02
@ -26,6 +26,7 @@ type ConfigOutput struct {
|
|||||||
UserSignupAllowed bool `json:"user_signup_allowed"`
|
UserSignupAllowed bool `json:"user_signup_allowed"`
|
||||||
PublicResourceCreationEnabled bool `json:"public_resource_creation_enabled"`
|
PublicResourceCreationEnabled bool `json:"public_resource_creation_enabled"`
|
||||||
SSHEnabled bool `json:"ssh_enabled"`
|
SSHEnabled bool `json:"ssh_enabled"`
|
||||||
|
GitspaceEnabled bool `json:"gitspace_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleGetConfig returns an http.HandlerFunc that processes an http.Request
|
// HandleGetConfig returns an http.HandlerFunc that processes an http.Request
|
||||||
@ -44,6 +45,7 @@ func HandleGetConfig(config *types.Config, sysCtrl *system.Controller) http.Hand
|
|||||||
SSHEnabled: config.SSH.Enable,
|
SSHEnabled: config.SSH.Enable,
|
||||||
UserSignupAllowed: userSignupAllowed,
|
UserSignupAllowed: userSignupAllowed,
|
||||||
PublicResourceCreationEnabled: config.PublicResourceCreationEnabled,
|
PublicResourceCreationEnabled: config.PublicResourceCreationEnabled,
|
||||||
|
GitspaceEnabled: config.Gitspace.Enable,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -399,6 +399,9 @@ type Config struct {
|
|||||||
DefaultBaseImage string `envconfig:"GITNESS_GITSPACE_DEFAULT_BASE_IMAGE" default:"mcr.microsoft.com/devcontainers/base:dev-ubuntu-24.04"` //nolint:lll
|
DefaultBaseImage string `envconfig:"GITNESS_GITSPACE_DEFAULT_BASE_IMAGE" default:"mcr.microsoft.com/devcontainers/base:dev-ubuntu-24.04"` //nolint:lll
|
||||||
// DefaultBindMountTargetPath is the target for bind mount in the Gitspace container.
|
// DefaultBindMountTargetPath is the target for bind mount in the Gitspace container.
|
||||||
DefaultBindMountTargetPath string `envconfig:"GITNESS_GITSPACE_DEFAULT_BIND_MOUNT_TARGET_PATH" default:"/gitspace"` //nolint:lll
|
DefaultBindMountTargetPath string `envconfig:"GITNESS_GITSPACE_DEFAULT_BIND_MOUNT_TARGET_PATH" default:"/gitspace"` //nolint:lll
|
||||||
|
|
||||||
|
Enable bool `envconfig:"GITNESS_GITSPACE_ENABLE" default:"false"`
|
||||||
|
|
||||||
// DefaultBindMountTargetPath is the source for bind mount in the Gitspace container.
|
// DefaultBindMountTargetPath is the source for bind mount in the Gitspace container.
|
||||||
// Sub-directories will be created from this eg <DefaultBindMountSourceBasePath>/gitspace/space1/space2/config1
|
// Sub-directories will be created from this eg <DefaultBindMountSourceBasePath>/gitspace/space1/space2/config1
|
||||||
// If left blank, it will be set to $HOME/.gitness
|
// If left blank, it will be set to $HOME/.gitness
|
||||||
|
@ -30,7 +30,6 @@ const moduleFederationConfig = require('./moduleFederation.config')
|
|||||||
const moduleFederationConfigCDE = require('./cde/moduleFederation.config')
|
const moduleFederationConfigCDE = require('./cde/moduleFederation.config')
|
||||||
const CONTEXT = process.cwd()
|
const CONTEXT = process.cwd()
|
||||||
const DEV = process.env.NODE_ENV === 'development'
|
const DEV = process.env.NODE_ENV === 'development'
|
||||||
const ENABLE_GITSPACE = process.env.ENABLE_GITSPACE === 'true'
|
|
||||||
|
|
||||||
const getModuleFields = () => {
|
const getModuleFields = () => {
|
||||||
if (process.env.MODULE === 'cde') {
|
if (process.env.MODULE === 'cde') {
|
||||||
@ -224,8 +223,7 @@ module.exports = {
|
|||||||
moduleFederationPlugin,
|
moduleFederationPlugin,
|
||||||
new DefinePlugin({
|
new DefinePlugin({
|
||||||
'process.env': '{}', // required for @blueprintjs/core
|
'process.env': '{}', // required for @blueprintjs/core
|
||||||
__DEV__: DEV,
|
__DEV__: DEV
|
||||||
__ENABLE_GITSPACE__: ENABLE_GITSPACE
|
|
||||||
}),
|
}),
|
||||||
new GenerateStringTypesPlugin(),
|
new GenerateStringTypesPlugin(),
|
||||||
new RetryChunkLoadPlugin({
|
new RetryChunkLoadPlugin({
|
||||||
|
@ -34,13 +34,12 @@ const API_URL = process.env.API_URL ?? 'http://localhost:3000'
|
|||||||
const HOST = 'localhost'
|
const HOST = 'localhost'
|
||||||
const PORT = getPortByModule()
|
const PORT = getPortByModule()
|
||||||
const STANDALONE = process.env.STANDALONE === 'true'
|
const STANDALONE = process.env.STANDALONE === 'true'
|
||||||
const ENABLE_GITSPACE = process.env.ENABLE_GITSPACE === 'true'
|
|
||||||
const CONTEXT = process.cwd()
|
const CONTEXT = process.cwd()
|
||||||
const prodConfig = require('./webpack.prod')
|
const prodConfig = require('./webpack.prod')
|
||||||
|
|
||||||
console.info(`Starting development build... http://${HOST}:${PORT}`)
|
console.info(`Starting development build... http://${HOST}:${PORT}`)
|
||||||
console.info('Environment variables:')
|
console.info('Environment variables:')
|
||||||
console.table({ STANDALONE, ENABLE_GITSPACE, HOST, PORT, API_URL })
|
console.table({ STANDALONE, HOST, PORT, API_URL })
|
||||||
|
|
||||||
const devConfig = {
|
const devConfig = {
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
"webpack:cde": "NODE_ENV=development MODULE=cde webpack serve --config config/webpack.dev.js",
|
"webpack:cde": "NODE_ENV=development MODULE=cde webpack serve --config config/webpack.dev.js",
|
||||||
"typed-scss": "typed-scss-modules src --watch",
|
"typed-scss": "typed-scss-modules src --watch",
|
||||||
"dev": "run-p webpack typed-scss",
|
"dev": "run-p webpack typed-scss",
|
||||||
"dev:cde": "MODULE=cde ENABLE_GITSPACE=true run-p webpack:cde typed-scss",
|
"dev:cde": "MODULE=cde run-p webpack:cde typed-scss",
|
||||||
"test": "jest src --silent",
|
"test": "jest src --silent",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"build": "rm -rf dist && webpack --config config/webpack.prod.js",
|
"build": "rm -rf dist && webpack --config config/webpack.prod.js",
|
||||||
"build:cde": "rm -rf dist && MODULE=cde ENABLE_GITSPACE=true webpack --config config/webpack.prod.js",
|
"build:cde": "rm -rf dist && MODULE=cde webpack --config config/webpack.prod.js",
|
||||||
"lint": "eslint --fix --rulesdir ./scripts/eslint-rules --ext .ts --ext .tsx src",
|
"lint": "eslint --rulesdir ./scripts/eslint-rules --ext .ts --ext .tsx src",
|
||||||
"prettier": "prettier --check \"./src/**/*.{ts,tsx,css,scss}\"",
|
"prettier": "prettier --check \"./src/**/*.{ts,tsx,css,scss}\"",
|
||||||
"coverage": "npm test --coverage",
|
"coverage": "npm test --coverage",
|
||||||
"typecheck": "tsc",
|
"typecheck": "tsc",
|
||||||
|
3
web/src/global.d.ts
vendored
3
web/src/global.d.ts
vendored
@ -17,9 +17,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
declare const __DEV__: boolean
|
declare const __DEV__: boolean
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
declare const __ENABLE_GITSPACE__: boolean
|
|
||||||
|
|
||||||
declare module '*.png' {
|
declare module '*.png' {
|
||||||
const value: string
|
const value: string
|
||||||
export default value
|
export default value
|
||||||
|
@ -19,6 +19,7 @@ import { Container, Layout } from '@harnessio/uicore'
|
|||||||
import { Render } from 'react-jsx-match'
|
import { Render } from 'react-jsx-match'
|
||||||
import { useHistory, useRouteMatch } from 'react-router-dom'
|
import { useHistory, useRouteMatch } from 'react-router-dom'
|
||||||
import { FingerprintLockCircle, BookmarkBook, UserSquare, Settings } from 'iconoir-react'
|
import { FingerprintLockCircle, BookmarkBook, UserSquare, Settings } from 'iconoir-react'
|
||||||
|
import { useGet } from 'restful-react'
|
||||||
import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata'
|
import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata'
|
||||||
import { useStrings } from 'framework/strings'
|
import { useStrings } from 'framework/strings'
|
||||||
import type { SpaceSpaceOutput } from 'services/code'
|
import type { SpaceSpaceOutput } from 'services/code'
|
||||||
@ -38,6 +39,8 @@ export const DefaultMenu: React.FC = () => {
|
|||||||
const routeMatch = useRouteMatch()
|
const routeMatch = useRouteMatch()
|
||||||
const isCommitSelected = useMemo(() => routeMatch.path === '/:space*/:repoName/commit/:commitRef*', [routeMatch])
|
const isCommitSelected = useMemo(() => routeMatch.path === '/:space*/:repoName/commit/:commitRef*', [routeMatch])
|
||||||
|
|
||||||
|
const { data: systemConfig } = useGet({ path: 'api/v1/system/config' })
|
||||||
|
|
||||||
const isFilesSelected = useMemo(
|
const isFilesSelected = useMemo(
|
||||||
() =>
|
() =>
|
||||||
!isCommitSelected &&
|
!isCommitSelected &&
|
||||||
@ -172,7 +175,7 @@ export const DefaultMenu: React.FC = () => {
|
|||||||
</Container>
|
</Container>
|
||||||
</Render>
|
</Render>
|
||||||
|
|
||||||
{__ENABLE_GITSPACE__ && (
|
{systemConfig?.gitspace_enabled && (
|
||||||
<Render when={selectedSpace}>
|
<Render when={selectedSpace}>
|
||||||
<NavMenuItem
|
<NavMenuItem
|
||||||
className=""
|
className=""
|
||||||
|
Loading…
Reference in New Issue
Block a user