Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.gui
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RELEASE=PRE-ALPHA-test
VERSION=1
BUILD=1
FIX=16
VERSION=3
BUILD=3
FIX=3-test
47 changes: 47 additions & 0 deletions .github/workflows/ci-build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and publish GUI

on:
push:
branches: [ v3.3.1 ]
paths:
- '.env.gui'

jobs:
PackageDeploy:
runs-on: ubuntu-latest

steps:
- name: Debugging Step
run: |
echo "Checking runner status..."
# Add more debugging commands as needed

- uses: actions/checkout@v2

- name: Docker Setup BuildX
uses: docker/setup-buildx-action@v2

Check failure on line 22 in .github/workflows/ci-build-image.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use full commit SHA hash for this dependency.

See more on https://sonarcloud.io/project/issues?id=buerokratt_Service-Module&issues=AaAza99aWmKYwrGfLoOv&open=AaAza99aWmKYwrGfLoOv&pullRequest=1153

- name: Load environment variables and set them
run: |
if [ -f .env.gui ]; then
export $(cat .env.gui | grep -v '^#' | xargs)
fi
echo "RELEASE=$RELEASE" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "BUILD=$BUILD" >> $GITHUB_ENV
echo "FIX=$FIX" >> $GITHUB_ENV
- name: Set repo
run: |
LOWER_CASE_GITHUB_REPOSITORY=$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')
echo "DOCKER_TAG_CUSTOM=ghcr.io/${LOWER_CASE_GITHUB_REPOSITORY}:$RELEASE-$VERSION.$BUILD.$FIX" >> $GITHUB_ENV
echo "$GITHUB_ENV"
- name: Docker Build
run: |
cd GUI
docker image build --tag $DOCKER_TAG_CUSTOM .

- name: Log in to GitHub container registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

Check warning on line 44 in .github/workflows/ci-build-image.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Avoid expanding secrets in a run block.

See more on https://sonarcloud.io/project/issues?id=buerokratt_Service-Module&issues=AaAza99aWmKYwrGfLoOu&open=AaAza99aWmKYwrGfLoOu&pullRequest=1153

- name: Push Docker image to ghcr
run: docker push $DOCKER_TAG_CUSTOM
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
.DS_Store
.vscode
.env
.env.gui

**/node_modules
**/dist
Expand Down
6 changes: 6 additions & 0 deletions DSL/Resql/services/POST/get-service-status-by-name.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT current_state
FROM services
WHERE name = :service_name
AND NOT deleted
ORDER BY id DESC
LIMIT 1;
5 changes: 3 additions & 2 deletions DSL/Resql/services/POST/get-services-list.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ SELECT
current_state AS state,
ruuter_type AS type,
slot,
CEIL((SELECT COUNT(DISTINCT service_id) FROM services WHERE NOT deleted AND (:is_common::TEXT = '' OR is_common = (:is_common::TEXT)::BOOLEAN)) / :page_size::DECIMAL) AS total_pages
CEIL((SELECT COUNT(DISTINCT service_id) FROM services WHERE NOT deleted AND (:is_common::TEXT = '' OR is_common = (:is_common::TEXT)::BOOLEAN) AND (:search IS NULL OR :search = '' OR LOWER(name) LIKE LOWER('%' || :search || '%'))) / :page_size::DECIMAL) AS total_pages
FROM services
WHERE NOT deleted
WHERE NOT deleted
AND (:is_common::TEXT = '' OR is_common = (:is_common::TEXT)::BOOLEAN)
AND (:search IS NULL OR :search = '' OR LOWER(name) LIKE LOWER('%' || :search || '%'))
ORDER BY
CASE WHEN :sorting = 'name asc' THEN name END ASC,
CASE WHEN :sorting = 'name desc' THEN name END DESC,
Expand Down
6 changes: 5 additions & 1 deletion DSL/Ruuter/services/POST/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ declaration:
description: "Body field 'sorting'"
- field: is_common
type: boolean
description: "Body field 'is_common'"
description: "Body field 'is_common'"
- field: search
type: string
description: "Body field 'search'"

get_services_list:
call: http.post
Expand All @@ -30,6 +33,7 @@ get_services_list:
page_size: ${incoming.body.page_size}
sorting: ${incoming.body.sorting}
is_common: ${incoming.body.is_common}
search: ${incoming.body.search}
limit: 600
result: services_res

Expand Down
2 changes: 1 addition & 1 deletion DSL/Ruuter/services/POST/services/add.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ delete_all_mcq_files:
url: "[#SERVICE_DMAPPER]/file-manager/delete-all-that-starts-with"
body:
path: "[#RUUTER_SERVICES_PATH]/${type}/services/draft"
keyword: "${name}_"
keyword: "${name}_mcq_"
result: deleteRes

convert_json_content_to_yml:
Expand Down
2 changes: 1 addition & 1 deletion DSL/Ruuter/services/POST/services/delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ delete_mcq_files:
url: "[#SERVICE_DMAPPER]/file-manager/delete-all-that-starts-with"
body:
path: "[#RUUTER_SERVICES_PATH]/${ruuter_type}/[#RUUTER_SERVICES_DIR_PATH]/${old_file_status_path}"
keyword: "${name_res.response.body[0].name}_"
keyword: "${name_res.response.body[0].name}_mcq_"
result: deleted_mcq

return_ok:
Expand Down
4 changes: 2 additions & 2 deletions DSL/Ruuter/services/POST/services/edit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ delete_old_mcq_files:
url: "[#SERVICE_DMAPPER]/file-manager/delete-all-that-starts-with"
body:
path: "[#RUUTER_SERVICES_PATH]/${type}/services/active"
keyword: "${get_service_result.response.body[0].name}_"
keyword: "${get_service_result.response.body[0].name}_mcq_"
result: deleteOldRes
next: delete_all_mcq_files

Expand All @@ -113,7 +113,7 @@ delete_all_mcq_files:
url: "[#SERVICE_DMAPPER]/file-manager/delete-all-that-starts-with"
body:
path: "[#RUUTER_SERVICES_PATH]/${type}/services/active"
keyword: "${name}_"
keyword: "${name}_mcq_"
result: deleteRes
next: check_for_content

Expand Down
6 changes: 3 additions & 3 deletions DSL/Ruuter/services/POST/services/status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ activate_all_mcq_services:
body:
file_path: "[#RUUTER_SERVICES_PATH]/${ruuter_type}/[#RUUTER_SERVICES_DIR_PATH]/${old_file_status_path}"
new_path: "[#RUUTER_SERVICES_PATH]/${ruuter_type}/[#RUUTER_SERVICES_DIR_PATH]/active"
keyword: "${name}_"
keyword: "${name}_mcq_"
format: "yml"
result: active_move_results
next: return_ok
Expand Down Expand Up @@ -257,7 +257,7 @@ dactivate_all_mcq_services:
body:
file_path: "[#RUUTER_SERVICES_PATH]/${ruuter_type}/[#RUUTER_SERVICES_DIR_PATH]/${old_file_status_path}"
new_path: "[#RUUTER_SERVICES_PATH]/${ruuter_type}/[#RUUTER_SERVICES_DIR_PATH]/inactive"
keyword: "${name}_"
keyword: "${name}_mcq_"
format: "tmp"
result: inactive_move_results
next: return_ok
Expand All @@ -279,7 +279,7 @@ draft_all_mcq_services:
body:
file_path: "[#RUUTER_SERVICES_PATH]/${ruuter_type}/[#RUUTER_SERVICES_DIR_PATH]/${old_file_status_path}"
new_path: "[#RUUTER_SERVICES_PATH]/${ruuter_type}/[#RUUTER_SERVICES_DIR_PATH]/draft"
keyword: "${name}_"
keyword: "${name}_mcq_"
format: "tmp"
result: inactive_move_results
next: return_ok
Expand Down
25 changes: 24 additions & 1 deletion DSL/Ruuter/services/TEMPLATES/jump-to-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,35 @@ check_for_body:
switch:
- condition: ${incoming.body == null || incoming.body.serviceName == null || incoming.body.serviceName == ""}
next: missing_service_name
next: get_service_status

get_service_status:
call: http.post
args:
url: "[#SERVICE_RESQL]/get-service-status-by-name"
body:
service_name: ${incoming.body.serviceName}
result: service_status_res
next: assign_service_status

assign_service_status:
assign:
service_status: "${service_status_res.response.body[0] && service_status_res.response.body[0].currentState === 'active' ? 'active' : 'draft'}"
next: get_new_nonce

get_new_nonce:
call: http.post
args:
url: "[#SERVICE_TRAINING_RESQL]/get-new-nonce"
result: nonce_res
next: trigger_service

trigger_service:
call: http.post
args:
url: "[#SERVICE_RUUTER]/services/active/${incoming.body.serviceName}"
url: "[#SERVICE_RUUTER]/services/${service_status}/${incoming.body.serviceName}"
headers:
x-ruuter-nonce: ${nonce_res.response.body[0].nonce}
body:
chatId: ${incoming.body.chatId}
authorId: ${incoming.body.authorId}
Expand Down
10 changes: 10 additions & 0 deletions GUI/src/services/service-tester.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1297,4 +1297,14 @@ describe('addSuccessMessages', () => {
expect(mockAddBotMessage).toHaveBeenCalledWith('Test response content', undefined);
expect(mockAddSuccess).toHaveBeenCalledWith('chat.service-test-success');
});

it('should not throw and should skip the bot message when the response array is empty', () => {
const responseData = {
response: [],
};

expect(() => addSuccessMessages(responseData)).not.toThrow();
expect(mockAddBotMessage).not.toHaveBeenCalled();
expect(mockAddSuccess).toHaveBeenCalledWith('chat.service-test-success');
});
});
6 changes: 4 additions & 2 deletions GUI/src/services/service-tester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,10 @@ export const executeService = async (state: ServiceState, name: string, input: s
};

export const addSuccessMessages = (responseData: ServiceResponse): void => {
const res = responseData.response[0];
const res = responseData.response?.[0];
const store = useTestServiceStore.getState();
store.addBotMessage(res.content, res.buttons);
if (res) {
store.addBotMessage(res.content, res.buttons);
}
store.addSuccess('chat.service-test-success');
};
2 changes: 2 additions & 0 deletions GUI/src/store/services.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const useServiceListStore = create<ServiceStoreState>()(
page_size: pagination.pageSize,
sorting: sort,
is_common: false,
search: '',
});
const services =
result.data.response[0].map?.((item: any) => ({
Expand Down Expand Up @@ -99,6 +100,7 @@ const useServiceListStore = create<ServiceStoreState>()(
page_size: pagination.pageSize,
sorting: sort,
is_common: true,
search: '',
});
const services =
result.data.response[0].map?.((item: any) => ({
Expand Down
6 changes: 3 additions & 3 deletions release.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
main
MAJOR=1
MINOR=1
PATCH=45
MAJOR=3
MINOR=3
PATCH=1
Loading