-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: app add endpoint manager and component manager
- Loading branch information
Showing
19 changed files
with
205 additions
and
67 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
49 changes: 49 additions & 0 deletions
49
...-base/sreworks-domain/src/main/java/com/alibaba/sreworks/domain/DO/AppMarketEndpoint.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,49 @@ | ||
package com.alibaba.sreworks.domain.DO; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import com.alibaba.sreworks.domain.DTO.AppDetail; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.*; | ||
|
||
/** | ||
* @author jinghua.yjh | ||
*/ | ||
@Slf4j | ||
@Entity | ||
@EntityListeners(AuditingEntityListener.class) | ||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AppMarketEndpoint { | ||
|
||
@Id | ||
@GeneratedValue | ||
private Long id; | ||
|
||
@Column | ||
private Long gmtCreate; | ||
|
||
@Column | ||
private Long gmtModified; | ||
|
||
@Column | ||
private String creator; | ||
|
||
@Column | ||
private String lastModifier; | ||
|
||
@Column(unique = true) | ||
private String name; | ||
|
||
@Column(columnDefinition = "text") | ||
private String config; | ||
|
||
|
||
} |
18 changes: 18 additions & 0 deletions
18
...ain/src/main/java/com/alibaba/sreworks/domain/repository/AppMarketEndpointRepository.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,18 @@ | ||
package com.alibaba.sreworks.domain.repository; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import com.alibaba.sreworks.domain.DO.AppMarketEndpoint; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
import java.util.List; | ||
|
||
|
||
public interface AppMarketEndpointRepository extends JpaRepository<AppMarketEndpoint, Long>, JpaSpecificationExecutor<AppMarketEndpoint> { | ||
|
||
AppMarketEndpoint findFirstById(Long id); | ||
|
||
AppMarketEndpoint findFirstByName(String name); | ||
|
||
} |
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
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
43 changes: 43 additions & 0 deletions
43
...v-server/src/main/java/io/sreworks/appdev/server/services/AppmanagerComponentService.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,43 @@ | ||
package io.sreworks.appdev.server.services; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
import com.alibaba.fastjson.JSONArray; | ||
import com.alibaba.fastjson.JSONObject; | ||
import com.alibaba.sreworks.common.util.AppmanagerServiceUtil; | ||
import com.alibaba.sreworks.common.util.JsonUtil; | ||
import com.alibaba.sreworks.domain.DO.App; | ||
import com.alibaba.tesla.web.constant.HttpHeaderNames; | ||
import io.sreworks.common.util.Requests; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Slf4j | ||
@Service | ||
public class AppmanagerComponentService { | ||
|
||
public JSONArray list(String appId, String user) throws Exception { | ||
|
||
JSONObject componentsConfigs = new JSONObject(); | ||
List<JSONObject> deployConfigs = new Requests(AppmanagerServiceUtil.getEndpoint() + "/application-configurations/types/components?appId=" + appId + "&typeIdPrefix=Type:components") | ||
.get() | ||
.headers(HttpHeaderNames.X_EMPL_ID, user) | ||
.isSuccessful().getJSONObject().getJSONObject("data").getJSONArray("items").toJavaList(JSONObject.class); | ||
|
||
for(JSONObject deployConfig: deployConfigs){ | ||
componentsConfigs.put(deployConfig.getString("typeId"), deployConfig); | ||
} | ||
|
||
log.info("GET " + AppmanagerServiceUtil.getEndpoint() + "/apps/" + appId + "/components"); | ||
List<JSONObject> components = new Requests(AppmanagerServiceUtil.getEndpoint() + "/apps/" + appId + "/components?withBlobs=true") | ||
.get() | ||
.headers(HttpHeaderNames.X_EMPL_ID, user) | ||
.isSuccessful().getJSONObject().getJSONArray("data").toJavaList(JSONObject.class); | ||
for(JSONObject component: components){ | ||
component.put("deployConfig", componentsConfigs.getJSONObject(component.getString("typeId"))); | ||
} | ||
return JSONArray.parseArray(JSON.toJSONString(components)); | ||
} | ||
|
||
} |
Oops, something went wrong.