-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat(#3141): Add option to configure production sites * Add headers * Fix import * feat: Show asset location on map * Remove scss * Fix formatting
- Loading branch information
1 parent
c15b157
commit dd8213e
Showing
56 changed files
with
1,729 additions
and
156 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...mpipes-model/src/main/java/org/apache/streampipes/model/configuration/LocationConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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.model.configuration; | ||
|
||
import org.apache.streampipes.model.shared.annotation.TsModel; | ||
|
||
@TsModel | ||
public record LocationConfig(boolean locationEnabled, | ||
String tileServerUrl, | ||
String attributionText) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...t/src/main/java/org/apache/streampipes/rest/impl/admin/LocationConfigurationResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* 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.rest.impl.admin; | ||
|
||
import org.apache.streampipes.model.configuration.LocationConfig; | ||
import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource; | ||
import org.apache.streampipes.rest.security.AuthConstants; | ||
|
||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api/v2/admin/location-config") | ||
public class LocationConfigurationResource extends AbstractAuthGuardedRestResource { | ||
|
||
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) | ||
public LocationConfig getLocationConfig() { | ||
return getSpCoreConfigurationStorage().get().getLocationConfig(); | ||
} | ||
|
||
@PutMapping(consumes = MediaType.APPLICATION_JSON_VALUE) | ||
@PreAuthorize(AuthConstants.IS_ADMIN_ROLE) | ||
public ResponseEntity<Void> updateGeneralConfiguration(@RequestBody LocationConfig config) { | ||
var storage = getSpCoreConfigurationStorage(); | ||
var cfg = storage.get(); | ||
cfg.setLocationConfig(config); | ||
storage.updateElement(cfg); | ||
|
||
return ok(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
ui/cypress/support/utils/configuration/ConfigurationUtils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* 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. | ||
* | ||
*/ | ||
|
||
export class ConfigurationUtils { | ||
public static goToConfigurationExport() { | ||
cy.visit('#/configuration/export'); | ||
} | ||
|
||
public static goToSitesConfiguration() { | ||
cy.visit('#/configuration/sites'); | ||
} | ||
|
||
public static goToGeneralConfiguration() { | ||
cy.visit('#/configuration/general'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* 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. | ||
* | ||
*/ | ||
|
||
export class SiteUtils { | ||
public static CHECKBOX_ENABLE_LOCATION_FEATURES = | ||
'sites-enable-location-features-checkbox'; | ||
public static INPUT_TILE_SERVER_URL = 'sites-location-config-tile-server'; | ||
|
||
public static BUTTON_MANAGE_SITES = 'sites-manage-sites-button'; | ||
public static BUTTON_EDIT_SITE = 'sites-edit-button'; | ||
public static BUTTON_DELETE_SITE = 'sites-delete-button'; | ||
public static BUTTON_SITE_DIALOG_SAVE = 'sites-dialog-save-button'; | ||
public static BUTTON_SITE_DIALOG_CANCEL = 'sites-dialog-cancel-button'; | ||
public static BUTTON_SITE_DIALOG_REMOVE_AREA = | ||
'sites-dialog-remove-area-button'; | ||
public static BUTTON_SITE_DIALOG_ADD_AREA = 'sites-dialog-add-area-button'; | ||
|
||
public static INPUT_SITE_DIALOG_SITE_INPUT = 'sites-dialog-site-input'; | ||
public static INPUT_SITE_DIALOG_NEW_AREA_INPUT = | ||
'sites-dialog-new-area-input'; | ||
|
||
public static LABEL_TABLE_NAME = 'site-table-row-label'; | ||
public static LABEL_TABLE_AREA = 'site-table-row-areas'; | ||
|
||
public static enableGeoFeatures(tileServerUrl: string): void { | ||
cy.dataCy(SiteUtils.CHECKBOX_ENABLE_LOCATION_FEATURES).click(); | ||
cy.dataCy(SiteUtils.INPUT_TILE_SERVER_URL).clear().type(tileServerUrl); | ||
cy.dataCy('sites-location-features-button').click(); | ||
} | ||
|
||
public static createNewSite(name: string, areas: string[]): void { | ||
cy.dataCy(SiteUtils.BUTTON_MANAGE_SITES).click(); | ||
cy.dataCy(SiteUtils.INPUT_SITE_DIALOG_SITE_INPUT, { timeout: 2000 }) | ||
.clear() | ||
.type(name); | ||
|
||
areas.forEach(area => { | ||
cy.dataCy(SiteUtils.INPUT_SITE_DIALOG_NEW_AREA_INPUT) | ||
.clear() | ||
.type(area); | ||
cy.dataCy(SiteUtils.BUTTON_SITE_DIALOG_ADD_AREA).click(); | ||
}); | ||
|
||
cy.dataCy(this.BUTTON_SITE_DIALOG_SAVE).click(); | ||
} | ||
|
||
public static openEditSiteDialog() { | ||
cy.dataCy(SiteUtils.BUTTON_EDIT_SITE).first().click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
ui/cypress/tests/configuration/sites/sites-geo-features.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* 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. | ||
* | ||
*/ | ||
|
||
import { SiteUtils } from '../../../support/utils/configuration/SiteUtils'; | ||
import { ConfigurationUtils } from '../../../support/utils/configuration/ConfigurationUtils'; | ||
|
||
describe('Test geo features settings', () => { | ||
beforeEach('Setup Test', () => { | ||
cy.initStreamPipesTest(); | ||
}); | ||
|
||
it('Perform Test', () => { | ||
// enable geo features | ||
ConfigurationUtils.goToSitesConfiguration(); | ||
SiteUtils.enableGeoFeatures('url'); | ||
|
||
ConfigurationUtils.goToGeneralConfiguration(); | ||
ConfigurationUtils.goToSitesConfiguration(); | ||
|
||
cy.dataCy(SiteUtils.CHECKBOX_ENABLE_LOCATION_FEATURES) | ||
.find('input') | ||
.should('be.checked'); | ||
|
||
cy.dataCy(SiteUtils.INPUT_TILE_SERVER_URL).should('have.value', 'url'); | ||
}); | ||
}); |
Oops, something went wrong.