diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 074726e..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: CI - -on: - push: - branches: - - master - pull_request: - -concurrency: - group: master-checktrack_connector-${{ github.event.number }} - cancel-in-progress: true - -jobs: - tests: - runs-on: ubuntu-latest - strategy: - fail-fast: false - name: Server - - services: - redis-cache: - image: redis:alpine - ports: - - 13000:6379 - redis-queue: - image: redis:alpine - ports: - - 11000:6379 - mariadb: - image: mariadb:10.6 - env: - MYSQL_ROOT_PASSWORD: root - ports: - - 3306:3306 - options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3 - - steps: - - name: Clone - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18 - check-latest: true - - - name: Cache pip - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py', '**/setup.cfg') }} - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: 'echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT' - - - uses: actions/cache@v4 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - name: Install MariaDB Client - run: sudo apt-get install -y mariadb-client - - - name: Setup - run: | - pip install frappe-bench - bench init --skip-redis-config-generation --skip-assets --python "$(which python)" ~/frappe-bench - mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'" - mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'" - - name: Install - working-directory: /home/runner/frappe-bench - run: | - bench get-app checktrack_connector $GITHUB_WORKSPACE - bench setup requirements --dev - bench new-site --db-root-password root --admin-password admin test_site - bench --site test_site install-app checktrack_connector - bench build - env: - CI: 'Yes' - - - name: Run Tests - working-directory: /home/runner/frappe-bench - run: | - bench --site test_site set-config allow_tests true - bench --site test_site run-tests --app checktrack_connector - env: - TYPE: server \ No newline at end of file diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 3f418ba..0000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Linters - -on: - pull_request: - workflow_dispatch: - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - linter: - name: 'Frappe Linter' - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - cache: pip - - uses: pre-commit/action@v3.0.0 - - - name: Download Semgrep rules - run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules - - - name: Run Semgrep rules - run: | - pip install semgrep - semgrep ci --config ./frappe-semgrep-rules/rules --config r/python.lang.correctness - deps-vulnerable-check: - name: 'Vulnerable Dependency Check' - runs-on: ubuntu-latest - - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - - uses: actions/checkout@v4 - - - name: Cache pip - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- - - name: Install and run pip-audit - run: | - pip install pip-audit - cd ${GITHUB_WORKSPACE} - pip-audit --desc on . \ No newline at end of file diff --git a/checktrack_connector/api.py b/checktrack_connector/api.py index ab5ce9a..979a43f 100644 --- a/checktrack_connector/api.py +++ b/checktrack_connector/api.py @@ -720,12 +720,14 @@ def check_tenant_exists(email): # Step 1: Get access token using hardcoded credentials auth_url = f"{USER_API_URL}/login" + admin_email = conf.get("checktrack_admin_email") + admin_password = conf.get("checktrack_admin_password") auth_payload = { - "email": "jaympatel9294@gmail.com", - "password": "0hr3VuNoyqcgy1Su" + "email": admin_email, + "password": admin_password } HEADERS = {"Content-Type": "application/json"} - + try: auth_response = requests.post(auth_url, headers=HEADERS, json=auth_payload) @@ -752,7 +754,7 @@ def check_tenant_exists(email): if not employee.get("company"): return {"exists": False, "message": "Employee has no associated company."} - + # Step 4: Get tenant_id from Company doctype tenant_id = frappe.db.get_value("Company", employee.get("company"), "tenant_id") diff --git a/checktrack_connector/checktrack_connector/doctype/checktrack_integration/checktrack_integration.js b/checktrack_connector/checktrack_connector/doctype/checktrack_integration/checktrack_integration.js index 2ff93ed..666dcca 100644 --- a/checktrack_connector/checktrack_connector/doctype/checktrack_integration/checktrack_integration.js +++ b/checktrack_connector/checktrack_connector/doctype/checktrack_integration/checktrack_integration.js @@ -7,20 +7,24 @@ frappe.ui.form.on('CheckTrack Integration', { frm.page.btn_primary.hide(); } if (!frm.is_new()) { + showConnectionLoader(frm); check_tenant_exists(frm, function(exists) { + hideConnectionLoader(frm); + if (exists) { - frm.fields.forEach(field => { - frm.set_df_property(field.df.fieldname, 'hidden', true); + if (field.df.fieldname !== 'name') { // Keep the name field visible + frm.set_df_property(field.df.fieldname, 'hidden', true); + } }); + frm.dashboard.clear_headline(); frm.dashboard.set_headline( `