Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Nov 22, 2023
2 parents 2d070d4 + b10d7b8 commit 4863366
Show file tree
Hide file tree
Showing 24 changed files with 327 additions and 224 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [11, 17]
java: [11, 17, 21]
os: [ubuntu-latest]
distribution: [temurin]

Expand All @@ -32,6 +32,6 @@ jobs:
java-version: ${{ matrix.java }}
maven-executable: ./mvnw
sonar-run-on-os: ubuntu-latest
sonar-run-on-java-version: 11
sonar-run-on-java-version: 17
sonar-token: ${{ secrets.SONAR_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/maven-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

name: Deploy

concurrency: ${{ github.workflow }}

on:
push:
branches:
Expand All @@ -15,7 +17,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure GIT
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-from-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ncipollo/release-action@v1
with:
body: 'Changes: https://wcm.io/caconfig/editor/changes-report.html'
Expand Down
Binary file modified .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
8 changes: 4 additions & 4 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
# 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.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
8 changes: 4 additions & 4 deletions bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<parent>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.caconfig.editor.parent</artifactId>
<version>1.15.6</version>
<version>1.15.8</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

<groupId>io.wcm</groupId>
<artifactId>io.wcm.caconfig.editor</artifactId>
<version>1.15.6</version>
<version>1.15.8</version>
<packaging>jar</packaging>

<name>Context-Aware Configuration Editor</name>
Expand All @@ -42,7 +42,7 @@
<site.url.module.prefix>caconfig/editor/bundle</site.url.module.prefix>

<!-- Enable reproducible builds -->
<project.build.outputTimestamp>2023-03-27T10:08:28Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2023-11-22T14:18:24Z</project.build.outputTimestamp>
</properties>

<dependencies>
Expand Down Expand Up @@ -112,7 +112,7 @@
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
<version>5.1.2</version>
<version>5.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* #%L
* wcm.io
* %%
* Copyright (C) 2023 wcm.io
* %%
* Licensed 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.
* #L%
*/
package io.wcm.caconfig.editor.impl;

import java.util.stream.Stream;

import org.apache.commons.lang3.StringUtils;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;

/**
* Detects Unified Shell (on AEMaaCS).
*/
@Component(service = UnifiedShellDetector.class, immediate = true)
public class UnifiedShellDetector {

private static final String BUNDLE_UNIFIED_SHELL_INTEGRATION = "com.adobe.cq.unifiedshell.unified-shell-integration";

private boolean available;

@Activate
private void activate(BundleContext bundleContext) {
this.available = Stream.of(bundleContext.getBundles())
.anyMatch(bundle -> StringUtils.equals(bundle.getSymbolicName(), BUNDLE_UNIFIED_SHELL_INTEGRATION));
}

/**
* @return True if Unified Shell Bundle is available
*/
public boolean isAvailable() {
return this.available;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import io.wcm.caconfig.editor.impl.ConfigNamesServlet;
import io.wcm.caconfig.editor.impl.ConfigPersistServlet;
import io.wcm.caconfig.editor.impl.EditorConfig;
import io.wcm.caconfig.editor.impl.UnifiedShellDetector;

/**
* Provides editor configuration options
Expand All @@ -67,6 +68,8 @@ public class EditorConfiguration {
private ConfigurationResourceResolver configResourceResolver;
@OSGiService
private EditorConfig editorConfig;
@OSGiService
private UnifiedShellDetector unifiedShellDetector;

private String servletContextPathPrefix;
private String configNamesUrl;
Expand All @@ -78,6 +81,7 @@ public class EditorConfiguration {
private String language;
private boolean enabled;
private boolean canReplicate;
private boolean unifiedShellAvailable;

@PostConstruct
private void activate() {
Expand All @@ -94,6 +98,7 @@ private void activate() {
this.language = request.getLocale().getLanguage();
this.enabled = editorConfig.isEnabled();
this.canReplicate = hasPermission(Replicator.REPLICATE_PRIVILEGE);
this.unifiedShellAvailable = unifiedShellDetector.isAvailable();
}

private String buildServletPath(String selector) {
Expand Down Expand Up @@ -174,4 +179,8 @@ public boolean isCanReplicate() {
return this.canReplicate;
}

public boolean isUnifiedShellAvailable() {
return this.unifiedShellAvailable;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
/**
* Controllers used by the configuration editor scripts internally.
*/
@org.osgi.annotation.versioning.Version("2.4")
@org.osgi.annotation.versioning.Version("2.5")
package io.wcm.caconfig.editor.model;
13 changes: 7 additions & 6 deletions bundle/src/main/resources/angularjs-partials/overviewView.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
bo-text="i18n('button.managePublication')"></button>

<div class="category-filter" ng-if="overview.state.hasConfigCategories">
<label for="categoryFilter">{{i18n('categoryFilter.label')}}</label>
<coral-select id="caconfig-configurationOverviewFilter">
<coral-select-item value="" bo-text="i18n('categoryFilter.all')"></coral-select-item>
<coral-select-item ng-repeat="category in overview.state.configCategories" bo-value="category.category" bo-text="category.label"
bo-attr bo-attr-selected="{{categoryFilter==category.category}}"></coral-select-item>
</coral-select>
<div class="category-filter-inner">
<label for="categoryFilter">{{i18n('categoryFilter.label')}}</label>
<coral-select id="caconfig-configurationOverviewFilter">
<coral-select-item ng-repeat="category in overview.state.configCategories" bo-value="category.category" bo-text="category.label"
bo-attr bo-attr-selected="{{categoryFilter==category.category}}"></coral-select-item>
</coral-select>
</div>
</div>

<p class="caconfig-contextPath"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"granite.ui.coral.foundation",
"io.wcm.caconfig.editor.angularjs",
"io.wcm.caconfig.editor.validation"
]
],
"jsProcessor": ["min:gcc;languageIn=ECMASCRIPT_2015"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ span.caconfig-tagbrowser {
display: inline-block;
margin-left: 1rem;
}
.category-filter-inner {
display: flex;
align-items: center;
}
.category-filter label {
margin-right: 0.25rem;
margin-right: 0.5rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Config Cache service
*
* Storing Config Data information in memory / in local storage.
* Storing Config Data information in memory / in session storage.
*/
angular.module("io.wcm.caconfig.editor")
.service("configCacheService", ConfigCacheService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@
state.configCategories = response.data.configCategories;
state.hasConfigCategories = response.data.configCategories && response.data.configCategories.length > 0;

// add category labels to config names
if (state.hasConfigCategories) {
// add "all" config categories item
state.configCategories.unshift({category:'',label:$rootScope.i18n("categoryFilter.all")});
// add category labels to config names
state.configNames.forEach(configName => {
configName.categoryLabel = state.configCategories.find(item => item.category==configName.category)?.label
const categoryItem = state.configCategories.find(item => item.category==configName.category)
if (categoryItem) {
configName.categoryLabel = categoryItem.label
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,21 @@
function OverviewController($document, $window, $rootScope, $timeout, configService, modalService, publishService) {
var that = this;

function validateSelectedCategory(category) {
if (!that.state.configCategories.find(item => item.category == category)) {
return '';
}
return category;
}

$rootScope.title = $rootScope.i18n("title");
that.state = configService.getState();
configService.loadConfigNames()
.then(function() {
that.ovReady = true;

// get last selected category filter
var lastCategoryFilter = $window.localStorage.getItem(STORAGE_OVERVIEW_CATEGORYFILTER);
if (!that.state.configCategories.find(item => item.category == lastCategoryFilter)) {
lastCategoryFilter = undefined;
}
$rootScope.categoryFilter = lastCategoryFilter;
$rootScope.categoryFilter = validateSelectedCategory($window.localStorage.getItem(STORAGE_OVERVIEW_CATEGORYFILTER));

// ugly block of code to register event of coral-select and propagate it's value to AngularJS change
// the coral-select widget itself lives outside AngularJS' controls
Expand All @@ -50,8 +53,10 @@
if (select) {
Coral.commons.ready(select, function(component) {
$(component).on('change', function() {
$rootScope.categoryFilter = component.value;
$window.localStorage.setItem(STORAGE_OVERVIEW_CATEGORYFILTER, component.value);
var selectedCategory = validateSelectedCategory(component.value);
$rootScope.categoryFilter = selectedCategory;
console.log('new categoryFilter: [' + selectedCategory + ']');
$window.localStorage.setItem(STORAGE_OVERVIEW_CATEGORYFILTER, selectedCategory);
$rootScope.$apply();
});
});
Expand Down Expand Up @@ -94,7 +99,7 @@
if (configName.exists != true) {
return false;
}
if (categoryFilter) {
if (categoryFilter && categoryFilter != '') {
return configName.category == categoryFilter;
}
return true;
Expand Down
Loading

0 comments on commit 4863366

Please sign in to comment.