-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support custom main menus in monitor template (#1703)
Signed-off-by: tomsun28 <[email protected]> Co-authored-by: Logic <[email protected]>
- Loading branch information
Showing
22 changed files
with
350 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
manager/src/main/java/org/dromara/hertzbeat/manager/pojo/dto/TemplateConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.dromara.hertzbeat.manager.pojo.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* App Template Config | ||
*/ | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class TemplateConfig { | ||
|
||
/** | ||
* app template config map | ||
* key: app name | ||
* value: app template config | ||
*/ | ||
private Map<String, AppTemplate> apps; | ||
|
||
|
||
/** | ||
* app template | ||
*/ | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class AppTemplate { | ||
|
||
/** | ||
* Is hide this app in main menus layout, only for app type, default true | ||
*/ | ||
private boolean hide = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...r/src/main/java/org/dromara/hertzbeat/manager/service/impl/TemplateConfigServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.dromara.hertzbeat.manager.service.impl; | ||
|
||
import com.fasterxml.jackson.core.type.TypeReference; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.dromara.hertzbeat.manager.dao.GeneralConfigDao; | ||
import org.dromara.hertzbeat.manager.pojo.dto.TemplateConfig; | ||
import org.dromara.hertzbeat.manager.service.AppService; | ||
import org.springframework.stereotype.Service; | ||
|
||
import jakarta.annotation.Resource; | ||
import java.lang.reflect.Type; | ||
|
||
/** | ||
* template config service impl | ||
*/ | ||
@Service | ||
public class TemplateConfigServiceImpl extends AbstractGeneralConfigServiceImpl<TemplateConfig> { | ||
|
||
@Resource | ||
private AppService appService; | ||
|
||
|
||
/** | ||
* 构造方法,传入GeneralConfigDao、ObjectMapper和type。 | ||
* | ||
* <p>Constructor, passing in GeneralConfigDao, ObjectMapper and type.</p> | ||
* | ||
* @param generalConfigDao 配置Dao对象 | ||
* @param objectMapper JSON工具类对象 | ||
*/ | ||
protected TemplateConfigServiceImpl(GeneralConfigDao generalConfigDao, ObjectMapper objectMapper) { | ||
super(generalConfigDao, objectMapper); | ||
} | ||
|
||
@Override | ||
public void handler(TemplateConfig templateConfig) { | ||
if (templateConfig != null) { | ||
appService.updateCustomTemplateConfig(templateConfig); | ||
} | ||
} | ||
|
||
@Override | ||
public String type() { | ||
return "template"; | ||
} | ||
|
||
|
||
@Override | ||
protected TypeReference<TemplateConfig> getTypeReference() { | ||
return new TypeReference<>() { | ||
@Override | ||
public Type getType() { | ||
return TemplateConfig.class; | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.