Skip to content

Commit

Permalink
Merge branch 'master' into 28337-binary-field-information-of-assets-n…
Browse files Browse the repository at this point in the history
…eeds-be-refreshed-after-any-change
  • Loading branch information
zJaaal authored Aug 13, 2024
2 parents ab20661 + 2e54089 commit 983abb4
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 36 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/legacy-release_sbom-generator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Generate SBOM for latest version of dotCMS and put into core-test-repo
on:
release:
types: [published]
workflow_dispatch:
inputs:
dotcms_version:
description: 'Enter the dotCMS version (vYY.MM.DD)'
required: true
default: ''

jobs:
scan:
runs-on: ubuntu-latest
permissions:
contents: write # Ensure write access to contents

steps:
- name: Checkout core-test-results repository
uses: actions/checkout@v3
with:
repository: dotCMS/core-test-results
token: ${{ secrets.GITHUB_TOKEN }}
path: core-test-results

- name: Get dotCMS release version
id: get_version
run: |
if [ "${{ github.event_name }}" == "release" ]; then
# Extract the tag name from the release event context
latest_tag=${{ github.event.release.tag_name }}
else
# Use the input provided in manual run
latest_tag=${{ github.event.inputs.dotcms_version }}
fi
# Format the tag name if necessary
formatted_tag=$(echo "$latest_tag" | sed -e 's/^dotcms-cli-//' -e 's/^v//')
echo "Latest tag: $formatted_tag"
echo "DOTCMS_VERSION=$formatted_tag" >> $GITHUB_ENV
- name: Pull and run dotCMS Docker image
run: |
docker pull dotcms/dotcms:${{ env.DOTCMS_VERSION }}
docker run -d -p 8082:8082 dotcms/dotcms:${{ env.DOTCMS_VERSION }}
- name: Install pipx
run: |
pip install pipx
- name: Scan Docker Image with Syft
run: |
pipx run anchore_syft dotcms/dotcms:${{ env.DOTCMS_VERSION }} -o cyclonedx-xml > core-test-results/sbom/cyclonedx.json
- name: Rename SBOM file with dotCMS version
run: |
mkdir -p core-test-results/sbom
mv core-test-results/sbom/cyclonedx.json core-test-results/sbom/dotcms-${{ env.DOTCMS_VERSION }}.json
- name: Configure Git
run: |
git config --global user.email "action@github.com"
git config --global user.name "Github Actions"
- name: Commit and push results to core-test-results repository
run: |
cd core-test-results
git add sbom/dotcms-${{ env.DOTCMS_VERSION }}.json
git commit -m "Add SBOM for dotCMS version ${{ env.DOTCMS_VERSION }}" || echo "No changes to commit"
git push origin master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('CategoriesService', () => {
const inode = 'inode-identifier';
spectator.service.getChildren(inode).subscribe();
spectator.expectOne(
`${API_URL}/children?inode=${inode}&per_page=${ITEMS_PER_PAGE}&direction=ASC&showChildrenCount=true`,
`${API_URL}/children?inode=${inode}&per_page=${ITEMS_PER_PAGE}&direction=ASC&parentList=true&showChildrenCount=true`,
HttpMethod.GET
);
});
Expand All @@ -23,7 +23,7 @@ describe('CategoriesService', () => {
const filter = 'query';
spectator.service.getChildren(inode, { filter }).subscribe();
spectator.expectOne(
`${API_URL}/children?inode=${inode}&per_page=${ITEMS_PER_PAGE}&direction=ASC&filter=${filter}&allLevels=true`,
`${API_URL}/children?inode=${inode}&per_page=${ITEMS_PER_PAGE}&direction=ASC&parentList=true&filter=${filter}&allLevels=true`,

HttpMethod.GET
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ export interface GetChildrenParams {
showChildrenCount: boolean;
filter?: string;
allLevels?: boolean;
parentList?: boolean;
}

const DEFAULT_PARAMS: Omit<GetChildrenParams, 'inode'> = {
per_page: 7000,
direction: 'ASC',
showChildrenCount: true,
allLevels: false
allLevels: false,
parentList: true
};

/**
Expand Down Expand Up @@ -90,7 +92,8 @@ export class CategoriesService {
let httpParams = new HttpParams()
.set('inode', params.inode)
.set('per_page', params.per_page.toString())
.set('direction', params.direction);
.set('direction', params.direction)
.set('parentList', params.parentList);

if (!params.filter) {
// No add showChildrenCount when we use filter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,27 +295,21 @@ export const CategoryFieldStore = signalStore(
return categoryService.getChildren(categoryInode).pipe(
tapResponse({
next: (newCategories) => {
const changes: Partial<CategoryFieldState> = {
categories: removeEmptyArrays([
...store.categories(),
newCategories
]),
state: ComponentStatus.LOADED
};
if (event) {
patchState(store, {
categories: removeEmptyArrays([
...store.categories(),
newCategories
]),
state: ComponentStatus.LOADED,
keyParentPath: [
...store.keyParentPath(),
event.item.key
]
});
} else {
patchState(store, {
categories: removeEmptyArrays([
...store.categories(),
newCategories
]),
state: ComponentStatus.LOADED
});
changes.keyParentPath = [
...store.keyParentPath(),
event.item.key
];
}

patchState(store, changes);
},
error: () => {
// TODO: Add Error Handler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ describe('CategoryFieldUtils', () => {
const item: DotCategoryFieldKeyValueObj = {
key: CATEGORY_LEVEL_1[1].key,
value: CATEGORY_LEVEL_1[1].categoryName,
inode: CATEGORY_LEVEL_1[1].inode
inode: CATEGORY_LEVEL_1[1].inode,
path: ''
};

const expected: DotCategoryFieldKeyValueObj[] = [...storedSelected, item];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const transformCategory = (
const { key, inode, categoryName, childrenCount } = category;
const hasChildren = childrenCount > 0;

const path = category.parentList ? getParentPath(category.parentList) : '';
const path = getParentPath(category.parentList ?? []);

return {
key,
Expand Down Expand Up @@ -181,7 +181,7 @@ export const updateChecked = (
if (!currentChecked.some((entry) => entry.key === item.key)) {
currentChecked = [
...currentChecked,
{ key: item.key, value: item.value, inode: item.inode }
{ key: item.key, value: item.value, inode: item.inode, path: item?.path ?? '' }
];
}
} else {
Expand All @@ -199,14 +199,14 @@ export const updateChecked = (
* @param parentList
*/
export const getParentPath = (parentList: DotCategoryParent[]): string => {
if (parentList) {
return parentList
.slice(1)
.map((parent) => parent.name)
.join(' / ');
if (parentList.length === 0) {
return '';
}

return '';
return parentList
.slice(1)
.map((parent) => parent.name)
.join(' / ');
};

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<table class="accordionEntry" style="margin-top:-10px;">
<table class="accordionEntry">

<tr>
<th style="padding-left:20px;" class="permissionType">${contentWillInherit} (Children)</th>
Expand All @@ -11,4 +11,4 @@
<tr>
<td colspan="6" style="padding-top:18px;font-style:italic;font-size:93%">${permissionsOnContentTypeChildren}</td>
</tr>
</table>
</table>
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@
}
});
var mySize = this._contentBox;
if (isHost && !inheritingPermissions) {
this._verticalSpace = 280;
}else if (isFolder && !inheritingPermissions) {
Expand All @@ -216,7 +218,7 @@
// Memo size to make displayed child
this._containerContentBox = {
h: this._verticalSpace,
h: 'auto',
w: mySize.w
};
Expand Down Expand Up @@ -332,7 +334,6 @@
function adjustAccordionHeigth() {
var container = dijit.byId('permissionsAccordionContainer');
container.resize();
}
function addPermissionsAccordionPane(role) {
Expand Down Expand Up @@ -363,7 +364,11 @@
else
break;
}
accordionContainer.addChild(contentPane, insertIndex);
}
function initPermissionsAccordionPane(role) {
Expand Down

0 comments on commit 983abb4

Please sign in to comment.