Search in sources :

Example 1 with PluginConfiguration

use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.

the class ElasticAgentViewViewModelBuilder method pluginInfoFor.

@Override
public PluginInfo pluginInfoFor(String pluginId) {
    PluginDescriptor descriptor = metadataStore.find(pluginId);
    if (descriptor == null) {
        return null;
    }
    Image icon = metadataStore.getIcon(descriptor);
    ArrayList<PluginConfiguration> pluginConfigurations = PluginConfiguration.getPluginConfigurations(metadataStore.getProfileMetadata(descriptor));
    PluginView pluginView = new PluginView(metadataStore.getProfileView(descriptor));
    PluggableInstanceSettings settings = new PluggableInstanceSettings(pluginConfigurations, pluginView);
    return new PluginInfo(descriptor, ElasticAgentPluginConstants.EXTENSION_NAME, null, settings, icon);
}
Also used : PluginDescriptor(com.thoughtworks.go.plugin.api.info.PluginDescriptor) PluggableInstanceSettings(com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings) PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) PluginView(com.thoughtworks.go.server.ui.plugins.PluginView) PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo) Image(com.thoughtworks.go.plugin.access.common.models.Image)

Example 2 with PluginConfiguration

use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.

the class PackageRepositoryPluginInfoBuilder method configurations.

static List<PluginConfiguration> configurations(PackageConfigurations packageConfigurations) {
    ArrayList<PluginConfiguration> pluginConfigurations = new ArrayList<>();
    for (PackageConfiguration configuration : packageConfigurations.list()) {
        Map<String, Object> metaData = new HashMap<>();
        metaData.put("required", configuration.getOption(Property.REQUIRED));
        metaData.put("secure", configuration.getOption(Property.SECURE));
        metaData.put("part_of_identity", configuration.getOption(Property.PART_OF_IDENTITY));
        metaData.put("display_name", configuration.getOption(Property.DISPLAY_NAME));
        metaData.put("display_order", configuration.getOption(Property.DISPLAY_ORDER));
        pluginConfigurations.add(new PluginConfiguration(configuration.getKey(), metaData));
    }
    return pluginConfigurations;
}
Also used : PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) PackageConfiguration(com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration)

Example 3 with PluginConfiguration

use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.

the class PackageViewModelBuilder method pluginInfoFor.

public PluginInfo pluginInfoFor(String pluginId) {
    String PACKAGE_CONFIGRATION_TYPE = "package";
    String REPOSITORY_CONFIGRATION_TYPE = "repository";
    if (!PackageMetadataStore.getInstance().hasPreferenceFor(pluginId)) {
        return null;
    }
    GoPluginDescriptor descriptor = pluginManager.getPluginDescriptorFor(pluginId);
    ArrayList<PluginConfiguration> pluginConfigurations = new ArrayList<>();
    pluginConfigurations.addAll(configurations(PackageMetadataStore.getInstance().getMetadata(pluginId), PACKAGE_CONFIGRATION_TYPE));
    pluginConfigurations.addAll(configurations(RepositoryMetadataStore.getInstance().getMetadata(pluginId), REPOSITORY_CONFIGRATION_TYPE));
    return new PluginInfo(descriptor, PackageRepositoryExtension.EXTENSION_NAME, null, new PluggableInstanceSettings(pluginConfigurations));
}
Also used : PluggableInstanceSettings(com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings) ArrayList(java.util.ArrayList) PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo)

Example 4 with PluginConfiguration

use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.

the class PluggableTaskPluginInfoBuilder method configurations.

static List<PluginConfiguration> configurations(TaskConfig config) {
    ArrayList<PluginConfiguration> pluginConfigurations = new ArrayList<>();
    for (Property property : config.list()) {
        Map<String, Object> metaData = new HashMap<>();
        metaData.put("required", property.getOption(Property.REQUIRED));
        metaData.put("secure", property.getOption(Property.SECURE));
        pluginConfigurations.add(new PluginConfiguration(property.getKey(), metaData));
    }
    return pluginConfigurations;
}
Also used : PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) Property(com.thoughtworks.go.plugin.api.config.Property)

Example 5 with PluginConfiguration

use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.

the class PluggableTaskPluginInfoBuilder method pluginInfoFor.

@Override
public PluggableTaskPluginInfo pluginInfoFor(String pluginId) {
    if (!store.pluginIds().contains(pluginId)) {
        return null;
    }
    GoPluginDescriptor plugin = pluginManager.getPluginDescriptorFor(pluginId);
    TaskPreference taskPreference = store.preferenceFor(pluginId);
    List<PluginConfiguration> pluginConfigurations = configurations(taskPreference.getConfig());
    PluginView pluginView = new PluginView(taskPreference.getView().template());
    return new PluggableTaskPluginInfo(plugin, taskPreference.getView().displayValue(), new PluggableInstanceSettings(pluginConfigurations, pluginView));
}
Also used : PluggableInstanceSettings(com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings) PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) PluginView(com.thoughtworks.go.server.ui.plugins.PluginView) PluggableTaskPluginInfo(com.thoughtworks.go.server.ui.plugins.PluggableTaskPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) TaskPreference(com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)

Aggregations

PluginConfiguration (com.thoughtworks.go.server.ui.plugins.PluginConfiguration)17 PluginInfo (com.thoughtworks.go.server.ui.plugins.PluginInfo)9 PluggableInstanceSettings (com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings)8 PluginView (com.thoughtworks.go.server.ui.plugins.PluginView)8 HashMap (java.util.HashMap)6 Image (com.thoughtworks.go.plugin.access.common.models.Image)5 PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)4 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 TaskPreference (com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)2 Property (com.thoughtworks.go.plugin.api.config.Property)2 PluginProfileMetadata (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadata)1 PluginProfileMetadataKey (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadataKey)1 PluginProfileMetadataKeys (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadataKeys)1 PackageConfiguration (com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration)1 SCMConfiguration (com.thoughtworks.go.plugin.access.scm.SCMConfiguration)1 SCMPreference (com.thoughtworks.go.plugin.access.scm.SCMPreference)1 AuthorizationPluginInfo (com.thoughtworks.go.server.ui.plugins.AuthorizationPluginInfo)1 ElasticPluginInfo (com.thoughtworks.go.server.ui.plugins.ElasticPluginInfo)1