diff --git a/Dockerfile.local b/Dockerfile.local index bbd162fdb..15019c2ad 100644 --- a/Dockerfile.local +++ b/Dockerfile.local @@ -1,12 +1,4 @@ -ARG BASE_IMAGE - -FROM node:16-alpine as ui-builder -ARG VERSION -WORKDIR /app/velaux -ADD . . -ENV VERSION=${VERSION} -RUN apk add --no-cache git && yarn install && yarn build - +ARG BASE_IMAG # Build the manager binary FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine@sha256:2381c1e5f8350a901597d633b2e517775eeac7a6682be39225a93b22cfd0f8bb as server-builder ARG GOPROXY @@ -41,6 +33,6 @@ WORKDIR /app/velaux ARG TARGETARCH ENV PATH=$PATH:/app/velaux COPY --from=server-builder /workspace/apiserver-${TARGETARCH} /app/velaux/server -COPY --from=ui-builder /app/velaux/public /app/velaux/public +COPY ./public /app/velaux/public CMD ["server"] \ No newline at end of file diff --git a/Makefile b/Makefile index 1d592d65a..5e2198747 100644 --- a/Makefile +++ b/Makefile @@ -134,3 +134,11 @@ check-diff: reviewable run-server: go run ./cmd/server/main.go + +build-ui: + @$(INFO) Building UI + yarn build + +build-test-image: build-ui + @$(INFO) Building image + docker build -t velaux:latest -f Dockerfile.local . diff --git a/packages/velaux-ui/src/layout/LeftMenu/index.tsx b/packages/velaux-ui/src/layout/LeftMenu/index.tsx index f9f078a5f..bf8fe44e0 100644 --- a/packages/velaux-ui/src/layout/LeftMenu/index.tsx +++ b/packages/velaux-ui/src/layout/LeftMenu/index.tsx @@ -38,7 +38,7 @@ const LeftMenuModule = (props: Props) => { menuService.loadPluginMenus().then(() => { const workspace = menuService.loadCurrentWorkspace(); const menus = workspace && props.userInfo ? menuService.loadMenus(workspace, props.userInfo) : []; - if (grafanaConfigs) { + if (grafanaConfigs && workspace?.name === 'extension') { const grafanaLeftMenu: LeftMenu = { catalog: 'Grafana', menus: [] }; grafanaConfigs.map((g) => { if (g.properties && g.properties['endpoint']) { diff --git a/packages/velaux-ui/src/locals/Zh/zh.json b/packages/velaux-ui/src/locals/Zh/zh.json index b54338c01..4cc4b1250 100644 --- a/packages/velaux-ui/src/locals/Zh/zh.json +++ b/packages/velaux-ui/src/locals/Zh/zh.json @@ -511,7 +511,7 @@ "User authentication configuration": "用户认证配置", "User login mode": "用户登录方式", "VelaUX address": "VelaUX 访问地址", - "Update the platform configuration success": "更新平台配置成功", + "Platform settings updated successfully": "平台配置更新成功", "There will auto get the domain for access the VelaUX": "平台访问地址,这里自动获取了当前访问的地址", "Deployed Clusters": "自定义部署集群", "Config Properties": "配置属性", @@ -650,4 +650,4 @@ "Click me to open the dex login page": "点击我打开 Dex 登录页面", "Setting the default projects for the dex login user": "设置 Dex 登录用户的默认项目", "Join Time": "加入时间" -} +} \ No newline at end of file diff --git a/packages/velaux-ui/src/pages/PlatformSetting/index.tsx b/packages/velaux-ui/src/pages/PlatformSetting/index.tsx index f1dd7f129..133c7bde4 100644 --- a/packages/velaux-ui/src/pages/PlatformSetting/index.tsx +++ b/packages/velaux-ui/src/pages/PlatformSetting/index.tsx @@ -65,17 +65,9 @@ class PlatformSetting extends React.Component { } componentDidMount() { + this.loadSystemInfo(); this.listProjects(); this.onGetDexConfig(); - this.field.setValues({ - loginType: this.props.systemInfo.loginType, - enableCollection: this.props.systemInfo.enableCollection, - }); - const items: Array<{ id: string; name: string; roles: string[] }> = []; - this.props.systemInfo.dexUserDefaultProjects?.map((item) => { - items.push({ id: uuid(), ...item }); - }); - this.setState({ defaultProjectItems: items }); } onGetDexConfig = () => { @@ -88,6 +80,23 @@ class PlatformSetting extends React.Component { }); }; + loadSystemInfo = () => { + this.props.dispatch({ + type: 'user/getSystemInfo', + callback: (systemInfo: SystemInfo) => { + this.field.setValues({ + loginType: systemInfo.loginType, + enableCollection: systemInfo.enableCollection, + }); + const items: Array<{ id: string; name: string; roles: string[] }> = []; + systemInfo.dexUserDefaultProjects?.map((item) => { + items.push({ id: uuid(), ...item }); + }); + this.setState({ defaultProjectItems: items }); + }, + }); + }; + onUpdate = () => { this.field.validate((errs: any, values: any) => { if (errs) { @@ -131,8 +140,8 @@ class PlatformSetting extends React.Component { updateSystemInfo(param) .then((res) => { if (res) { - Message.success(i18n.t('Update the platform configuration success')); - this.props.syncPlatformSetting(); + Message.success(i18n.t('Platform settings updated successfully')); + this.loadSystemInfo(); } }) .catch((err) => { @@ -209,7 +218,6 @@ class PlatformSetting extends React.Component { const { businessGuideCode } = this.state; if (businessGuideCode === 12011) { this.dialogGuideDex?.hide(); - this.props.onClose(); this.props.dispatch( routerRedux.push({ pathname: '/configs/dex-connector/config', @@ -217,7 +225,6 @@ class PlatformSetting extends React.Component { ); } else if (businessGuideCode === 14010) { this.dialogGuideUser?.hide(); - this.props.onClose(); this.props.dispatch( routerRedux.push({ pathname: '/users', @@ -293,6 +300,18 @@ class PlatformSetting extends React.Component { const { defaultProjectItems } = this.state; return (
+ +
+ + + + + + + + +
+
{ } /> +
+ +
); diff --git a/pkg/server/domain/service/authentication.go b/pkg/server/domain/service/authentication.go index e960ae6d2..056d01f16 100644 --- a/pkg/server/domain/service/authentication.go +++ b/pkg/server/domain/service/authentication.go @@ -18,6 +18,7 @@ package service import ( "context" + "encoding/json" "errors" "fmt" "net/http" @@ -380,6 +381,26 @@ func restartDex(ctx context.Context, kubeClient client.Client) error { } return err } + for i, comp := range dexApp.Spec.Components { + if comp.Name == keyDex { + var v model.JSONStruct + err := json.Unmarshal(comp.Properties.Raw, &v) + if err != nil { + return err + } + // restart the dex server + if _, ok := v["values"]; ok { + v["values"].(map[string]interface{})["env"] = map[string]string{ + "TIME_STAMP": time.Now().Format(time.RFC3339), + } + } + dexApp.Spec.Components[i].Properties = v.RawExtension() + if err := kubeClient.Update(ctx, dexApp); err != nil { + return err + } + break + } + } oam.SetPublishVersion(dexApp, apiutils.GenerateVersion("addon")) return kubeClient.Update(ctx, dexApp) }