mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-23 22:19:13 +00:00
Merge branch 'master' into bug5931
This commit is contained in:
+36
-17
@@ -36,44 +36,63 @@ public class ApplicationReplicaSetsImagesBarCell extends ImagesBarCell {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
public ApplicationReplicaSetsImagesBarCell(SafeHtmlRenderer<String> renderer, UserService userService, StringMessages stringMessages) {
|
||||
public ApplicationReplicaSetsImagesBarCell(SafeHtmlRenderer<String> renderer, UserService userService,
|
||||
StringMessages stringMessages) {
|
||||
this(userService, stringMessages);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<ImageSpec> getImageSpecs() {
|
||||
@SuppressWarnings("unchecked")
|
||||
final SailingApplicationReplicaSetDTO<String> applicationReplicaSet = (SailingApplicationReplicaSetDTO<String>) getContext().getKey();
|
||||
final SailingApplicationReplicaSetDTO<String> applicationReplicaSet = (SailingApplicationReplicaSetDTO<String>) getContext()
|
||||
.getKey();
|
||||
final List<ImageSpec> result = new ArrayList<>();
|
||||
if (!applicationReplicaSet.isLocalReplicaSet(userService)) {
|
||||
if (!applicationReplicaSet.isLocalReplicaSet(userService) && !applicationReplicaSet.isArchive()) {
|
||||
result.add(new ImageSpec(ACTION_ARCHIVE, stringMessages.archive(), IconResources.INSTANCE.archiveIcon()));
|
||||
result.add(new ImageSpec(ACTION_REMOVE, stringMessages.remove(), IconResources.INSTANCE.removeIcon()));
|
||||
}
|
||||
result.add(new ImageSpec(ACTION_DEFINE_LANDING_PAGE, stringMessages.defineLandingPage(),
|
||||
IconResources.INSTANCE.editIcon()));
|
||||
if (!applicationReplicaSet.isArchive()) {
|
||||
result.add(new ImageSpec(ACTION_DEFINE_LANDING_PAGE, stringMessages.defineLandingPage(),
|
||||
IconResources.INSTANCE.editIcon()));
|
||||
}
|
||||
result.add(new ImageSpec(ACTION_CREATE_LOAD_BALANCER_MAPPING, stringMessages.createLoadBalancerMapping(),
|
||||
IconResources.INSTANCE.loadBalancerIcon()));
|
||||
result.add(new ImageSpec(ACTION_LAUNCH_ANOTHER_REPLICA_SET_ON_THIS_MASTER,
|
||||
stringMessages.launchAnotherReplicaSetOnThisMaster(),
|
||||
IconResources.INSTANCE.launchAnotherReplicaSetOnThisMasterIcon()));
|
||||
if (!applicationReplicaSet.isLocalReplicaSet(userService)) {
|
||||
if (!applicationReplicaSet.isLocalReplicaSet(userService) && !applicationReplicaSet.isArchive()) {
|
||||
result.add(new ImageSpec(ACTION_UPGRADE, stringMessages.upgrade(), IconResources.INSTANCE.refreshIcon()));
|
||||
}
|
||||
result.add(new ImageSpec(ACTION_ENSURE_ONE_REPLICA_THEN_STOP_REPLICATING_AND_REMOVE_MASTER_FROM_TARGET_GROUPS,
|
||||
stringMessages.ensureAtLeastOneReplicaExistsStopReplicatingAndRemoveMasterFromTargetGroups(),
|
||||
IconResources.INSTANCE.unlinkIcon()));
|
||||
if (!applicationReplicaSet.isArchive()) {
|
||||
result.add(
|
||||
new ImageSpec(ACTION_ENSURE_ONE_REPLICA_THEN_STOP_REPLICATING_AND_REMOVE_MASTER_FROM_TARGET_GROUPS,
|
||||
stringMessages
|
||||
.ensureAtLeastOneReplicaExistsStopReplicatingAndRemoveMasterFromTargetGroups(),
|
||||
IconResources.INSTANCE.unlinkIcon()));
|
||||
}
|
||||
if (applicationReplicaSet.getAutoScalingGroupAmiId() != null) {
|
||||
result.add(new ImageSpec(ACTION_UPDATE_AMI_FOR_AUTO_SCALING_REPLICAS, stringMessages.updateAmiForAutoScalingReplicas(), IconResources.INSTANCE.redGearsIcon()));
|
||||
result.add(new ImageSpec(ACTION_SWITCH_TO_AUTO_SCALING_REPLICAS_ONLY, stringMessages.switchToAutoScalingReplicasOnly(), IconResources.INSTANCE.scaleUpIcon()));
|
||||
result.add(new ImageSpec(ACTION_OPEN_SHARD_MANAGEMENT, stringMessages.openShardManagement(), IconResources.INSTANCE.shardManagementIcon()));
|
||||
result.add(new ImageSpec(ACTION_UPDATE_AMI_FOR_AUTO_SCALING_REPLICAS,
|
||||
stringMessages.updateAmiForAutoScalingReplicas(), IconResources.INSTANCE.redGearsIcon()));
|
||||
result.add(new ImageSpec(ACTION_SWITCH_TO_AUTO_SCALING_REPLICAS_ONLY,
|
||||
stringMessages.switchToAutoScalingReplicasOnly(), IconResources.INSTANCE.scaleUpIcon()));
|
||||
result.add(new ImageSpec(ACTION_OPEN_SHARD_MANAGEMENT, stringMessages.openShardManagement(),
|
||||
IconResources.INSTANCE.shardManagementIcon()));
|
||||
}
|
||||
result.add(new ImageSpec(ACTION_SWITCH_TO_REPLICA_ON_SHARED_INSTANCE, stringMessages.switchToReplicaOnSharedInstance(), IconResources.INSTANCE.scaleDownIcon()));
|
||||
if (!applicationReplicaSet.isLocalReplicaSet(userService)) {
|
||||
result.add(new ImageSpec(ACTION_MOVE_MASTER_TO_OTHER_INSTANCE, stringMessages.moveMasterToOtherInstance(), IconResources.INSTANCE.moveIcon()));
|
||||
if (!applicationReplicaSet.isArchive()) {
|
||||
result.add(new ImageSpec(ACTION_SWITCH_TO_REPLICA_ON_SHARED_INSTANCE,
|
||||
stringMessages.switchToReplicaOnSharedInstance(), IconResources.INSTANCE.scaleDownIcon()));
|
||||
}
|
||||
if (!applicationReplicaSet.isLocalReplicaSet(userService) && !applicationReplicaSet.isArchive()) {
|
||||
result.add(new ImageSpec(ACTION_MOVE_MASTER_TO_OTHER_INSTANCE, stringMessages.moveMasterToOtherInstance(),
|
||||
IconResources.INSTANCE.moveIcon()));
|
||||
}
|
||||
if (!applicationReplicaSet.isArchive()) {
|
||||
result.add(new ImageSpec(ACTION_SCALE_AUTO_SCALING_REPLICAS_UP_DOWN,
|
||||
stringMessages.scaleAutoScalingReplicasUpOrDown(), IconResources.INSTANCE.scaleIcon()));
|
||||
}
|
||||
result.add(new ImageSpec(ACTION_SCALE_AUTO_SCALING_REPLICAS_UP_DOWN, stringMessages.scaleAutoScalingReplicasUpOrDown(), IconResources.INSTANCE.scaleIcon()));
|
||||
if (applicationReplicaSet.getMaster().getHost().isShared()) {
|
||||
result.add(new ImageSpec(ACTION_MOVE_ALL_APPLICATION_PROCESSES_AWAY_FROM, stringMessages.moveAllApplicationProcessesAwayFromMaster(), IconResources.INSTANCE.moveAway()));
|
||||
result.add(new ImageSpec(ACTION_MOVE_ALL_APPLICATION_PROCESSES_AWAY_FROM,
|
||||
stringMessages.moveAllApplicationProcessesAwayFromMaster(), IconResources.INSTANCE.moveAway()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+9
@@ -370,12 +370,14 @@ public class LandscapeManagementPanel extends SimplePanel {
|
||||
StringMessages.INSTANCE::doYouReallyWantToRemoveSelectedElements,
|
||||
e -> removeApplicationReplicaSets(stringMessages, regionsTable.getSelectionModel().getSelectedObject(), applicationReplicaSetsTable.getSelectionModel().getSelectedSet()));
|
||||
disableButtonWhenLocalReplicaSetIsSelected(removeApplicationReplicaSetButton, userService);
|
||||
disableButtonWhenArchive(removeApplicationReplicaSetButton);
|
||||
applicationReplicaSetsButtonPanel.add(removeApplicationReplicaSetButton);
|
||||
final SelectedElementsCountingButton<SailingApplicationReplicaSetDTO<String>> upgradeApplicationReplicaSetButton = new SelectedElementsCountingButton<>(
|
||||
stringMessages.upgrade(), applicationReplicaSetsTable.getSelectionModel(),
|
||||
e->upgradeApplicationReplicaSet(stringMessages, regionsTable.getSelectionModel().getSelectedObject(),
|
||||
applicationReplicaSetsTable.getSelectionModel().getSelectedSet()));
|
||||
disableButtonWhenLocalReplicaSetIsSelected(upgradeApplicationReplicaSetButton, userService);
|
||||
disableButtonWhenArchive(upgradeApplicationReplicaSetButton);
|
||||
applicationReplicaSetsButtonPanel.add(upgradeApplicationReplicaSetButton);
|
||||
final SelectedElementsCountingButton<SailingApplicationReplicaSetDTO<String>> stopReplicatingAndUnregisterMasterButton = new SelectedElementsCountingButton<>(
|
||||
stringMessages.stopReplicating(), applicationReplicaSetsTable.getSelectionModel(),
|
||||
@@ -391,10 +393,12 @@ public class LandscapeManagementPanel extends SimplePanel {
|
||||
stringMessages.switchToReplicaOnSharedInstance(), applicationReplicaSetsTable.getSelectionModel(),
|
||||
e->switchToReplicaOnSharedInstance(stringMessages, applicationReplicaSetsTable.getSelectionModel().getSelectedSet()));
|
||||
applicationReplicaSetsButtonPanel.add(useSharedInsteadOfDedicatedAutoScalingReplicasButton);
|
||||
disableButtonWhenArchive(useSharedInsteadOfDedicatedAutoScalingReplicasButton);
|
||||
final SelectedElementsCountingButton<SailingApplicationReplicaSetDTO<String>> scaleAutoScalingReplicasUpDown = new SelectedElementsCountingButton<>(
|
||||
stringMessages.scaleAutoScalingReplicasUpOrDown(), applicationReplicaSetsTable.getSelectionModel(),
|
||||
e->scaleAutoScalingReplicasUpDown(stringMessages, regionsTable.getSelectionModel().getSelectedObject(),
|
||||
applicationReplicaSetsTable.getSelectionModel().getSelectedSet()));
|
||||
disableButtonWhenArchive(scaleAutoScalingReplicasUpDown);
|
||||
applicationReplicaSetsButtonPanel.add(scaleAutoScalingReplicasUpDown);
|
||||
applicationReplicaSetsCaptionPanel.add(applicationReplicaSetsVerticalPanel);
|
||||
applicationReplicaSetsVerticalPanel.add(applicationReplicaSetsTable);
|
||||
@@ -522,6 +526,11 @@ public class LandscapeManagementPanel extends SimplePanel {
|
||||
!applicationReplicaSetsTable.getSelectionModel().getSelectedSet().stream().filter(arsDTO->arsDTO.isLocalReplicaSet(userService)).findAny().isPresent()));
|
||||
}
|
||||
|
||||
private void disableButtonWhenArchive(Button button) {
|
||||
applicationReplicaSetsTable.getSelectionModel().addSelectionChangeHandler(e->button.setEnabled(
|
||||
!applicationReplicaSetsTable.getSelectionModel().getSelectedSet().stream().filter(arsDTO-> arsDTO.isArchive()).findAny().isPresent()));
|
||||
}
|
||||
|
||||
private void validatePassphrase(StringMessages stringMessages, AsyncCallback<Boolean> callback) {
|
||||
landscapeManagementService.verifyPassphrase(regionsTable.getSelectionModel().getSelectedObject(),
|
||||
sshKeyManagementPanel.getSelectedKeyPair(),
|
||||
|
||||
+12
-2
@@ -3,6 +3,7 @@ package com.sap.sailing.landscape.ui.shared;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.landscape.common.SharedLandscapeConstants;
|
||||
import com.sap.sse.common.Named;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.gwt.client.ServerInfoDTO;
|
||||
@@ -83,13 +84,22 @@ public class SailingApplicationReplicaSetDTO<ShardingKey> implements Named, IsSe
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if this replica set is the one that this method is being run on. See
|
||||
* {@link ServerInfoDTO} and {@link UserService#getServerInfo()}.
|
||||
* @return {@code true} if this replica set is the one that this method is being run on. See {@link ServerInfoDTO}
|
||||
* and {@link UserService#getServerInfo()}.
|
||||
*/
|
||||
public boolean isLocalReplicaSet(UserService userService) {
|
||||
return getName().equals(userService.getServerInfo().getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Based on this replica set's {@link #getName() name} decides whether this is the ARCHIVE.
|
||||
*
|
||||
* @see SharedLandscapeConstants#ARCHIVE_SERVER_APPLICATION_REPLICA_SET_NAME
|
||||
*/
|
||||
public boolean isArchive() {
|
||||
return getName().equals(SharedLandscapeConstants.ARCHIVE_SERVER_APPLICATION_REPLICA_SET_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SailingApplicationReplicaSetDTO [replicaSetName=" + replicaSetName + ", master=" + master
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ echo "Server process $SERVER_PID didn't die within ${KILL_TIMEOUT_IN_SECONDS}s a
|
||||
kill $SERVER_PID
|
||||
TIMEOUT_FOR_KILLED_PROCESS_TO_DISAPPEAR=120
|
||||
seconds_counter=$TIMEOUT_FOR_KILLED_PROCESS_TO_DISAPPEAR
|
||||
echo "Waiting up to $TIMEOUT_FOR_KILLED_PROCESS_TO_DISAPPEAR for server process $SERVER_PID to disappear..."
|
||||
echo "Waiting up to ${TIMEOUT_FOR_KILLED_PROCESS_TO_DISAPPEAR}s for server process $SERVER_PID to disappear..."
|
||||
while ((seconds_counter-- != 0)); do
|
||||
if [ ! -d /proc/$SERVER_PID ]; then
|
||||
echo "Server process $SERVER_PID disappeared after killing it. This took $(($TIMEOUT_FOR_KILLED_PROCESS_TO_DISAPPEAR-$seconds_counter))s."
|
||||
@@ -56,7 +56,7 @@ done
|
||||
echo "Server process $SERVER_PID did not die or disappear after SIGTERM. Trying SIGKILL..."
|
||||
kill -9 $SERVER_PID
|
||||
seconds_counter=$TIMEOUT_FOR_KILLED_PROCESS_TO_DISAPPEAR
|
||||
echo "Waiting up to $TIMEOUT_FOR_KILLED_PROCESS_TO_DISAPPEAR for server process $SERVER_PID to disappear after kill -SIGKILL..."
|
||||
echo "Waiting up to ${TIMEOUT_FOR_KILLED_PROCESS_TO_DISAPPEAR}s for server process $SERVER_PID to disappear after kill -SIGKILL..."
|
||||
while ((seconds_counter-- != 0)); do
|
||||
if [ ! -d /proc/$SERVER_PID ]; then
|
||||
echo "Server process $SERVER_PID disappeared after killing it with SIGKILL. This took $(($TIMEOUT_FOR_KILLED_PROCESS_TO_DISAPPEAR-$seconds_counter))s."
|
||||
|
||||
Reference in New Issue
Block a user