Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/docker/onecx/docker-spa-base-1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG authored Mar 6, 2024
2 parents 5bead4b + d645426 commit 5c74bed
Show file tree
Hide file tree
Showing 42 changed files with 5,814 additions and 3,126 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
uses: onecx/ci-angular/.github/workflows/build.yml@v1
secrets: inherit
with:
helmEventTargetRepository: onecx/onecx-announcement
helmEventTargetRepository: onecx/onecx-permission
12 changes: 5 additions & 7 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ app:
spec:
permissions:
APP:
EDIT: Edit app
SAVE: Update and save app
SEARCH: Search apps
VIEW: View mode for app
EDIT: Edit permission app details
SAVE: Update and save permission app details
SEARCH: Search permission apps
VIEW: View app details
PERMISSION:
GRANT: Assign or remove assignment of a permission to a role
GRANT: Assign or remove a permission to a role
CREATE: Create permission
DELETE: Delete permission
EDIT: Edit permission
Expand All @@ -44,5 +44,3 @@ app:
clientId: "onecx-permission-ui"

# PIPE Config


5,559 changes: 3,615 additions & 1,944 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
"@ngneat/falso": "^6.4.0",
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"@onecx/accelerator": "^4.5.1",
"@onecx/integration-interface": "^4.5.1",
"@onecx/keycloak-auth": "^4.5.1",
"@onecx/portal-integration-angular": "^4.5.1",
"@onecx/portal-layout-styles": "^4.5.1",
"@onecx/accelerator": "^4.9.0",
"@onecx/integration-interface": "^4.9.0",
"@onecx/keycloak-auth": "^4.9.0",
"@onecx/portal-integration-angular": "^4.9.0",
"@onecx/portal-layout-styles": "^4.9.0",
"file-saver": "^2.0.5",
"i18n-iso-countries": "^7.6.0",
"ngx-color": "^8.0.3",
Expand Down Expand Up @@ -85,22 +85,22 @@
"@schematics/angular": "15.2.6",
"@storybook/addon-essentials": "7.0.4",
"@storybook/angular": "7.6.14",
"@storybook/core-server": "7.0.4 ",
"@storybook/core-server": "7.6.17",
"@svgr/webpack": "^7.0.0",
"@swc-node/register": "^1.6.5",
"@swc/cli": "~0.1.63",
"@swc/core": "^1.3.56",
"@swc/helpers": "0.5.1",
"@swc/helpers": "0.5.6",
"@types/jasmine": "~3.10.0",
"@types/node": "18.16.3",
"@typescript-eslint/eslint-plugin": "5.48.2",
"@typescript-eslint/parser": "5.62.0",
"autoprefixer": "10.4.14",
"chromatic": "^6.17.4",
"css-loader": "^6.7.3",
"css-loader": "^6.10.0",
"cypress": "^12.11.0",
"eslint": "^8.33.0",
"eslint-config-prettier": "8.8.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-cypress": "^2.13.3",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "6.7.1",
Expand Down Expand Up @@ -131,7 +131,7 @@
"stylus": "^0.59.0",
"stylus-loader": "^7.1.0",
"tailwindcss": "3.3.2",
"ts-node": "10.9.1",
"ts-node": "10.9.2",
"typescript": "4.9.5",
"url-loader": "^4.1.1",
"webpack": "^5.82.0",
Expand Down
79 changes: 79 additions & 0 deletions scripts/load-permissions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

# relative paths to values.yaml and Chart.yaml
values_file="helm/values.yaml"
chart_file="helm/Chart.yaml"

array=()

if [ ! -f "$values_file" ]; then
echo "\"$values_file\" cannot be found - execute this script from product root directory"
exit 1
fi
if [ ! -f "$chart_file" ]; then
echo "\"$chart_file\" cannot be found - execute this script from product root directory"
exit 1
fi

extract_app_id_and_product_name() {
app_id=$(sed -n '2 s/^name: \([^ ]*\).*/\1/p' "$chart_file")
app_name=$(sed -n '4 s/description: //p' "$chart_file")
product_name=$(echo "$app_id" | sed 's/-ui$//')
echo "=> app id: $app_id"
echo "=> app name: $app_name"
echo "=> product name: $product_name"
}

find_permissions() {
while IFS= read -r line; do
if [[ "$line" == *"permissions:"* ]]; then
permissions_spaces=$(echo "$line" | grep -oE '^[[:space:]]*' | wc -c)

while IFS= read -r next_line; do
next_spaces=$(echo "$next_line" | grep -oE '^[[:space:]]*' | wc -c)

if (( next_spaces <= permissions_spaces )); then
break
fi
if (( next_spaces == permissions_spaces + 2 )); then
current_key=$(echo "$next_line" | tr -d ':' | tr -d ' ')
elif (( next_spaces == permissions_spaces + 4 )); then
value=$(echo "$next_line" | awk -F ':' '{print $1}' | tr -d ' ')
description=$(echo "$next_line" | awk -F ':' '{$1=""; print $0}' | sed 's/^ *//')
echo -e "Key: $current_key \t Value: $value \t Description: $description"
array+=( "{\"resource\":\"$current_key\",\"action\":\"$value\",\"description\":\"$description\"}" )
fi
done < <(sed -n "/permissions:/,/^$/p" "$values_file" | tail -n +2)
break
fi
done < "$values_file"
}

create_json() {
permissions_json="{"
permissions_json+="\"name\": \"$app_name\","
permissions_json+="\"description\": \"local permission import\","
permissions_json+="\"permissions\":["

for ((i = 0; i < ${#array[@]}; i++)); do
permissions_json+="${array[i]}"
if ((i < ${#array[@]} - 1)); then
permissions_json+=","
fi
done

permissions_json+="]"
permissions_json+="}"
}

send_permission_to_svc() {
echo "=> send permissions to service"
curl -v -X PUT -H "Content-Type: application/json" -d "$permissions_json" \
http://onecx-permission-svc/operator/v1/$product_name/$app_id
}

extract_app_id_and_product_name
find_permissions
create_json
send_permission_to_svc
exit 0
201 changes: 201 additions & 0 deletions src/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
// disable preset of opacity in form: not readable
@mixin make-disabled-form-readable-input {
:host ::ng-deep {
.p-inputtext.p-component:disabled {
opacity: unset;
}
}
}

@mixin make-disabled-form-readable-dropdown {
:host ::ng-deep {
.p-dropdown.p-component.p-disabled {
opacity: unset;
}
}
}

@mixin prepare-inputgroup {
:host ::ng-deep {
.inputgroup-dropdown-with-link {
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.input-field-correction .p-inputtext {
padding-top: 1rem !important;
padding-bottom: 0.5rem !important;
}
.pseudo-button:hover {
background: var(--button-hover-bg) !important;
cursor: pointer;
* {
background: var(--button-hover-bg) !important;
}
}
}
}

@mixin card-badges {
:host ::ng-deep {
.card-badge-right {
display: inline-block;
position: absolute;
right: 3px;
&.badge-1 {
top: 3px;
}
&.badge-2 {
top: 35px;
}
}
.card-badge-left {
display: inline-block;
position: absolute;
left: 3px;
&.badge-1 {
top: 3px;
}
&.badge-2 {
top: 35px;
}
}
.pseudo-button-link {
border-radius: var(--border-radius);
&:hover {
color: var(--primary-color-text);
background: var(--button-hover-bg);
cursor: pointer;
padding: 5px !important;
}
}
}
}

@mixin correct-data-view-control {
:host ::ng-deep {
.data-view-control,
.data-view-control * {
color: var(--emphasis-medium);
}
// correction for data-view-control component
.data-view-control-border {
border: var(--toggle-button-border);
&.p-dropdown {
.p-inputtext {
color: var(--emphasis-medium);
opacity: 0.9;
}
&:last-of-type {
border-top-left-radius: var(--border-radius);
border-bottom-left-radius: var(--border-radius);
}
}
&.p-inputtext:hover,
&.p-dropdown:hover {
border-color: rgb(0 0 0 / 30%) !important;
}
}
}
}

@mixin correct-search-criteria {
:host ::ng-deep {
.search-criteria-container > div {
display: flex;
flex-wrap: wrap;
align-content: center;
row-gap: 0.5rem;
column-gap: 3rem;
.search-criteria-buttons {
flex-wrap: wrap;
align-content: center;
margin-left: 0.5rem;
margin-top: unset;
}
}
}
}

@mixin search-criteria-select-button-slim {
:host ::ng-deep {
.slim-selectbutton {
display: flex;
flex-wrap: wrap;
flex-direction: column;
row-gap: 0.1rem;
align-items: center;

.p-selectbutton .p-button {
text-align: center;
display: inline-block;
color: var(--emphasis-medium);
font-weight: var(--font-weight);
padding: 0.3rem 0.8rem;
border: var(--input-border);
}
.p-selectbutton-subtitle {
color: var(--emphasis-medium);
font-size: 0.8rem;
}
}
}
}
@mixin search-criteria-select-button-filter {
:host ::ng-deep {
.filter-selectbutton {
.p-selectbutton .p-button {
opacity: 0.9 !important;
border: var(--toggle-button-border);
&.p-highlight {
background: var(--toggle-button-active-bg);
border-color: var(--toggle-button-active-border-color);
}
&:not(.p-disabled):not(.p-highlight):hover {
color: var(--text-color);
border-color: var(--toggle-button-hover-border-color);
background-color: var(--toggle-button-hover-bg);
}
}
}
}
}
@mixin search-criteria-select-button {
:host ::ng-deep {
.p-selectbutton-title {
width: 2rem;
text-align: right;
}
.search-criteria-selectbutton {
.p-selectbutton .p-button {
&.p-highlight {
color: var(--primary-text-color);
border-color: var(--toggle-button-hover-border-color);
background-color: var(--primary-color);
}
&:not(.p-disabled):not(.p-highlight):hover {
color: var(--primary-text-color);
border-color: var(--toggle-button-hover-border-color);
background-color: var(--button-hover-bg);
}
}
}
}
}
@mixin table-inline-buttons {
:host ::ng-deep {
// reduce the size of buttons used inside a table row
th button.p-button,
td button.p-button {
&.p-button-icon-only {
width: unset !important;
}
&.p-button-rounded {
height: unset !important;
}
&:disabled {
opacity: 0.38 !important;
}
}
}
}
Loading

0 comments on commit 5c74bed

Please sign in to comment.