Skip to content

Commit

Permalink
Fixed the front-end
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxianhjy committed Sep 11, 2024
1 parent a90c2ac commit cafde02
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.ctrip.framework.apollo.portal.component.config.PortalConfig;
import com.ctrip.framework.apollo.portal.entity.vo.ItemInfo;
import com.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.portal.service.GlobalSearchValueService;
import com.ctrip.framework.apollo.portal.service.GlobalSearchService;
import com.google.gson.Gson;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
Expand All @@ -40,20 +40,20 @@


@RestController
public class GlobalSearchValueController {
public class GlobalSearchController {
private final PortalSettings portalSettings;
private final GlobalSearchValueService globalSearchValueService;
private final GlobalSearchService globalSearchService;
private final PortalConfig portalConfig;

public GlobalSearchValueController(final PortalSettings portalSettings, final GlobalSearchValueService globalSearchValueService, final PortalConfig portalConfig) {
public GlobalSearchController(final PortalSettings portalSettings, final GlobalSearchService globalSearchService, final PortalConfig portalConfig) {
this.portalSettings = portalSettings;
this.globalSearchValueService = globalSearchValueService;
this.globalSearchService = globalSearchService;
this.portalConfig = portalConfig;
}

@PreAuthorize(value = "@permissionValidator.isSuperAdmin()")
@GetMapping("/global-search/item-info/by-key-or-value")
public ResponseEntity<?> get_ItemInfo_BySearch(@RequestParam(value = "key", required = false, defaultValue = "") String key,
public ResponseEntity<?> getItemInfoBySearch(@RequestParam(value = "key", required = false, defaultValue = "") String key,
@RequestParam(value = "value", required = false , defaultValue = "") String value) {

if(key.isEmpty() && value.isEmpty()) {
Expand All @@ -76,7 +76,7 @@ public ResponseEntity<?> get_ItemInfo_BySearch(@RequestParam(value = "key", requ
List<String> envBeyondLimit = new ArrayList<>();
AtomicBoolean hasMoreData = new AtomicBoolean(false);
activeEnvs.forEach(env -> {
PageDTO<ItemInfo> perEnvItemInfos = globalSearchValueService.get_PerEnv_ItemInfo_BySearch(env, key, value,0, portalConfig.getPerEnvSearchMaxResults());
PageDTO<ItemInfo> perEnvItemInfos = globalSearchService.getPerEnvItemInfoBySearch(env, key, value,0, portalConfig.getPerEnvSearchMaxResults());
if (!perEnvItemInfos.hasContent()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
import java.util.List;

@Service
public class GlobalSearchValueService {
public class GlobalSearchService {

private static final Logger LOGGER = LoggerFactory.getLogger(GlobalSearchValueService.class);
private static final Logger LOGGER = LoggerFactory.getLogger(GlobalSearchService.class);
private final AdminServiceAPI.ItemAPI itemAPI;

public GlobalSearchValueService(AdminServiceAPI.ItemAPI itemAPI) {
public GlobalSearchService(AdminServiceAPI.ItemAPI itemAPI) {
this.itemAPI = itemAPI;
}

public PageDTO<ItemInfo> get_PerEnv_ItemInfo_BySearch(Env env, String key, String value, int page, int size) {
public PageDTO<ItemInfo> getPerEnvItemInfoBySearch(Env env, String key, String value, int page, int size) {
List<ItemInfo> perEnvItemInfos = new ArrayList<>();
PageDTO<ItemInfoDTO> perEnvItemInfoDTOs = itemAPI.getPerEnvItemInfoBySearch(env, key, value, page, size);
perEnvItemInfoDTOs.getContent().forEach(itemInfoDTO -> {
Expand Down
25 changes: 14 additions & 11 deletions apollo-portal/src/main/resources/static/global_search_value.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<th style="text-align: left;width: 10%">{{'Global.Cluster' | translate }}</th>
<th style="text-align: left;width: 10%">{{'Global.NameSpace' | translate }}</th>
<th style="text-align: left;width: 15%">{{'Global.Key' | translate }}</th>
<th style="text-align: left;width: 35%">{{'Global.Value' | translate }}</th>
<th style="text-align: left;width: 35%" id="valueColumn">{{'Global.Value' | translate }}</th>
<th style="text-align: left;width: 10%">{{'Global.Operate' | translate }}</th>
</tr>
<tr ng-repeat="item in pageItemInfo track by $index" href="#" class="hover cursor-pointer">
Expand All @@ -82,18 +82,21 @@
<td>{{ item.clusterName }}</td>
<td>{{ item.namespaceName }}</td>
<td>
<span ng-if="isPageItemInfoDirectlyDisplayKey[$index] == '0'">{{ item.key }}</span>
<span ng-if="!(isPageItemInfoDirectlyDisplayKey[$index] == '0')" ng-bind-html="highlightKeyword(item.key,needToBeHighlightedKey)"></span>
<span ng-if="isPageItemInfoDirectlyDisplayKeyWithoutShowHighlightKeyword[$index] == '0'">{{ item.key }}</span>
<span ng-if="!(isPageItemInfoDirectlyDisplayKeyWithoutShowHighlightKeyword[$index] == '0')" ng-bind-html="highlightKeyword(item.key,needToBeHighlightedKey)"></span>
</td>
<td>
<span ng-if="isPageItemInfoDirectlyDisplayValue[$index] == '0'">{{ item.value }}</span>
<span ng-if="!(isPageItemInfoDirectlyDisplayValue[$index] == '0')">
<span ng-show="(isPageItemInfoDirectlyDisplayValue[$index] == '1') && (!isShowHighlightKeyword[$index])" ng-model="needToBeHighlightedValue">{{ needToBeHighlightedValue }}...</span>
<span ng-show="(isPageItemInfoDirectlyDisplayValue[$index] == '2') && (!isShowHighlightKeyword[$index])" ng-model="needToBeHighlightedValue">...{{ needToBeHighlightedValue }}</span>
<span ng-show="(isPageItemInfoDirectlyDisplayValue[$index] == '3') && (!isShowHighlightKeyword[$index])" ng-model="needToBeHighlightedValue">...{{ needToBeHighlightedValue }}...</span>
<a ng-show="!isShowHighlightKeyword[$index]" href="#" ng-click="isShowAllValue($index)">| {{'Global.Expand' | translate }}</a>
<span ng-show="isShowHighlightKeyword[$index]" ng-bind-html="highlightKeyword(item.value,needToBeHighlightedValue)"></span>
<a ng-show="isShowHighlightKeyword[$index]" href="#" ng-click="isShowAllValue($index)">| {{'Global.Abbreviate' | translate }}</a>
<span ng-if="isPageItemInfoDirectlyDisplayValueWithoutShowHighlightKeyword[$index] == '0'">{{ item.value }}</span>
<span ng-if="!(isPageItemInfoDirectlyDisplayValueWithoutShowHighlightKeyword[$index] == '0')">
<span ng-if="isPageItemInfoDisplayValueInARow[$index] == '0'" ng-bind-html="highlightKeyword(item.value,needToBeHighlightedValue)">{{ item.value }}</span>
<span ng-if="!(isPageItemInfoDisplayValueInARow[$index] == '0')">
<span ng-show="(isPageItemInfoDisplayValueInARow[$index] == '1') && (!isShowHighlightKeyword[$index])" ng-model="needToBeHighlightedValue">{{ needToBeHighlightedValue }}...</span>
<span ng-show="(isPageItemInfoDisplayValueInARow[$index] == '2') && (!isShowHighlightKeyword[$index])" ng-model="needToBeHighlightedValue">...{{ needToBeHighlightedValue }}</span>
<span ng-show="(isPageItemInfoDisplayValueInARow[$index] == '3') && (!isShowHighlightKeyword[$index])" ng-model="needToBeHighlightedValue">...{{ needToBeHighlightedValue }}...</span>
<a ng-show="!isShowHighlightKeyword[$index]" href="#" ng-click="isShowAllValue($index)">| {{'Global.Expand' | translate }}</a>
<span ng-show="isShowHighlightKeyword[$index]" ng-bind-html="highlightKeyword(item.value,needToBeHighlightedValue)"></span>
<a ng-show="isShowHighlightKeyword[$index]" href="#" ng-click="isShowAllValue($index)">| {{'Global.Abbreviate' | translate }}</a>
</span>
</span>
</td>
<td>
Expand Down
Loading

0 comments on commit cafde02

Please sign in to comment.