Skip to content

Commit

Permalink
feat(#2975): Add configurable documentation links (#2978)
Browse files Browse the repository at this point in the history
* feat(#2975): Add documentation links to model, modify info view

* feat(#2975): Add configurable application links

* Fix checkstyle

---------

Co-authored-by: Dominik Riemer <[email protected]>
  • Loading branch information
dominikriemer and Dominik Riemer authored Jun 30, 2024
1 parent 2263cec commit 4b37c0e
Show file tree
Hide file tree
Showing 43 changed files with 551 additions and 799 deletions.
2 changes: 1 addition & 1 deletion .idea/runConfigurations/ui.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@
*
*/

.about-logo {
width: 300px;
}
package org.apache.streampipes.model.configuration;

.about-container {
margin-top: 20px;
margin-left: auto;
margin-right: auto;
}
public class DefaultGeneralConfig {

.p-10 {
padding: 10px;
public GeneralConfig make() {
var generalConfig = new GeneralConfig();
generalConfig.setLinkSettings(new DefaultLinkSettings().make());
return generalConfig;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@
*
*/

import { Component } from '@angular/core';
package org.apache.streampipes.model.configuration;

@Component({
selector: 'sp-license',
templateUrl: './license.component.html',
styleUrls: ['./license.component.scss'],
})
export class LicenseComponent {
constructor() {}
public class DefaultLinkSettings {

public LinkSettings make() {
return new LinkSettings(
"https://streampipes.apache.org",
"",
true,
true,
false,
true
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class DefaultSpCoreConfiguration {
public SpCoreConfiguration make() {
var coreCfg = new SpCoreConfiguration();

coreCfg.setGeneralConfig(new GeneralConfig());
coreCfg.setGeneralConfig(new DefaultGeneralConfig().make());
coreCfg.setMessagingSettings(new DefaultMessagingSettings().make());
coreCfg.setEmailConfig(EmailConfig.fromDefaults());
coreCfg.setEmailTemplateConfig(new DefaultEmailTemplateConfiguration().getDefaultTemplates());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class GeneralConfig {
private boolean allowPasswordRecovery;

private List<String> defaultUserRoles;
private LinkSettings linkSettings;

public GeneralConfig() {
}
Expand Down Expand Up @@ -104,4 +105,12 @@ public String getAppName() {
public void setAppName(String appName) {
this.appName = appName;
}

public LinkSettings getLinkSettings() {
return linkSettings;
}

public void setLinkSettings(LinkSettings linkSettings) {
this.linkSettings = linkSettings;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*
*/

.pageheadbar {
padding: 0 0 0 10px;
background-color: #f6f6f6;
font-size: 14px;
line-height: 24px;
border-bottom: 1px solid #ccc;
}
package org.apache.streampipes.model.configuration;

.margin-top {
margin-top: 5px;
}
import org.apache.streampipes.model.shared.annotation.TsModel;

@TsModel
public record LinkSettings(String documentationUrl,
String supportUrl,
boolean showDocumentationLinkOnStartScreen,
boolean showApiDocumentationLinkOnStartScreen,
boolean showSupportUrlOnStartScreen,
boolean showDocumentationLinkInProfileMenu) {}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public ResponseEntity<Map<String, Object>> getAuthSettings() {
Map<String, Object> response = new HashMap<>();
response.put("allowSelfRegistration", config.isAllowSelfRegistration());
response.put("allowPasswordRecovery", config.isAllowPasswordRecovery());
response.put("linkSettings", config.getLinkSettings());

return ok(response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.streampipes.service.core.migrations.v093.AdapterMigration;
import org.apache.streampipes.service.core.migrations.v093.StoreEmailTemplatesMigration;
import org.apache.streampipes.service.core.migrations.v095.MergeFilenamesAndRenameDuplicatesMigration;
import org.apache.streampipes.service.core.migrations.v970.AddLinkSettingsMigration;

import java.util.Arrays;
import java.util.List;
Expand All @@ -40,7 +41,8 @@ public List<Migration> getAvailableMigrations() {
new UpdateUsernameViewMigration(),
new AdapterMigration(),
new StoreEmailTemplatesMigration(),
new MergeFilenamesAndRenameDuplicatesMigration()
new MergeFilenamesAndRenameDuplicatesMigration(),
new AddLinkSettingsMigration()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.apache.streampipes.service.core.migrations.v970;

import org.apache.streampipes.model.configuration.DefaultLinkSettings;
import org.apache.streampipes.service.core.migrations.Migration;
import org.apache.streampipes.storage.api.ISpCoreConfigurationStorage;
import org.apache.streampipes.storage.management.StorageDispatcher;

import java.io.IOException;

public class AddLinkSettingsMigration implements Migration {

private final ISpCoreConfigurationStorage coreConfigStore = StorageDispatcher
.INSTANCE
.getNoSqlStore()
.getSpCoreConfigurationStorage();

@Override
public boolean shouldExecute() {
return coreConfigStore.get().getGeneralConfig().getLinkSettings() == null;
}

@Override
public void executeMigration() throws IOException {
var linkSettings = new DefaultLinkSettings().make();
var coreConfig = coreConfigStore.get();
coreConfig.getGeneralConfig().setLinkSettings(linkSettings);
coreConfigStore.updateElement(coreConfig);
}

@Override
public String getDescription() {
return "Adding link settings to general config";
}
}
4 changes: 2 additions & 2 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*
*/

import { LinkSettings } from '../gen/streampipes-model';

export interface GeneralConfigModel {
hostname: string;
port: number;
Expand All @@ -25,4 +27,5 @@ export interface GeneralConfigModel {
allowSelfRegistration: boolean;
defaultUserRoles: string[];
appName: string;
linkSettings: LinkSettings;
}
Loading

0 comments on commit 4b37c0e

Please sign in to comment.