Skip to content

Commit

Permalink
fix: Use a better way to determine whether we have a built-in dashboa…
Browse files Browse the repository at this point in the history
…rd (#394)
  • Loading branch information
CH3CHO authored Jan 2, 2025
1 parent a783f45 commit c14e12f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
3 changes: 3 additions & 0 deletions backend/console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

<properties>
<nodejs.version>16.19.0</nodejs.version>

<app.build.version>2.0.0</app.build.version>
<app.build.dev>true</app.build.dev>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.higress.console.constant.UserConfigKey;
import com.alibaba.higress.console.controller.dto.DashboardInfo;
import com.alibaba.higress.console.controller.dto.DashboardType;
import com.alibaba.higress.console.controller.dto.Response;
import com.alibaba.higress.console.controller.dto.SystemInfo;
import com.alibaba.higress.console.controller.dto.SystemInitRequest;
Expand Down Expand Up @@ -81,9 +79,7 @@ public void setSystemService(SystemService systemService) {
@PostConstruct
public void syncSystemState() {
configService.setConfig(UserConfigKey.SYSTEM_INITIALIZED, sessionService.isAdminInitialized());
DashboardInfo dashboardInfo = dashboardService.getDashboardInfo(DashboardType.MAIN);
configService.setConfig(UserConfigKey.DASHBOARD_BUILTIN,
dashboardInfo != null && Boolean.TRUE.equals(dashboardInfo.getBuiltIn()));
configService.setConfig(UserConfigKey.DASHBOARD_BUILTIN, dashboardService.isBuiltIn());
}

@PostMapping("/init")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
*/
public interface DashboardService {

boolean isBuiltIn();

@Deprecated
DashboardInfo getDashboardInfo();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ public void initialize() {
}
}

public boolean isBuiltIn() {
return StringUtils.isNoneBlank(apiBaseUrl, promDatasourceUrl, lokiDatasourceUrl);
}

@Override
public DashboardInfo getDashboardInfo() {
return getDashboardInfo(DashboardType.MAIN);
Expand Down Expand Up @@ -377,10 +381,6 @@ private DashboardInfo getConfiguredDashboardInfo(DashboardType type) {
return new DashboardInfo(false, null, url);
}

private boolean isBuiltIn() {
return StringUtils.isNoneBlank(apiBaseUrl, promDatasourceUrl, lokiDatasourceUrl);
}

private String buildConfigData(String dashboardConfiguration, String datasourceUid) {
return dashboardConfiguration.replace(DATASOURCE_UID_PLACEHOLDER, datasourceUid);
}
Expand Down
3 changes: 0 additions & 3 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@
<plugin.inputEncoding>${project.build.sourceEncoding}</plugin.inputEncoding>
<plugin.outputEncoding>${project.build.sourceEncoding}</plugin.outputEncoding>

<app.build.version>1.2.1</app.build.version>
<app.build.dev>true</app.build.dev>

<delombok.output>${project.basedir}/target/delombok-sources</delombok.output>
</properties>

Expand Down

0 comments on commit c14e12f

Please sign in to comment.