use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.
the class GetProjectMockConfigurationAction method execute.
@Override
protected void execute(ActionEvent e) {
Optional<String> projectId = getUserInput("Please enter projectId to fetch mock configuration", InputCacheIdentifier.PROJECT_ID);
if (!projectId.isPresent()) {
return;
}
DeveloperAdministration administration = getContext().getAdministration();
String url = administration.getUrlBuilder().buildGetProjectMockConfiguration(asSecHubId(projectId.get()));
String json = administration.getRestHelper().getJSON(url);
getContext().getOutputUI().output(JSONDeveloperHelper.INSTANCE.beatuifyJSON(json));
}
use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.
the class ChangeProjectAccessLevelAction method execute.
@Override
public void execute(ActionEvent e) {
Optional<String> optProjectId = getUserInput("Please enter project ID/name", InputCacheIdentifier.PROJECT_ID);
if (!optProjectId.isPresent()) {
return;
}
String projectId = optProjectId.get().toLowerCase().trim();
DeveloperAdministration administration = getContext().getAdministration();
ProjectAccessLevel currentAccessLevel = fetchCurrentProjectAccessLevel(projectId, administration);
ChangeProjectAccessLevelDialogUI dialogUI = new ChangeProjectAccessLevelDialogUI(getContext(), projectId, currentAccessLevel);
dialogUI.showDialog();
if (!dialogUI.isOkPressed()) {
return;
}
ProjectAccessLevel wantedAccessLevel = dialogUI.getSelectedValue();
if (!confirm("Do you really want to change the project access level for project:" + projectId + " to " + wantedAccessLevel + " ?")) {
return;
}
administration.changeProjectAccessLevel(projectId, wantedAccessLevel);
}
use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.
the class LoadJSONAdapterDialogAction method execute.
@Override
protected void execute(ActionEvent e) throws Exception {
DeveloperAdministration adm = getDialogUI().getContext().getAdministration();
String url = adm.getUrlBuilder().buildGetMapping(getMappingUI().getMappingId());
String json = adm.getRestHelper().getJSON(url);
getMappingUI().setJSON(json);
}
use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.
the class SaveJSONAdapterDialogAction method execute.
@Override
protected void execute(ActionEvent e) throws Exception {
DeveloperAdministration adm = getDialogUI().getContext().getAdministration();
String url = adm.getUrlBuilder().buildUpdateMapping(getMappingUI().getMappingId());
String json = getMappingUI().getJSON();
// just check json correct
MappingData data = MappingData.fromString(json);
int size = data.getEntries().size();
boolean confirmed = getDialogUI().getContext().getDialogUI().confirm("Do you really want to upload?\n\n" + size + " entries will be set!");
if (!confirmed) {
getDialogUI().getContext().getOutputUI().output(getClass().getSimpleName() + ":Canceled by user");
return;
}
adm.getRestHelper().putJSON(url, json);
getDialogUI().getContext().getOutputUI().output("Updated mapping:" + getMappingUI().getMappingId());
}
use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.
the class DeveloperAdministrationUI method start.
private void start(String[] args) {
administration = new DeveloperAdministration(this, this, this);
useNimbusLookAndFeel();
String env = ConfigurationSetup.SECHUB_ADMIN_ENVIRONMENT.getStringValueOrFail();
frame = new JFrame(env + " - SecHub");
ImageIcon imageIcon = new ImageIcon(DeveloperAdministrationUI.class.getClassLoader().getResource("sechub-logo.png"));
Image image = imageIcon.getImage();
frame.setIconImage(image);
Container contentPane = frame.getContentPane();
credentialUI = new CredentialUI(this);
outputPanelUI = new OutputUI();
commandPanelUI = new CommandUI(this);
glassPaneUI = new GlassPaneUI(this, frame);
dialogUI = new DialogUI(frame);
pdsConfigurationUI = new PDSConfigurationUI(this);
contentPane.add(outputPanelUI.getPanel(), BorderLayout.CENTER);
JPanel northPanel = new JPanel(new BorderLayout());
contentPane.add(northPanel, BorderLayout.NORTH);
contentPane.add(commandPanelUI.getPanel(), BorderLayout.SOUTH);
northPanel.add(credentialUI.getPanel(), BorderLayout.NORTH);
northPanel.add(commandPanelUI.getToolBar(), BorderLayout.SOUTH);
frame.setJMenuBar(commandPanelUI.getMenuBar());
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
// centered...
frame.setLocationRelativeTo(null);
frame.setSize(1024, 768);
frame.setVisible(true);
}
Aggregations