Skip to content

Commit 2408424

Browse files
committed
Refactor => Change Allowed Methods property to View Only and send into ContextInfo
1 parent be0aefb commit 2408424

File tree

7 files changed

+26
-9
lines changed

7 files changed

+26
-9
lines changed

deploy/docker-compose-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ services:
6666
- ET_ENABLE_CLOUD_MODE=false
6767
- ET_EPM_K8S_MASTER=localhost
6868
- ET_EPM_K8S_TOKEN=none
69-
- ET_ETM_ALLOWED_METHODS=*
69+
- ET_ETM_VIEW_ONLY=false
7070
entrypoint: /run.sh
7171
expose:
7272
- 8091

docker/docker-compose-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ services:
6363
- ET_ENABLE_CLOUD_MODE=false
6464
- ET_EPM_K8S_MASTER=localhost
6565
- ET_EPM_K8S_TOKEN=none
66-
- ET_ETM_ALLOWED_METHODS=*
66+
- ET_ETM_VIEW_ONLY=false
6767
entrypoint: /run.sh
6868
expose:
6969
- 8091

elastest-torm-gui/src/app/elastest-etm/etm-monitoring-view/etm-chart-group/etm-chart-group.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ export class EtmChartGroupComponent implements OnInit, AfterViewInit, AfterViewC
657657

658658
removeAndUnsubscribe(metric: ESRabComplexMetricsModel): void {
659659
if (metric) {
660-
console.log(metric);
661660
this.removeAndUnsubscribeByNameAndList(metric.name, metric.isCombinedPair ? this.combinedPairChartsList : this.chartsList);
662661
}
663662
}

elastest-torm/src/main/java/io/elastest/etm/config/WebRequestFilter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
public class WebRequestFilter implements Filter {
2424
final Logger logger = getLogger(lookup().lookupClass());
2525

26-
@Value("${et.etm.allowed.methods}")
27-
public String allowedMethods;
26+
@Value("${et.etm.view.only}")
27+
public Boolean etEtmViewOnly;
2828

2929
List<String> allowedMethodsList = Arrays.asList("*");
3030

3131
@Override
3232
public void init(FilterConfig filterConfig) throws ServletException {
33-
if (allowedMethods != null && !"".equals(allowedMethods)) {
34-
allowedMethodsList = Arrays.asList(allowedMethods.split(","));
33+
if (etEtmViewOnly != null && etEtmViewOnly) {
34+
allowedMethodsList = Arrays.asList("GET");
3535
}
3636
logger.info("Allowed Methods: {}", Arrays.asList(allowedMethodsList));
3737
}

elastest-torm/src/main/java/io/elastest/etm/model/ContextInfo.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ public class ContextInfo {
9191
@JsonProperty("isKubernetes")
9292
private boolean isKubernetes;
9393

94+
@JsonProperty("etmViewOnly")
95+
private boolean etmViewOnly;
96+
9497
public ContextInfo() {
9598
}
9699

@@ -322,6 +325,14 @@ public void setIsKubernetes(boolean isKubernetes) {
322325
this.isKubernetes = isKubernetes;
323326
}
324327

328+
public boolean isEtmViewOnly() {
329+
return etmViewOnly;
330+
}
331+
332+
public void setEtmViewOnly(boolean etmViewOnly) {
333+
this.etmViewOnly = etmViewOnly;
334+
}
335+
325336
@Override
326337
public String toString() {
327338
return "ContextInfo [elasticSearchUrl=" + elasticSearchUrl
@@ -347,7 +358,8 @@ public String toString() {
347358
+ ", eusSSInstance=" + eusSSInstance + ", testLinkStarted="
348359
+ testLinkStarted + ", empGrafanaUrl=" + empGrafanaUrl
349360
+ ", edmCommandUrl=" + edmCommandUrl + ", etmApiUrl="
350-
+ etmApiUrl + ", isKubernetes=" + isKubernetes + "]";
361+
+ etmApiUrl + ", isKubernetes=" + isKubernetes
362+
+ ", etmViewOnly=" + etmViewOnly + "]";
351363
}
352364

353365
}

elastest-torm/src/main/java/io/elastest/etm/service/EtmContextAuxService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ public class EtmContextAuxService {
100100
@Value("${et.edm.command.context-path}")
101101
private String etEdmCommandContextPath;
102102

103+
@Value("${et.etm.view.only}")
104+
public Boolean etEtmViewOnly;
105+
103106
private UtilsService utilsService;
104107
private ContextInfo contextInfo;
105108
private PlatformService platformService;
@@ -203,6 +206,9 @@ private ContextInfo createContextInfo() {
203206
contextInfo
204207
.setEtmApiUrl("http://" + proxyIp + ":" + proxyPort + "/api/");
205208
contextInfo.setIsKubernetes(utilsService.isKubernetes());
209+
210+
contextInfo
211+
.setEtmViewOnly(etEtmViewOnly != null ? etEtmViewOnly : false);
206212
return contextInfo;
207213
}
208214

elastest-torm/src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ et.user=none
88
et.pass=none
99
et.enable.cloud.mode=false
1010

11-
et.etm.allowed.methods=*
11+
et.etm.view.only=false
1212

1313
docker.port=2376
1414

0 commit comments

Comments
 (0)