Skip to content

Commit

Permalink
Remove volume size filter
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoasr committed Jul 16, 2024
1 parent 2cb71d2 commit ae7bbe3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public class AmiTagManager {
public static final String KEY_RELEASE = "release";
public static final String KEY_ARCHITECTURE = "architecture";
public static final String KEY_APPLICATION_ENVIRONMENT = "application_environment";
public static final String KEY_VOLUME_SIZE = "ebs_volume_size";
public static final String VALUE_KAFKA = "kafka";
public static UnaryOperator<String> tag = key -> "tag:" + key;
public static final String ENV_TYPES_KEY = "envTypes";
Expand Down Expand Up @@ -100,19 +99,8 @@ public List<Ami> getAmiList(Map<String, String> filter) {
if (resp.hasImages() && !resp.images().isEmpty()) {
// The limitation of images newer than 180 days is temporarily suspended
// ZonedDateTime cutDate = ZonedDateTime.now().minusDays(180);
boolean filterVolumeSize = filter.containsKey(KEY_VOLUME_SIZE);
int volumeSize = filterVolumeSize ? Integer.parseInt(filter.get(KEY_VOLUME_SIZE)) : 0;
resp.images().forEach(image -> {
/*if (ZonedDateTime.parse(image.creationDate(), DateTimeFormatter.ISO_ZONED_DATE_TIME).isAfter(cutDate)) {*/
boolean matchesVolumeSizeCriteria = ! filterVolumeSize;
if (filterVolumeSize) {
for (BlockDeviceMapping dev : image.blockDeviceMappings()) {
if (dev.deviceName().equals("/dev/sda1") && dev.ebs() != null)
matchesVolumeSizeCriteria = (dev.ebs().volumeSize() == volumeSize);
break;
}
}
if (matchesVolumeSizeCriteria) {
Iterator<Tag> i = image.tags().iterator();
Tag t;
String appEnvTag = null;
Expand All @@ -128,7 +116,7 @@ public List<Ami> getAmiList(Map<String, String> filter) {
appEnvTag,
image.creationDate()
));
}
// }
});
Function<Ami, ZonedDateTime> parse = i -> ZonedDateTime.parse(i.getCreationDate(), DateTimeFormatter.ISO_ZONED_DATE_TIME);
amiList.sort((a, b) -> - parse.apply(a).compareTo(parse.apply(b)));
Expand Down
18 changes: 0 additions & 18 deletions orion-server/src/main/resources/webapp/src/basic-components/Ami.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ function Ami({ amiList, requestAmiList, envTypes, requestEnvTypes, updateAmiTag
const handleArchChange = event => {
setArch(event.target.value);
};
const [volumeSize, setVolumeSize] = React.useState();
const handleVolumeSizeChange = event => {
setVolumeSize(event.target.value);
};
const [selected, setSelected] = React.useState([]);
const handleTableRowSelect = (id, row) => {
setSelected(id);
Expand Down Expand Up @@ -87,8 +83,6 @@ function Ami({ amiList, requestAmiList, envTypes, requestEnvTypes, updateAmiTag
parms.push("release=" + os);
if (arch)
parms.push("architecture=" + arch);
if (volumeSize)
parms.push("ebs_volume_size=" + volumeSize);
requestAmiList(parms.join('&'));
requestEnvTypes();
}
Expand Down Expand Up @@ -146,18 +140,6 @@ function Ami({ amiList, requestAmiList, envTypes, requestEnvTypes, updateAmiTag
</Select>
</FormControl>
</div>
<div>
<FormControl className={classes.formControl}>
<TextField
id="volume_size"
label="volume_size"
value={volumeSize}
onChange={handleVolumeSizeChange}
style={{ width: "200px" }}
InputLabelProps={{ shrink: true }}
/>
</FormControl>
</div>
<div>
<FormControl className={classes.formControl}>
<TextField
Expand Down

0 comments on commit ae7bbe3

Please sign in to comment.