diff --git a/.eslintrc.json b/.eslintrc.json index be8f2c8f..1f97f031 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,18 +1,11 @@ { "root": true, - "ignorePatterns": [ - "projects/**/*" - ], + "ignorePatterns": ["projects/**/*"], "overrides": [ { - "files": [ - "*.ts" - ], + "files": ["*.ts"], "parserOptions": { - "project": [ - "tsconfig.json", - "e2e/tsconfig.json" - ], + "project": ["tsconfig.json", "e2e/tsconfig.json"], "createDefaultProgram": true }, "extends": [ @@ -45,12 +38,8 @@ } }, { - "files": [ - "*.html" - ], - "extends": [ - "plugin:@angular-eslint/template/recommended" - ], + "files": ["*.html"], + "extends": ["plugin:@angular-eslint/template/recommended", "prettier"], "rules": {} } ] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 31887089..dc94fb7d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,10 +1,9 @@ --- name: Bug report about: Create a report to help us improve -title: '' -labels: ['bug'] -assignees: '' - +title: "" +labels: ["bug"] +assignees: "" --- **Describe the bug** @@ -12,6 +11,7 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] **Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index abd8476b..bf7a8e26 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,10 +1,9 @@ --- name: Feature request about: Suggest an idea for this project -title: '' -labels: ['enhancement'] -assignees: '' - +title: "" +labels: ["enhancement"] +assignees: "" --- **Is your feature request related to a problem? Please describe.** diff --git a/.github/labeler.yml b/.github/labeler.yml index 960ece5e..84cb168d 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,22 +1,22 @@ API-Client: -- projects/cobbler-api/* -- projects/cobbler-api/**/* + - projects/cobbler-api/* + - projects/cobbler-api/**/* Frontend: -- projects/cobbler-frontend/* -- projects/cobbler-frontend/**/* + - projects/cobbler-frontend/* + - projects/cobbler-frontend/**/* TS-XMLRPC: -- projects/typescript-xmlrpc/* -- projects/typescript-xmlrpc/**/* + - projects/typescript-xmlrpc/* + - projects/typescript-xmlrpc/**/* documentation: -- docs-additional/* -- docs-additional/**/* + - docs-additional/* + - docs-additional/**/* tests: -- '*.spec.ts' + - "*.spec.ts" dependencies: -- package.json -- package-lock.json + - package.json + - package-lock.json diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e2a3e938..c22001e8 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,12 +13,12 @@ name: "CodeQL" on: push: - branches: [ main ] + branches: [main] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] schedule: - - cron: '34 17 * * 4' + - cron: "34 17 * * 4" jobs: analyze: @@ -32,39 +32,39 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ["javascript"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://git.io/codeql-language-support steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/container-build-push.yml b/.github/workflows/container-build-push.yml index ee325494..24bcca86 100644 --- a/.github/workflows/container-build-push.yml +++ b/.github/workflows/container-build-push.yml @@ -4,7 +4,7 @@ name: Create and publish a Docker image on: push: - branches: ['main'] + branches: ["main"] env: REGISTRY: ghcr.io diff --git a/.github/workflows/coverage-upload.yml b/.github/workflows/coverage-upload.yml index a1b2adbd..faeffd20 100644 --- a/.github/workflows/coverage-upload.yml +++ b/.github/workflows/coverage-upload.yml @@ -12,7 +12,7 @@ jobs: steps: # https://github.com/actions/github-script # Based on: https://github.com/orgs/community/discussions/34652 - - name: 'Download artifact' + - name: "Download artifact" uses: actions/github-script@v7 with: script: | @@ -52,24 +52,24 @@ jobs: fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/coverage-report-xmlrpc.zip`, Buffer.from(downloadXmlRpc.data)); fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/coverage-report-api.zip`, Buffer.from(downloadApi.data)); fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/coverage-report-frontend.zip`, Buffer.from(downloadFrontend.data)); - - name: 'Create folder structure' + - name: "Create folder structure" run: | mkdir -p coverage/typescript-xmlrpc mkdir -p coverage/cobbler-api mkdir -p coverage/cobbler-frontend - - name: 'Unzip typescript-xmlrpc artifact' + - name: "Unzip typescript-xmlrpc artifact" run: | unzip coverage-report-xmlrpc.zip mv lcov.info coverage/typescript-xmlrpc - - name: 'Unzip cobbler-api artifact' + - name: "Unzip cobbler-api artifact" run: | unzip coverage-report-api.zip mv lcov.info coverage/cobbler-api - - name: 'Unzip cobbler-frontend artifact' + - name: "Unzip cobbler-frontend artifact" run: | unzip coverage-report-frontend.zip mv lcov.info coverage/cobbler-frontend - - name: 'Show filetree' + - name: "Show filetree" run: | sudo apt-get install -y tree tree diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index aa069c46..73cdbe3d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,9 +2,9 @@ name: Docs on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build: @@ -30,7 +30,7 @@ jobs: name: documentation path: documentation deploy: - name : Deploy 🚀 + name: Deploy 🚀 needs: [build] if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 924ae71f..862eeca8 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -9,7 +9,7 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4 + - uses: actions/labeler@v5 with: sync-labels: true repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0c68715c..d0431dc3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,18 +2,39 @@ name: Linter on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] # Always use latest Node.js version! jobs: + lint-prettier: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v4 + - name: Node ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Install deps + run: npm install + - name: Lint with prettier + run: npx prettier . --check lint-lib-xmlrpc: runs-on: ubuntu-latest strategy: matrix: - node-version: [ 18.x ] + node-version: [18.x] steps: - uses: actions/checkout@v4 - name: Node ${{ matrix.node-version }} @@ -34,7 +55,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [ 18.x ] + node-version: [18.x] steps: - uses: actions/checkout@v4 - name: Node ${{ matrix.node-version }} @@ -55,7 +76,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [ 18.x ] + node-version: [18.x] steps: - uses: actions/checkout@v4 - name: Node ${{ matrix.node-version }} diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index e0f21fc7..a795215c 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -2,9 +2,9 @@ name: Tests on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] # Always use latest Node.js version! @@ -97,7 +97,7 @@ jobs: path: coverage/cobbler-frontend/lcov.info if-no-files-found: error e2e-cobbler-frontend: - if: ${{ false }} # disable for now; we don't have e2e tests currently + if: ${{ false }} # disable for now; we don't have e2e tests currently runs-on: ubuntu-latest container: image: timbru31/node-chrome diff --git a/.gitpod.yml b/.gitpod.yml index ea449728..0f9a1aa5 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -5,5 +5,3 @@ tasks: - init: npm install && npm run build command: npm run start - - diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..a40272c5 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +# Ignore artifacts: +coverage +dist +node_modules diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index d4e1cd71..af1ad6ab 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the +- Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or +- The use of sexualized language or imagery, and sexual attention or advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an +standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within diff --git a/README.md b/README.md index 67287f69..ff1cc8df 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ Initial developer: [@nelliesnoodles](https://github.com/nelliesnoodles) & [@Scho ## Prerequisites -* Node.js and npm -* install Node.js dependencies with `npm install` -* build required projects +- Node.js and npm +- install Node.js dependencies with `npm install` +- build required projects ```shell npm run build typescript-xmlrpc diff --git a/angular.json b/angular.json index c26f4f70..7e6897aa 100644 --- a/angular.json +++ b/angular.json @@ -205,7 +205,8 @@ } }, "cli": { - "schematicCollections": ["@angular-eslint/schematics"] + "schematicCollections": ["@angular-eslint/schematics"], + "analytics": false }, "schematics": { "@angular-eslint/schematics:application": { diff --git a/docs-additonal/development-setup.md b/docs-additonal/development-setup.md index 06ea5ab8..6818b637 100644 --- a/docs-additonal/development-setup.md +++ b/docs-additonal/development-setup.md @@ -22,7 +22,7 @@ This will give you a setup of both repositories of the main Git branches. - Run the built image: `docker run -it --rm --name cobbler-dev -p 80:80 -p 443:443 -v ${PWD}:/code cobbler-dev` - Execute the setup script in the running container: `./docker/develop/scripts/setup-supervisor.sh` - Let the container run in the foreground! You may want to tail the Cobbler log: - `tail -f /var/log/cobbler/cobbler.log` + `tail -f /var/log/cobbler/cobbler.log` 4. Go into the `cobbler-web` directory and follow these steps: - Run an `npm install` to install the development and runtime dependencies. - Build the TS-XMLRPC API via: `npm run build typescript-xmlrpc` @@ -61,7 +61,6 @@ make clean ./docker/develop/scripts/setup-supervisor.sh ``` - ## Error handling ### CORS diff --git a/package-lock.json b/package-lock.json index cc29f010..a6e69e69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,6 +42,7 @@ "@typescript-eslint/parser": "^7.15.0", "codecov": "^3.8.3", "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "jasmine-core": "~3.8.0", "jasmine-spec-reporter": "~6.0.0", "karma": "~6.3.12", @@ -50,6 +51,8 @@ "karma-jasmine": "~4.0.1", "karma-jasmine-html-reporter": "^1.7.0", "ng-packagr": "^17.3.0", + "prettier": "3.3.3", + "prettier-eslint": "^16.3.0", "protractor": "~7.0.0", "ts-node": "~9.1.1", "typescript": "~5.4.5" @@ -9140,6 +9143,16 @@ "dev": true, "license": "ISC" }, + "node_modules/common-tags": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz", + "integrity": "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -10137,6 +10150,13 @@ "node": ">=8" } }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true, + "license": "MIT" + }, "node_modules/dns-packet": { "version": "5.6.1", "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz", @@ -10826,6 +10846,19 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "license": "MIT", + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-scope": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.1.tgz", @@ -14948,6 +14981,77 @@ "url": "https://tidelift.com/funding/github/npm/loglevel" } }, + "node_modules/loglevel-colored-level-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/loglevel-colored-level-prefix/-/loglevel-colored-level-prefix-1.0.0.tgz", + "integrity": "sha512-u45Wcxxc+SdAlh4yeF/uKlC1SPUPCy0gullSNKXod5I4bmifzk+Q4lSLExNEVn19tGaJipbZ4V4jbFn79/6mVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^1.1.3", + "loglevel": "^1.4.1" + } + }, + "node_modules/loglevel-colored-level-prefix/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/loglevel-colored-level-prefix/node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/loglevel-colored-level-prefix/node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/loglevel-colored-level-prefix/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/loglevel-colored-level-prefix/node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/loglevel-plugin-prefix": { "version": "0.8.4", "resolved": "https://registry.npmjs.org/loglevel-plugin-prefix/-/loglevel-plugin-prefix-0.8.4.tgz", @@ -17319,6 +17423,166 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-eslint": { + "version": "16.3.0", + "resolved": "https://registry.npmjs.org/prettier-eslint/-/prettier-eslint-16.3.0.tgz", + "integrity": "sha512-Lh102TIFCr11PJKUMQ2kwNmxGhTsv/KzUg9QYF2Gkw259g/kPgndZDWavk7/ycbRvj2oz4BPZ1gCU8bhfZH/Xg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/parser": "^6.7.5", + "common-tags": "^1.4.0", + "dlv": "^1.1.0", + "eslint": "^8.7.0", + "indent-string": "^4.0.0", + "lodash.merge": "^4.6.0", + "loglevel-colored-level-prefix": "^1.0.0", + "prettier": "^3.0.1", + "pretty-format": "^29.7.0", + "require-relative": "^0.8.7", + "typescript": "^5.2.2", + "vue-eslint-parser": "^9.1.0" + }, + "engines": { + "node": ">=16.10.0" + }, + "peerDependencies": { + "prettier-plugin-svelte": "^3.0.0", + "svelte-eslint-parser": "*" + }, + "peerDependenciesMeta": { + "prettier-plugin-svelte": { + "optional": true + }, + "svelte-eslint-parser": { + "optional": true + } + } + }, + "node_modules/prettier-eslint/node_modules/@typescript-eslint/parser": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", + "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/prettier-eslint/node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/prettier-eslint/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/prettier-eslint/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/prettier-eslint/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", @@ -18096,6 +18360,13 @@ "dev": true, "license": "ISC" }, + "node_modules/require-relative": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz", + "integrity": "sha512-AKGr4qvHiryxRb19m3PsLRGuKVAbJLUD7E6eOaHkfKhwc+vSgVOCY5xNvm9EkolBKTOf0GrQAZKLimOCz81Khg==", + "dev": true, + "license": "MIT" + }, "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -20822,6 +21093,48 @@ "node": ">=0.10.0" } }, + "node_modules/vue-eslint-parser": { + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.4.3.tgz", + "integrity": "sha512-2rYRLWlIpaiN8xbPiDyXZXRgLGOtWxERV7ND5fFAv5qo1D2N9Fu9MNajBNc6o13lZ+24DAWCkQCvj4klgmcITg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "eslint-scope": "^7.1.1", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", + "esquery": "^1.4.0", + "lodash": "^4.17.21", + "semver": "^7.3.6" + }, + "engines": { + "node": "^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=6.0.0" + } + }, + "node_modules/vue-eslint-parser/node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", diff --git a/package.json b/package.json index c212d362..d90cd950 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "@typescript-eslint/parser": "^7.15.0", "codecov": "^3.8.3", "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "jasmine-core": "~3.8.0", "jasmine-spec-reporter": "~6.0.0", "karma": "~6.3.12", @@ -56,6 +57,8 @@ "karma-jasmine": "~4.0.1", "karma-jasmine-html-reporter": "^1.7.0", "ng-packagr": "^17.3.0", + "prettier": "3.3.3", + "prettier-eslint": "^16.3.0", "protractor": "~7.0.0", "ts-node": "~9.1.1", "typescript": "~5.4.5" diff --git a/projects/cobbler-api/.eslintrc.json b/projects/cobbler-api/.eslintrc.json index a256dcc5..b56db33e 100644 --- a/projects/cobbler-api/.eslintrc.json +++ b/projects/cobbler-api/.eslintrc.json @@ -1,13 +1,9 @@ { "extends": "../../.eslintrc.json", - "ignorePatterns": [ - "!**/*" - ], + "ignorePatterns": ["!**/*"], "overrides": [ { - "files": [ - "*.ts" - ], + "files": ["*.ts"], "parserOptions": { "project": [ "projects/cobbler-api/tsconfig.lib.json", @@ -35,9 +31,7 @@ } }, { - "files": [ - "*.html" - ], + "files": ["*.html"], "rules": {} } ] diff --git a/projects/cobbler-api/README.md b/projects/cobbler-api/README.md index 48cc1679..834798f5 100644 --- a/projects/cobbler-api/README.md +++ b/projects/cobbler-api/README.md @@ -5,7 +5,8 @@ This library was generated with [Angular CLI](https://github.com/angular/angular ## Code scaffolding Run `ng generate component component-name --project cobbler-api` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project cobbler-api`. -> Note: Don't forget to add `--project cobbler-api` or else it will be added to the default project in your `angular.json` file. + +> Note: Don't forget to add `--project cobbler-api` or else it will be added to the default project in your `angular.json` file. ## Build diff --git a/projects/cobbler-api/karma.conf.js b/projects/cobbler-api/karma.conf.js index 2434756a..e41db7fb 100644 --- a/projects/cobbler-api/karma.conf.js +++ b/projects/cobbler-api/karma.conf.js @@ -3,14 +3,14 @@ module.exports = function (config) { config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], + basePath: "", + frameworks: ["jasmine", "@angular-devkit/build-angular"], plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage'), - require('@angular-devkit/build-angular/plugins/karma') + require("karma-jasmine"), + require("karma-chrome-launcher"), + require("karma-jasmine-html-reporter"), + require("karma-coverage"), + require("@angular-devkit/build-angular/plugins/karma"), ], client: { jasmine: { @@ -19,41 +19,38 @@ module.exports = function (config) { // for example, you can disable the random execution with `random: false` // or set a specific seed with `seed: 4321` }, - clearContext: false // leave Jasmine Spec Runner output visible in browser + clearContext: false, // leave Jasmine Spec Runner output visible in browser }, jasmineHtmlReporter: { - suppressAll: true // removes the duplicated traces + suppressAll: true, // removes the duplicated traces }, coverageReporter: { - dir: require('path').join(__dirname, '../../coverage/cobbler-api'), - subdir: '.', + dir: require("path").join(__dirname, "../../coverage/cobbler-api"), + subdir: ".", reporters: [ - { type: 'html' }, - { type: 'text-summary' }, - { type: 'lcovonly' }, - ] + { type: "html" }, + { type: "text-summary" }, + { type: "lcovonly" }, + ], }, - reporters: ['progress', 'kjhtml'], + reporters: ["progress", "kjhtml"], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, - browsers: ['Chrome'], + browsers: ["Chrome"], customLaunchers: { Chrome_without_security: { - base: 'Chrome', - flags: ['--disable-web-security'] + base: "Chrome", + flags: ["--disable-web-security"], }, Headless: { - base: 'ChromeHeadless', - flags: [ - '--no-sandbox', - '--disable-setuid-sandbox' - ] - } + base: "ChromeHeadless", + flags: ["--no-sandbox", "--disable-setuid-sandbox"], + }, }, singleRun: false, - restartOnFileChange: true + restartOnFileChange: true, }); - process.env.TZ = 'Europe/Berlin'; + process.env.TZ = "Europe/Berlin"; }; diff --git a/projects/cobbler-api/ng-package.json b/projects/cobbler-api/ng-package.json index 7433d45a..c065c5c9 100644 --- a/projects/cobbler-api/ng-package.json +++ b/projects/cobbler-api/ng-package.json @@ -4,4 +4,4 @@ "lib": { "entryFile": "src/public-api.ts" } -} \ No newline at end of file +} diff --git a/projects/cobbler-api/package.json b/projects/cobbler-api/package.json index 20ebef8c..5459ee1b 100644 --- a/projects/cobbler-api/package.json +++ b/projects/cobbler-api/package.json @@ -8,4 +8,4 @@ "dependencies": { "tslib": "^2.0.0" } -} \ No newline at end of file +} diff --git a/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts b/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts index 846c6e58..33953b46 100644 --- a/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts +++ b/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts @@ -1,18 +1,30 @@ -import {TestBed} from '@angular/core/testing'; -import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; -import {Distro, File, Image, Mgmgtclass, Package, Profile, Repo, System} from './custom-types/items'; +import { TestBed } from '@angular/core/testing'; +import { + HttpClientTestingModule, + HttpTestingController, +} from '@angular/common/http/testing'; +import { + Distro, + File, + Image, + Mgmgtclass, + Package, + Profile, + Repo, + System, +} from './custom-types/items'; import { BackgroundBuildisoOptions, BackgroundImportOptions, BackgroundReplicateOptions, Event, ExtendedVersion, - InstallationStatus + InstallationStatus, } from './custom-types/misc'; -import {COBBLER_URL} from './lib.config'; -import {AngularXmlrpcService} from 'typescript-xmlrpc'; +import { COBBLER_URL } from './lib.config'; +import { AngularXmlrpcService } from 'typescript-xmlrpc'; -import {CobblerApiService} from './cobbler-api.service'; +import { CobblerApiService } from './cobbler-api.service'; describe('CobblerApiService', () => { let service: CobblerApiService; @@ -24,17 +36,17 @@ describe('CobblerApiService', () => { providers: [ { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, { provide: AngularXmlrpcService, - useClass: AngularXmlrpcService + useClass: AngularXmlrpcService, }, { provide: CobblerApiService, - deps: [AngularXmlrpcService, COBBLER_URL] - } - ] + deps: [AngularXmlrpcService, COBBLER_URL], + }, + ], }); httpTestingController = TestBed.inject(HttpTestingController); service = TestBed.inject(CobblerApiService); @@ -56,11 +68,11 @@ describe('CobblerApiService', () => { const result = [ // eslint-disable-next-line max-len - 'The \'server\' field in /etc/cobbler/settings.yaml must be set to something other than localhost, or automatic installation features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.', + "The 'server' field in /etc/cobbler/settings.yaml must be set to something other than localhost, or automatic installation features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.", // eslint-disable-next-line max-len - 'For PXE to be functional, the \'next_server_v4\' field in /etc/cobbler/settings.yaml must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.', + "For PXE to be functional, the 'next_server_v4' field in /etc/cobbler/settings.yaml must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.", // eslint-disable-next-line max-len - 'For PXE to be functional, the \'next_server_v6\' field in /etc/cobbler/settings.yaml must be set to something other than ::1, and should match the IP of the boot server on the PXE network.', + "For PXE to be functional, the 'next_server_v6' field in /etc/cobbler/settings.yaml must be set to something other than ::1, and should match the IP of the boot server on the PXE network.", 'service cobblerd is not running', // eslint-disable-next-line max-len 'some network boot-loaders are missing from /var/lib/cobbler/loaders. If you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, andmenu.c32.', @@ -68,40 +80,43 @@ describe('CobblerApiService', () => { 'reposync not installed, install yum-utils', 'yumdownloader is not installed, install yum-utils', // eslint-disable-next-line max-len - 'The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings.yaml) is still set to \'cobbler\' and should be changed, try: "openssl passwd -1 -salt \'random-phrase-here\' \'your-password-here\'" to generate new one' + "The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings.yaml) is still set to 'cobbler' and should be changed, try: \"openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'\" to generate new one", ]; - service.check('').subscribe( - value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + service.check('').subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the background_buildiso action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `2023-01-24_083001_Build Iso_20fa7d4256fc4f61a2b9c2237c80fb41` - const result = "2023-01-24_083001_Build Iso_20fa7d4256fc4f61a2b9c2237c80fb41" + const methodResponse = `2023-01-24_083001_Build Iso_20fa7d4256fc4f61a2b9c2237c80fb41`; + const result = + '2023-01-24_083001_Build Iso_20fa7d4256fc4f61a2b9c2237c80fb41'; const buildisoOptions: BackgroundBuildisoOptions = { - iso: "", - profiles: "", - systems: "", - buildisodir: "", - distro: "", + iso: '', + profiles: '', + systems: '', + buildisodir: '', + distro: '', standalone: false, airgapped: false, - source: "", + source: '', excludeDNS: false, - xorrisofsOpts: "", - } + xorrisofsOpts: '', + }; - service.background_buildiso(buildisoOptions, '').subscribe( - value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + service.background_buildiso(buildisoOptions, '').subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -122,69 +137,81 @@ describe('CobblerApiService', () => { it('should execute the background_hardlink action on the Cobbler Server', () => { // eslint-disable-next-line max-len - const methodResponse = `2022-09-30_203004_Hardlink_800c38f4e0424187aed6a6ffb6553ef8` - const result = "2022-09-30_203004_Hardlink_800c38f4e0424187aed6a6ffb6553ef8" - service.background_hardlink('').subscribe(value => { - expect(value).toEqual(result) + const methodResponse = `2022-09-30_203004_Hardlink_800c38f4e0424187aed6a6ffb6553ef8`; + const result = + '2022-09-30_203004_Hardlink_800c38f4e0424187aed6a6ffb6553ef8'; + service.background_hardlink('').subscribe((value) => { + expect(value).toEqual(result); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the background_mkloaders action on the Cobbler Server', () => { // eslint-disable-next-line max-len - const methodResponse = `2022-09-30_203957_Create bootable bootloader images_9c809af4d6f148e49b071fac84f9a664` - const result = "2022-09-30_203957_Create bootable bootloader images_9c809af4d6f148e49b071fac84f9a664" - service.backgroundMkloaders('').subscribe(value => { - expect(value).toEqual(result) + const methodResponse = `2022-09-30_203957_Create bootable bootloader images_9c809af4d6f148e49b071fac84f9a664`; + const result = + '2022-09-30_203957_Create bootable bootloader images_9c809af4d6f148e49b071fac84f9a664'; + service.backgroundMkloaders('').subscribe((value) => { + expect(value).toEqual(result); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); - it('should execute the background_validate_autoinstall_files action on the Cobbler Server', - () => { - // eslint-disable-next-line max-len - const methodResponse = `2022-09-30_203505_Automated installation files validation_487b1a5d1d914c62834126391ac2b601` - const result = "2022-09-30_203505_Automated installation files validation_487b1a5d1d914c62834126391ac2b601" - service.background_validate_autoinstall_files('').subscribe(value => { - expect(value).toEqual(result) - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); - mockRequest.flush(methodResponse); + it('should execute the background_validate_autoinstall_files action on the Cobbler Server', () => { + // eslint-disable-next-line max-len + const methodResponse = `2022-09-30_203505_Automated installation files validation_487b1a5d1d914c62834126391ac2b601`; + const result = + '2022-09-30_203505_Automated installation files validation_487b1a5d1d914c62834126391ac2b601'; + service.background_validate_autoinstall_files('').subscribe((value) => { + expect(value).toEqual(result); }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); + mockRequest.flush(methodResponse); + }); it('should execute the background_replicate action on the Cobbler Server', () => { // eslint-disable-next-line max-len - const methodResponse = `2023-01-24_075801_Replicate_ea7a003a81264039b4277ac55664661a` - const result = "2023-01-24_075801_Replicate_ea7a003a81264039b4277ac55664661a" + const methodResponse = `2023-01-24_075801_Replicate_ea7a003a81264039b4277ac55664661a`; + const result = + '2023-01-24_075801_Replicate_ea7a003a81264039b4277ac55664661a'; const replicateOptions: BackgroundReplicateOptions = { - master: "", - port: "", - distro_patterns: "", - profile_patterns: "", - system_patterns: "", - repo_patterns: "", - image_patterns: "", - mgmtclass_patterns: "", - package_patterns: "", - file_patterns: "", + master: '', + port: '', + distro_patterns: '', + profile_patterns: '', + system_patterns: '', + repo_patterns: '', + image_patterns: '', + mgmtclass_patterns: '', + package_patterns: '', + file_patterns: '', prune: false, omit_data: false, sync_all: false, use_ssl: false, - } - service.background_replicate(replicateOptions, '').subscribe(value => { - expect(value).toEqual(result) + }; + service.background_replicate(replicateOptions, '').subscribe((value) => { + expect(value).toEqual(result); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the background_import action on the Cobbler Server', () => { // eslint-disable-next-line max-len - const methodResponse = `2023-01-24_103639_Media import_dd297121f7bc412e9ce4d80f05de4b3f` - const result = "2023-01-24_103639_Media import_dd297121f7bc412e9ce4d80f05de4b3f" + const methodResponse = `2023-01-24_103639_Media import_dd297121f7bc412e9ce4d80f05de4b3f`; + const result = + '2023-01-24_103639_Media import_dd297121f7bc412e9ce4d80f05de4b3f'; const importOptions: BackgroundImportOptions = { path: '', name: '', @@ -194,11 +221,13 @@ describe('CobblerApiService', () => { arch: '', breed: '', os_version: '', - } - service.background_import(importOptions, '').subscribe(value => { - expect(value).toEqual(result) + }; + service.background_import(importOptions, '').subscribe((value) => { + expect(value).toEqual(result); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -219,52 +248,57 @@ describe('CobblerApiService', () => { it('should execute the background_signature_update action on the Cobbler Server', () => { // eslint-disable-next-line max-len - const methodResponse = `2022-09-30_195846_Updating Signatures_6c5300d51c224984b4319fb536cc21d0` - const result = "2022-09-30_195846_Updating Signatures_6c5300d51c224984b4319fb536cc21d0" - service.background_signature_update('').subscribe(value => { - expect(value).toEqual(result) + const methodResponse = `2022-09-30_195846_Updating Signatures_6c5300d51c224984b4319fb536cc21d0`; + const result = + '2022-09-30_195846_Updating Signatures_6c5300d51c224984b4319fb536cc21d0'; + service.background_signature_update('').subscribe((value) => { + expect(value).toEqual(result); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_events action on the Cobbler Server', () => { // eslint-disable-next-line max-len - const methodResponse = `2023-01-24_075223_Create bootable bootloader images_77c9dbafc9234f018d67ec3295fcc22b1674546743.8418643Create bootable bootloader imagescomplete1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_075801_Replicate_ea7a003a81264039b4277ac55664661a1674547081.1178503Replicatefailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_083001_Build Iso_20fa7d4256fc4f61a2b9c2237c80fb411674549001.176315Build Isofailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_083137_(CLI) ACL Configuration_334327920d2946fda3ac95dbf457e76d1674549097.240632(CLI) ACL Configurationfailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==` - const result : Array = [ + const methodResponse = `2023-01-24_075223_Create bootable bootloader images_77c9dbafc9234f018d67ec3295fcc22b1674546743.8418643Create bootable bootloader imagescomplete1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_075801_Replicate_ea7a003a81264039b4277ac55664661a1674547081.1178503Replicatefailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_083001_Build Iso_20fa7d4256fc4f61a2b9c2237c80fb411674549001.176315Build Isofailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_083137_(CLI) ACL Configuration_334327920d2946fda3ac95dbf457e76d1674549097.240632(CLI) ACL Configurationfailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==`; + const result: Array = [ { - id: "2023-01-24_075223_Create bootable bootloader images_77c9dbafc9234f018d67ec3295fcc22b", + id: '2023-01-24_075223_Create bootable bootloader images_77c9dbafc9234f018d67ec3295fcc22b', statetime: 1674546743.8418643, - name: "Create bootable bootloader images", - state: "complete", - readByWho: ["1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ=="] + name: 'Create bootable bootloader images', + state: 'complete', + readByWho: ['1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ=='], }, { - id: "2023-01-24_075801_Replicate_ea7a003a81264039b4277ac55664661a", + id: '2023-01-24_075801_Replicate_ea7a003a81264039b4277ac55664661a', statetime: 1674547081.1178503, - name: "Replicate", - state: "failed", - readByWho: ["1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ=="] + name: 'Replicate', + state: 'failed', + readByWho: ['1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ=='], }, { - id: "2023-01-24_083001_Build Iso_20fa7d4256fc4f61a2b9c2237c80fb41", + id: '2023-01-24_083001_Build Iso_20fa7d4256fc4f61a2b9c2237c80fb41', statetime: 1674549001.176315, - name: "Build Iso", - state: "failed", - readByWho: ["1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ=="] + name: 'Build Iso', + state: 'failed', + readByWho: ['1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ=='], }, { - id: "2023-01-24_083137_(CLI) ACL Configuration_334327920d2946fda3ac95dbf457e76d", + id: '2023-01-24_083137_(CLI) ACL Configuration_334327920d2946fda3ac95dbf457e76d', statetime: 1674549097.240632, - name: "(CLI) ACL Configuration", - state: "failed", - readByWho: ["1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ=="] - } + name: '(CLI) ACL Configuration', + state: 'failed', + readByWho: ['1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ=='], + }, ]; - service.get_events('').subscribe(value => { - expect(value).toEqual(result) + service.get_events('').subscribe((value) => { + expect(value).toEqual(result); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -297,31 +331,37 @@ describe('CobblerApiService', () => { [2022-09-30_145124_Sync_2cabdc4eddfa4731b45f145d7b625e29] 2022-09-30 14:51:24,962 - INFO | running post-sync triggers [2022-09-30_145124_Sync_2cabdc4eddfa4731b45f145d7b625e29] 2022-09-30 14:51:24,962 - INFO | running: ['dhcpd', '-t', '-q'] [2022-09-30_145124_Sync_2cabdc4eddfa4731b45f145d7b625e29] 2022-09-30 14:51:25,002 - INFO | received on stdout: -[2022-09-30_145124_Sync_2cabdc4eddfa4731b45f145d7b625e29] 2022-09-30 14:51:26,044 - INFO | ### TASK COMPLETE ###` +[2022-09-30_145124_Sync_2cabdc4eddfa4731b45f145d7b625e29] 2022-09-30 14:51:26,044 - INFO | ### TASK COMPLETE ###`; /* eslint-enable max-len */ - service.get_event_log('2022-09-30_145124_Sync_2cabdc4eddfa4731b45f145d7b625e29').subscribe(value => [ - expect(value.split(/\r?\n/).length).toEqual(28) - ]); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + service + .get_event_log('2022-09-30_145124_Sync_2cabdc4eddfa4731b45f145d7b625e29') + .subscribe((value) => [expect(value.split(/\r?\n/).length).toEqual(28)]); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_task_status action on the Cobbler Server', () => { // eslint-disable-next-line max-len - const methodResponse = `1664568243.5196018Updating Signaturescomplete` + const methodResponse = `1664568243.5196018Updating Signaturescomplete`; const result = { - id: "2022-09-30_200403_Updating Signatures_8f2b3c1626fb4b158636059b31242ee6", + id: '2022-09-30_200403_Updating Signatures_8f2b3c1626fb4b158636059b31242ee6', statetime: 1664568243.5196018, - name: "Updating Signatures", - state: "complete", - readByWho: [] - } - service.get_task_status( - '2022-09-30_200403_Updating Signatures_8f2b3c1626fb4b158636059b31242ee6' - ).subscribe(value => { - expect(value).toEqual(result) - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + name: 'Updating Signatures', + state: 'complete', + readByWho: [], + }; + service + .get_task_status( + '2022-09-30_200403_Updating Signatures_8f2b3c1626fb4b158636059b31242ee6', + ) + .subscribe((value) => { + expect(value).toEqual(result); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -347,157 +387,161 @@ describe('CobblerApiService', () => { it('should execute the get_distro action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480439.039089mtime1721480439.039089uid12f034d6781946d1af0783e20684cbd4nametestcommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classesmgmt_parametersis_subobject0tree_build_time0.0archx86_64boot_loaders<<inherit>>breedinitrd/root/initrdkernel/root/kernelos_versionredhat_management_key<<inherit>>source_reposremote_boot_kernelremote_grub_kernelremote_boot_initrdremote_grub_initrdks_meta` + const methodResponse = `parentdepth0ctime1721480439.039089mtime1721480439.039089uid12f034d6781946d1af0783e20684cbd4nametestcommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classesmgmt_parametersis_subobject0tree_build_time0.0archx86_64boot_loaders<<inherit>>breedinitrd/root/initrdkernel/root/kernelos_versionredhat_management_key<<inherit>>source_reposremote_boot_kernelremote_grub_kernelremote_boot_initrdremote_grub_initrdks_meta`; const result: Distro = { ctime: 1721480439.039089, depth: 0, mtime: 1721480439.039089, - uid: "12f034d6781946d1af0783e20684cbd4", + uid: '12f034d6781946d1af0783e20684cbd4', source_repos: [], tree_build_time: 0, - arch: "x86_64", + arch: 'x86_64', autoinstall_meta: {}, boot_files: {}, - boot_loaders: "<>", + boot_loaders: '<>', is_subobject: false, - parent: "", - breed: "", - comment: "", + parent: '', + breed: '', + comment: '', fetchable_files: {}, - initrd: "/root/initrd", - kernel: "/root/kernel", - remote_boot_initrd: "", - remote_boot_kernel: "", - remote_grub_initrd: "", - remote_grub_kernel: "", + initrd: '/root/initrd', + kernel: '/root/kernel', + remote_boot_initrd: '', + remote_boot_kernel: '', + remote_grub_initrd: '', + remote_grub_kernel: '', kernel_options: {}, kernel_options_post: {}, mgmt_classes: [], mgmt_parameters: {}, - name: "test", - os_version: "", - owners: "<>", - redhat_management_key: "<>", + name: 'test', + os_version: '', + owners: '<>', + redhat_management_key: '<>', template_files: {}, - } - service.get_distro('', false, false, "").subscribe(value => { - expect(value).toEqual(result) - done() + }; + service.get_distro('', false, false, '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_profile action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth1ctime1721480439.3090012mtime1721480439.3090012uid5f01667614244fcd9c7ca7fa59c7def1nametestprofcommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0autoinstall<<inherit>>boot_loaders<<inherit>>dhcp_tagdistrotestenable_ipxe<<inherit>>enable_menu<<inherit>>name_serversname_servers_searchnext_server_v4<<inherit>>next_server_v6<<inherit>>filenameproxy<<inherit>>redhat_management_key<<inherit>>reposserver<<inherit>>menuvirt_auto_boot<<inherit>>virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_typexenpvkickstart<<inherit>>ks_meta<<inherit>>` + const methodResponse = `parentdepth1ctime1721480439.3090012mtime1721480439.3090012uid5f01667614244fcd9c7ca7fa59c7def1nametestprofcommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0autoinstall<<inherit>>boot_loaders<<inherit>>dhcp_tagdistrotestenable_ipxe<<inherit>>enable_menu<<inherit>>name_serversname_servers_searchnext_server_v4<<inherit>>next_server_v6<<inherit>>filenameproxy<<inherit>>redhat_management_key<<inherit>>reposserver<<inherit>>menuvirt_auto_boot<<inherit>>virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_typexenpvkickstart<<inherit>>ks_meta<<inherit>>`; const result: Profile = { - name: "testprof", + name: 'testprof', depth: 1, mtime: 1721480439.3090012, is_subobject: false, - boot_loaders: "<>", - autoinstall_meta: "<>", - server: "<>", - distro: "test", - comment: "", - next_server_v4: "<>", - next_server_v6: "<>", - enable_ipxe: "<>", - parent: "", - owners: "<>", - autoinstall: "<>", - uid: "5f01667614244fcd9c7ca7fa59c7def1", - virt_ram: "<>", - boot_files: "<>", - mgmt_parameters: "<>", + boot_loaders: '<>', + autoinstall_meta: '<>', + server: '<>', + distro: 'test', + comment: '', + next_server_v4: '<>', + next_server_v6: '<>', + enable_ipxe: '<>', + parent: '', + owners: '<>', + autoinstall: '<>', + uid: '5f01667614244fcd9c7ca7fa59c7def1', + virt_ram: '<>', + boot_files: '<>', + mgmt_parameters: '<>', name_servers: [], - enable_menu: "<>", - menu: "", + enable_menu: '<>', + menu: '', ctime: 1721480439.3090012, - fetchable_files: "<>", - mgmt_classes: "<>", - kernel_options: "<>", - virt_auto_boot: "<>", - kernel_options_post: "<>", - proxy: "<>", - filename: "", - dhcp_tag: "", - redhat_management_key: "<>", + fetchable_files: '<>', + mgmt_classes: '<>', + kernel_options: '<>', + virt_auto_boot: '<>', + kernel_options_post: '<>', + proxy: '<>', + filename: '', + dhcp_tag: '', + redhat_management_key: '<>', repos: [], template_files: {}, - virt_type: "xenpv", + virt_type: 'xenpv', virt_cpus: 1, - virt_bridge: "<>", + virt_bridge: '<>', name_servers_search: [], - virt_path: "", - virt_file_size: "<>", - virt_disk_driver: "raw", - } - service.get_profile('', false, false, "").subscribe(value => { - expect(value).toEqual(result) - done() + virt_path: '', + virt_file_size: '<>', + virt_disk_driver: 'raw', + }; + service.get_profile('', false, false, '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_system action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth2ctime1721480439.5932038mtime1721480439.5932038uida3320bc9105c44f1b92ab1743d460ed8nametestsyscommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0interfacesdefaultbonding_optsbridge_optscnamesconnected_mode0dhcp_tagdns_nameif_gatewayinterface_masterinterface_typenaip_addressipv6_addressipv6_default_gatewayipv6_mtuipv6_prefixipv6_secondariesipv6_static_routesmac_addressmanagement0mtunetmaskstatic0static_routesvirt_bridge<<inherit>>ipv6_autoconfiguration0repos_enabled0autoinstall<<inherit>>boot_loaders<<inherit>>enable_ipxe<<inherit>>gatewayhostnameimageipv6_default_devicename_serversname_servers_searchnetboot_enabled0next_server_v4<<inherit>>next_server_v6<<inherit>>filename<<inherit>>power_addresspower_idpower_passpower_typepower_userpower_optionspower_identity_fileprofiletestprofproxy<<inherit>>redhat_management_key<<inherit>>server<<inherit>>statusvirt_auto_boot<<inherit>>virt_cpus<<inherit>>virt_disk_driver<<inherit>>virt_file_size<<inherit>>virt_path<<inherit>>virt_pxe_boot0virt_ram<<inherit>>virt_type<<inherit>>serial_device-1serial_baud_rate-1kickstart<<inherit>>ks_meta<<inherit>>` + const methodResponse = `parentdepth2ctime1721480439.5932038mtime1721480439.5932038uida3320bc9105c44f1b92ab1743d460ed8nametestsyscommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0interfacesdefaultbonding_optsbridge_optscnamesconnected_mode0dhcp_tagdns_nameif_gatewayinterface_masterinterface_typenaip_addressipv6_addressipv6_default_gatewayipv6_mtuipv6_prefixipv6_secondariesipv6_static_routesmac_addressmanagement0mtunetmaskstatic0static_routesvirt_bridge<<inherit>>ipv6_autoconfiguration0repos_enabled0autoinstall<<inherit>>boot_loaders<<inherit>>enable_ipxe<<inherit>>gatewayhostnameimageipv6_default_devicename_serversname_servers_searchnetboot_enabled0next_server_v4<<inherit>>next_server_v6<<inherit>>filename<<inherit>>power_addresspower_idpower_passpower_typepower_userpower_optionspower_identity_fileprofiletestprofproxy<<inherit>>redhat_management_key<<inherit>>server<<inherit>>statusvirt_auto_boot<<inherit>>virt_cpus<<inherit>>virt_disk_driver<<inherit>>virt_file_size<<inherit>>virt_path<<inherit>>virt_pxe_boot0virt_ram<<inherit>>virt_type<<inherit>>serial_device-1serial_baud_rate-1kickstart<<inherit>>ks_meta<<inherit>>`; const result: System = { ctime: 1721480439.5932038, mtime: 1721480439.5932038, - name: "testsys", + name: 'testsys', depth: 2, - comment: "", - owners: "<>", - uid: "a3320bc9105c44f1b92ab1743d460ed8", - autoinstall: "<>", - boot_files: "<>", - boot_loaders: "<>", - parent: "", + comment: '', + owners: '<>', + uid: 'a3320bc9105c44f1b92ab1743d460ed8', + autoinstall: '<>', + boot_files: '<>', + boot_loaders: '<>', + parent: '', is_subobject: false, - autoinstall_meta: "<>", - enable_ipxe: "<>", - fetchable_files: "<>", - filename: "<>", - gateway: "", - hostname: "", - image: "", + autoinstall_meta: '<>', + enable_ipxe: '<>', + fetchable_files: '<>', + filename: '<>', + gateway: '', + hostname: '', + image: '', ipv6_autoconfiguration: false, - ipv6_default_device: "", - kernel_options: "<>", - kernel_options_post: "<>", - mgmt_classes: "<>", - mgmt_parameters: "<>", + ipv6_default_device: '', + kernel_options: '<>', + kernel_options_post: '<>', + mgmt_classes: '<>', + mgmt_parameters: '<>', name_servers: [], name_servers_search: [], netboot_enabled: false, - next_server_v4: "<>", - next_server_v6: "<>", - power_address: "", - power_id: "", - power_identity_file: "", - power_options: "", - power_pass: "", - power_type: "", - power_user: "", - profile: "testprof", - proxy: "<>", - redhat_management_key: "<>", + next_server_v4: '<>', + next_server_v6: '<>', + power_address: '', + power_id: '', + power_identity_file: '', + power_options: '', + power_pass: '', + power_type: '', + power_user: '', + profile: 'testprof', + proxy: '<>', + redhat_management_key: '<>', repos_enabled: false, - server: "<>", + server: '<>', serial_baud_rate: -1, - serial_device : -1, - status: "", - virt_auto_boot: "<>", - virt_disk_driver: "<>", - virt_path: "<>", - virt_ram: "<>", - virt_type: "<>", - virt_file_size: "<>", - virt_cpus: "<>", + serial_device: -1, + status: '', + virt_auto_boot: '<>', + virt_disk_driver: '<>', + virt_path: '<>', + virt_ram: '<>', + virt_type: '<>', + virt_file_size: '<>', + virt_cpus: '<>', virt_pxe_boot: false, template_files: {}, interfaces: { @@ -525,129 +569,135 @@ describe('CobblerApiService', () => { static: false, static_routes: [], virt_bridge: '<>', - } + }, }, - } - service.get_system('', false, false, "").subscribe(value => { - expect(value).toEqual(result) - done() + }; + service.get_system('', false, false, '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_repo action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480440.9711354mtime1721480440.9711354uid8b58f9b09a3e4d28965160d97a5de482nametestrepocommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0breednonearchnoneenvironmentyumoptsrsyncoptsmirror_typebaseurlapt_componentsapt_distscreaterepo_flags<<inherit>>keep_updated0mirrormirror_locally0priority0proxy<<inherit>>rpm_listos_versionks_meta` + const methodResponse = `parentdepth0ctime1721480440.9711354mtime1721480440.9711354uid8b58f9b09a3e4d28965160d97a5de482nametestrepocommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0breednonearchnoneenvironmentyumoptsrsyncoptsmirror_typebaseurlapt_componentsapt_distscreaterepo_flags<<inherit>>keep_updated0mirrormirror_locally0priority0proxy<<inherit>>rpm_listos_versionks_meta`; const result: Repo = { ctime: 1721480440.9711354, mtime: 1721480440.9711354, - name: "testrepo", + name: 'testrepo', depth: 0, - comment: "", - owners: "<>", - uid: "8b58f9b09a3e4d28965160d97a5de482", + comment: '', + owners: '<>', + uid: '8b58f9b09a3e4d28965160d97a5de482', fetchable_files: {}, is_subobject: false, - parent: "", + parent: '', kernel_options: {}, kernel_options_post: {}, - mgmt_classes: "<>", + mgmt_classes: '<>', mgmt_parameters: {}, - arch: "none", - breed: "none", + arch: 'none', + breed: 'none', apt_components: [], apt_dists: [], - mirror: "", + mirror: '', rsyncopts: {}, - proxy: "<>", - createrepo_flags: "<>", + proxy: '<>', + createrepo_flags: '<>', environment: {}, keep_updated: false, mirror_locally: false, - mirror_type: "baseurl", + mirror_type: 'baseurl', priority: 0, rpm_list: [], yumopts: {}, autoinstall_meta: {}, boot_files: {}, - os_version: "", + os_version: '', template_files: {}, - } - service.get_repo('', false, false, "").subscribe(value => { - expect(value).toEqual(result) - done() + }; + service.get_repo('', false, false, '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_image action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480441.493743mtime1721480441.493743uid911577c3691b4294acdf017e7f15f4cfnametestimagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0archx86_64autoinstall<<inherit>>breedfileimage_typedirectnetwork_count0os_versionboot_loadersmenuvirt_auto_boot0virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_type<<inherit>>kickstart<<inherit>>ks_meta` + const methodResponse = `parentdepth0ctime1721480441.493743mtime1721480441.493743uid911577c3691b4294acdf017e7f15f4cfnametestimagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0archx86_64autoinstall<<inherit>>breedfileimage_typedirectnetwork_count0os_versionboot_loadersmenuvirt_auto_boot0virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_type<<inherit>>kickstart<<inherit>>ks_meta`; const result: Image = { ctime: 1721480441.493743, mtime: 1721480441.493743, - name: "testimage", + name: 'testimage', depth: 0, - comment: "", - owners: "<>", - uid: "911577c3691b4294acdf017e7f15f4cf", - arch: "x86_64", - breed: "", - file: "", + comment: '', + owners: '<>', + uid: '911577c3691b4294acdf017e7f15f4cf', + arch: 'x86_64', + breed: '', + file: '', fetchable_files: {}, is_subobject: false, - parent: "", + parent: '', kernel_options: {}, kernel_options_post: {}, - mgmt_classes: "<>", + mgmt_classes: '<>', mgmt_parameters: {}, - autoinstall: "<>", - image_type: "direct", + autoinstall: '<>', + image_type: 'direct', network_count: 0, - os_version: "", + os_version: '', virt_auto_boot: false, - virt_bridge: "<>", + virt_bridge: '<>', virt_cpus: 1, - virt_disk_driver: "raw", - virt_file_size: "<>", - virt_path: "", - virt_ram: "<>", - virt_type: "<>", - menu: "", + virt_disk_driver: 'raw', + virt_file_size: '<>', + virt_path: '', + virt_ram: '<>', + virt_type: '<>', + menu: '', autoinstall_meta: {}, boot_files: {}, boot_loaders: [], template_files: {}, - } - service.get_image('', false, false, "").subscribe(value => { - expect(value).toEqual(result) - done() + }; + service.get_image('', false, false, '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_mgmtclass action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480442.0213087mtime1721480442.0213087uid5a4898be6fca4d7884898fa60a64e6dcnametestmgmtclasscommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0is_definition0paramsclass_namefilespackagesks_meta` + const methodResponse = `parentdepth0ctime1721480442.0213087mtime1721480442.0213087uid5a4898be6fca4d7884898fa60a64e6dcnametestmgmtclasscommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0is_definition0paramsclass_namefilespackagesks_meta`; const result: Mgmgtclass = { ctime: 1721480442.0213087, mtime: 1721480442.0213087, - name: "testmgmtclass", + name: 'testmgmtclass', depth: 0, - comment: "", - owners: "<>", - uid: "5a4898be6fca4d7884898fa60a64e6dc", + comment: '', + owners: '<>', + uid: '5a4898be6fca4d7884898fa60a64e6dc', fetchable_files: {}, is_subobject: false, - parent: "", + parent: '', kernel_options: {}, kernel_options_post: {}, - mgmt_classes: "<>", + mgmt_classes: '<>', mgmt_parameters: {}, - class_name: "", + class_name: '', files: [], is_definition: false, packages: [], @@ -655,87 +705,93 @@ describe('CobblerApiService', () => { autoinstall_meta: {}, boot_files: {}, template_files: {}, - } - service.get_mgmtclass('', false, false, "").subscribe(value => { - expect(value).toEqual(result) - done() + }; + service.get_mgmtclass('', false, false, '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_package action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480441.7595894mtime1721480441.7595894uida6d7ee9851d74f73b9f393f89efd4caenametestpackagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemodeownergrouppathtemplateinstallerversionks_meta` + const methodResponse = `parentdepth0ctime1721480441.7595894mtime1721480441.7595894uida6d7ee9851d74f73b9f393f89efd4caenametestpackagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemodeownergrouppathtemplateinstallerversionks_meta`; const result: Package = { ctime: 1721480441.7595894, mtime: 1721480441.7595894, - name: "testpackage", + name: 'testpackage', depth: 0, - comment: "", - owners: "<>", - uid: "a6d7ee9851d74f73b9f393f89efd4cae", - action: "create", - installer: "", - version: "", - mode: "", - group: "", - owner: "", - path: "", - template: "", + comment: '', + owners: '<>', + uid: 'a6d7ee9851d74f73b9f393f89efd4cae', + action: 'create', + installer: '', + version: '', + mode: '', + group: '', + owner: '', + path: '', + template: '', fetchable_files: {}, is_subobject: false, - parent: "", + parent: '', kernel_options: {}, kernel_options_post: {}, - mgmt_classes: "<>", + mgmt_classes: '<>', mgmt_parameters: {}, boot_files: {}, autoinstall_meta: {}, template_files: {}, - } - service.get_package('', false, false, "").subscribe(value => { - expect(value).toEqual(result) - done() + }; + service.get_package('', false, false, '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_file action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480443.0627294mtime1721480443.0627294uid650659dad2694598a14632f4a434c4a9nametestfilecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemode0644ownerrootgrouprootpath/root/testfiletemplate/etc/cobbler/dhcp.templateis_dir0ks_meta` + const methodResponse = `parentdepth0ctime1721480443.0627294mtime1721480443.0627294uid650659dad2694598a14632f4a434c4a9nametestfilecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemode0644ownerrootgrouprootpath/root/testfiletemplate/etc/cobbler/dhcp.templateis_dir0ks_meta`; const result: File = { ctime: 1721480443.0627294, mtime: 1721480443.0627294, - name: "testfile", + name: 'testfile', depth: 0, - comment: "", - owners: "<>", - uid: "650659dad2694598a14632f4a434c4a9", - owner: "root", - action: "create", - group: "root", + comment: '', + owners: '<>', + uid: '650659dad2694598a14632f4a434c4a9', + owner: 'root', + action: 'create', + group: 'root', is_dir: false, - mode: "0644", - path: "/root/testfile", - template: "/etc/cobbler/dhcp.template", + mode: '0644', + path: '/root/testfile', + template: '/etc/cobbler/dhcp.template', fetchable_files: {}, is_subobject: false, kernel_options: {}, kernel_options_post: {}, - mgmt_classes: "<>", + mgmt_classes: '<>', mgmt_parameters: {}, template_files: {}, autoinstall_meta: {}, boot_files: {}, - parent: "", - } - service.get_file('', false, false, "").subscribe(value => { - expect(value).toEqual(result) - done() + parent: '', + }; + service.get_file('', false, false, '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -746,174 +802,180 @@ describe('CobblerApiService', () => { it('should execute the get_item_names action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `testdistro` - const result = ["testdistro"] - service.get_item_names('distro').subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `testdistro`; + const result = ['testdistro']; + service.get_item_names('distro').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_distros action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480439.039089mtime1721480439.039089uid12f034d6781946d1af0783e20684cbd4nametestcommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classesmgmt_parametersis_subobject0tree_build_time0.0archx86_64boot_loaders<<inherit>>breedinitrd/root/initrdkernel/root/kernelos_versionredhat_management_key<<inherit>>source_reposremote_boot_kernelremote_grub_kernelremote_boot_initrdremote_grub_initrdks_meta` + const methodResponse = `parentdepth0ctime1721480439.039089mtime1721480439.039089uid12f034d6781946d1af0783e20684cbd4nametestcommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classesmgmt_parametersis_subobject0tree_build_time0.0archx86_64boot_loaders<<inherit>>breedinitrd/root/initrdkernel/root/kernelos_versionredhat_management_key<<inherit>>source_reposremote_boot_kernelremote_grub_kernelremote_boot_initrdremote_grub_initrdks_meta`; const result: Array = [ { ctime: 1721480439.039089, depth: 0, mtime: 1721480439.039089, - uid: "12f034d6781946d1af0783e20684cbd4", + uid: '12f034d6781946d1af0783e20684cbd4', source_repos: [], tree_build_time: 0, - arch: "x86_64", + arch: 'x86_64', autoinstall_meta: {}, boot_files: {}, - boot_loaders: "<>", + boot_loaders: '<>', is_subobject: false, - parent: "", - breed: "", - comment: "", + parent: '', + breed: '', + comment: '', fetchable_files: {}, - initrd: "/root/initrd", - kernel: "/root/kernel", - remote_boot_initrd: "", - remote_boot_kernel: "", - remote_grub_initrd: "", - remote_grub_kernel: "", + initrd: '/root/initrd', + kernel: '/root/kernel', + remote_boot_initrd: '', + remote_boot_kernel: '', + remote_grub_initrd: '', + remote_grub_kernel: '', kernel_options: {}, kernel_options_post: {}, mgmt_classes: [], mgmt_parameters: {}, - name: "test", - os_version: "", - owners: "<>", - redhat_management_key: "<>", - template_files: {} - } - ] - service.get_distros().subscribe(value => { - expect(value).toEqual(result) - done() + name: 'test', + os_version: '', + owners: '<>', + redhat_management_key: '<>', + template_files: {}, + }, + ]; + service.get_distros().subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_profiles action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth1ctime1721480439.3090012mtime1721480439.3090012uid5f01667614244fcd9c7ca7fa59c7def1nametestprofcommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0autoinstall<<inherit>>boot_loaders<<inherit>>dhcp_tagdistrotestenable_ipxe<<inherit>>enable_menu<<inherit>>name_serversname_servers_searchnext_server_v4<<inherit>>next_server_v6<<inherit>>filenameproxy<<inherit>>redhat_management_key<<inherit>>reposserver<<inherit>>menuvirt_auto_boot<<inherit>>virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_typexenpvkickstart<<inherit>>ks_meta<<inherit>>` + const methodResponse = `parentdepth1ctime1721480439.3090012mtime1721480439.3090012uid5f01667614244fcd9c7ca7fa59c7def1nametestprofcommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0autoinstall<<inherit>>boot_loaders<<inherit>>dhcp_tagdistrotestenable_ipxe<<inherit>>enable_menu<<inherit>>name_serversname_servers_searchnext_server_v4<<inherit>>next_server_v6<<inherit>>filenameproxy<<inherit>>redhat_management_key<<inherit>>reposserver<<inherit>>menuvirt_auto_boot<<inherit>>virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_typexenpvkickstart<<inherit>>ks_meta<<inherit>>`; const result: Array = [ { - name: "testprof", + name: 'testprof', depth: 1, mtime: 1721480439.3090012, is_subobject: false, - boot_loaders: "<>", - autoinstall_meta: "<>", - server: "<>", - distro: "test", - comment: "", - next_server_v4: "<>", - next_server_v6: "<>", - enable_ipxe: "<>", - parent: "", - owners: "<>", - autoinstall: "<>", - uid: "5f01667614244fcd9c7ca7fa59c7def1", - virt_ram: "<>", - boot_files: "<>", - mgmt_parameters: "<>", + boot_loaders: '<>', + autoinstall_meta: '<>', + server: '<>', + distro: 'test', + comment: '', + next_server_v4: '<>', + next_server_v6: '<>', + enable_ipxe: '<>', + parent: '', + owners: '<>', + autoinstall: '<>', + uid: '5f01667614244fcd9c7ca7fa59c7def1', + virt_ram: '<>', + boot_files: '<>', + mgmt_parameters: '<>', name_servers: [], - enable_menu: "<>", - menu: "", + enable_menu: '<>', + menu: '', ctime: 1721480439.3090012, - fetchable_files: "<>", - mgmt_classes: "<>", - kernel_options: "<>", - virt_auto_boot: "<>", - kernel_options_post: "<>", - proxy: "<>", - filename: "", - dhcp_tag: "", - redhat_management_key: "<>", + fetchable_files: '<>', + mgmt_classes: '<>', + kernel_options: '<>', + virt_auto_boot: '<>', + kernel_options_post: '<>', + proxy: '<>', + filename: '', + dhcp_tag: '', + redhat_management_key: '<>', repos: [], template_files: {}, - virt_type: "xenpv", + virt_type: 'xenpv', virt_cpus: 1, - virt_bridge: "<>", + virt_bridge: '<>', name_servers_search: [], - virt_path: "", - virt_file_size: "<>", - virt_disk_driver: "raw", - } - ] - service.get_profiles().subscribe(value => { - expect(value).toEqual(result) - done() + virt_path: '', + virt_file_size: '<>', + virt_disk_driver: 'raw', + }, + ]; + service.get_profiles().subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_systems action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth2ctime1721480439.5932038mtime1721480439.5932038uida3320bc9105c44f1b92ab1743d460ed8nametestsyscommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0interfacesdefaultbonding_optsbridge_optscnamesconnected_mode0dhcp_tagdns_nameif_gatewayinterface_masterinterface_typenaip_addressipv6_addressipv6_default_gatewayipv6_mtuipv6_prefixipv6_secondariesipv6_static_routesmac_addressmanagement0mtunetmaskstatic0static_routesvirt_bridge<<inherit>>ipv6_autoconfiguration0repos_enabled0autoinstall<<inherit>>boot_loaders<<inherit>>enable_ipxe<<inherit>>gatewayhostnameimageipv6_default_devicename_serversname_servers_searchnetboot_enabled0next_server_v4<<inherit>>next_server_v6<<inherit>>filename<<inherit>>power_addresspower_idpower_passpower_typepower_userpower_optionspower_identity_fileprofiletestprofproxy<<inherit>>redhat_management_key<<inherit>>server<<inherit>>statusvirt_auto_boot<<inherit>>virt_cpus<<inherit>>virt_disk_driver<<inherit>>virt_file_size<<inherit>>virt_path<<inherit>>virt_pxe_boot0virt_ram<<inherit>>virt_type<<inherit>>serial_device-1serial_baud_rate-1kickstart<<inherit>>ks_meta<<inherit>>` + const methodResponse = `parentdepth2ctime1721480439.5932038mtime1721480439.5932038uida3320bc9105c44f1b92ab1743d460ed8nametestsyscommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0interfacesdefaultbonding_optsbridge_optscnamesconnected_mode0dhcp_tagdns_nameif_gatewayinterface_masterinterface_typenaip_addressipv6_addressipv6_default_gatewayipv6_mtuipv6_prefixipv6_secondariesipv6_static_routesmac_addressmanagement0mtunetmaskstatic0static_routesvirt_bridge<<inherit>>ipv6_autoconfiguration0repos_enabled0autoinstall<<inherit>>boot_loaders<<inherit>>enable_ipxe<<inherit>>gatewayhostnameimageipv6_default_devicename_serversname_servers_searchnetboot_enabled0next_server_v4<<inherit>>next_server_v6<<inherit>>filename<<inherit>>power_addresspower_idpower_passpower_typepower_userpower_optionspower_identity_fileprofiletestprofproxy<<inherit>>redhat_management_key<<inherit>>server<<inherit>>statusvirt_auto_boot<<inherit>>virt_cpus<<inherit>>virt_disk_driver<<inherit>>virt_file_size<<inherit>>virt_path<<inherit>>virt_pxe_boot0virt_ram<<inherit>>virt_type<<inherit>>serial_device-1serial_baud_rate-1kickstart<<inherit>>ks_meta<<inherit>>`; const result: Array = [ { ctime: 1721480439.5932038, mtime: 1721480439.5932038, - name: "testsys", + name: 'testsys', depth: 2, - comment: "", - owners: "<>", - uid: "a3320bc9105c44f1b92ab1743d460ed8", - autoinstall: "<>", - boot_files: "<>", - boot_loaders: "<>", - parent: "", + comment: '', + owners: '<>', + uid: 'a3320bc9105c44f1b92ab1743d460ed8', + autoinstall: '<>', + boot_files: '<>', + boot_loaders: '<>', + parent: '', is_subobject: false, - autoinstall_meta: "<>", - enable_ipxe: "<>", - fetchable_files: "<>", - filename: "<>", - gateway: "", - hostname: "", - image: "", + autoinstall_meta: '<>', + enable_ipxe: '<>', + fetchable_files: '<>', + filename: '<>', + gateway: '', + hostname: '', + image: '', ipv6_autoconfiguration: false, - ipv6_default_device: "", - kernel_options: "<>", - kernel_options_post: "<>", - mgmt_classes: "<>", - mgmt_parameters: "<>", + ipv6_default_device: '', + kernel_options: '<>', + kernel_options_post: '<>', + mgmt_classes: '<>', + mgmt_parameters: '<>', name_servers: [], name_servers_search: [], netboot_enabled: false, - next_server_v4: "<>", - next_server_v6: "<>", - power_address: "", - power_id: "", - power_identity_file: "", - power_options: "", - power_pass: "", - power_type: "", - power_user: "", - profile: "testprof", - proxy: "<>", - redhat_management_key: "<>", + next_server_v4: '<>', + next_server_v6: '<>', + power_address: '', + power_id: '', + power_identity_file: '', + power_options: '', + power_pass: '', + power_type: '', + power_user: '', + profile: 'testprof', + proxy: '<>', + redhat_management_key: '<>', repos_enabled: false, - server: "<>", + server: '<>', serial_baud_rate: -1, serial_device: -1, - status: "", - virt_auto_boot: "<>", - virt_disk_driver: "<>", - virt_path: "<>", - virt_ram: "<>", - virt_type: "<>", - virt_file_size: "<>", - virt_cpus: "<>", + status: '', + virt_auto_boot: '<>', + virt_disk_driver: '<>', + virt_path: '<>', + virt_ram: '<>', + virt_type: '<>', + virt_file_size: '<>', + virt_cpus: '<>', virt_pxe_boot: false, template_files: {}, interfaces: { @@ -941,135 +1003,141 @@ describe('CobblerApiService', () => { static: false, static_routes: [], virt_bridge: '<>', - } - } - } - ] - service.get_systems().subscribe(value => { - expect(value).toEqual(result) - done() + }, + }, + }, + ]; + service.get_systems().subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_repos action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480440.9711354mtime1721480440.9711354uid8b58f9b09a3e4d28965160d97a5de482nametestrepocommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0breednonearchnoneenvironmentyumoptsrsyncoptsmirror_typebaseurlapt_componentsapt_distscreaterepo_flags<<inherit>>keep_updated0mirrormirror_locally0priority0proxy<<inherit>>rpm_listos_versionks_meta` + const methodResponse = `parentdepth0ctime1721480440.9711354mtime1721480440.9711354uid8b58f9b09a3e4d28965160d97a5de482nametestrepocommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0breednonearchnoneenvironmentyumoptsrsyncoptsmirror_typebaseurlapt_componentsapt_distscreaterepo_flags<<inherit>>keep_updated0mirrormirror_locally0priority0proxy<<inherit>>rpm_listos_versionks_meta`; const result: Array = [ { ctime: 1721480440.9711354, mtime: 1721480440.9711354, - name: "testrepo", + name: 'testrepo', depth: 0, - comment: "", - owners: "<>", - uid: "8b58f9b09a3e4d28965160d97a5de482", + comment: '', + owners: '<>', + uid: '8b58f9b09a3e4d28965160d97a5de482', fetchable_files: {}, is_subobject: false, - parent: "", + parent: '', kernel_options: {}, kernel_options_post: {}, - mgmt_classes: "<>", + mgmt_classes: '<>', mgmt_parameters: {}, - arch: "none", - breed: "none", + arch: 'none', + breed: 'none', apt_components: [], apt_dists: [], - mirror: "", + mirror: '', rsyncopts: {}, - proxy: "<>", - createrepo_flags: "<>", + proxy: '<>', + createrepo_flags: '<>', environment: {}, keep_updated: false, mirror_locally: false, - mirror_type: "baseurl", + mirror_type: 'baseurl', priority: 0, rpm_list: [], yumopts: {}, autoinstall_meta: {}, boot_files: {}, - os_version: "", + os_version: '', template_files: {}, - } - ] - service.get_repos().subscribe(value => { - expect(value).toEqual(result) - done() + }, + ]; + service.get_repos().subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_images action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480441.493743mtime1721480441.493743uid911577c3691b4294acdf017e7f15f4cfnametestimagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0archx86_64autoinstall<<inherit>>breedfileimage_typedirectnetwork_count0os_versionboot_loadersmenuvirt_auto_boot0virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_type<<inherit>>kickstart<<inherit>>ks_meta` + const methodResponse = `parentdepth0ctime1721480441.493743mtime1721480441.493743uid911577c3691b4294acdf017e7f15f4cfnametestimagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0archx86_64autoinstall<<inherit>>breedfileimage_typedirectnetwork_count0os_versionboot_loadersmenuvirt_auto_boot0virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_type<<inherit>>kickstart<<inherit>>ks_meta`; const result: Array = [ { ctime: 1721480441.493743, mtime: 1721480441.493743, - name: "testimage", + name: 'testimage', depth: 0, - comment: "", - owners: "<>", - uid: "911577c3691b4294acdf017e7f15f4cf", - arch: "x86_64", - breed: "", - file: "", + comment: '', + owners: '<>', + uid: '911577c3691b4294acdf017e7f15f4cf', + arch: 'x86_64', + breed: '', + file: '', fetchable_files: {}, is_subobject: false, - parent: "", + parent: '', kernel_options: {}, kernel_options_post: {}, - mgmt_classes: "<>", + mgmt_classes: '<>', mgmt_parameters: {}, - autoinstall: "<>", - image_type: "direct", + autoinstall: '<>', + image_type: 'direct', network_count: 0, - os_version: "", + os_version: '', virt_auto_boot: false, - virt_bridge: "<>", + virt_bridge: '<>', virt_cpus: 1, - virt_disk_driver: "raw", - virt_file_size: "<>", - virt_path: "", - virt_ram: "<>", - virt_type: "<>", - menu: "", + virt_disk_driver: 'raw', + virt_file_size: '<>', + virt_path: '', + virt_ram: '<>', + virt_type: '<>', + menu: '', autoinstall_meta: {}, boot_files: {}, boot_loaders: [], template_files: {}, - } - ] - service.get_images().subscribe(value => { - expect(value).toEqual(result) - done() + }, + ]; + service.get_images().subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_mgmtclasses action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480442.0213087mtime1721480442.0213087uid5a4898be6fca4d7884898fa60a64e6dcnametestmgmtclasscommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0is_definition0paramsclass_namefilespackagesks_meta` + const methodResponse = `parentdepth0ctime1721480442.0213087mtime1721480442.0213087uid5a4898be6fca4d7884898fa60a64e6dcnametestmgmtclasscommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0is_definition0paramsclass_namefilespackagesks_meta`; const result: Array = [ { ctime: 1721480442.0213087, mtime: 1721480442.0213087, - name: "testmgmtclass", + name: 'testmgmtclass', depth: 0, - comment: "", - owners: "<>", - uid: "5a4898be6fca4d7884898fa60a64e6dc", + comment: '', + owners: '<>', + uid: '5a4898be6fca4d7884898fa60a64e6dc', fetchable_files: {}, is_subobject: false, - parent: "", + parent: '', kernel_options: {}, kernel_options_post: {}, - mgmt_classes: "<>", + mgmt_classes: '<>', mgmt_parameters: {}, - class_name: "", + class_name: '', files: [], is_definition: false, packages: [], @@ -1077,92 +1145,98 @@ describe('CobblerApiService', () => { autoinstall_meta: {}, boot_files: {}, template_files: {}, - } - ] - service.get_mgmtclasses().subscribe(value => { - expect(value).toEqual(result) - done() + }, + ]; + service.get_mgmtclasses().subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_packages action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480441.7595894mtime1721480441.7595894uida6d7ee9851d74f73b9f393f89efd4caenametestpackagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemodeownergrouppathtemplateinstallerversionks_meta` + const methodResponse = `parentdepth0ctime1721480441.7595894mtime1721480441.7595894uida6d7ee9851d74f73b9f393f89efd4caenametestpackagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemodeownergrouppathtemplateinstallerversionks_meta`; const result: Array = [ { ctime: 1721480441.7595894, mtime: 1721480441.7595894, - name: "testpackage", + name: 'testpackage', depth: 0, - comment: "", - owners: "<>", - uid: "a6d7ee9851d74f73b9f393f89efd4cae", - action: "create", - installer: "", - version: "", - mode: "", - group: "", - owner: "", - path: "", - template: "", + comment: '', + owners: '<>', + uid: 'a6d7ee9851d74f73b9f393f89efd4cae', + action: 'create', + installer: '', + version: '', + mode: '', + group: '', + owner: '', + path: '', + template: '', fetchable_files: {}, is_subobject: false, - parent: "", + parent: '', kernel_options: {}, kernel_options_post: {}, - mgmt_classes: "<>", + mgmt_classes: '<>', mgmt_parameters: {}, boot_files: {}, autoinstall_meta: {}, template_files: {}, - } - ] - service.get_packages().subscribe(value => { - expect(value).toEqual(result) - done() + }, + ]; + service.get_packages().subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_files action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `parentdepth0ctime1721480443.0627294mtime1721480443.0627294uid650659dad2694598a14632f4a434c4a9nametestfilecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemode0644ownerrootgrouprootpath/root/testfiletemplate/etc/cobbler/dhcp.templateis_dir0ks_meta` + const methodResponse = `parentdepth0ctime1721480443.0627294mtime1721480443.0627294uid650659dad2694598a14632f4a434c4a9nametestfilecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemode0644ownerrootgrouprootpath/root/testfiletemplate/etc/cobbler/dhcp.templateis_dir0ks_meta`; const result: Array = [ { ctime: 1721480443.0627294, mtime: 1721480443.0627294, - name: "testfile", + name: 'testfile', depth: 0, - comment: "", - owners: "<>", - uid: "650659dad2694598a14632f4a434c4a9", - owner: "root", - action: "create", - group: "root", + comment: '', + owners: '<>', + uid: '650659dad2694598a14632f4a434c4a9', + owner: 'root', + action: 'create', + group: 'root', is_dir: false, - mode: "0644", - path: "/root/testfile", - template: "/etc/cobbler/dhcp.template", + mode: '0644', + path: '/root/testfile', + template: '/etc/cobbler/dhcp.template', fetchable_files: {}, is_subobject: false, kernel_options: {}, kernel_options_post: {}, - mgmt_classes: "<>", + mgmt_classes: '<>', mgmt_parameters: {}, template_files: {}, autoinstall_meta: {}, boot_files: {}, - parent: "", - } - ] - service.get_files().subscribe(value => { - expect(value).toEqual(result) - done() + parent: '', + }, + ]; + service.get_files().subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -1228,97 +1302,113 @@ describe('CobblerApiService', () => { it('should execute the get_distro_handle action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `distro::test` - const result = "distro::test" - service.get_distro_handle("", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `distro::test`; + const result = 'distro::test'; + service.get_distro_handle('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_profile_handle action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `profile::testprof` - const result = "profile::testprof" - service.get_profile_handle("", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `profile::testprof`; + const result = 'profile::testprof'; + service.get_profile_handle('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_system_handle action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `distro::testdistro` - const result = "distro::testdistro" - service.get_system_handle("", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `distro::testdistro`; + const result = 'distro::testdistro'; + service.get_system_handle('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_repo_handle action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `repo::testrepo` - const result = "repo::testrepo" - service.get_repo_handle("", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `repo::testrepo`; + const result = 'repo::testrepo'; + service.get_repo_handle('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_image_handle action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `image::testimage` - const result = "image::testimage" - service.get_image_handle("", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `image::testimage`; + const result = 'image::testimage'; + service.get_image_handle('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_mgmtclass_handle action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `mgmtclass::testmgmtclass` - const result = "mgmtclass::testmgmtclass" - service.get_mgmtclass_handle("", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `mgmtclass::testmgmtclass`; + const result = 'mgmtclass::testmgmtclass'; + service.get_mgmtclass_handle('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_package_handle action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `package::testpackage` - const result = "package::testpackage" - service.get_package_handle("", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `package::testpackage`; + const result = 'package::testpackage'; + service.get_package_handle('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_file_handle action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `file::testfile` - const result = "file::testfile" - service.get_file_handle("", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `file::testfile`; + const result = 'file::testfile'; + service.get_file_handle('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -1329,97 +1419,113 @@ describe('CobblerApiService', () => { it('should execute the remove_distro action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.remove_distro("", "", false).subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.remove_distro('', '', false).subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the remove_profile action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.remove_profile("", "", false).subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.remove_profile('', '', false).subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the remove_system action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.remove_system("", "", false).subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.remove_system('', '', false).subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the remove_repo action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.remove_repo("", "", false).subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.remove_repo('', '', false).subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the remove_image action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.remove_image("", "", false).subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.remove_image('', '', false).subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the remove_mgmtclass action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.remove_mgmtclass("", "", false).subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.remove_mgmtclass('', '', false).subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the remove_package action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.remove_package("", "", false).subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.remove_package('', '', false).subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the remove_file action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.remove_file("", "", false).subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.remove_file('', '', false).subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -1430,97 +1536,113 @@ describe('CobblerApiService', () => { it('should execute the copy_distro action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.copy_distro("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.copy_distro('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the copy_profile action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.copy_profile("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.copy_profile('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the copy_system action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.copy_system("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.copy_system('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the copy_repo action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.copy_repo("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.copy_repo('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the copy_image action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.copy_image("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.copy_image('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the copy_mgmtclass action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.copy_mgmtclass("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.copy_mgmtclass('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the copy_package action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.copy_package("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.copy_package('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the copy_file action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.copy_file("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.copy_file('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -1531,97 +1653,113 @@ describe('CobblerApiService', () => { it('should execute the rename_distro action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.rename_distro("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.rename_distro('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the rename_profile action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.rename_profile("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.rename_profile('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the rename_system action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.rename_system("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.rename_system('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the rename_repo action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.rename_repo("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.rename_repo('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the rename_image action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.rename_image("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.rename_image('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the rename_mgmtclass action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.rename_mgmtclass("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.rename_mgmtclass('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the rename_package action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.rename_package("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.rename_package('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the rename_file action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` - const result = true - service.rename_file("", "", "").subscribe(value => { - expect(value).toEqual(result) - done() + const methodResponse = `1`; + const result = true; + service.rename_file('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -1731,7 +1869,7 @@ describe('CobblerApiService', () => { }); xit('should execute the xapi_object_edit action on the Cobbler Server', () => { - service.xapi_object_edit('', '', '', {members: []}, ''); + service.xapi_object_edit('', '', '', { members: [] }, ''); expect(service).toBeFalsy(); }); @@ -1760,7 +1898,6 @@ describe('CobblerApiService', () => { expect(service).toBeFalsy(); }); - xit('should execute the save_repo action on the Cobbler Server', () => { service.save_repo('', '', ''); expect(service).toBeFalsy(); @@ -1783,25 +1920,89 @@ describe('CobblerApiService', () => { it('should execute the get_autoinstall_templates action on the Cobbler Server', () => { // eslint-disable-next-line max-len - const methodResponse = `default.ksesxi4-ks.cfgesxi5-ks.cfglegacy.kspowerkvm.kspxerescue.kssample.kssample.seedsample_autoyast.xmlsample_esxi4.kssample_esxi5.kssample_esxi6.kssample_esxi7.kssample_legacy.kssample_old.seedwin.ks` + const methodResponse = `default.ksesxi4-ks.cfgesxi5-ks.cfglegacy.kspowerkvm.kspxerescue.kssample.kssample.seedsample_autoyast.xmlsample_esxi4.kssample_esxi5.kssample_esxi6.kssample_esxi7.kssample_legacy.kssample_old.seedwin.ks`; // eslint-disable-next-line max-len - const result = ["default.ks", "esxi4-ks.cfg", "esxi5-ks.cfg", "legacy.ks", "powerkvm.ks", "pxerescue.ks", "sample.ks", "sample.seed", "sample_autoyast.xml", "sample_esxi4.ks", "sample_esxi5.ks", "sample_esxi6.ks", "sample_esxi7.ks", "sample_legacy.ks", "sample_old.seed", "win.ks"] - service.get_autoinstall_templates("").subscribe(value => { - expect(value).toEqual(result) + const result = [ + 'default.ks', + 'esxi4-ks.cfg', + 'esxi5-ks.cfg', + 'legacy.ks', + 'powerkvm.ks', + 'pxerescue.ks', + 'sample.ks', + 'sample.seed', + 'sample_autoyast.xml', + 'sample_esxi4.ks', + 'sample_esxi5.ks', + 'sample_esxi6.ks', + 'sample_esxi7.ks', + 'sample_legacy.ks', + 'sample_old.seed', + 'win.ks', + ]; + service.get_autoinstall_templates('').subscribe((value) => { + expect(value).toEqual(result); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the get_autoinstall_snippets action on the Cobbler Server', () => { // eslint-disable-next-line max-len - const methodResponse = `addons.xmlautoinstall_doneautoinstall_startcobbler_registerdownload_config_filesdownload_config_files_debhosts.xmlkdump.xmlkeep_cfengine_keyskeep_fileskeep_rhn_keyskeep_rudder_keyskeep_rudder_uuidkeep_ssh_host_keyskoan_environmentlate_apt_repo_configlog_ks_postlog_ks_post_nochrootlog_ks_premain_partition_selectnetwork_confignetwork_config_esxnetwork_config_esxinetworking.xmlpartition_selectpost_anamonpost_install_kernel_optionspost_install_network_configpost_install_network_config_debpost_koan_add_reinstall_entrypost_run_debpre_anamonpre_install_network_configpre_partition_selectpreseed_apt_repo_configproxy.xmlpuppet_install_if_enabledpuppet_register_if_enabledredhat_registerrestore_boot_devicesave_boot_devicesuse_scriptwrapper.xml` + const methodResponse = `addons.xmlautoinstall_doneautoinstall_startcobbler_registerdownload_config_filesdownload_config_files_debhosts.xmlkdump.xmlkeep_cfengine_keyskeep_fileskeep_rhn_keyskeep_rudder_keyskeep_rudder_uuidkeep_ssh_host_keyskoan_environmentlate_apt_repo_configlog_ks_postlog_ks_post_nochrootlog_ks_premain_partition_selectnetwork_confignetwork_config_esxnetwork_config_esxinetworking.xmlpartition_selectpost_anamonpost_install_kernel_optionspost_install_network_configpost_install_network_config_debpost_koan_add_reinstall_entrypost_run_debpre_anamonpre_install_network_configpre_partition_selectpreseed_apt_repo_configproxy.xmlpuppet_install_if_enabledpuppet_register_if_enabledredhat_registerrestore_boot_devicesave_boot_devicesuse_scriptwrapper.xml`; // eslint-disable-next-line max-len - const result = ['addons.xml', 'autoinstall_done', 'autoinstall_start', 'cobbler_register', 'download_config_files', 'download_config_files_deb', 'hosts.xml', 'kdump.xml', 'keep_cfengine_keys', 'keep_files', 'keep_rhn_keys', 'keep_rudder_keys', 'keep_rudder_uuid', 'keep_ssh_host_keys', 'koan_environment', 'late_apt_repo_config', 'log_ks_post', 'log_ks_post_nochroot', 'log_ks_pre', 'main_partition_select', 'network_config', 'network_config_esx', 'network_config_esxi', 'networking.xml', 'partition_select', 'post_anamon', 'post_install_kernel_options', 'post_install_network_config', 'post_install_network_config_deb', 'post_koan_add_reinstall_entry', 'post_run_deb', 'pre_anamon', 'pre_install_network_config', 'pre_partition_select', 'preseed_apt_repo_config', 'proxy.xml', 'puppet_install_if_enabled', 'puppet_register_if_enabled', 'redhat_register', 'restore_boot_device', 'save_boot_device', 'suse_scriptwrapper.xml'] - service.get_autoinstall_snippets("").subscribe(value => { - expect(value).toEqual(result) + const result = [ + 'addons.xml', + 'autoinstall_done', + 'autoinstall_start', + 'cobbler_register', + 'download_config_files', + 'download_config_files_deb', + 'hosts.xml', + 'kdump.xml', + 'keep_cfengine_keys', + 'keep_files', + 'keep_rhn_keys', + 'keep_rudder_keys', + 'keep_rudder_uuid', + 'keep_ssh_host_keys', + 'koan_environment', + 'late_apt_repo_config', + 'log_ks_post', + 'log_ks_post_nochroot', + 'log_ks_pre', + 'main_partition_select', + 'network_config', + 'network_config_esx', + 'network_config_esxi', + 'networking.xml', + 'partition_select', + 'post_anamon', + 'post_install_kernel_options', + 'post_install_network_config', + 'post_install_network_config_deb', + 'post_koan_add_reinstall_entry', + 'post_run_deb', + 'pre_anamon', + 'pre_install_network_config', + 'pre_partition_select', + 'preseed_apt_repo_config', + 'proxy.xml', + 'puppet_install_if_enabled', + 'puppet_register_if_enabled', + 'redhat_register', + 'restore_boot_device', + 'save_boot_device', + 'suse_scriptwrapper.xml', + ]; + service.get_autoinstall_snippets('').subscribe((value) => { + expect(value).toEqual(result); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -1847,14 +2048,16 @@ describe('CobblerApiService', () => { it('should execute the get_settings action on the Cobbler Server', (done) => { // eslint-disable-next-line max-len - const methodResponse = `auto_migrate_settings0allow_duplicate_hostnames0allow_duplicate_ips0allow_duplicate_macs0allow_dynamic_settings0always_write_dhcp_entries0anamon_enabled0auth_token_expiration3600authn_pam_serviceloginautoinstall_snippets_dir/var/lib/cobbler/snippetsautoinstall_templates_dir/var/lib/cobbler/templatesbind_chroot_pathbind_zonefile_path/var/lib/namedbind_master127.0.0.1boot_loader_conf_template_dir/etc/cobbler/boot_loader_confbootloaders_dir/var/lib/cobbler/loadersbootloaders_shim_folder/usr/share/efi/*/bootloaders_shim_fileshim\\.efi$bootloaders_ipxe_folder/usr/share/ipxe/bootloaders_formatsaarch64binary_namegrubaa64.efiarmbinary_namebootarm.efiarm64-efibinary_namegrubaa64.efiextra_modulesefineti386-efibinary_namebootia32.efii386-pc-pxebinary_namegrub.0mod_diri386-pcextra_moduleschainpxebiosdiski686binary_namebootia32.efiIA64binary_namebootia64.efipowerpc-ieee1275binary_namegrub.ppc64leextra_modulesnetofnetx86_64-efibinary_namegrubx86.efiextra_moduleschainefinetbootloaders_modulesbtrfsext2xfsjfsreiserfsall_videobootcatconfigfileechofatfontgfxmenugfxtermgziohaltiso9660jpeglinuxloadenvminicmdnormalpart_applepart_gptpart_msdospassword_pbkdf2pngrebootsearchsearch_fs_filesearch_fs_uuidsearch_labelsleeptesttruevideomdraid09mdraid1xlvmserialregexptrtftphttpluksgcry_rijndaelgcry_sha1gcry_sha256grubconfig_dir/var/lib/cobbler/grub_configbuild_reporting_enabled0build_reporting_emailbuild_reporting_ignorelistbuild_reporting_senderbuild_reporting_smtp_serverlocalhostbuild_reporting_subjectbuildisodir/var/cache/cobbler/buildisocheetah_import_whitelistrerandomtimeclient_use_https0client_use_localhost0cobbler_masterconvert_server_to_ip0createrepo_flags-ccache-sshaautoinstalldefault.ksdefault_name_serversdefault_name_servers_searchdefault_ownershipadmindefault_password_crypted\\$1\\$mF86/UHC\\$WvcIcX2t6crBz2onWxyac.default_template_typecheetahdefault_virt_bridgexenbr0default_virt_disk_driverrawdefault_virt_file_size5.0default_virt_ram512default_virt_typexenpvenable_ipxe0enable_menu1grub2_mod_dir/usr/share/grub2/http_port80iso_template_dir/etc/cobbler/isojinja2_includedir/var/lib/cobbler/jinja2kernel_optionsldap_anonymous_bind1ldap_base_dnDC=devel,DC=redhat,DC=comldap_port389ldap_search_bind_dnldap_search_passwdldap_search_prefixuid=ldap_servergrimlock.devel.redhat.comldap_tls1ldap_tls_cacertdirldap_tls_cacertfileldap_tls_certfileldap_tls_keyfileldap_tls_reqcerthardldap_tls_cipher_suitebind_manage_ipmi0manage_dhcp1manage_dhcp_v60manage_dhcp_v41manage_dns0manage_forward_zonesmanage_reverse_zonesmanage_genders0manage_rsync0manage_tftpd1mgmt_classesmgmt_parametersfrom_cobbler1next_server_v4192.168.1.1next_server_v6::1nsupdate_enabled0nsupdate_log/var/log/cobbler/nsupdate.lognsupdate_tsig_algorithmhmac-sha512nsupdate_tsig_keypower_management_default_typeipmilanproxiesproxy_url_extproxy_url_intpuppet_auto_setup0puppet_parameterized_classes1puppet_serverpuppetpuppet_version2puppetca_path/usr/bin/puppetpxe_just_once1nopxe_with_triggers1redhat_management_permissive0redhat_management_serverxmlrpc.rhn.redhat.comredhat_management_keyregister_new_installs0remove_old_puppet_certs_automatically0replicate_repo_rsync_options-avzHreplicate_rsync_options-avzHreposync_flags-l-m-dreposync_rsync_flagsrestart_dhcp1restart_dns1run_install_triggers1scm_track_enabled0scm_track_modegitscm_track_authorcobbler<cobbler@localhost>scm_push_script/bin/trueserializer_pretty_json0server192.168.1.1sign_puppet_certs_automatically0signature_path/var/lib/cobbler/distro_signatures.jsonsignature_urlhttps://cobbler.github.io/signatures/3.0.x/latest.jsonsyslinux_dir/usr/share/syslinuxsyslinux_memdisk_folder/usr/share/syslinuxsyslinux_pxelinux_folder/usr/share/syslinuxtftpboot_location/srv/tftpbootvirt_auto_boot1webdir/var/www/cobblerwebdir_whitelist.link_cachemiscdistro_mirrorimageslinkslocalmirrorpubrenderedrepo_mirrorrepo_profilerepo_systemsvcwebwebuixmlrpc_port25151yum_distro_priority1yum_post_install_mirror1yumdownloader_flags--resolvewindows_enabled0windows_template_dir/etc/cobbler/windowssamba_distro_shareDISTRO` - const result = 131 + const methodResponse = `auto_migrate_settings0allow_duplicate_hostnames0allow_duplicate_ips0allow_duplicate_macs0allow_dynamic_settings0always_write_dhcp_entries0anamon_enabled0auth_token_expiration3600authn_pam_serviceloginautoinstall_snippets_dir/var/lib/cobbler/snippetsautoinstall_templates_dir/var/lib/cobbler/templatesbind_chroot_pathbind_zonefile_path/var/lib/namedbind_master127.0.0.1boot_loader_conf_template_dir/etc/cobbler/boot_loader_confbootloaders_dir/var/lib/cobbler/loadersbootloaders_shim_folder/usr/share/efi/*/bootloaders_shim_fileshim\\.efi$bootloaders_ipxe_folder/usr/share/ipxe/bootloaders_formatsaarch64binary_namegrubaa64.efiarmbinary_namebootarm.efiarm64-efibinary_namegrubaa64.efiextra_modulesefineti386-efibinary_namebootia32.efii386-pc-pxebinary_namegrub.0mod_diri386-pcextra_moduleschainpxebiosdiski686binary_namebootia32.efiIA64binary_namebootia64.efipowerpc-ieee1275binary_namegrub.ppc64leextra_modulesnetofnetx86_64-efibinary_namegrubx86.efiextra_moduleschainefinetbootloaders_modulesbtrfsext2xfsjfsreiserfsall_videobootcatconfigfileechofatfontgfxmenugfxtermgziohaltiso9660jpeglinuxloadenvminicmdnormalpart_applepart_gptpart_msdospassword_pbkdf2pngrebootsearchsearch_fs_filesearch_fs_uuidsearch_labelsleeptesttruevideomdraid09mdraid1xlvmserialregexptrtftphttpluksgcry_rijndaelgcry_sha1gcry_sha256grubconfig_dir/var/lib/cobbler/grub_configbuild_reporting_enabled0build_reporting_emailbuild_reporting_ignorelistbuild_reporting_senderbuild_reporting_smtp_serverlocalhostbuild_reporting_subjectbuildisodir/var/cache/cobbler/buildisocheetah_import_whitelistrerandomtimeclient_use_https0client_use_localhost0cobbler_masterconvert_server_to_ip0createrepo_flags-ccache-sshaautoinstalldefault.ksdefault_name_serversdefault_name_servers_searchdefault_ownershipadmindefault_password_crypted\\$1\\$mF86/UHC\\$WvcIcX2t6crBz2onWxyac.default_template_typecheetahdefault_virt_bridgexenbr0default_virt_disk_driverrawdefault_virt_file_size5.0default_virt_ram512default_virt_typexenpvenable_ipxe0enable_menu1grub2_mod_dir/usr/share/grub2/http_port80iso_template_dir/etc/cobbler/isojinja2_includedir/var/lib/cobbler/jinja2kernel_optionsldap_anonymous_bind1ldap_base_dnDC=devel,DC=redhat,DC=comldap_port389ldap_search_bind_dnldap_search_passwdldap_search_prefixuid=ldap_servergrimlock.devel.redhat.comldap_tls1ldap_tls_cacertdirldap_tls_cacertfileldap_tls_certfileldap_tls_keyfileldap_tls_reqcerthardldap_tls_cipher_suitebind_manage_ipmi0manage_dhcp1manage_dhcp_v60manage_dhcp_v41manage_dns0manage_forward_zonesmanage_reverse_zonesmanage_genders0manage_rsync0manage_tftpd1mgmt_classesmgmt_parametersfrom_cobbler1next_server_v4192.168.1.1next_server_v6::1nsupdate_enabled0nsupdate_log/var/log/cobbler/nsupdate.lognsupdate_tsig_algorithmhmac-sha512nsupdate_tsig_keypower_management_default_typeipmilanproxiesproxy_url_extproxy_url_intpuppet_auto_setup0puppet_parameterized_classes1puppet_serverpuppetpuppet_version2puppetca_path/usr/bin/puppetpxe_just_once1nopxe_with_triggers1redhat_management_permissive0redhat_management_serverxmlrpc.rhn.redhat.comredhat_management_keyregister_new_installs0remove_old_puppet_certs_automatically0replicate_repo_rsync_options-avzHreplicate_rsync_options-avzHreposync_flags-l-m-dreposync_rsync_flagsrestart_dhcp1restart_dns1run_install_triggers1scm_track_enabled0scm_track_modegitscm_track_authorcobbler<cobbler@localhost>scm_push_script/bin/trueserializer_pretty_json0server192.168.1.1sign_puppet_certs_automatically0signature_path/var/lib/cobbler/distro_signatures.jsonsignature_urlhttps://cobbler.github.io/signatures/3.0.x/latest.jsonsyslinux_dir/usr/share/syslinuxsyslinux_memdisk_folder/usr/share/syslinuxsyslinux_pxelinux_folder/usr/share/syslinuxtftpboot_location/srv/tftpbootvirt_auto_boot1webdir/var/www/cobblerwebdir_whitelist.link_cachemiscdistro_mirrorimageslinkslocalmirrorpubrenderedrepo_mirrorrepo_profilerepo_systemsvcwebwebuixmlrpc_port25151yum_distro_priority1yum_post_install_mirror1yumdownloader_flags--resolvewindows_enabled0windows_template_dir/etc/cobbler/windowssamba_distro_shareDISTRO`; + const result = 131; service.get_settings('').subscribe((data) => { // Let's not compare the content as this is taken care of by the deserializer tests expect(Object.keys(data).length).toEqual(result); done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -1925,37 +2128,40 @@ describe('CobblerApiService', () => { it('should execute the version action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `3.4` - const result = 3.4 - service.version().subscribe(value => { + const methodResponse = `3.4`; + const result = 3.4; + service.version().subscribe((value) => { expect(value).toEqual(result); - done() + done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the extended_version action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `gitdateMon Jun 13 16:13:33 2022 +0200gitstamp0e20f01bbuilddateMon Jun 27 06:34:23 2022version3.4.0version_tuple340` + const methodResponse = `gitdateMon Jun 13 16:13:33 2022 +0200gitstamp0e20f01bbuilddateMon Jun 27 06:34:23 2022version3.4.0version_tuple340`; const result: ExtendedVersion = { - gitdate: "Mon Jun 13 16:13:33 2022 +0200", - gitstamp: "0e20f01b", - builddate: "Mon Jun 27 06:34:23 2022", - version: "3.4.0", + gitdate: 'Mon Jun 13 16:13:33 2022 +0200', + gitstamp: '0e20f01b', + builddate: 'Mon Jun 27 06:34:23 2022', + version: '3.4.0', versionTuple: { major: 3, minor: 4, - patch: 0 - } - } + patch: 0, + }, + }; - service.extended_version().subscribe( - value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + service.extended_version().subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -2061,24 +2267,28 @@ describe('CobblerApiService', () => { it('should execute the get_status action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `127.0.0.11720873663.75668951720873696.675196system:testsys12finished` + const methodResponse = `127.0.0.11720873663.75668951720873696.675196system:testsys12finished`; const result: Array = [ { - ip: "127.0.0.1", + ip: '127.0.0.1', mostRecentStart: 1720873663.7566895, mostRecentStop: 1720873696.675196, mostRecentTarget: 'system:testsys', seenStart: 1, seenStop: 2, - state: 'finished' - } - ] - service.get_status('normal', 'alksjdbskjdbakljdbsaajkiuhgzulnbgtz').subscribe(value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + state: 'finished', + }, + ]; + service + .get_status('normal', 'alksjdbskjdbakljdbsaajkiuhgzulnbgtz') + .subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -2102,12 +2312,13 @@ describe('CobblerApiService', () => { const methodResponse = `alksjdbskjdbakljdbsaajkiuhgzulnbgtz=`; const result = 'alksjdbskjdbakljdbsaajkiuhgzulnbgtz='; - service.login('cobbler', 'cobbler').subscribe( - value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + service.login('cobbler', 'cobbler').subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -2116,12 +2327,15 @@ describe('CobblerApiService', () => { const methodResponse = `1`; const result = true; - service.logout('alksjdbskjdbakljdbsaajkiuhgzulnbgtz=').subscribe( - value => { + service + .logout('alksjdbskjdbakljdbsaajkiuhgzulnbgtz=') + .subscribe((value) => { expect(value).toEqual(result); done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -2130,12 +2344,15 @@ describe('CobblerApiService', () => { const methodResponse = `1`; const result = true; - service.token_check('alksjdbskjdbakljdbsaajkiuhgzulnbgtz=').subscribe( - value => { + service + .token_check('alksjdbskjdbakljdbsaajkiuhgzulnbgtz=') + .subscribe((value) => { expect(value).toEqual(result); done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -2144,12 +2361,15 @@ describe('CobblerApiService', () => { const methodResponse = `1`; const result = true; - service.sync_dhcp('alksjdbskjdbakljdbsaajkiuhgzulnbgtz=').subscribe( - value => { + service + .sync_dhcp('alksjdbskjdbakljdbsaajkiuhgzulnbgtz=') + .subscribe((value) => { expect(value).toEqual(result); done(); }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); @@ -2158,90 +2378,97 @@ describe('CobblerApiService', () => { const methodResponse = `1`; const result = true; - service.sync('alksjdbskjdbakljdbsaajkiuhgzulnbgtz=').subscribe( - value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + service.sync('alksjdbskjdbakljdbsaajkiuhgzulnbgtz=').subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the read_autoinstall_template action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `sample content` - const result = "sample content"; - service.read_autoinstall_template('', '').subscribe( - value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const methodResponse = `sample content`; + const result = 'sample content'; + service.read_autoinstall_template('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the write_autoinstall_template action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` + const methodResponse = `1`; const result = true; - service.write_autoinstall_template('', '', '').subscribe( - value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + service.write_autoinstall_template('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the remove_autoinstall_template action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` + const methodResponse = `1`; const result = true; - service.remove_autoinstall_template('', '').subscribe( - value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + service.remove_autoinstall_template('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the read_autoinstall_snippet action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `sample content` - const result = "sample content"; - service.read_autoinstall_snippet('', '',).subscribe( - value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const methodResponse = `sample content`; + const result = 'sample content'; + service.read_autoinstall_snippet('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the write_autoinstall_snippet action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` + const methodResponse = `1`; const result = true; - service.write_autoinstall_snippet('', '', '').subscribe( - value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + service.write_autoinstall_snippet('', '', '').subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); it('should execute the remove_autoinstall_snippet action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len - const methodResponse = `1` + const methodResponse = `1`; const result = true; - service.remove_autoinstall_snippet('', '').subscribe( - value => { - expect(value).toEqual(result); - done(); - }); - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + service.remove_autoinstall_snippet('', '').subscribe((value) => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); }); diff --git a/projects/cobbler-api/src/lib/cobbler-api.service.ts b/projects/cobbler-api/src/lib/cobbler-api.service.ts index 8189dd0e..d315fd61 100644 --- a/projects/cobbler-api/src/lib/cobbler-api.service.ts +++ b/projects/cobbler-api/src/lib/cobbler-api.service.ts @@ -1,10 +1,25 @@ -import {Injectable, Inject} from '@angular/core'; -import {Observable} from 'rxjs'; -import {map} from 'rxjs/operators'; -import {AngularXmlrpcService, MethodResponse, MethodFault, XmlRpcStruct, XmlRpcArray} from 'typescript-xmlrpc'; -import {Settings} from './custom-types/settings'; -import {COBBLER_URL} from './lib.config'; -import {Distro, Image, Mgmgtclass, Package, Profile, Repo, System, File} from './custom-types/items'; +import { Injectable, Inject } from '@angular/core'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { + AngularXmlrpcService, + MethodResponse, + MethodFault, + XmlRpcStruct, + XmlRpcArray, +} from 'typescript-xmlrpc'; +import { Settings } from './custom-types/settings'; +import { COBBLER_URL } from './lib.config'; +import { + Distro, + Image, + Mgmgtclass, + Package, + Profile, + Repo, + System, + File, +} from './custom-types/items'; import { BackgroundAclSetupOptions, BackgroundBuildisoOptions, @@ -19,19 +34,22 @@ import { RegisterOptions, SyncOptions, SyncSystemsOptions, - Version + Version, } from './custom-types/misc'; -import {DistroSignatures} from "./custom-types/signatures"; +import { DistroSignatures } from './custom-types/signatures'; // TODO: Investigate on server side to build and receive well known interfaces, not just plain objects. @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class CobblerApiService { private client: AngularXmlrpcService; - constructor(xmlrpcService: AngularXmlrpcService, @Inject(COBBLER_URL) url: URL) { + constructor( + xmlrpcService: AngularXmlrpcService, + @Inject(COBBLER_URL) url: URL, + ) { this.client = xmlrpcService; this.client.configureService(url); } @@ -41,548 +59,778 @@ export class CobblerApiService { } check(token: string): Observable> { - return this.client - .methodCall('check', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('check', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as XmlRpcArray; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Check failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }), - map>((data: XmlRpcArray) => { - const result: Array = []; - data.data.forEach(element => { - result.push(element as string); - }); - return result; - }) - ); - } - - background_buildiso(options: BackgroundBuildisoOptions, token: string): Observable { + throw new Error( + 'Check failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), + map>((data: XmlRpcArray) => { + const result: Array = []; + data.data.forEach((element) => { + result.push(element as string); + }); + return result; + }), + ); + } + + background_buildiso( + options: BackgroundBuildisoOptions, + token: string, + ): Observable { const transformedOptions: XmlRpcStruct = { members: [ - {name: 'iso', value: options.iso}, - {name: 'profiles', value: options.profiles}, - {name: 'systems', value: options.systems}, - {name: 'buildisodir', value: options.buildisodir}, - {name: 'distro', value: options.distro}, - {name: 'standalone', value: options.standalone}, - {name: 'airgapped', value: options.airgapped}, - {name: 'source', value: options.source}, - {name: 'excludeDNS', value: options.excludeDNS}, - {name: 'xorrisofsOpts', value: options.xorrisofsOpts}, - ] - } + { name: 'iso', value: options.iso }, + { name: 'profiles', value: options.profiles }, + { name: 'systems', value: options.systems }, + { name: 'buildisodir', value: options.buildisodir }, + { name: 'distro', value: options.distro }, + { name: 'standalone', value: options.standalone }, + { name: 'airgapped', value: options.airgapped }, + { name: 'source', value: options.source }, + { name: 'excludeDNS', value: options.excludeDNS }, + { name: 'xorrisofsOpts', value: options.xorrisofsOpts }, + ], + }; return this.client .methodCall('background_buildiso', [transformedOptions, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Building the ISO in the background failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Building the ISO in the background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - background_aclsetup(options: BackgroundAclSetupOptions, token: string): Observable { + background_aclsetup( + options: BackgroundAclSetupOptions, + token: string, + ): Observable { const transformedOptions: XmlRpcStruct = { members: [ - {name: 'adduser', value: options.adduser}, - {name: 'addgroup', value: options.addgroup}, - {name: 'removeuser', value: options.removeuser}, - {name: 'adduser', value: options.adduser}, - ] - } + { name: 'adduser', value: options.adduser }, + { name: 'addgroup', value: options.addgroup }, + { name: 'removeuser', value: options.removeuser }, + { name: 'adduser', value: options.adduser }, + ], + }; return this.client .methodCall('background_aclsetup', [transformedOptions, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Applying the ACLs in the background failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Applying the ACLs in the background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } background_sync(options: SyncOptions, token: string): Observable { const transformedOptions: XmlRpcStruct = { members: [ - {name: 'dhcp', value: options.dhcp}, - {name: 'dns', value: options.dns}, - {name: 'verbose', value: options.verbose}, - ] - } + { name: 'dhcp', value: options.dhcp }, + { name: 'dns', value: options.dns }, + { name: 'verbose', value: options.verbose }, + ], + }; return this.client .methodCall('background_sync', [transformedOptions, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Executing a sync in the background failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Executing a sync in the background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - background_syncsystems(options: SyncSystemsOptions, token: string): Observable { + background_syncsystems( + options: SyncSystemsOptions, + token: string, + ): Observable { const transformedOptions: XmlRpcStruct = { members: [ - {name: 'systems', value: {data: options.systems}}, - {name: 'verbose', value: options.verbose}, - ] - } + { name: 'systems', value: { data: options.systems } }, + { name: 'verbose', value: options.verbose }, + ], + }; return this.client .methodCall('background_syncsystems', [transformedOptions, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Syncing the systems in background failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Syncing the systems in background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } background_hardlink(token: string): Observable { - const hardlinkOptions: XmlRpcStruct = {members: []} + const hardlinkOptions: XmlRpcStruct = { members: [] }; return this.client .methodCall('background_hardlink', [hardlinkOptions, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Hardlinking files on the server in the background failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Hardlinking files on the server in the background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } backgroundMkloaders(token: string): Observable { - const mkloadersOptions: XmlRpcStruct = {members: []} + const mkloadersOptions: XmlRpcStruct = { members: [] }; return this.client .methodCall('background_mkloaders', [mkloadersOptions, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Mkloading files on the server in the background failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Mkloading files on the server in the background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } background_validate_autoinstall_files(token: string): Observable { - const validateAutoinstallOptions: XmlRpcStruct = {members: []} - return this.client - .methodCall('background_validate_autoinstall_files', [validateAutoinstallOptions, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Validation of auto-installation files in the background failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); - } - }) + const validateAutoinstallOptions: XmlRpcStruct = { members: [] }; + return this.client + .methodCall('background_validate_autoinstall_files', [ + validateAutoinstallOptions, + token, + ]) + .pipe( + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Validation of auto-installation files in the background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - background_replicate(options: BackgroundReplicateOptions, token: string): Observable { + background_replicate( + options: BackgroundReplicateOptions, + token: string, + ): Observable { const transformedOptions: XmlRpcStruct = { members: [ - {name: 'master', value: options.master}, - {name: 'port', value: options.port}, - {name: 'distro_patterns', value: options.distro_patterns}, - {name: 'profile_patterns', value: options.profile_patterns}, - {name: 'system_patterns', value: options.system_patterns}, - {name: 'repo_patterns', value: options.repo_patterns}, - {name: 'image_patterns', value: options.image_patterns}, - {name: 'mgmtclass_patterns', value: options.mgmtclass_patterns}, - {name: 'package_patterns', value: options.package_patterns}, - {name: 'file_patterns', value: options.file_patterns}, - {name: 'prune', value: options.prune}, - {name: 'omit_data', value: options.omit_data}, - {name: 'sync_all', value: options.sync_all}, - {name: 'use_ssl', value: options.use_ssl}, - ] - } + { name: 'master', value: options.master }, + { name: 'port', value: options.port }, + { name: 'distro_patterns', value: options.distro_patterns }, + { name: 'profile_patterns', value: options.profile_patterns }, + { name: 'system_patterns', value: options.system_patterns }, + { name: 'repo_patterns', value: options.repo_patterns }, + { name: 'image_patterns', value: options.image_patterns }, + { name: 'mgmtclass_patterns', value: options.mgmtclass_patterns }, + { name: 'package_patterns', value: options.package_patterns }, + { name: 'file_patterns', value: options.file_patterns }, + { name: 'prune', value: options.prune }, + { name: 'omit_data', value: options.omit_data }, + { name: 'sync_all', value: options.sync_all }, + { name: 'use_ssl', value: options.use_ssl }, + ], + }; return this.client .methodCall('background_replicate', [transformedOptions, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Replicating the Cobbler instance in the background failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Replicating the Cobbler instance in the background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - background_import(options: BackgroundImportOptions, token: string): Observable { + background_import( + options: BackgroundImportOptions, + token: string, + ): Observable { const transformedOptions: XmlRpcStruct = { members: [ - {name: 'path', value: options.path}, - {name: 'name', value: options.name}, - {name: 'available_as', value: options.available_as}, - {name: 'autoinstall_file', value: options.autoinstall_file}, - {name: 'rsync_flags', value: options.rsync_flags}, - {name: 'arch', value: options.arch}, - {name: 'breed', value: options.breed}, - {name: 'os_version', value: options.os_version}, - ] - } + { name: 'path', value: options.path }, + { name: 'name', value: options.name }, + { name: 'available_as', value: options.available_as }, + { name: 'autoinstall_file', value: options.autoinstall_file }, + { name: 'rsync_flags', value: options.rsync_flags }, + { name: 'arch', value: options.arch }, + { name: 'breed', value: options.breed }, + { name: 'os_version', value: options.os_version }, + ], + }; return this.client .methodCall('background_import', [transformedOptions, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Importing an ISO on the server in the background failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Importing an ISO on the server in the background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - background_reposync(options: BackgroundReposyncOptions, token: string): Observable { + background_reposync( + options: BackgroundReposyncOptions, + token: string, + ): Observable { const transformedOptions: XmlRpcStruct = { members: [ - {name: 'repos', value: {data: options.repos}}, - {name: 'only', value: options.only}, - {name: 'nofail', value: options.nofail}, - {name: 'tries', value: options.tries}, - ] - } + { name: 'repos', value: { data: options.repos } }, + { name: 'only', value: options.only }, + { name: 'nofail', value: options.nofail }, + { name: 'tries', value: options.tries }, + ], + }; return this.client .methodCall('background_reposync', [transformedOptions, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Executing a reposync in the background failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Executing a reposync in the background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - background_power_system(options: BackgroundPowerSystem, token: string): Observable { + background_power_system( + options: BackgroundPowerSystem, + token: string, + ): Observable { const transformedOptions: XmlRpcStruct = { members: [ - {name: 'systems', value: {data: options.systems}}, - {name: 'power', value: options.power}, - ] - } + { name: 'systems', value: { data: options.systems } }, + { name: 'power', value: options.power }, + ], + }; return this.client .methodCall('background_power_system', [transformedOptions, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Executing the power action for a system in the background failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Executing the power action for a system in the background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - power_system(systemId: string, power: string, token: string): Observable { + power_system( + systemId: string, + power: string, + token: string, + ): Observable { return this.client .methodCall('power_system', [systemId, power, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Executing the power action for a system failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Executing the power action for a system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } background_signature_update(token: string): Observable { - const signatureUpdateOptions: XmlRpcStruct = {members: []} - return this.client - .methodCall('background_signature_update', [signatureUpdateOptions, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Updating the signatures in the background failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + const signatureUpdateOptions: XmlRpcStruct = { members: [] }; + return this.client + .methodCall('background_signature_update', [ + signatureUpdateOptions, + token, + ]) + .pipe( + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Updating the signatures in the background failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } get_events(forUser: string): Observable> { - return this.client - .methodCall('get_events', [forUser]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_events', [forUser]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as XmlRpcStruct; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the events failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }), - map>((data: XmlRpcStruct) => { - let result: Array = []; - data.members.forEach( element => { - const membersArray = element.value as XmlRpcArray - const usersArray = membersArray.data[3] as XmlRpcArray - result.push({ - id: element.name, - statetime: membersArray.data[0] as number, - name: membersArray.data[1] as string, - state: membersArray.data[2] as string, - readByWho: usersArray.data as string[] - }) - }) - return result; - }) - ); + throw new Error( + 'Getting the events failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), + map>((data: XmlRpcStruct) => { + let result: Array = []; + data.members.forEach((element) => { + const membersArray = element.value as XmlRpcArray; + const usersArray = membersArray.data[3] as XmlRpcArray; + result.push({ + id: element.name, + statetime: membersArray.data[0] as number, + name: membersArray.data[1] as string, + state: membersArray.data[2] as string, + readByWho: usersArray.data as string[], + }); + }); + return result; + }), + ); } get_event_log(eventId: string): Observable { - return this.client - .methodCall('get_event_log', [eventId]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_event_log', [eventId]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the event log failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the event log failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_task_status(eventId: string): Observable { - return this.client - .methodCall('get_task_status', [eventId]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_task_status', [eventId]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as XmlRpcArray; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the status of the requested task failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }), - map((data: XmlRpcArray) => { - const readByWho = data.data[3] as XmlRpcArray - return { - id: eventId, - statetime: data.data[0] as number, - name: data.data[1] as string, - state: data.data[2] as string, - readByWho: readByWho.data as string[], - } - }) - ); + throw new Error( + 'Getting the status of the requested task failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), + map((data: XmlRpcArray) => { + const readByWho = data.data[3] as XmlRpcArray; + return { + id: eventId, + statetime: data.data[0] as number, + name: data.data[1] as string, + state: data.data[2] as string, + readByWho: readByWho.data as string[], + }; + }), + ); } last_modified_time(): Observable { - return this.client - .methodCall('last_modified_time') - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('last_modified_time').pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as number; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the last modified time failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the last modified time failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } ping(): Observable { - return this.client - .methodCall('ping') - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('ping').pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Pinging the server failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Pinging the server failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_user_from_token(token: string): Observable { - return this.client - .methodCall('get_user_from_token', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_user_from_token', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the user from the requested token failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the user from the requested token failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } private rebuildItem(xmlrpcStruct: XmlRpcStruct): object { - const result = {} - xmlrpcStruct.members.forEach(value => { - if (value.name === "ks_meta" || value.name === "kickstart") { + const result = {}; + xmlrpcStruct.members.forEach((value) => { + if (value.name === 'ks_meta' || value.name === 'kickstart') { // Skip legacy keys return; } if (AngularXmlrpcService.instanceOfXmlRpcArray(value.value)) { - result[value.name] = this.convertXmlRpcArrayToTypeScriptArray(value.value) + result[value.name] = this.convertXmlRpcArrayToTypeScriptArray( + value.value, + ); } else if (AngularXmlrpcService.instanceOfXmlRpcStruct(value.value)) { - result[value.name] = this.convertXmlRpcStructToTypeScriptObject(value.value) - } else if (value.value === "<<inherit>>") { + result[value.name] = this.convertXmlRpcStructToTypeScriptObject( + value.value, + ); + } else if (value.value === '<<inherit>>') { // FIXME: Maybe we need to XML encode this as other strings potentially also could need encoding - result[value.name] = "<>" + result[value.name] = '<>'; } else { - result[value.name] = value.value + result[value.name] = value.value; } - }) - return result + }); + return result; } // TODO: Create casting magic to output the right item type - get_item(what: string, name: string, flatten: boolean = false): Observable { - return this.client - .methodCall('get_item', [what, name, flatten]) - .pipe( - map((data: MethodResponse | MethodFault) => { + get_item( + what: string, + name: string, + flatten: boolean = false, + ): Observable { + return this.client.methodCall('get_item', [what, name, flatten]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested item failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the requested item failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } - get_distro(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { + get_distro( + name: string, + flatten: boolean = false, + resolved: boolean = false, + token: string, + ): Observable { return this.client .methodCall('get_distro', [name, flatten, resolved, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { - throw new Error("Expected XML-RPC Struct not something else!") + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error('Expected XML-RPC Struct not something else!'); + } + const result = this.rebuildItem(data.value); + return result as Distro; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested distro failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - const result = this.rebuildItem(data.value) - return result as Distro; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested distro failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + }, + ), ); } - get_profile(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { + get_profile( + name: string, + flatten: boolean = false, + resolved: boolean = false, + token: string, + ): Observable { return this.client .methodCall('get_profile', [name, flatten, resolved, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { - throw new Error("Expected XML-RPC Struct not something else!") + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error('Expected XML-RPC Struct not something else!'); + } + const result = this.rebuildItem(data.value); + return result as Profile; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - const result = this.rebuildItem(data.value) - return result as Profile; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested profile failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + }, + ), ); } - get_system(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { + get_system( + name: string, + flatten: boolean = false, + resolved: boolean = false, + token: string, + ): Observable { return this.client .methodCall('get_system', [name, flatten, resolved, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { - throw new Error("Expected XML-RPC Struct not something else!") + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error('Expected XML-RPC Struct not something else!'); + } + const result = this.rebuildItem(data.value); + return result as System; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - const result = this.rebuildItem(data.value) - return result as System; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested system failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + }, + ), ); } - get_repo(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { + get_repo( + name: string, + flatten: boolean = false, + resolved: boolean = false, + token: string, + ): Observable { return this.client .methodCall('get_repo', [name, flatten, resolved, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { - throw new Error("Expected XML-RPC Struct not something else!") + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error('Expected XML-RPC Struct not something else!'); + } + const result = this.rebuildItem(data.value); + return result as Repo; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested repository failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - const result = this.rebuildItem(data.value) - return result as Repo; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested repository failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + }, + ), ); } - get_image(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { + get_image( + name: string, + flatten: boolean = false, + resolved: boolean = false, + token: string, + ): Observable { return this.client .methodCall('get_image', [name, flatten, resolved, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { - throw new Error("Expected XML-RPC Struct not something else!") + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error('Expected XML-RPC Struct not something else!'); + } + const result = this.rebuildItem(data.value); + return result as Image; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested image failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - const result = this.rebuildItem(data.value) - return result as Image; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested image failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + }, + ), ); } @@ -590,61 +838,92 @@ export class CobblerApiService { name: string, flatten: boolean = false, resolved: boolean = false, - token: string + token: string, ): Observable { return this.client .methodCall('get_mgmtclass', [name, flatten, resolved, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { - throw new Error("Expected XML-RPC Struct not something else!") + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error('Expected XML-RPC Struct not something else!'); + } + const result = this.rebuildItem(data.value); + return result as Mgmgtclass; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested management class failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - const result = this.rebuildItem(data.value) - return result as Mgmgtclass; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested management class failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + }, + ), ); } - get_package(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { + get_package( + name: string, + flatten: boolean = false, + resolved: boolean = false, + token: string, + ): Observable { return this.client .methodCall('get_package', [name, flatten, resolved, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { - throw new Error("Expected XML-RPC Struct not something else!") + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error('Expected XML-RPC Struct not something else!'); + } + const result = this.rebuildItem(data.value); + return result as Package; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested package failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - const result = this.rebuildItem(data.value) - return result as Package; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested package failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + }, + ), ); } - get_file(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { + get_file( + name: string, + flatten: boolean = false, + resolved: boolean = false, + token: string, + ): Observable { return this.client .methodCall('get_file', [name, flatten, resolved, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { - throw new Error("Expected XML-RPC Struct not something else!") + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error('Expected XML-RPC Struct not something else!'); + } + const result = this.rebuildItem(data.value); + return result as File; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested file failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - const result = this.rebuildItem(data.value) - return result as File; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested file failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + }, + ), ); } @@ -652,254 +931,321 @@ export class CobblerApiService { get_items(what: string): Observable> { // TODO: Add magic for casting to correct Collection - return this.client - .methodCall('get_items', [what]) - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_items', [what]).pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { // FIXME: Make the cast without the unknown possible return data.value as unknown as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested collection failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the requested collection failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_item_names(what: string): Observable> { - return this.client - .methodCall('get_item_names', [what]) - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_item_names', [what]).pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { - throw new Error("Expected XML-RPC Array but got something else!") + throw new Error('Expected XML-RPC Array but got something else!'); } return data.value.data as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the item names failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the item names failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_distros(): Observable> { - return this.client - .methodCall('get_distros') - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_distros').pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { - throw new Error("Expected XML-RPC Array!") + throw new Error('Expected XML-RPC Array!'); } - const result = [] - data.value.data.forEach(value => { + const result = []; + data.value.data.forEach((value) => { if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { - throw new Error("Expected XML-RPC Struct!") + throw new Error('Expected XML-RPC Struct!'); } - result.push(this.rebuildItem(value)) - }) + result.push(this.rebuildItem(value)); + }); return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting all distros failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting all distros failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_profiles(): Observable> { - return this.client - .methodCall('get_profiles') - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_profiles').pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { - throw new Error("Expected XML-RPC Array!") + throw new Error('Expected XML-RPC Array!'); } - const result = [] - data.value.data.forEach(value => { + const result = []; + data.value.data.forEach((value) => { if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { - throw new Error("Expected XML-RPC Struct!") + throw new Error('Expected XML-RPC Struct!'); } - result.push(this.rebuildItem(value)) - }) + result.push(this.rebuildItem(value)); + }); return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting all profiles failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting all profiles failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_systems(): Observable> { - return this.client - .methodCall('get_systems') - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_systems').pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { - throw new Error("Expected XML-RPC Array!") + throw new Error('Expected XML-RPC Array!'); } - const result = [] - data.value.data.forEach(value => { + const result = []; + data.value.data.forEach((value) => { if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { - throw new Error("Expected XML-RPC Struct!") + throw new Error('Expected XML-RPC Struct!'); } - result.push(this.rebuildItem(value)) - }) + result.push(this.rebuildItem(value)); + }); return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the systems failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the systems failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_repos(): Observable> { - return this.client - .methodCall('get_repos') - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_repos').pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { - throw new Error("Expected XML-RPC Array!") + throw new Error('Expected XML-RPC Array!'); } - const result = [] - data.value.data.forEach(value => { + const result = []; + data.value.data.forEach((value) => { if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { - throw new Error("Expected XML-RPC Struct!") + throw new Error('Expected XML-RPC Struct!'); } - result.push(this.rebuildItem(value)) - }) + result.push(this.rebuildItem(value)); + }); return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the repositories failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the repositories failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_images(): Observable> { - return this.client - .methodCall('get_images') - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_images').pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { - throw new Error("Expected XML-RPC Array!") + throw new Error('Expected XML-RPC Array!'); } - const result = [] - data.value.data.forEach(value => { + const result = []; + data.value.data.forEach((value) => { if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { - throw new Error("Expected XML-RPC Struct!") + throw new Error('Expected XML-RPC Struct!'); } - result.push(this.rebuildItem(value)) - }) + result.push(this.rebuildItem(value)); + }); return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the images failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the images failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_mgmtclasses(): Observable> { - return this.client - .methodCall('get_mgmtclasses') - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_mgmtclasses').pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { - throw new Error("Expected XML-RPC Array!") + throw new Error('Expected XML-RPC Array!'); } - const result = [] - data.value.data.forEach(value => { + const result = []; + data.value.data.forEach((value) => { if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { - throw new Error("Expected XML-RPC Struct!") + throw new Error('Expected XML-RPC Struct!'); } - result.push(this.rebuildItem(value)) - }) + result.push(this.rebuildItem(value)); + }); return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the management classes failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the management classes failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_packages(): Observable> { - return this.client - .methodCall('get_packages') - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_packages').pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { - throw new Error("Expected XML-RPC Array!") + throw new Error('Expected XML-RPC Array!'); } - const result = [] - data.value.data.forEach(value => { + const result = []; + data.value.data.forEach((value) => { if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { - throw new Error("Expected XML-RPC Struct!") + throw new Error('Expected XML-RPC Struct!'); } - result.push(this.rebuildItem(value)) - }) + result.push(this.rebuildItem(value)); + }); return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the packages failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the packages failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_files(): Observable> { - return this.client - .methodCall('get_files') - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_files').pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { - throw new Error("Expected XML-RPC Array!") + throw new Error('Expected XML-RPC Array!'); } - const result = [] - data.value.data.forEach(value => { + const result = []; + data.value.data.forEach((value) => { if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { - throw new Error("Expected XML-RPC Struct!") + throw new Error('Expected XML-RPC Struct!'); } - result.push(this.rebuildItem(value)) - }) + result.push(this.rebuildItem(value)); + }); return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the files failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the files failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } // TODO: Create method for Menus - find_items(what: string, criteria: object, sortField: string, expand: boolean): Observable> { - return this.client - .methodCall('find_items', [what, criteria as XmlRpcStruct, sortField, expand]) - .pipe( - map>((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Finding the requested items failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + find_items( + what: string, + criteria: object, + sortField: string, + expand: boolean, + ): Observable> { + return this.client + .methodCall('find_items', [ + what, + criteria as XmlRpcStruct, + sortField, + expand, + ]) + .pipe( + map>( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + // FIXME: Make the cast without the unknown possible + return data.value as unknown as Array; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Finding the requested items failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } @@ -907,15 +1253,22 @@ export class CobblerApiService { return this.client .methodCall('find_distro', [criteria as XmlRpcStruct, expand]) .pipe( - map>((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Finding the requested distros failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map>( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + // FIXME: Make the cast without the unknown possible + return data.value as unknown as Array; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Finding the requested distros failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } @@ -923,15 +1276,22 @@ export class CobblerApiService { return this.client .methodCall('find_profile', [criteria as XmlRpcStruct, expand]) .pipe( - map>((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Finding the requested profiles failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map>( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + // FIXME: Make the cast without the unknown possible + return data.value as unknown as Array; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Finding the requested profiles failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } @@ -939,15 +1299,22 @@ export class CobblerApiService { return this.client .methodCall('find_system', [criteria as XmlRpcStruct, expand]) .pipe( - map>((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Finding the requested systems failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map>( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + // FIXME: Make the cast without the unknown possible + return data.value as unknown as Array; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Finding the requested systems failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } @@ -955,15 +1322,22 @@ export class CobblerApiService { return this.client .methodCall('find_repo', [criteria as XmlRpcStruct, expand]) .pipe( - map>((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Finding the requested repos failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map>( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + // FIXME: Make the cast without the unknown possible + return data.value as unknown as Array; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Finding the requested repos failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } @@ -971,31 +1345,48 @@ export class CobblerApiService { return this.client .methodCall('find_image', [criteria as XmlRpcStruct, expand]) .pipe( - map>((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Finding the requested images failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map>( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + // FIXME: Make the cast without the unknown possible + return data.value as unknown as Array; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Finding the requested images failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - find_mgmtclass(criteria: object, expand: boolean): Observable> { + find_mgmtclass( + criteria: object, + expand: boolean, + ): Observable> { return this.client .methodCall('find_mgmtclass', [criteria as XmlRpcStruct, expand]) .pipe( - map>((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Finding the requested management classes failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map>( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + // FIXME: Make the cast without the unknown possible + return data.value as unknown as Array; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Finding the requested management classes failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } @@ -1003,15 +1394,22 @@ export class CobblerApiService { return this.client .methodCall('find_package', [criteria as XmlRpcStruct, expand]) .pipe( - map>((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Finding the requested packages failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map>( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + // FIXME: Make the cast without the unknown possible + return data.value as unknown as Array; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Finding the requested packages failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } @@ -1019,1122 +1417,1807 @@ export class CobblerApiService { return this.client .methodCall('find_file', [criteria as XmlRpcStruct, expand]) .pipe( - map>((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Finding the requested files failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map>( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + // FIXME: Make the cast without the unknown possible + return data.value as unknown as Array; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Finding the requested files failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } // TODO: Create find for menu - find_items_paged(what: string, criteria: object, sortFields: string, page: number, itemsPerPage: number, - token: string): Observable { - return this.client - .methodCall('find_items_paged', [what, criteria as XmlRpcStruct, sortFields, page, itemsPerPage, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as PagesItemsResult; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Finding the requested items (paged) failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + find_items_paged( + what: string, + criteria: object, + sortFields: string, + page: number, + itemsPerPage: number, + token: string, + ): Observable { + return this.client + .methodCall('find_items_paged', [ + what, + criteria as XmlRpcStruct, + sortFields, + page, + itemsPerPage, + token, + ]) + .pipe( + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + // FIXME: Make the cast without the unknown possible + return data.value as unknown as PagesItemsResult; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Finding the requested items (paged) failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } has_item(what: string, name: string, token: string): Observable { - return this.client - .methodCall('has_item', [what, name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('has_item', [what, name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Checking if the item exists failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Checking if the item exists failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } - get_item_handle(what: string, name: string, token: string): Observable { - return this.client - .methodCall('get_item_handle', [what, name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + get_item_handle( + what: string, + name: string, + token: string, + ): Observable { + return this.client.methodCall('get_item_handle', [what, name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the item handle failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the item handle failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_distro_handle(name: string, token: string): Observable { - return this.client - .methodCall('get_distro_handle', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_distro_handle', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the distro handle failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the distro handle failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_profile_handle(name: string, token: string): Observable { - return this.client - .methodCall('get_profile_handle', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_profile_handle', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the profile handle failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the profile handle failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_system_handle(name: string, token: string): Observable { - return this.client - .methodCall('get_system_handle', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_system_handle', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the system handle failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the system handle failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_repo_handle(name: string, token: string): Observable { - return this.client - .methodCall('get_repo_handle', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_repo_handle', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the repository handle failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the repository handle failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_image_handle(name: string, token: string): Observable { - return this.client - .methodCall('get_image_handle', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_image_handle', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the image handle failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the image handle failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_mgmtclass_handle(name: string, token: string): Observable { - return this.client - .methodCall('get_mgmtclass_handle', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_mgmtclass_handle', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the management class handle failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the management class handle failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_package_handle(name: string, token: string): Observable { - return this.client - .methodCall('get_package_handle', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_package_handle', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the package handle failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the package handle failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_file_handle(name: string, token: string): Observable { - return this.client - .methodCall('get_file_handle', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_file_handle', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the file handle failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the file handle failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } - remove_item(what: string, name: string, token: string, recursive = true): Observable { + remove_item( + what: string, + name: string, + token: string, + recursive = true, + ): Observable { return this.client .methodCall('remove_item', [what, name, token, recursive]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Removing the requested item failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Removing the requested item failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - remove_distro(name: string, token: string, recursive = true): Observable { + remove_distro( + name: string, + token: string, + recursive = true, + ): Observable { return this.client .methodCall('remove_distro', [name, token, recursive]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Removing the requested distro failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Removing the requested distro failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - remove_profile(name: string, token: string, recursive = true): Observable { + remove_profile( + name: string, + token: string, + recursive = true, + ): Observable { return this.client .methodCall('remove_profile', [name, token, recursive]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Removing the requested profile failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Removing the requested profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - remove_system(name: string, token: string, recursive = true): Observable { + remove_system( + name: string, + token: string, + recursive = true, + ): Observable { return this.client .methodCall('remove_system', [name, token, recursive]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Removing the requested system failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Removing the requested system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - remove_repo(name: string, token: string, recursive = true): Observable { - return this.client - .methodCall('remove_repo', [name, token, recursive]) - .pipe( - map((data: MethodResponse | MethodFault) => { + remove_repo( + name: string, + token: string, + recursive = true, + ): Observable { + return this.client.methodCall('remove_repo', [name, token, recursive]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Removing the requested repo failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Removing the requested repo failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } - remove_image(name: string, token: string, recursive = true): Observable { + remove_image( + name: string, + token: string, + recursive = true, + ): Observable { return this.client .methodCall('remove_image', [name, token, recursive]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Removing the requested image failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Removing the requested image failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - remove_mgmtclass(name: string, token: string, recursive = true): Observable { + remove_mgmtclass( + name: string, + token: string, + recursive = true, + ): Observable { return this.client .methodCall('remove_mgmtclass', [name, token, recursive]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Removing the requested management class failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Removing the requested management class failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - remove_package(name: string, token: string, recursive = true): Observable { + remove_package( + name: string, + token: string, + recursive = true, + ): Observable { return this.client .methodCall('remove_package', [name, token, recursive]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Removing the requested package failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Removing the requested package failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - remove_file(name: string, token: string, recursive = true): Observable { - return this.client - .methodCall('remove_file', [name, token, recursive]) - .pipe( - map((data: MethodResponse | MethodFault) => { + remove_file( + name: string, + token: string, + recursive = true, + ): Observable { + return this.client.methodCall('remove_file', [name, token, recursive]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Removing the requested file failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Removing the requested file failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } - copy_item(what: string, objectId: string, newName: string, token: string): Observable { + copy_item( + what: string, + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('copy_item', [what, objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Copying the requested item failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Copying the requested item failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - copy_distro(objectId: string, newName: string, token: string): Observable { + copy_distro( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('copy_distro', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Copying the requested distro failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Copying the requested distro failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - copy_profile(objectId: string, newName: string, token: string): Observable { + copy_profile( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('copy_profile', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Copying the requested profile failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Copying the requested profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - copy_system(objectId: string, newName: string, token: string): Observable { + copy_system( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('copy_system', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Copying the requested system failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Copying the requested system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - copy_repo(objectId: string, newName: string, token: string): Observable { - return this.client - .methodCall('copy_repo', [objectId, newName, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + copy_repo( + objectId: string, + newName: string, + token: string, + ): Observable { + return this.client.methodCall('copy_repo', [objectId, newName, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Copying the requested repository failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Copying the requested repository failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } - copy_image(objectId: string, newName: string, token: string): Observable { + copy_image( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('copy_image', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Copying the requested image failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Copying the requested image failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - copy_mgmtclass(objectId: string, newName: string, token: string): Observable { + copy_mgmtclass( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('copy_mgmtclass', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Copying the requested management class failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Copying the requested management class failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - copy_package(objectId: string, newName: string, token: string): Observable { + copy_package( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('copy_package', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Copying the requested package failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Copying the requested package failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - copy_file(objectId: string, newName: string, token: string): Observable { - return this.client - .methodCall('copy_file', [objectId, newName, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + copy_file( + objectId: string, + newName: string, + token: string, + ): Observable { + return this.client.methodCall('copy_file', [objectId, newName, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Copying the requested file failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Copying the requested file failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } - rename_item(what: string, objectId: string, newName: string, token: string): Observable { + rename_item( + what: string, + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('rename_item', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Renaming the requested item failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Renaming the requested item failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - rename_distro(objectId: string, newName: string, token: string): Observable { + rename_distro( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('rename_distro', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Renaming the requested distro failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Renaming the requested distro failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - rename_profile(objectId: string, newName: string, token: string): Observable { + rename_profile( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('rename_profile', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Renaming the requested profile failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Renaming the requested profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - rename_system(objectId: string, newName: string, token: string): Observable { + rename_system( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('rename_system', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Renaming the requested system failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Renaming the requested system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - rename_repo(objectId: string, newName: string, token: string): Observable { + rename_repo( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('rename_repo', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Renaming the requested repository failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Renaming the requested repository failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - rename_image(objectId: string, newName: string, token: string): Observable { + rename_image( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('rename_image', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Renaming the requested image failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Renaming the requested image failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - rename_mgmtclass(objectId: string, newName: string, token: string): Observable { + rename_mgmtclass( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('rename_mgmtclass', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Renaming the requested management class failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Renaming the requested management class failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - rename_package(objectId: string, newName: string, token: string): Observable { + rename_package( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('rename_package', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Renaming the requested package failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Renaming the requested package failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - rename_file(objectId: string, newName: string, token: string): Observable { + rename_file( + objectId: string, + newName: string, + token: string, + ): Observable { return this.client .methodCall('rename_file', [objectId, newName, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Renaming the requested file failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Renaming the requested file failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - new_item(what: string, token: string, isSubobject = false): Observable { - return this.client - .methodCall('new_item', [what, token, isSubobject]) - .pipe( - map((data: MethodResponse | MethodFault) => { + new_item( + what: string, + token: string, + isSubobject = false, + ): Observable { + return this.client.methodCall('new_item', [what, token, isSubobject]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Creating a new item failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Creating a new item failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } new_distro(token: string): Observable { - return this.client - .methodCall('new_distro', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('new_distro', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Creating a new distro failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Creating a new distro failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } new_profile(token: string): Observable { - return this.client - .methodCall('new_profile', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('new_profile', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Creating a new profile failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Creating a new profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } new_subprofile(token: string): Observable { - return this.client - .methodCall('new_subprofile', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('new_subprofile', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Creating a new subprofile failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Creating a new subprofile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } new_system(token: string): Observable { - return this.client - .methodCall('new_system', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('new_system', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Creating a new system failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Creating a new system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } new_repo(token: string): Observable { - return this.client - .methodCall('new_repo', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('new_repo', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Creating a new repository failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Creating a new repository failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } new_image(token: string): Observable { - return this.client - .methodCall('new_image', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('new_image', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Creating a new image failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Creating a new image failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } new_mgmtclass(token: string): Observable { - return this.client - .methodCall('new_mgmtclass', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('new_mgmtclass', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Creating a new management class failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Creating a new management class failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } new_package(token: string): Observable { - return this.client - .methodCall('new_package', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('new_package', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Creating a new package failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Creating a new package failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } new_file(token: string): Observable { - return this.client - .methodCall('new_file', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('new_file', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Creating a new file failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) - ); - } - - modify_item(what: string, objectId: string, attribute: string, arg: any, token: string): Observable { + throw new Error( + 'Creating a new file failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), + ); + } + + modify_item( + what: string, + objectId: string, + attribute: string, + arg: any, + token: string, + ): Observable { return this.client .methodCall('modify_item', [what, objectId, attribute, arg, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Modifying the requested item failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Modifying the requested item failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - modify_distro(objectId: string, attribute: string, arg: any, token: string): Observable { + modify_distro( + objectId: string, + attribute: string, + arg: any, + token: string, + ): Observable { return this.client .methodCall('modify_distro', [objectId, attribute, arg, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Modifying the requested distro failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Modifying the requested distro failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - modify_profile(objectId: string, attribute: string, arg: any, token: string): Observable { + modify_profile( + objectId: string, + attribute: string, + arg: any, + token: string, + ): Observable { return this.client .methodCall('modify_profile', [objectId, attribute, arg, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Modifying the requested profile failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Modifying the requested profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - modify_system(objectId: string, attribute: string, arg: any, token: string): Observable { + modify_system( + objectId: string, + attribute: string, + arg: any, + token: string, + ): Observable { return this.client .methodCall('modify_system', [objectId, attribute, arg, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Modifying the requested system failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Modifying the requested system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - modify_image(objectId: string, attribute: string, arg: any, token: string): Observable { + modify_image( + objectId: string, + attribute: string, + arg: any, + token: string, + ): Observable { return this.client .methodCall('modify_image', [objectId, attribute, arg, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Modifying the requested image failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Modifying the requested image failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - modify_repo(objectId: string, attribute: string, arg: any, token: string): Observable { + modify_repo( + objectId: string, + attribute: string, + arg: any, + token: string, + ): Observable { return this.client .methodCall('modify_repo', [objectId, attribute, arg, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Modifying the requested repository failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Modifying the requested repository failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - modify_mgmtclass(objectId: string, attribute: string, arg: any, token: string): Observable { + modify_mgmtclass( + objectId: string, + attribute: string, + arg: any, + token: string, + ): Observable { return this.client .methodCall('modify_mgmtclass', [objectId, attribute, arg, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Modifying the requested management class failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Modifying the requested management class failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - modify_package(objectId: string, attribute: string, arg: any, token: string): Observable { + modify_package( + objectId: string, + attribute: string, + arg: any, + token: string, + ): Observable { return this.client .methodCall('modify_package', [objectId, attribute, arg, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Modifying the requested package failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Modifying the requested package failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - modify_file(objectId: string, attribute: string, arg: any, token: string): Observable { + modify_file( + objectId: string, + attribute: string, + arg: any, + token: string, + ): Observable { return this.client .methodCall('modify_file', [objectId, attribute, arg, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Modifying the requested file failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Modifying the requested file failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } modify_setting(name: string, value: any, token: string): Observable { - return this.client - .methodCall('modify_setting', [name, value, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('modify_setting', [name, value, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as number; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Modifying the requested setting failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Modifying the requested setting failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } auto_add_repos(token: string): Observable { - return this.client - .methodCall('auto_add_repos', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('auto_add_repos', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Auto adding the repositories failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Auto adding the repositories failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } xapi_object_edit( - objectType: string, objectName: string, editType: string, attributes: XmlRpcStruct, token: string + objectType: string, + objectName: string, + editType: string, + attributes: XmlRpcStruct, + token: string, ): Observable { return this.client - .methodCall('xapi_object_edit', [objectType, objectName, editType, attributes, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('xapi_object_edit failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + .methodCall('xapi_object_edit', [ + objectType, + objectName, + editType, + attributes, + token, + ]) + .pipe( + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'xapi_object_edit failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - save_item(what: string, objectId: string, token: string, editmode = 'bypass'): Observable { + save_item( + what: string, + objectId: string, + token: string, + editmode = 'bypass', + ): Observable { return this.client .methodCall('save_item', [what, objectId, token, editmode]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Saving the requested item failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Saving the requested item failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - save_distro(objectId: string, token: string, editmode = 'bypass'): Observable { + save_distro( + objectId: string, + token: string, + editmode = 'bypass', + ): Observable { return this.client .methodCall('save_distro', [objectId, token, editmode]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Saving the requested distro failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Saving the requested distro failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - save_profile(objectId: string, token: string, editmode = 'bypass'): Observable { + save_profile( + objectId: string, + token: string, + editmode = 'bypass', + ): Observable { return this.client .methodCall('save_profile', [objectId, token, editmode]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Saving the requested profile failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Saving the requested profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - save_system(objectId: string, token: string, editmode = 'bypass'): Observable { + save_system( + objectId: string, + token: string, + editmode = 'bypass', + ): Observable { return this.client .methodCall('save_system', [objectId, token, editmode]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Saving the requested system failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Saving the requested system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - save_image(objectId: string, token: string, editmode = 'bypass'): Observable { + save_image( + objectId: string, + token: string, + editmode = 'bypass', + ): Observable { return this.client .methodCall('save_image', [objectId, token, editmode]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Saving the requested image failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Saving the requested image failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - save_repo(objectId: string, token: string, editmode = 'bypass'): Observable { + save_repo( + objectId: string, + token: string, + editmode = 'bypass', + ): Observable { return this.client .methodCall('save_repo', [objectId, token, editmode]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Saving the requested repository failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Saving the requested repository failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - save_mgmtclass(objectId: string, token: string, editmode = 'bypass'): Observable { + save_mgmtclass( + objectId: string, + token: string, + editmode = 'bypass', + ): Observable { return this.client .methodCall('save_mgmtclass', [objectId, token, editmode]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Saving the requested management class failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Saving the requested management class failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - save_package(objectId: string, token: string, editmode = 'bypass'): Observable { + save_package( + objectId: string, + token: string, + editmode = 'bypass', + ): Observable { return this.client .methodCall('save_package', [objectId, token, editmode]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Saving the requested package failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Saving the requested package failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - save_file(objectId: string, token: string, editmode = 'bypass'): Observable { + save_file( + objectId: string, + token: string, + editmode = 'bypass', + ): Observable { return this.client .methodCall('save_file', [objectId, token, editmode]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Saving the requested file failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Saving the requested file failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } get_autoinstall_templates(token: string): Observable> { - return this.client - .methodCall('get_autoinstall_templates', [token]) - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_autoinstall_templates', [token]).pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { - throw new Error("Exepcted XML-RPC Array!") + throw new Error('Exepcted XML-RPC Array!'); } return this.convertXmlRpcArrayToTypeScriptArray(data.value); } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested auto-installation templates failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the requested auto-installation templates failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_autoinstall_snippets(token: string): Observable> { - return this.client - .methodCall('get_autoinstall_snippets', [token]) - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_autoinstall_snippets', [token]).pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { - throw new Error("Expected XML-RPC Array!") + throw new Error('Expected XML-RPC Array!'); } return this.convertXmlRpcArrayToTypeScriptArray(data.value); } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested auto-installation snippets failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the requested auto-installation snippets failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } is_autoinstall_in_use(ai: string, token: string): Observable { - return this.client - .methodCall('is_autoinstall_in_use', [ai, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('is_autoinstall_in_use', [ai, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Checking if the auto-installation is in use failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Checking if the auto-installation is in use failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } generate_autoinstall(profile: string, system: string): Observable { return this.client .methodCall('generate_autoinstall', [profile, system]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Generating the auto-installation file failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Generating the auto-installation file failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } @@ -2142,271 +3225,373 @@ export class CobblerApiService { return this.client .methodCall('generate_profile_autoinstall', [profile]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Generating the auto-installation for the requested profile failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Generating the auto-installation for the requested profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } generate_system_autoinstall(system: string): Observable { - return this.client - .methodCall('generate_system_autoinstall', [system]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('generate_system_autoinstall', [system]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Generating the auto-installation for the requested system failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Generating the auto-installation for the requested system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } - generate_ipxe(profile: string, image: string, system: string): Observable { + generate_ipxe( + profile: string, + image: string, + system: string, + ): Observable { return this.client .methodCall('generate_ipxe', [profile, image, system]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Generating the requested iPXE data failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Generating the requested iPXE data failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } generate_bootcfg(profile: string, system: string): Observable { - return this.client - .methodCall('generate_bootcfg', [profile, system]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('generate_bootcfg', [profile, system]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Generating the boofcfg for the requested profile or system failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Generating the boofcfg for the requested profile or system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } - generate_script(profile: string, system: string, scriptName: string): Observable { + generate_script( + profile: string, + system: string, + scriptName: string, + ): Observable { return this.client .methodCall('generate_script', [profile, system, scriptName]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Generating the requested script for the system or profile failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Generating the requested script for the system or profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } get_blended_data(profile: string, system: string): Observable { - return this.client - .methodCall('get_blended_data', [profile, system]) - .pipe( - map((responseData: MethodResponse | MethodFault) => { + return this.client.methodCall('get_blended_data', [profile, system]).pipe( + map( + (responseData: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(responseData)) { return responseData.value; } else if (AngularXmlrpcService.instanceOfMethodFault(responseData)) { - throw new Error('Getting the blended data for the requested profile or system failed with code "' - + responseData.faultCode + '" and error message "' + responseData.faultString + '"'); - } - }) - ); - } - - private convertXmlRpcStructToTypeScriptObject(inputStruct: XmlRpcStruct): object { - const result_object = {} + throw new Error( + 'Getting the blended data for the requested profile or system failed with code "' + + responseData.faultCode + + '" and error message "' + + responseData.faultString + + '"', + ); + } + }, + ), + ); + } + + private convertXmlRpcStructToTypeScriptObject( + inputStruct: XmlRpcStruct, + ): object { + const result_object = {}; inputStruct.members.forEach((member) => { let value; if (AngularXmlrpcService.instanceOfXmlRpcArray(member.value)) { value = this.convertXmlRpcArrayToTypeScriptArray(member.value); } else if (AngularXmlrpcService.instanceOfXmlRpcStruct(member.value)) { value = this.convertXmlRpcStructToTypeScriptObject(member.value); - } else if (member.value === "<<inherit>>") { + } else if (member.value === '<<inherit>>') { // FIXME: Maybe we need to XML encode this as other strings potentially also could need encoding - value = "<>" + value = '<>'; } else { value = member.value; } result_object[member.name] = value; - }) + }); return result_object; } - private convertXmlRpcArrayToTypeScriptArray(inputArray: XmlRpcArray): Array { - const resultArray = [] + private convertXmlRpcArrayToTypeScriptArray( + inputArray: XmlRpcArray, + ): Array { + const resultArray = []; inputArray.data.forEach((value) => { if (AngularXmlrpcService.instanceOfXmlRpcArray(value)) { resultArray.push(this.convertXmlRpcArrayToTypeScriptArray(value)); } else if (AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { resultArray.push(this.convertXmlRpcStructToTypeScriptObject(value)); - } else if (value === "<<inherit>>") { + } else if (value === '<<inherit>>') { // FIXME: Maybe we need to XML encode this as other strings potentially also could need encoding - resultArray.push("<>") + resultArray.push('<>'); } else { resultArray.push(value); } - }) + }); return resultArray; } get_settings(token: string): Observable { - return this.client - .methodCall('get_settings', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_settings', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { if (AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { - return this.convertXmlRpcStructToTypeScriptObject(data.value) as Settings; + return this.convertXmlRpcStructToTypeScriptObject( + data.value, + ) as Settings; } - throw new Error('The return value of the settings was not in the expected format of an XML-RPC Struct!') + throw new Error( + 'The return value of the settings was not in the expected format of an XML-RPC Struct!', + ); } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Retrieving the settings failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Retrieving the settings failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_signatures(token: string): Observable { - return this.client - .methodCall('get_signatures', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_signatures', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as XmlRpcStruct; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the signatures failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }), - map(value => { - let result: DistroSignatures = {breeds: {}} - value.members.forEach(breedStruct => { - const osBreedStruct = breedStruct.value - if (!AngularXmlrpcService.instanceOfXmlRpcStruct(osBreedStruct)) { - throw new Error("Expected to receive XmlRpcStruct!") - } - const osBreedArray = osBreedStruct.members - osBreedArray.forEach(osBreedObject => { - const osBreedName = osBreedObject.name - result.breeds[osBreedName] = {} - const osVersionArray = osBreedObject.value - if (!AngularXmlrpcService.instanceOfXmlRpcStruct(osVersionArray)) { - throw new Error("Expected to receive XmlRpcStruct!") + throw new Error( + 'Getting the signatures failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), + map((value) => { + let result: DistroSignatures = { breeds: {} }; + value.members.forEach((breedStruct) => { + const osBreedStruct = breedStruct.value; + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(osBreedStruct)) { + throw new Error('Expected to receive XmlRpcStruct!'); + } + const osBreedArray = osBreedStruct.members; + osBreedArray.forEach((osBreedObject) => { + const osBreedName = osBreedObject.name; + result.breeds[osBreedName] = {}; + const osVersionArray = osBreedObject.value; + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(osVersionArray)) { + throw new Error('Expected to receive XmlRpcStruct!'); + } + osVersionArray.members.forEach((osVersionStruct) => { + const osVersionValueStruct = osVersionStruct.value; + const osVersionName = osVersionStruct.name; + if ( + !AngularXmlrpcService.instanceOfXmlRpcStruct( + osVersionValueStruct, + ) + ) { + throw new Error('Expected to receive XmlRpcStruct!'); } - osVersionArray.members.forEach(osVersionStruct => { - const osVersionValueStruct = osVersionStruct.value - const osVersionName = osVersionStruct.name - if (!AngularXmlrpcService.instanceOfXmlRpcStruct(osVersionValueStruct)) { - throw new Error("Expected to receive XmlRpcStruct!") + // @ts-ignore - Due to this being dynamically filled + result.breeds[osBreedName][osVersionName] = {}; + osVersionValueStruct.members.forEach((osVersionAttribute) => { + const attributeName = osVersionAttribute.name; + const attributeValue = osVersionAttribute.value; + if ( + AngularXmlrpcService.instanceOfXmlRpcArray(attributeValue) + ) { + result.breeds[osBreedName][osVersionName][attributeName] = + attributeValue.data; + } else { + result.breeds[osBreedName][osVersionName][attributeName] = + attributeValue; } - // @ts-ignore - Due to this being dynamically filled - result.breeds[osBreedName][osVersionName] = {} - osVersionValueStruct.members.forEach(osVersionAttribute => { - const attributeName = osVersionAttribute.name - const attributeValue = osVersionAttribute.value - if (AngularXmlrpcService.instanceOfXmlRpcArray(attributeValue)) { - result.breeds[osBreedName][osVersionName][attributeName] = attributeValue.data - } else { - result.breeds[osBreedName][osVersionName][attributeName] = attributeValue - } - }) - }) - }) - }) - return result - }) - ); + }); + }); + }); + }); + return result; + }), + ); } get_valid_breeds(token: string): Observable> { - return this.client - .methodCall('get_valid_breeds', [token]) - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_valid_breeds', [token]).pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as unknown as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the valid breeds failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the valid breeds failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_valid_os_versions_for_breed(token: string): Observable> { return this.client .methodCall('get_valid_os_versions_for_breed', [token]) .pipe( - map>((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as unknown as Array; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the valid OS versions for the requested breed failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map>( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as unknown as Array; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the valid OS versions for the requested breed failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } get_valid_os_versions(token: string): Observable> { - return this.client - .methodCall('get_valid_os_versions', [token]) - .pipe( - map>((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_valid_os_versions', [token]).pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as unknown as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the valid OS versions failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the valid OS versions failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } - get_valid_archs(systemName: string, token: string): Observable> { - return this.client - .methodCall('get_valid_archs', [systemName, token]) - .pipe( - map>((data: MethodResponse | MethodFault) => { + get_valid_archs( + systemName: string, + token: string, + ): Observable> { + return this.client.methodCall('get_valid_archs', [systemName, token]).pipe( + map>( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { // FIXME: Make the cast without the unknown possible return data.value as unknown as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the valid architectures for the requested system failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the valid architectures for the requested system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_repo_config_for_profile(profileName: string): Observable { return this.client .methodCall('get_repo_config_for_profile', [profileName]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the repository configuration for the requested profile failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the repository configuration for the requested profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } @@ -2414,398 +3599,565 @@ export class CobblerApiService { return this.client .methodCall('get_repo_config_for_system', [systemName]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the repository configuration for the requested system failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the repository configuration for the requested system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - get_template_file_for_profile(profileName: string, path: string): Observable { + get_template_file_for_profile( + profileName: string, + path: string, + ): Observable { return this.client .methodCall('get_template_file_for_profile', [profileName, path]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested templdate for the requested profile failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested templdate for the requested profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - get_template_file_for_system(systemName: string, path: string): Observable { + get_template_file_for_system( + systemName: string, + path: string, + ): Observable { return this.client .methodCall('get_template_file_for_system', [systemName, path]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested template for requested the system failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested template for requested the system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } register_new_system(info: RegisterOptions): Observable { const transformedOptions: XmlRpcStruct = { members: [ - {name: 'name', value: info.name}, - {name: 'profile', value: info.profile}, - {name: 'hostname', value: info.hostname}, - {name: 'interfaces', value: info.interfaces as XmlRpcStruct}, - ] - } + { name: 'name', value: info.name }, + { name: 'profile', value: info.profile }, + { name: 'hostname', value: info.hostname }, + { name: 'interfaces', value: info.interfaces as XmlRpcStruct }, + ], + }; return this.client .methodCall('register_new_system', [transformedOptions]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Registering a new system failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Registering a new system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } disable_netboot(name: string, token: string): Observable { - return this.client - .methodCall('disable_netboot', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('disable_netboot', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Disabling netboot for the requested system failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) - ); - } - - upload_log_data(sysName: string, file: any, size: any, offset: any, data: any, token: string): Observable { + throw new Error( + 'Disabling netboot for the requested system failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), + ); + } + + upload_log_data( + sysName: string, + file: any, + size: any, + offset: any, + data: any, + token: string, + ): Observable { return this.client .methodCall('upload_log_data', [sysName, file, size, offset, data, token]) .pipe( - map((responseData: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(responseData)) { - return responseData.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(responseData)) { - throw new Error('Uploading the log data failed with code "' + responseData.faultCode - + '" and error message "' + responseData.faultString + '"'); - } - }) + map( + (responseData: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(responseData)) { + return responseData.value as boolean; + } else if ( + AngularXmlrpcService.instanceOfMethodFault(responseData) + ) { + throw new Error( + 'Uploading the log data failed with code "' + + responseData.faultCode + + '" and error message "' + + responseData.faultString + + '"', + ); + } + }, + ), ); } - run_install_triggers(mode: string, objtype: string, name: string, ip: any, token: string): Observable { + run_install_triggers( + mode: string, + objtype: string, + name: string, + ip: any, + token: string, + ): Observable { return this.client .methodCall('run_install_triggers', [mode, objtype, name, ip, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Running the install triggers failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Running the install triggers failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } version(): Observable { - return this.client - .methodCall('version') - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('version').pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as number; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the Cobbler version failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting the Cobbler version failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } extended_version(): Observable { - return this.client - .methodCall('extended_version') - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('extended_version').pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as XmlRpcStruct; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the extended Cobbler version failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }), - map((data: XmlRpcStruct) => { - const versionArray = data.members[4].value as XmlRpcArray; - return { - gitdate: data.members[0].value, - gitstamp: data.members[1].value, - builddate: data.members[2].value, - version: data.members[3].value, - versionTuple: { - major: versionArray.data[0], - minor: versionArray.data[1], - patch: versionArray.data[2] - } as Version - } as ExtendedVersion; - }) - ); + throw new Error( + 'Getting the extended Cobbler version failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), + map((data: XmlRpcStruct) => { + const versionArray = data.members[4].value as XmlRpcArray; + return { + gitdate: data.members[0].value, + gitstamp: data.members[1].value, + builddate: data.members[2].value, + version: data.members[3].value, + versionTuple: { + major: versionArray.data[0], + minor: versionArray.data[1], + patch: versionArray.data[2], + } as Version, + } as ExtendedVersion; + }), + ); } get_distros_since(mtime: number): Observable { - return this.client - .methodCall('get_distros_since', [mtime]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_distros_since', [mtime]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the distros modified since the requested mtime failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the distros modified since the requested mtime failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_profiles_since(mtime: number): Observable { - return this.client - .methodCall('get_profiles_since', [mtime]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_profiles_since', [mtime]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the profiles modified since the requested mtime failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the profiles modified since the requested mtime failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_systems_since(mtime: number): Observable { - return this.client - .methodCall('get_systems_since', [mtime]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_systems_since', [mtime]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the systems modified since the requested mtime failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the systems modified since the requested mtime failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_repos_since(mtime: number): Observable { - return this.client - .methodCall('get_repos_since', [mtime]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_repos_since', [mtime]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the repositories modified since the requested mtime failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the repositories modified since the requested mtime failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_images_since(mtime: number): Observable { - return this.client - .methodCall('get_images_since', [mtime]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_images_since', [mtime]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the images modified since the requested mtime failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the images modified since the requested mtime failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_mgmtclasses_since(mtime: number): Observable { - return this.client - .methodCall('get_mgmtclasses_since', [mtime]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_mgmtclasses_since', [mtime]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the management classes modified since the requested mtime failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the management classes modified since the requested mtime failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_packages_since(mtime: number): Observable { - return this.client - .methodCall('get_packages_since', [mtime]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_packages_since', [mtime]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the packages modified since the requested mtime failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the packages modified since the requested mtime failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_files_since(mtime: number): Observable { - return this.client - .methodCall('get_files_since', [mtime]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_files_since', [mtime]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the files modified since the requested mtime failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the files modified since the requested mtime failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } // TODO: Add gem_menus_since - get_repos_compatible_with_profile(profile: string, token: string): Observable { + get_repos_compatible_with_profile( + profile: string, + token: string, + ): Observable { return this.client .methodCall('get_repos_compatible_with_profile', [profile, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the repositories compatible with the requested profile failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the repositories compatible with the requested profile failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } find_system_by_dns_name(dnsName: string): Observable { - return this.client - .methodCall('find_system_by_dns_name', [dnsName]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('find_system_by_dns_name', [dnsName]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Finding a system by its DNS name failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Finding a system by its DNS name failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_distro_as_rendered(name: string, token: string): Observable { - return this.client - .methodCall('get_distro_as_rendered', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_distro_as_rendered', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested distro in a rendered format failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the requested distro in a rendered format failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_profile_as_rendered(name: string, token: string): Observable { return this.client .methodCall('get_profile_as_rendered', [name, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as object; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested profile in a rendered format failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as object; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested profile in a rendered format failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } get_system_as_rendered(name: string, token: string): Observable { - return this.client - .methodCall('get_system_as_rendered', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_system_as_rendered', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested system in a rendered format failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the requested system in a rendered format failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_repo_as_rendered(name: string, token: string): Observable { - return this.client - .methodCall('get_repo_as_rendered', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_repo_as_rendered', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested repository in a rendered format failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the requested repository in a rendered format failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_image_as_rendered(name: string, token: string): Observable { - return this.client - .methodCall('get_image_as_rendered', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_image_as_rendered', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested image in a rendered format failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the requested image in a rendered format failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } get_mgmtclass_as_rendered(name: string, token: string): Observable { return this.client .methodCall('get_mgmtclass_as_rendered', [name, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as object; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested management class in a rendered format failed with code "' - + data.faultCode + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as object; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested management class in a rendered format failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } @@ -2813,332 +4165,492 @@ export class CobblerApiService { return this.client .methodCall('get_package_as_rendered', [name, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as object; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested package in a rendered format failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as object; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Getting the requested package in a rendered format failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } get_file_as_rendered(name: string, token: string): Observable { - return this.client - .methodCall('get_file_as_rendered', [name, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_file_as_rendered', [name, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as object; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the requested file in a rendered format failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the requested file in a rendered format failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } // TODO: menu_as_rendered get_random_mac(virtType: string): Observable { - return this.client - .methodCall('get_random_mac', [virtType]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_random_mac', [virtType]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting a random MAC address failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Getting a random MAC address failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } xmlrpc_hacks(data: any): Observable { - return this.client - .methodCall('xmlrpc_hacks', [data]) - .pipe( - map((responseData: MethodResponse | MethodFault) => { + return this.client.methodCall('xmlrpc_hacks', [data]).pipe( + map( + (responseData: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(responseData)) { return responseData.value; } else if (AngularXmlrpcService.instanceOfMethodFault(responseData)) { - throw new Error('Executing the XML-RPC hacks failed with code "' + responseData.faultCode - + '" and error message "' + responseData.faultString + '"'); - } - }) - ); - } - - get_status(mode: string, token: string): Observable> { - return this.client - .methodCall('get_status', [mode, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + throw new Error( + 'Executing the XML-RPC hacks failed with code "' + + responseData.faultCode + + '" and error message "' + + responseData.faultString + + '"', + ); + } + }, + ), + ); + } + + get_status( + mode: string, + token: string, + ): Observable> { + return this.client.methodCall('get_status', [mode, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as XmlRpcStruct; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the status failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }), - map>((data: XmlRpcStruct) => { - let result: Array = []; - data.members.forEach( element => { - const membersArray = element.value as XmlRpcArray - result.push({ - ip: element.name, - mostRecentStart: membersArray.data[0] as number, - mostRecentStop: membersArray.data[1] as number, - mostRecentTarget: membersArray.data[2] as string, - seenStart: membersArray.data[3] as number, - seenStop: membersArray.data[4] as number, - state: membersArray.data[5] as string, - }) - }) - return result; - }) - ); + throw new Error( + 'Getting the status failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), + map>((data: XmlRpcStruct) => { + let result: Array = []; + data.members.forEach((element) => { + const membersArray = element.value as XmlRpcArray; + result.push({ + ip: element.name, + mostRecentStart: membersArray.data[0] as number, + mostRecentStop: membersArray.data[1] as number, + mostRecentTarget: membersArray.data[2] as string, + seenStart: membersArray.data[3] as number, + seenStop: membersArray.data[4] as number, + state: membersArray.data[5] as string, + }); + }); + return result; + }), + ); } - check_access_no_fail(token: string, resource: string, arg1: any, arg2: any): Observable { + check_access_no_fail( + token: string, + resource: string, + arg1: any, + arg2: any, + ): Observable { return this.client .methodCall('check_access_no_fail', [token, resource, arg1, arg2]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Checking the access without failure failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Checking the access without failure failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - check_access(token: string, resource: string, arg1: any, arg2: any): Observable { + check_access( + token: string, + resource: string, + arg1: any, + arg2: any, + ): Observable { return this.client .methodCall('check_access', [token, resource, arg1, arg2]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Checking the access failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Checking the access failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } get_authn_module_name(token: string): Observable { - return this.client - .methodCall('get_authn_module_name', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_authn_module_name', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Getting the authentication module name failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Getting the authentication module name failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } login(username: string, password: string): Observable { - return this.client - .methodCall('login', [username, password]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('login', [username, password]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Login failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Login failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } logout(token: string): Observable { - return this.client - .methodCall('logout', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('logout', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Logout failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Logout failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } token_check(token: string): Observable { - return this.client - .methodCall('token_check', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('token_check', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Check of the token failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'Check of the token failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } sync_dhcp(token: string): Observable { - return this.client - .methodCall('sync_dhcp', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('sync_dhcp', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('The sync DHCP action failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'The sync DHCP action failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } sync(token: string): Observable { - return this.client - .methodCall('sync', [token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('sync', [token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('The sync action failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); + throw new Error( + 'The sync action failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } - read_autoinstall_template(filePath: string, token: string): Observable { + read_autoinstall_template( + filePath: string, + token: string, + ): Observable { return this.client .methodCall('read_autoinstall_template', [filePath, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Reading the auto-installation template failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Reading the auto-installation template failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - write_autoinstall_template(filePath: string, data: string, token: string): Observable { + write_autoinstall_template( + filePath: string, + data: string, + token: string, + ): Observable { return this.client .methodCall('write_autoinstall_template', [filePath, data, token]) .pipe( - map((responseData: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(responseData)) { - return responseData.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(responseData)) { - throw new Error('Writing the auto-installation template failed with code "' + responseData.faultCode - + '" and error message "' + responseData.faultString + '"'); - } - }) + map( + (responseData: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(responseData)) { + return responseData.value as boolean; + } else if ( + AngularXmlrpcService.instanceOfMethodFault(responseData) + ) { + throw new Error( + 'Writing the auto-installation template failed with code "' + + responseData.faultCode + + '" and error message "' + + responseData.faultString + + '"', + ); + } + }, + ), ); } - remove_autoinstall_template(filePath: string, token: string): Observable { + remove_autoinstall_template( + filePath: string, + token: string, + ): Observable { return this.client .methodCall('remove_autoinstall_template', [filePath, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Removing the auto-installation template failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Removing the auto-installation template failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - read_autoinstall_snippet(filePath: string, token: string): Observable { + read_autoinstall_snippet( + filePath: string, + token: string, + ): Observable { return this.client .methodCall('read_autoinstall_snippet', [filePath, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as string; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Reading the auto-installation snippet failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as string; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Reading the auto-installation snippet failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } - write_autoinstall_snippet(filePath: string, data: string, token: string): Observable { + write_autoinstall_snippet( + filePath: string, + data: string, + token: string, + ): Observable { return this.client .methodCall('write_autoinstall_snippet', [filePath, data, token]) .pipe( - map((responseData: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(responseData)) { - return responseData.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(responseData)) { - throw new Error('Writing the auto-installation snippet failed with code "' + responseData.faultCode - + '" and error message "' + responseData.faultString + '"'); - } - }) + map( + (responseData: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(responseData)) { + return responseData.value as boolean; + } else if ( + AngularXmlrpcService.instanceOfMethodFault(responseData) + ) { + throw new Error( + 'Writing the auto-installation snippet failed with code "' + + responseData.faultCode + + '" and error message "' + + responseData.faultString + + '"', + ); + } + }, + ), ); } - remove_autoinstall_snippet(filePath: string, token: string): Observable { + remove_autoinstall_snippet( + filePath: string, + token: string, + ): Observable { return this.client .methodCall('remove_autoinstall_snippet', [filePath, token]) .pipe( - map((data: MethodResponse | MethodFault) => { - if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as boolean; - } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Removing the auto-installation snippet failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); - } - }) + map( + (data: MethodResponse | MethodFault) => { + if (AngularXmlrpcService.instanceOfMethodResponse(data)) { + return data.value as boolean; + } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { + throw new Error( + 'Removing the auto-installation snippet failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), ); } get_config_data(hostname: string): Observable { - return this.client - .methodCall('get_config_data', [hostname]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('get_config_data', [hostname]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as string; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Retrieving the configuration data failed with code "' + data.faultCode - + '" and error message "' + data.faultString + '"'); + throw new Error( + 'Retrieving the configuration data failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); } - }) - ); + }, + ), + ); } clear_system_logs(objectId: string, token: string): Observable { - return this.client - .methodCall('clear_system_logs', [objectId, token]) - .pipe( - map((data: MethodResponse | MethodFault) => { + return this.client.methodCall('clear_system_logs', [objectId, token]).pipe( + map( + (data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { return data.value as boolean; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { - throw new Error('Clearing the system logs failed with code "' + data.faultCode + '" and error message "' - + data.faultString + '"'); - } - }) - ); + throw new Error( + 'Clearing the system logs failed with code "' + + data.faultCode + + '" and error message "' + + data.faultString + + '"', + ); + } + }, + ), + ); } } diff --git a/projects/cobbler-api/src/lib/custom-types/items.ts b/projects/cobbler-api/src/lib/custom-types/items.ts index c6206c5c..3c5ad860 100644 --- a/projects/cobbler-api/src/lib/custom-types/items.ts +++ b/projects/cobbler-api/src/lib/custom-types/items.ts @@ -45,7 +45,7 @@ export interface Profile extends Item { distro: string; enable_ipxe: string | boolean; enable_menu: string | boolean; - menu: string, + menu: string; fetchable_files: string | object; kernel_options: string | object; kernel_options_post: string | object; @@ -78,7 +78,7 @@ export interface NetworkInterface { bonding_opts: string; bridge_opts: string; cnames: Array; - connected_mode: false, + connected_mode: false; dhcp_tag: string; dns_name: string; if_gateway: string; diff --git a/projects/cobbler-api/src/lib/custom-types/misc.ts b/projects/cobbler-api/src/lib/custom-types/misc.ts index ee99682c..b2d5e299 100644 --- a/projects/cobbler-api/src/lib/custom-types/misc.ts +++ b/projects/cobbler-api/src/lib/custom-types/misc.ts @@ -109,11 +109,11 @@ export interface PageInfo { } export interface Event { - id: string - statetime: number - name: string - state: string - readByWho: Array + id: string; + statetime: number; + name: string; + state: string; + readByWho: Array; } export interface InstallationStatus { diff --git a/projects/cobbler-api/src/lib/custom-types/settings.ts b/projects/cobbler-api/src/lib/custom-types/settings.ts index ee407341..929810e0 100644 --- a/projects/cobbler-api/src/lib/custom-types/settings.ts +++ b/projects/cobbler-api/src/lib/custom-types/settings.ts @@ -1,4 +1,4 @@ -export type Settings = V3_3_1 | V3_3_2 | V3_3_3 | V3_4_0 +export type Settings = V3_3_1 | V3_3_2 | V3_3_3 | V3_4_0; export interface V3_3_1 { // TODO @@ -9,138 +9,138 @@ export interface V3_3_2 { } export interface V3_3_3 { - auto_migrate_settings: boolean - allow_duplicate_hostnames: boolean - allow_duplicate_ips: boolean - allow_duplicate_macs: boolean - allow_dynamic_settings: boolean - always_write_dhcp_entries: boolean - anamon_enabled: boolean - auth_token_expiration: number - authn_pam_service: string - autoinstall_snippets_dir: string - autoinstall_templates_dir: string - bind_chroot_path: string - bind_zonefile_path: string - bind_master: string - boot_loader_conf_template_dir: string - bootloaders_dir?: string - bootloaders_formats?: object - bootloaders_modules?: Array - bootloaders_shim_folder?: string - bootloaders_shim_file?: string - bootloaders_ipxe_folder?: string - syslinux_dir?: string - syslinux_memdisk_folder?: string - syslinux_pxelinux_folder?: string - grub2_mod_dir?: string - grubconfig_dir?: string - build_reporting_enabled: boolean - build_reporting_email: Array - build_reporting_ignorelist: Array - build_reporting_sender: string - build_reporting_smtp_server: string - build_reporting_subject: string - buildisodir?: string - cheetah_import_whitelist?: string - client_use_https: boolean - client_use_localhost: boolean - cobbler_master?: string - convert_server_to_ip?: boolean - createrepo_flags: string - autoinstall: string - default_name_servers: Array - default_name_servers_search: Array - default_ownership: Array - default_password_crypted: string - default_template_type: string - default_virt_bridge: string - default_virt_disk_driver?: string - default_virt_file_size: number - default_virt_ram: number - default_virt_type: string - enable_ipxe: boolean - enable_menu: boolean - http_port: number - include: Array - iso_template_dir?: string - jinja2_includedir?: string - kernel_options: object - ldap_anonymous_bind?: boolean - ldap_base_dn?: string - ldap_port?: number - ldap_search_bind_dn?: string - ldap_search_passwd?: string - ldap_search_prefix?: string - ldap_server?: string - ldap_tls?: boolean - ldap_tls_cacertdir?: string - ldap_tls_cacertfile?: string - ldap_tls_certfile?: string - ldap_tls_keyfile?: string - ldap_tls_reqcert?: string - ldap_tls_cipher_suite?: string - bind_manage_ipmi?: boolean - manage_dhcp: boolean - manage_dhcp_v4: boolean - manage_dhcp_v6: boolean - manage_dns: boolean - manage_forward_zones: Array - manage_reverse_zones: Array - manage_genders?: boolean - manage_rsync: boolean - manage_tftpd: boolean - mgmt_classes: Array - mgmt_parameters: object - next_server_v4: string - next_server_v6: string - nsupdate_enabled?: boolean - nsupdate_log?: string - nsupdate_tsig_algorithm?: string - nsupdate_tsig_key?: Array - power_management_default_type: string - proxies?: Array - proxy_url_ext: string - proxy_url_int: string - puppet_auto_setup: boolean - puppet_parameterized_classes?: boolean - puppet_server?: string - puppet_version?: number - puppetca_path: string - pxe_just_once: boolean - nopxe_with_triggers: boolean - redhat_management_permissive: boolean - redhat_management_server: string - redhat_management_key: string - register_new_installs: boolean - remove_old_puppet_certs_automatically: boolean - replicate_repo_rsync_options: string - replicate_rsync_options: string - reposync_flags: string - reposync_rsync_flags: string - restart_dhcp: boolean - restart_dns: boolean - run_install_triggers: boolean - scm_track_enabled: boolean - scm_track_mode: string - scm_track_author: string - scm_push_script: string - serializer_pretty_json: boolean - server: string - sign_puppet_certs_automatically: boolean - signature_path?: string - signature_url?: string - tftpboot_location: string - virt_auto_boot: boolean - webdir: string - webdir_whitelist: Array - xmlrpc_port: number - yum_distro_priority: number - yum_post_install_mirror: boolean - yumdownloader_flags: string - windows_enabled?: boolean - windows_template_dir?: string - samba_distro_share?: string + auto_migrate_settings: boolean; + allow_duplicate_hostnames: boolean; + allow_duplicate_ips: boolean; + allow_duplicate_macs: boolean; + allow_dynamic_settings: boolean; + always_write_dhcp_entries: boolean; + anamon_enabled: boolean; + auth_token_expiration: number; + authn_pam_service: string; + autoinstall_snippets_dir: string; + autoinstall_templates_dir: string; + bind_chroot_path: string; + bind_zonefile_path: string; + bind_master: string; + boot_loader_conf_template_dir: string; + bootloaders_dir?: string; + bootloaders_formats?: object; + bootloaders_modules?: Array; + bootloaders_shim_folder?: string; + bootloaders_shim_file?: string; + bootloaders_ipxe_folder?: string; + syslinux_dir?: string; + syslinux_memdisk_folder?: string; + syslinux_pxelinux_folder?: string; + grub2_mod_dir?: string; + grubconfig_dir?: string; + build_reporting_enabled: boolean; + build_reporting_email: Array; + build_reporting_ignorelist: Array; + build_reporting_sender: string; + build_reporting_smtp_server: string; + build_reporting_subject: string; + buildisodir?: string; + cheetah_import_whitelist?: string; + client_use_https: boolean; + client_use_localhost: boolean; + cobbler_master?: string; + convert_server_to_ip?: boolean; + createrepo_flags: string; + autoinstall: string; + default_name_servers: Array; + default_name_servers_search: Array; + default_ownership: Array; + default_password_crypted: string; + default_template_type: string; + default_virt_bridge: string; + default_virt_disk_driver?: string; + default_virt_file_size: number; + default_virt_ram: number; + default_virt_type: string; + enable_ipxe: boolean; + enable_menu: boolean; + http_port: number; + include: Array; + iso_template_dir?: string; + jinja2_includedir?: string; + kernel_options: object; + ldap_anonymous_bind?: boolean; + ldap_base_dn?: string; + ldap_port?: number; + ldap_search_bind_dn?: string; + ldap_search_passwd?: string; + ldap_search_prefix?: string; + ldap_server?: string; + ldap_tls?: boolean; + ldap_tls_cacertdir?: string; + ldap_tls_cacertfile?: string; + ldap_tls_certfile?: string; + ldap_tls_keyfile?: string; + ldap_tls_reqcert?: string; + ldap_tls_cipher_suite?: string; + bind_manage_ipmi?: boolean; + manage_dhcp: boolean; + manage_dhcp_v4: boolean; + manage_dhcp_v6: boolean; + manage_dns: boolean; + manage_forward_zones: Array; + manage_reverse_zones: Array; + manage_genders?: boolean; + manage_rsync: boolean; + manage_tftpd: boolean; + mgmt_classes: Array; + mgmt_parameters: object; + next_server_v4: string; + next_server_v6: string; + nsupdate_enabled?: boolean; + nsupdate_log?: string; + nsupdate_tsig_algorithm?: string; + nsupdate_tsig_key?: Array; + power_management_default_type: string; + proxies?: Array; + proxy_url_ext: string; + proxy_url_int: string; + puppet_auto_setup: boolean; + puppet_parameterized_classes?: boolean; + puppet_server?: string; + puppet_version?: number; + puppetca_path: string; + pxe_just_once: boolean; + nopxe_with_triggers: boolean; + redhat_management_permissive: boolean; + redhat_management_server: string; + redhat_management_key: string; + register_new_installs: boolean; + remove_old_puppet_certs_automatically: boolean; + replicate_repo_rsync_options: string; + replicate_rsync_options: string; + reposync_flags: string; + reposync_rsync_flags: string; + restart_dhcp: boolean; + restart_dns: boolean; + run_install_triggers: boolean; + scm_track_enabled: boolean; + scm_track_mode: string; + scm_track_author: string; + scm_push_script: string; + serializer_pretty_json: boolean; + server: string; + sign_puppet_certs_automatically: boolean; + signature_path?: string; + signature_url?: string; + tftpboot_location: string; + virt_auto_boot: boolean; + webdir: string; + webdir_whitelist: Array; + xmlrpc_port: number; + yum_distro_priority: number; + yum_post_install_mirror: boolean; + yumdownloader_flags: string; + windows_enabled?: boolean; + windows_template_dir?: string; + samba_distro_share?: string; } export interface V3_4_0 { diff --git a/projects/cobbler-api/src/lib/custom-types/signatures.ts b/projects/cobbler-api/src/lib/custom-types/signatures.ts index 106b696f..16c2901f 100644 --- a/projects/cobbler-api/src/lib/custom-types/signatures.ts +++ b/projects/cobbler-api/src/lib/custom-types/signatures.ts @@ -1,51 +1,51 @@ export interface DistroSignatureOsVersion { - signatures: string[] - version_file: string | null - version_file_regex?: string | null - kernel_arch: string - kernel_arch_regex?: string | null + signatures: string[]; + version_file: string | null; + version_file_regex?: string | null; + kernel_arch: string; + kernel_arch_regex?: string | null; supported_arches: ( - | "arm" - | "ARM64" - | "armhfp" - | "aarch64" - | "i386" - | "i586" - | "ia64" - | "ppc" - | "ppc64" - | "ppc64le" - | "ppc64el" - | "s390" - | "s390x" - | "x86_64" - | "amd64" - | "AMD64" - | "x86" - )[] - supported_repo_breeds: ("rsync" | "rhn" | "yum" | "apt")[] - kernel_file: string - initrd_file: string - isolinux_ok?: boolean - default_autoinstall: string - kernel_options: string - kernel_options_post: string - template_files?: string - boot_files?: string[] + | 'arm' + | 'ARM64' + | 'armhfp' + | 'aarch64' + | 'i386' + | 'i586' + | 'ia64' + | 'ppc' + | 'ppc64' + | 'ppc64le' + | 'ppc64el' + | 's390' + | 's390x' + | 'x86_64' + | 'amd64' + | 'AMD64' + | 'x86' + )[]; + supported_repo_breeds: ('rsync' | 'rhn' | 'yum' | 'apt')[]; + kernel_file: string; + initrd_file: string; + isolinux_ok?: boolean; + default_autoinstall: string; + kernel_options: string; + kernel_options_post: string; + template_files?: string; + boot_files?: string[]; boot_loaders?: { - arm?: ("pxe" | "ipxe" | "grub")[] - armhfp?: ("pxe" | "ipxe" | "grub")[] - aarch64?: ("pxe" | "ipxe" | "grub")[] - i386?: ("pxe" | "ipxe" | "grub")[] - ia64?: ("pxe" | "ipxe" | "grub")[] - ppc?: ("pxe" | "ipxe" | "grub")[] - ppc64?: ("pxe" | "ipxe" | "grub")[] - ppc64le?: ("pxe" | "ipxe" | "grub")[] - s390?: ("pxe" | "ipxe" | "grub")[] - s390x?: ("pxe" | "ipxe" | "grub")[] - x86_64?: ("pxe" | "ipxe" | "grub")[] - [k: string]: unknown - } + arm?: ('pxe' | 'ipxe' | 'grub')[]; + armhfp?: ('pxe' | 'ipxe' | 'grub')[]; + aarch64?: ('pxe' | 'ipxe' | 'grub')[]; + i386?: ('pxe' | 'ipxe' | 'grub')[]; + ia64?: ('pxe' | 'ipxe' | 'grub')[]; + ppc?: ('pxe' | 'ipxe' | 'grub')[]; + ppc64?: ('pxe' | 'ipxe' | 'grub')[]; + ppc64le?: ('pxe' | 'ipxe' | 'grub')[]; + s390?: ('pxe' | 'ipxe' | 'grub')[]; + s390x?: ('pxe' | 'ipxe' | 'grub')[]; + x86_64?: ('pxe' | 'ipxe' | 'grub')[]; + [k: string]: unknown; + }; } /** @@ -64,7 +64,7 @@ export interface DistroSignatures { * This interface was referenced by `undefined`'s JSON-Schema definition * via the `patternProperty` "^[a-zA-Z0-9]*$". */ - [k: string]: DistroSignatureOsVersion - } - } + [k: string]: DistroSignatureOsVersion; + }; + }; } diff --git a/projects/cobbler-api/src/lib/lib.config.ts b/projects/cobbler-api/src/lib/lib.config.ts index 1df170bd..6ba3c644 100644 --- a/projects/cobbler-api/src/lib/lib.config.ts +++ b/projects/cobbler-api/src/lib/lib.config.ts @@ -1,11 +1,11 @@ -import {InjectionToken} from '@angular/core'; +import { InjectionToken } from '@angular/core'; export const COBBLER_URL = new InjectionToken('COBBLER_URL'); export const cobblerUrlFactory = () => { - const value = localStorage.getItem("COBBLER_URL") + const value = localStorage.getItem('COBBLER_URL'); if (value) { return new URL(value); } - return new URL("http://localhost/cobbler_api") -} + return new URL('http://localhost/cobbler_api'); +}; diff --git a/projects/cobbler-api/src/test.ts b/projects/cobbler-api/src/test.ts index 70b00709..cd56cc80 100644 --- a/projects/cobbler-api/src/test.ts +++ b/projects/cobbler-api/src/test.ts @@ -5,13 +5,14 @@ import 'zone.js/testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, - platformBrowserDynamicTesting + platformBrowserDynamicTesting, } from '@angular/platform-browser-dynamic/testing'; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, - platformBrowserDynamicTesting(), { - teardown: { destroyAfterEach: false } -} + platformBrowserDynamicTesting(), + { + teardown: { destroyAfterEach: false }, + }, ); diff --git a/projects/cobbler-api/tsconfig.lib.json b/projects/cobbler-api/tsconfig.lib.json index ea356ef5..8a72d02c 100644 --- a/projects/cobbler-api/tsconfig.lib.json +++ b/projects/cobbler-api/tsconfig.lib.json @@ -7,18 +7,12 @@ "declarationMap": true, "inlineSources": true, "types": [], - "lib": [ - "dom", - "es2018" - ] + "lib": ["dom", "es2018"] }, "angularCompilerOptions": { "skipTemplateCodegen": true, "strictMetadataEmit": true, "enableResourceInlining": true }, - "exclude": [ - "src/test.ts", - "**/*.spec.ts" - ] + "exclude": ["src/test.ts", "**/*.spec.ts"] } diff --git a/projects/cobbler-api/tsconfig.spec.json b/projects/cobbler-api/tsconfig.spec.json index 715dd0a5..fafd1e12 100644 --- a/projects/cobbler-api/tsconfig.spec.json +++ b/projects/cobbler-api/tsconfig.spec.json @@ -3,15 +3,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine" - ] + "types": ["jasmine"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": ["src/test.ts"], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/projects/cobbler-frontend/.eslintrc.json b/projects/cobbler-frontend/.eslintrc.json index 408c0dee..5f665d53 100644 --- a/projects/cobbler-frontend/.eslintrc.json +++ b/projects/cobbler-frontend/.eslintrc.json @@ -1,13 +1,9 @@ { "extends": "../../.eslintrc.json", - "ignorePatterns": [ - "!**/*" - ], + "ignorePatterns": ["!**/*"], "overrides": [ { - "files": [ - "*.ts" - ], + "files": ["*.ts"], "rules": { "@angular-eslint/directive-selector": [ "error", @@ -28,9 +24,7 @@ } }, { - "files": [ - "*.html" - ], + "files": ["*.html"], "rules": {} } ] diff --git a/projects/cobbler-frontend/e2e/protractor.conf.js b/projects/cobbler-frontend/e2e/protractor.conf.js index 361e7f0c..a61a83f4 100644 --- a/projects/cobbler-frontend/e2e/protractor.conf.js +++ b/projects/cobbler-frontend/e2e/protractor.conf.js @@ -2,36 +2,36 @@ // Protractor configuration file, see link for more information // https://github.com/angular/protractor/blob/master/lib/config.ts -const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); +const { SpecReporter, StacktraceOption } = require("jasmine-spec-reporter"); /** * @type { import("protractor").Config } */ exports.config = { allScriptsTimeout: 11000, - specs: [ - './src/**/*.e2e-spec.ts' - ], + specs: ["./src/**/*.e2e-spec.ts"], capabilities: { - browserName: 'chrome' + browserName: "chrome", }, directConnect: true, SELENIUM_PROMISE_MANAGER: false, - baseUrl: 'http://localhost:4200/', - framework: 'jasmine', + baseUrl: "http://localhost:4200/", + framework: "jasmine", jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, - print: function() {} + print: function () {}, }, onPrepare() { - require('ts-node').register({ - project: require('path').join(__dirname, './tsconfig.json') + require("ts-node").register({ + project: require("path").join(__dirname, "./tsconfig.json"), }); - jasmine.getEnv().addReporter(new SpecReporter({ - spec: { - displayStacktrace: StacktraceOption.PRETTY - } - })); - } -}; \ No newline at end of file + jasmine.getEnv().addReporter( + new SpecReporter({ + spec: { + displayStacktrace: StacktraceOption.PRETTY, + }, + }), + ); + }, +}; diff --git a/projects/cobbler-frontend/e2e/src/app.e2e-spec.ts b/projects/cobbler-frontend/e2e/src/app.e2e-spec.ts index bc96be15..064103e9 100644 --- a/projects/cobbler-frontend/e2e/src/app.e2e-spec.ts +++ b/projects/cobbler-frontend/e2e/src/app.e2e-spec.ts @@ -10,14 +10,18 @@ describe('workspace-project App', () => { it('should display welcome message', async () => { await page.navigateTo(); - expect(await page.getTitleText()).toEqual('cobbler-frontend app is running!'); + expect(await page.getTitleText()).toEqual( + 'cobbler-frontend app is running!', + ); }); afterEach(async () => { // Assert that there are no errors emitted from the browser const logs = await browser.manage().logs().get(logging.Type.BROWSER); - expect(logs).not.toContain(jasmine.objectContaining({ - level: logging.Level.SEVERE, - } as logging.Entry)); + expect(logs).not.toContain( + jasmine.objectContaining({ + level: logging.Level.SEVERE, + } as logging.Entry), + ); }); }); diff --git a/projects/cobbler-frontend/e2e/tsconfig.json b/projects/cobbler-frontend/e2e/tsconfig.json index dacd5c32..38556bc7 100644 --- a/projects/cobbler-frontend/e2e/tsconfig.json +++ b/projects/cobbler-frontend/e2e/tsconfig.json @@ -5,9 +5,6 @@ "outDir": "../../../out-tsc/e2e", "module": "commonjs", "target": "es2018", - "types": [ - "jasmine", - "node" - ] + "types": ["jasmine", "node"] } } diff --git a/projects/cobbler-frontend/karma.conf.js b/projects/cobbler-frontend/karma.conf.js index fbcf1eb0..8efbe058 100644 --- a/projects/cobbler-frontend/karma.conf.js +++ b/projects/cobbler-frontend/karma.conf.js @@ -3,14 +3,14 @@ module.exports = function (config) { config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], + basePath: "", + frameworks: ["jasmine", "@angular-devkit/build-angular"], plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage'), - require('@angular-devkit/build-angular/plugins/karma') + require("karma-jasmine"), + require("karma-chrome-launcher"), + require("karma-jasmine-html-reporter"), + require("karma-coverage"), + require("@angular-devkit/build-angular/plugins/karma"), ], client: { jasmine: { @@ -19,41 +19,38 @@ module.exports = function (config) { // for example, you can disable the random execution with `random: false` // or set a specific seed with `seed: 4321` }, - clearContext: false // leave Jasmine Spec Runner output visible in browser + clearContext: false, // leave Jasmine Spec Runner output visible in browser }, jasmineHtmlReporter: { - suppressAll: true // removes the duplicated traces + suppressAll: true, // removes the duplicated traces }, coverageReporter: { - dir: require('path').join(__dirname, '../../coverage/cobbler-frontend'), - subdir: '.', + dir: require("path").join(__dirname, "../../coverage/cobbler-frontend"), + subdir: ".", reporters: [ - { type: 'html' }, - { type: 'text-summary' }, - { type: 'lcovonly' }, - ] + { type: "html" }, + { type: "text-summary" }, + { type: "lcovonly" }, + ], }, - reporters: ['progress', 'kjhtml'], + reporters: ["progress", "kjhtml"], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, - browsers: ['Chrome'], + browsers: ["Chrome"], customLaunchers: { Chrome_without_security: { - base: 'Chrome', - flags: ['--disable-web-security'] + base: "Chrome", + flags: ["--disable-web-security"], }, Headless: { - base: 'ChromeHeadless', - flags: [ - '--no-sandbox', - '--disable-setuid-sandbox' - ] - } + base: "ChromeHeadless", + flags: ["--no-sandbox", "--disable-setuid-sandbox"], + }, }, singleRun: false, - restartOnFileChange: true + restartOnFileChange: true, }); - process.env.TZ = 'Europe/Berlin'; + process.env.TZ = "Europe/Berlin"; }; diff --git a/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.html b/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.html index e6f1e850..c5e9f3e7 100644 --- a/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.html +++ b/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.html @@ -1,13 +1,24 @@ -

BUILD ISO IMAGES

+

BUILD ISO IMAGES

Distro - + ISO - + Profiles @@ -19,18 +30,39 @@

BUILD ISO IMAGES

Buildiso directory - + Source - + xorrisofs Options - + - Standalone - Airgapped - Exclude DNS + Standalone + Airgapped + Exclude DNS
diff --git a/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.spec.ts b/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.spec.ts index 5282107a..f57b331b 100644 --- a/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.spec.ts +++ b/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.spec.ts @@ -1,32 +1,26 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { MatListModule } from '@angular/material/list'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { COBBLER_URL } from 'cobbler-api'; import { BuildISOComponent } from './build-iso.component'; - describe('BuildISOComponent', () => { let component: BuildISOComponent; let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - BuildISOComponent, - NoopAnimationsModule, - ], + imports: [BuildISOComponent, NoopAnimationsModule], providers: [ provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] + ], }).compileComponents(); }); diff --git a/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.ts b/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.ts index 2a7b6bbf..0b595004 100644 --- a/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.ts +++ b/projects/cobbler-frontend/src/app/actions/build-iso/build-iso.component.ts @@ -1,13 +1,13 @@ -import {Component, inject} from '@angular/core'; -import {FormBuilder, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatInput} from '@angular/material/input'; -import {MatListModule} from '@angular/material/list'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {BackgroundBuildisoOptions, CobblerApiService} from 'cobbler-api'; -import {UserService} from '../../services/user.service'; +import { Component, inject } from '@angular/core'; +import { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { MatButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatInput } from '@angular/material/input'; +import { MatListModule } from '@angular/material/list'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { BackgroundBuildisoOptions, CobblerApiService } from 'cobbler-api'; +import { UserService } from '../../services/user.service'; @Component({ selector: 'cobbler-build-iso', @@ -22,7 +22,7 @@ import {UserService} from '../../services/user.service'; MatInput, MatLabel, ReactiveFormsModule, - MatCheckbox + MatCheckbox, ], }) export class BuildISOComponent { @@ -38,14 +38,13 @@ export class BuildISOComponent { source: '', excludeDNS: false, xorrisofsOpts: '', - }) + }); constructor( public userService: UserService, private cobblerApiService: CobblerApiService, - private _snackBar: MatSnackBar - ) { - } + private _snackBar: MatSnackBar, + ) {} runBuildiso(): void { const buildisoOptions: BackgroundBuildisoOptions = { @@ -61,21 +60,27 @@ export class BuildISOComponent { xorrisofsOpts: this.buildisoFormGroup.controls.xorrisofsOpts.value, }; if (this.buildisoFormGroup.invalid) { - this._snackBar.open('Please fill out all required inputs!', 'Close', {duration: 2000}); + this._snackBar.open('Please fill out all required inputs!', 'Close', { + duration: 2000, + }); return; } - this.cobblerApiService.background_buildiso(buildisoOptions, this.userService.token).subscribe( - value => { - // TODO - }, - error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .background_buildiso(buildisoOptions, this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.html b/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.html index 776cdb11..d403be77 100644 --- a/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.html +++ b/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.html @@ -5,12 +5,14 @@

CHECK

- +
- + diff --git a/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.spec.ts b/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.spec.ts index b56419a0..27433292 100644 --- a/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.spec.ts +++ b/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.spec.ts @@ -1,12 +1,11 @@ -import {provideHttpClient} from '@angular/common/http'; +import { provideHttpClient } from '@angular/common/http'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatListModule } from '@angular/material/list'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { CheckSysComponent } from './check-sys.component'; - describe('CheckSysComponent', () => { let component: CheckSysComponent; let fixture: ComponentFixture; @@ -19,9 +18,9 @@ describe('CheckSysComponent', () => { provideHttpClient(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] + ], }).compileComponents(); }); diff --git a/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.ts b/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.ts index 7bafa129..c44f734e 100644 --- a/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.ts +++ b/projects/cobbler-frontend/src/app/actions/check-sys/check-sys.component.ts @@ -1,15 +1,15 @@ -import {CommonModule} from '@angular/common'; -import {Component, OnInit} from '@angular/core'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatIcon} from '@angular/material/icon'; +import { CommonModule } from '@angular/common'; +import { Component, OnInit } from '@angular/core'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatIcon } from '@angular/material/icon'; import { MatListModule } from '@angular/material/list'; -import {MatProgressSpinner} from '@angular/material/progress-spinner'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {MatTooltip} from '@angular/material/tooltip'; +import { MatProgressSpinner } from '@angular/material/progress-spinner'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatTooltip } from '@angular/material/tooltip'; import { RouterOutlet } from '@angular/router'; -import {CobblerApiService} from 'cobbler-api'; -import {Observable, of} from 'rxjs'; -import {UserService} from '../../services/user.service'; +import { CobblerApiService } from 'cobbler-api'; +import { Observable, of } from 'rxjs'; +import { UserService } from '../../services/user.service'; @Component({ selector: 'cobbler-check-sys', @@ -24,39 +24,41 @@ import {UserService} from '../../services/user.service'; MatIconButton, MatIcon, MatTooltip, - MatProgressSpinner + MatProgressSpinner, ], }) export class CheckSysComponent implements OnInit { - public data: Observable> = of([]) + public data: Observable> = of([]); public isLoading = true; constructor( public userService: UserService, private cobblerApiService: CobblerApiService, private _snackBar: MatSnackBar, - ) { - } + ) {} ngOnInit(): void { - this.updateChecks() + this.updateChecks(); } updateChecks(): void { this.isLoading = true; - this.cobblerApiService.check(this.userService.token).subscribe(data => { - this.data = of(data); - this.isLoading = false - },error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close') - this.isLoading = false - }) + this.cobblerApiService.check(this.userService.token).subscribe( + (data) => { + this.data = of(data); + this.isLoading = false; + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + this.isLoading = false; + }, + ); } - toHTML(input: string) : any { + toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, "text/html").documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } - } diff --git a/projects/cobbler-frontend/src/app/actions/hardlink/hardlink.component.spec.ts b/projects/cobbler-frontend/src/app/actions/hardlink/hardlink.component.spec.ts index b4d8b0ad..d5a132b3 100644 --- a/projects/cobbler-frontend/src/app/actions/hardlink/hardlink.component.spec.ts +++ b/projects/cobbler-frontend/src/app/actions/hardlink/hardlink.component.spec.ts @@ -1,8 +1,8 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {MatButtonModule} from '@angular/material/button'; -import {COBBLER_URL} from 'cobbler-api'; +import { MatButtonModule } from '@angular/material/button'; +import { COBBLER_URL } from 'cobbler-api'; import { HardlinkComponent } from './hardlink.component'; @@ -12,20 +12,16 @@ describe('HardlinkComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - HardlinkComponent, - MatButtonModule, - ], + imports: [HardlinkComponent, MatButtonModule], providers: [ provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(HardlinkComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/actions/hardlink/hardlink.component.ts b/projects/cobbler-frontend/src/app/actions/hardlink/hardlink.component.ts index 90effb8f..e59edaf7 100644 --- a/projects/cobbler-frontend/src/app/actions/hardlink/hardlink.component.ts +++ b/projects/cobbler-frontend/src/app/actions/hardlink/hardlink.component.ts @@ -1,41 +1,40 @@ -import {Component} from '@angular/core'; -import {MatButton} from '@angular/material/button'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {CobblerApiService} from 'cobbler-api'; -import {UserService} from '../../services/user.service'; +import { Component } from '@angular/core'; +import { MatButton } from '@angular/material/button'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { CobblerApiService } from 'cobbler-api'; +import { UserService } from '../../services/user.service'; @Component({ selector: 'cobbler-hardlink', standalone: true, - imports: [ - MatButton - ], + imports: [MatButton], templateUrl: './hardlink.component.html', - styleUrl: './hardlink.component.scss' + styleUrl: './hardlink.component.scss', }) export class HardlinkComponent { - constructor( public userService: UserService, private cobblerApiService: CobblerApiService, - private _snackBar: MatSnackBar - ) { - } + private _snackBar: MatSnackBar, + ) {} runHardlink(): void { - this.cobblerApiService.background_hardlink(this.userService.token).subscribe( - value => { - // TODO - }, - error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .background_hardlink(this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } - } diff --git a/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.html b/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.html index 731fc3a0..c9004e7b 100644 --- a/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.html +++ b/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.html @@ -3,23 +3,50 @@

IMPORT DVD

Path - + Name - + Available as - + Autoinstallation file - + rsync flags - + Architecture @@ -31,7 +58,12 @@

IMPORT DVD

Operating System Version - +
diff --git a/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.spec.ts b/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.spec.ts index f6b286b1..b2f2a5a3 100644 --- a/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.spec.ts +++ b/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.spec.ts @@ -1,13 +1,12 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {ReactiveFormsModule} from '@angular/forms'; -import {MatButtonModule} from '@angular/material/button'; -import {MatFormFieldModule} from '@angular/material/form-field'; -import {MatInputModule} from '@angular/material/input'; -import { MatListModule } from '@angular/material/list'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {COBBLER_URL} from 'cobbler-api'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatButtonModule } from '@angular/material/button'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { COBBLER_URL } from 'cobbler-api'; import { ImportDVDComponent } from './import-dvd.component'; @@ -30,9 +29,9 @@ describe('ImportDVDComponent', () => { provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] + ], }).compileComponents(); }); diff --git a/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.ts b/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.ts index 52b66649..54068f1b 100644 --- a/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.ts +++ b/projects/cobbler-frontend/src/app/actions/import-dvd/import-dvd.component.ts @@ -1,23 +1,24 @@ -import {Component, inject} from '@angular/core'; -import {FormBuilder, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatButton} from '@angular/material/button'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatInput} from '@angular/material/input'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {CobblerApiService, BackgroundImportOptions} from 'cobbler-api'; -import {UserService} from '../../services/user.service'; +import { Component, inject } from '@angular/core'; +import { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { MatButton } from '@angular/material/button'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatInput } from '@angular/material/input'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { CobblerApiService, BackgroundImportOptions } from 'cobbler-api'; +import { UserService } from '../../services/user.service'; @Component({ selector: 'cobbler-import-dvd', templateUrl: './import-dvd.component.html', - styleUrls: ['./import-dvd.component.scss'], standalone: true, + styleUrls: ['./import-dvd.component.scss'], + standalone: true, imports: [ FormsModule, MatFormField, MatInput, MatLabel, ReactiveFormsModule, - MatButton + MatButton, ], }) export class ImportDVDComponent { @@ -31,14 +32,13 @@ export class ImportDVDComponent { arch: '', breed: '', os_version: '', - }) + }); constructor( public userService: UserService, private cobblerApiService: CobblerApiService, - private _snackBar: MatSnackBar - ) { - } + private _snackBar: MatSnackBar, + ) {} runImport(): void { const importOptions: BackgroundImportOptions = { @@ -52,22 +52,27 @@ export class ImportDVDComponent { os_version: this.importFormGroup.controls.os_version.value, }; if (this.importFormGroup.invalid) { - this._snackBar.open("Please give all inputs a system name!", "Close", {duration: 2000}) + this._snackBar.open('Please give all inputs a system name!', 'Close', { + duration: 2000, + }); return; } - this.cobblerApiService.background_import(importOptions, this.userService.token).subscribe( - value => { - // TODO - }, - error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .background_import(importOptions, this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } - } diff --git a/projects/cobbler-frontend/src/app/actions/mkloaders/mkloaders.component.spec.ts b/projects/cobbler-frontend/src/app/actions/mkloaders/mkloaders.component.spec.ts index 411f7ca1..85bc92b5 100644 --- a/projects/cobbler-frontend/src/app/actions/mkloaders/mkloaders.component.spec.ts +++ b/projects/cobbler-frontend/src/app/actions/mkloaders/mkloaders.component.spec.ts @@ -1,8 +1,8 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {MatButtonModule} from '@angular/material/button'; -import {COBBLER_URL} from 'cobbler-api'; +import { MatButtonModule } from '@angular/material/button'; +import { COBBLER_URL } from 'cobbler-api'; import { MkloadersComponent } from './mkloaders.component'; @@ -12,20 +12,16 @@ describe('MkloadersComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - MkloadersComponent, - MatButtonModule, - ], + imports: [MkloadersComponent, MatButtonModule], providers: [ provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(MkloadersComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/actions/mkloaders/mkloaders.component.ts b/projects/cobbler-frontend/src/app/actions/mkloaders/mkloaders.component.ts index 951eb0ff..9ce1c642 100644 --- a/projects/cobbler-frontend/src/app/actions/mkloaders/mkloaders.component.ts +++ b/projects/cobbler-frontend/src/app/actions/mkloaders/mkloaders.component.ts @@ -26,14 +26,14 @@ export class MkloadersComponent implements OnDestroy { runMkloaders(): void { this.subs.add( this.cobblerApiSvc.background_hardlink(this.userSvc.token).subscribe({ - next:(value) => { + next: (value) => { // TODO }, - error:(error) => { + error: (error) => { // HTML encode the error message since it originates from XML this._snackBar.open(this.toHTML(error.message), 'Close'); - } - }) + }, + }), ); } diff --git a/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.html b/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.html index 7bffc80d..86f18644 100644 --- a/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.html +++ b/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.html @@ -3,7 +3,12 @@

REPLICATE

Master - + Port @@ -11,35 +16,90 @@

REPLICATE

Distro Pattern - + Profile Pattern - + System Pattern - + Repository Pattern - + Image Pattern - + Management-Class Pattern - + File Pattern - + - Prune - Omit data - Sync all - Use SSL + Prune + Omit data + Sync all + Use SSL
diff --git a/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.spec.ts b/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.spec.ts index 26ab5942..b209bf33 100644 --- a/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.spec.ts +++ b/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.spec.ts @@ -1,11 +1,11 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {MatButtonModule} from '@angular/material/button'; -import {MatFormFieldModule} from '@angular/material/form-field'; -import {MatInputModule} from '@angular/material/input'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {COBBLER_URL} from 'cobbler-api'; +import { MatButtonModule } from '@angular/material/button'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { COBBLER_URL } from 'cobbler-api'; import { ReplicateComponent } from './replicate.component'; @@ -27,11 +27,10 @@ describe('ReplicateComponent', () => { provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') - } - ] - }) - .compileComponents(); + useValue: new URL('http://localhost/cobbler_api'), + }, + ], + }).compileComponents(); fixture = TestBed.createComponent(ReplicateComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.ts b/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.ts index 17aba350..c211878e 100644 --- a/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.ts +++ b/projects/cobbler-frontend/src/app/actions/replicate/replicate.component.ts @@ -1,12 +1,12 @@ -import {Component, inject} from '@angular/core'; -import {FormBuilder, ReactiveFormsModule} from '@angular/forms'; -import {MatButton} from '@angular/material/button'; -import {MatFormFieldModule, MatLabel} from '@angular/material/form-field'; -import {MatFormField, MatInput} from '@angular/material/input'; -import {MatSlideToggle} from '@angular/material/slide-toggle'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {BackgroundReplicateOptions, CobblerApiService} from 'cobbler-api'; -import {UserService} from '../../services/user.service'; +import { Component, inject } from '@angular/core'; +import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; +import { MatButton } from '@angular/material/button'; +import { MatFormFieldModule, MatLabel } from '@angular/material/form-field'; +import { MatFormField, MatInput } from '@angular/material/input'; +import { MatSlideToggle } from '@angular/material/slide-toggle'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { BackgroundReplicateOptions, CobblerApiService } from 'cobbler-api'; +import { UserService } from '../../services/user.service'; @Component({ selector: 'cobbler-replicate', @@ -21,21 +21,21 @@ import {UserService} from '../../services/user.service'; MatButton, ], templateUrl: './replicate.component.html', - styleUrl: './replicate.component.scss' + styleUrl: './replicate.component.scss', }) export class ReplicateComponent { private readonly _formBuilder = inject(FormBuilder); replicateFormGroup = this._formBuilder.group({ - master: "", - port: "", - distro_patterns: "", - profile_patterns: "", - system_patterns: "", - repo_patterns: "", - image_patterns: "", - mgmtclass_patterns: "", - package_patterns: "", - file_patterns: "", + master: '', + port: '', + distro_patterns: '', + profile_patterns: '', + system_patterns: '', + repo_patterns: '', + image_patterns: '', + mgmtclass_patterns: '', + package_patterns: '', + file_patterns: '', prune: false, omit_data: false, sync_all: false, @@ -45,9 +45,8 @@ export class ReplicateComponent { constructor( public userService: UserService, private cobblerApiService: CobblerApiService, - private _snackBar: MatSnackBar - ) { - } + private _snackBar: MatSnackBar, + ) {} runReplicate(): void { const replicateOptions: BackgroundReplicateOptions = { @@ -58,26 +57,31 @@ export class ReplicateComponent { system_patterns: this.replicateFormGroup.controls.system_patterns.value, repo_patterns: this.replicateFormGroup.controls.repo_patterns.value, image_patterns: this.replicateFormGroup.controls.image_patterns.value, - mgmtclass_patterns: this.replicateFormGroup.controls.mgmtclass_patterns.value, + mgmtclass_patterns: + this.replicateFormGroup.controls.mgmtclass_patterns.value, package_patterns: this.replicateFormGroup.controls.package_patterns.value, file_patterns: this.replicateFormGroup.controls.file_patterns.value, prune: this.replicateFormGroup.controls.prune.value, omit_data: this.replicateFormGroup.controls.omit_data.value, sync_all: this.replicateFormGroup.controls.sync_all.value, use_ssl: this.replicateFormGroup.controls.use_ssl.value, - } - this.cobblerApiService.background_replicate(replicateOptions, this.userService.token).subscribe( - value => { - // TODO - }, - error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + }; + this.cobblerApiService + .background_replicate(replicateOptions, this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } - toHTML(input: string) : any { + toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, "text/html").documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.html b/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.html index 63bf11fd..beb13d26 100644 --- a/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.html +++ b/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.html @@ -14,9 +14,19 @@

SYNC REPOSITORIES

{{ i + 1 }}.  - - - @if (reposyncFormGroup.controls.repoName.controls[i].hasError('required')) { + + + @if ( + reposyncFormGroup.controls.repoName.controls[i].hasError("required") + ) { Repository name is required } @@ -27,7 +37,12 @@

SYNC REPOSITORIES

} Tries - + No Fail diff --git a/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.spec.ts b/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.spec.ts index 3ca214ed..2bb0addc 100644 --- a/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.spec.ts +++ b/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.spec.ts @@ -1,13 +1,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatListModule } from '@angular/material/list'; -import {provideRouter} from '@angular/router'; +import { provideRouter } from '@angular/router'; import { RepoSyncComponent } from './repo-sync.component'; -import {provideHttpClient} from "@angular/common/http"; -import {provideHttpClientTesting} from "@angular/common/http/testing"; -import {COBBLER_URL} from "cobbler-api"; -import {NoopAnimationsModule} from "@angular/platform-browser/animations"; - +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; +import { COBBLER_URL } from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; describe('RepoSyncComponent', () => { let component: RepoSyncComponent; @@ -15,20 +14,16 @@ describe('RepoSyncComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - MatListModule, - RepoSyncComponent, - NoopAnimationsModule, - ], + imports: [MatListModule, RepoSyncComponent, NoopAnimationsModule], providers: [ provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] + ], }).compileComponents(); }); diff --git a/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.ts b/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.ts index 0d8cd714..478c7699 100644 --- a/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.ts +++ b/projects/cobbler-frontend/src/app/actions/repo-sync/repo-sync.component.ts @@ -1,11 +1,11 @@ -import {Component, inject} from '@angular/core'; -import {MatListModule} from '@angular/material/list'; -import {RouterOutlet} from '@angular/router'; -import {UserService} from "../../services/user.service"; -import {CobblerApiService} from "cobbler-api"; -import {MatSnackBar} from "@angular/material/snack-bar"; -import {MatButton, MatIconButton} from "@angular/material/button"; -import {BackgroundReposyncOptions} from "cobbler-api"; +import { Component, inject } from '@angular/core'; +import { MatListModule } from '@angular/material/list'; +import { RouterOutlet } from '@angular/router'; +import { UserService } from '../../services/user.service'; +import { CobblerApiService } from 'cobbler-api'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { BackgroundReposyncOptions } from 'cobbler-api'; import { FormArray, FormBuilder, @@ -13,12 +13,18 @@ import { FormGroup, FormsModule, ReactiveFormsModule, - Validators -} from "@angular/forms"; -import {MatCheckbox} from "@angular/material/checkbox"; -import {MatFormField, MatFormFieldModule, MatLabel, MatPrefix, MatSuffix} from "@angular/material/form-field"; -import {MatIcon} from "@angular/material/icon"; -import {MatInput, MatInputModule} from "@angular/material/input"; + Validators, +} from '@angular/forms'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { + MatFormField, + MatFormFieldModule, + MatLabel, + MatPrefix, + MatSuffix, +} from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput, MatInputModule } from '@angular/material/input'; @Component({ selector: 'cobbler-repo-sync', @@ -55,9 +61,8 @@ export class RepoSyncComponent { constructor( public userService: UserService, private cobblerApiService: CobblerApiService, - private _snackBar: MatSnackBar - ) { - } + private _snackBar: MatSnackBar, + ) {} get newRepositoryFormGroup(): FormGroup { return new FormGroup({ @@ -78,31 +83,35 @@ export class RepoSyncComponent { } runReposync(): void { - let repoNames: Array = [] + let repoNames: Array = []; for (let control of this.reposyncFormGroup.controls.repoName.controls) { if (control instanceof FormGroup) { - repoNames.push(control.value.repoName) + repoNames.push(control.value.repoName); } } const reposyncOptions: BackgroundReposyncOptions = { repos: repoNames, - only: "", + only: '', tries: this.reposyncFormGroup.controls.reposyncTries.value, nofail: this.reposyncFormGroup.controls.reposyncNoFail.value, - } - this.cobblerApiService.background_reposync(reposyncOptions, this.userService.token).subscribe( - value => { - // TODO - console.log(value) - }, - error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + }; + this.cobblerApiService + .background_reposync(reposyncOptions, this.userService.token) + .subscribe( + (value) => { + // TODO + console.log(value); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/actions/status/status.component.html b/projects/cobbler-frontend/src/app/actions/status/status.component.html index 42937364..eecfa821 100644 --- a/projects/cobbler-frontend/src/app/actions/status/status.component.html +++ b/projects/cobbler-frontend/src/app/actions/status/status.component.html @@ -2,69 +2,86 @@

Installation Status

Filter - +
- - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - +
IP {{ element.ip }}IP{{ element.ip }} Object Type {{ element.mostRecentTarget.split(":")[0] }}Object Type + {{ element.mostRecentTarget.split(":")[0] }} + Name {{ element.mostRecentTarget.split(":")[1] }}Name + {{ element.mostRecentTarget.split(":")[1] }} + Most Recent Start {{ element.mostRecentStart * 1000 | date:'short' }}Most Recent Start + {{ element.mostRecentStart * 1000 | date: "short" }} + Most Recent Stop {{ element.mostRecentStop * 1000 | date:'short' }}Most Recent Stop + {{ element.mostRecentStop * 1000 | date: "short" }} + Seen Start Counter {{ element.seenStop }}Seen Start Counter{{ element.seenStop }} Seen Stop Counter {{ element.seenStop }}Seen Stop Counter{{ element.seenStop }} State {{ element.state }}State{{ element.state }}
No data matching the filter "{{ input.value }}" + No data matching the filter "{{ input.value }}" +
- +
diff --git a/projects/cobbler-frontend/src/app/actions/status/status.component.spec.ts b/projects/cobbler-frontend/src/app/actions/status/status.component.spec.ts index 4711db6e..35e737e4 100644 --- a/projects/cobbler-frontend/src/app/actions/status/status.component.spec.ts +++ b/projects/cobbler-frontend/src/app/actions/status/status.component.spec.ts @@ -1,12 +1,12 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {MatFormFieldModule} from '@angular/material/form-field'; -import {MatInputModule} from '@angular/material/input'; -import {MatPaginatorModule} from '@angular/material/paginator'; -import {MatTableModule} from '@angular/material/table'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {COBBLER_URL} from 'cobbler-api'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatPaginatorModule } from '@angular/material/paginator'; +import { MatTableModule } from '@angular/material/table'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { COBBLER_URL } from 'cobbler-api'; import { StatusComponent } from './status.component'; @@ -27,13 +27,12 @@ describe('StatusComponent', () => { providers: [ { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, provideHttpClient(), provideHttpClientTesting(), - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(StatusComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/actions/status/status.component.ts b/projects/cobbler-frontend/src/app/actions/status/status.component.ts index 89024e37..fe131db8 100644 --- a/projects/cobbler-frontend/src/app/actions/status/status.component.ts +++ b/projects/cobbler-frontend/src/app/actions/status/status.component.ts @@ -1,13 +1,12 @@ -import {DatePipe} from '@angular/common'; -import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core'; -import {MatFormFieldModule} from '@angular/material/form-field'; -import {MatInputModule} from '@angular/material/input'; -import {MatPaginator, MatPaginatorModule} from '@angular/material/paginator'; -import {MatSort} from '@angular/material/sort'; -import {MatTableDataSource, MatTableModule} from '@angular/material/table'; -import {CobblerApiService, InstallationStatus} from 'cobbler-api'; -import {UserService} from '../../services/user.service'; - +import { DatePipe } from '@angular/common'; +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; +import { MatTableDataSource, MatTableModule } from '@angular/material/table'; +import { CobblerApiService, InstallationStatus } from 'cobbler-api'; +import { UserService } from '../../services/user.service'; @Component({ selector: 'cobbler-status', @@ -21,7 +20,7 @@ import {UserService} from '../../services/user.service'; DatePipe, ], templateUrl: './status.component.html', - styleUrl: './status.component.scss' + styleUrl: './status.component.scss', }) export class StatusComponent implements OnInit, AfterViewInit { displayedColumns: string[] = [ @@ -32,9 +31,11 @@ export class StatusComponent implements OnInit, AfterViewInit { 'mostRecentStop', 'seenStart', 'seenStop', - 'state' + 'state', ]; - dataSource: MatTableDataSource = new MatTableDataSource([]); + dataSource: MatTableDataSource = new MatTableDataSource( + [], + ); @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; @@ -42,14 +43,15 @@ export class StatusComponent implements OnInit, AfterViewInit { constructor( public userService: UserService, private cobblerApiService: CobblerApiService, - ) { - } + ) {} ngOnInit(): void { - this.cobblerApiService.get_status("normal", this.userService.token).subscribe((value) => { - console.log(value) - this.dataSource.data = value - }) + this.cobblerApiService + .get_status('normal', this.userService.token) + .subscribe((value) => { + console.log(value); + this.dataSource.data = value; + }); } ngAfterViewInit() { diff --git a/projects/cobbler-frontend/src/app/actions/sync/sync.component.html b/projects/cobbler-frontend/src/app/actions/sync/sync.component.html index 8cc5e0ee..6725e6ea 100644 --- a/projects/cobbler-frontend/src/app/actions/sync/sync.component.html +++ b/projects/cobbler-frontend/src/app/actions/sync/sync.component.html @@ -26,16 +26,30 @@

Systems Sync

{{ i + 1 }}.  - - - @if (systemsSync.controls.keyValue.controls[i].hasError('required')) { + + + @if ( + systemsSync.controls.keyValue.controls[i].hasError("required") + ) { System name is required }
} @empty { -

Syncing All Systems

+

Syncing All Systems

} Verbose diff --git a/projects/cobbler-frontend/src/app/actions/sync/sync.component.spec.ts b/projects/cobbler-frontend/src/app/actions/sync/sync.component.spec.ts index e630f98a..98a07a3e 100644 --- a/projects/cobbler-frontend/src/app/actions/sync/sync.component.spec.ts +++ b/projects/cobbler-frontend/src/app/actions/sync/sync.component.spec.ts @@ -1,19 +1,18 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {ReactiveFormsModule} from '@angular/forms'; -import {MatButtonModule} from '@angular/material/button'; -import {MatCheckboxModule} from '@angular/material/checkbox'; -import {MatFormFieldModule} from '@angular/material/form-field'; -import {MatIconModule} from '@angular/material/icon'; -import {MatInputModule} from '@angular/material/input'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatButtonModule } from '@angular/material/button'; +import { MatCheckboxModule } from '@angular/material/checkbox'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatIconModule } from '@angular/material/icon'; +import { MatInputModule } from '@angular/material/input'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { SyncComponent } from './sync.component'; - describe('SyncComponent', () => { let component: SyncComponent; let fixture: ComponentFixture; @@ -36,9 +35,9 @@ describe('SyncComponent', () => { provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] + ], }).compileComponents(); }); diff --git a/projects/cobbler-frontend/src/app/actions/sync/sync.component.ts b/projects/cobbler-frontend/src/app/actions/sync/sync.component.ts index 8d4e5026..168e80de 100644 --- a/projects/cobbler-frontend/src/app/actions/sync/sync.component.ts +++ b/projects/cobbler-frontend/src/app/actions/sync/sync.component.ts @@ -1,21 +1,27 @@ -import {CommonModule} from '@angular/common'; -import {ChangeDetectionStrategy, Component, inject} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormArray, FormBuilder, FormControl, FormGroup, - ReactiveFormsModule, Validators, + ReactiveFormsModule, + Validators, } from '@angular/forms'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatDialogClose} from '@angular/material/dialog'; -import {MatIcon} from '@angular/material/icon'; -import {MatFormField, MatInput, MatPrefix, MatSuffix} from '@angular/material/input'; -import {MatSnackBar} from '@angular/material/snack-bar'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatDialogClose } from '@angular/material/dialog'; +import { MatIcon } from '@angular/material/icon'; +import { + MatFormField, + MatInput, + MatPrefix, + MatSuffix, +} from '@angular/material/input'; +import { MatSnackBar } from '@angular/material/snack-bar'; import { RouterOutlet } from '@angular/router'; -import {CobblerApiService} from 'cobbler-api'; -import {UserService} from '../../services/user.service'; +import { CobblerApiService } from 'cobbler-api'; +import { UserService } from '../../services/user.service'; @Component({ selector: 'cobbler-sync', @@ -34,7 +40,7 @@ import {UserService} from '../../services/user.service'; MatIcon, MatFormField, MatPrefix, - MatSuffix + MatSuffix, ], changeDetection: ChangeDetectionStrategy.OnPush, }) @@ -51,7 +57,7 @@ export class SyncComponent { systemsSync = this._formBuilder.group({ keyValue: this.keyValueFA, - systemsSyncVerbose: false + systemsSyncVerbose: false, }); constructor( @@ -82,19 +88,22 @@ export class SyncComponent { const syncOptions = { dhcp: this.fullSync.controls.fullSyncDhcp.value, dns: this.fullSync.controls.fullSyncDns.value, - verbose: this.fullSync.controls.fullSyncVerbose.value - } - this.fullSync.controls.fullSyncDhcp.reset(false) - this.fullSync.controls.fullSyncDns.reset(false) - this.fullSync.controls.fullSyncVerbose.reset(false) + verbose: this.fullSync.controls.fullSyncVerbose.value, + }; + this.fullSync.controls.fullSyncDhcp.reset(false); + this.fullSync.controls.fullSyncDns.reset(false); + this.fullSync.controls.fullSyncVerbose.reset(false); this.cobblerApiService .background_sync(syncOptions, this.userService.token) - .subscribe(value => { - console.log(value) - },error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close') - }) + .subscribe( + (value) => { + console.log(value); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } syncSystemsSubmit(): void { @@ -102,32 +111,40 @@ export class SyncComponent { for (let control of this.systemsSync.controls.keyValue.controls) { control.markAsTouched(); } - this._snackBar.open("Please give all inputs a system name!", "Close", {duration: 2000}) + this._snackBar.open('Please give all inputs a system name!', 'Close', { + duration: 2000, + }); return; } - let systemNames: Array = [] + let systemNames: Array = []; for (let control of this.systemsSync.controls.keyValue.controls) { if (control instanceof FormGroup) { - systemNames.push(control.value.systemName) + systemNames.push(control.value.systemName); } } - const syncOptions = {systems: systemNames, verbose: this.systemsSync.controls.systemsSyncVerbose.value} - this.systemsSync.controls.systemsSyncVerbose.reset(false) - this.systemsSync.controls.keyValue.reset([]) + const syncOptions = { + systems: systemNames, + verbose: this.systemsSync.controls.systemsSyncVerbose.value, + }; + this.systemsSync.controls.systemsSyncVerbose.reset(false); + this.systemsSync.controls.keyValue.reset([]); this.cobblerApiService .background_syncsystems(syncOptions, this.userService.token) - .subscribe(value => { - console.log(value) - },error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close') - }) + .subscribe( + (value) => { + console.log(value); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } - toHTML(input: string) : any { + toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, "text/html").documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } - } diff --git a/projects/cobbler-frontend/src/app/actions/validate-autoinstalls/validate-autoinstalls.component.spec.ts b/projects/cobbler-frontend/src/app/actions/validate-autoinstalls/validate-autoinstalls.component.spec.ts index 701d323a..963e93aa 100644 --- a/projects/cobbler-frontend/src/app/actions/validate-autoinstalls/validate-autoinstalls.component.spec.ts +++ b/projects/cobbler-frontend/src/app/actions/validate-autoinstalls/validate-autoinstalls.component.spec.ts @@ -1,8 +1,8 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {MatButtonModule} from '@angular/material/button'; -import {COBBLER_URL} from 'cobbler-api'; +import { MatButtonModule } from '@angular/material/button'; +import { COBBLER_URL } from 'cobbler-api'; import { ValidateAutoinstallsComponent } from './validate-autoinstalls.component'; @@ -12,20 +12,16 @@ describe('ValidateAutoinstallsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - ValidateAutoinstallsComponent, - MatButtonModule - ], + imports: [ValidateAutoinstallsComponent, MatButtonModule], providers: [ provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') - } - ] - }) - .compileComponents(); + useValue: new URL('http://localhost/cobbler_api'), + }, + ], + }).compileComponents(); fixture = TestBed.createComponent(ValidateAutoinstallsComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/actions/validate-autoinstalls/validate-autoinstalls.component.ts b/projects/cobbler-frontend/src/app/actions/validate-autoinstalls/validate-autoinstalls.component.ts index 8cbce727..a30fc3e1 100644 --- a/projects/cobbler-frontend/src/app/actions/validate-autoinstalls/validate-autoinstalls.component.ts +++ b/projects/cobbler-frontend/src/app/actions/validate-autoinstalls/validate-autoinstalls.component.ts @@ -1,40 +1,40 @@ import { Component } from '@angular/core'; -import {MatButton} from '@angular/material/button'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {CobblerApiService} from 'cobbler-api'; -import {UserService} from '../../services/user.service'; +import { MatButton } from '@angular/material/button'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { CobblerApiService } from 'cobbler-api'; +import { UserService } from '../../services/user.service'; @Component({ selector: 'cobbler-validate-autoinstalls', standalone: true, - imports: [ - MatButton - ], + imports: [MatButton], templateUrl: './validate-autoinstalls.component.html', - styleUrl: './validate-autoinstalls.component.scss' + styleUrl: './validate-autoinstalls.component.scss', }) export class ValidateAutoinstallsComponent { constructor( public userService: UserService, private cobblerApiService: CobblerApiService, - private _snackBar: MatSnackBar - ) { - } + private _snackBar: MatSnackBar, + ) {} runValidateAutoinstalls(): void { - this.cobblerApiService.background_validate_autoinstall_files(this.userService.token).subscribe( - value => { - // TODO - }, - error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .background_validate_autoinstall_files(this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } - } diff --git a/projects/cobbler-frontend/src/app/app-events/app-events.component.html b/projects/cobbler-frontend/src/app/app-events/app-events.component.html index 8b1e650a..9066b4b7 100644 --- a/projects/cobbler-frontend/src/app/app-events/app-events.component.html +++ b/projects/cobbler-frontend/src/app/app-events/app-events.component.html @@ -1,39 +1,48 @@
-

EVENTS

- - + + - - + + - - + + - + - +
Name {{ element.name }} Name{{ element.name }} State {{ element.state }} State{{ element.state }} Date {{ element.statetime * 1000 | date:'long' }} Date + {{ element.statetime * 1000 | date: "long" }} + Read by Read by - - {{item}} - - + - + + {{ item }} - + + - + + + - - - - +
diff --git a/projects/cobbler-frontend/src/app/app-events/app-events.component.spec.ts b/projects/cobbler-frontend/src/app/app-events/app-events.component.spec.ts index adc8b9fa..cc77f46c 100644 --- a/projects/cobbler-frontend/src/app/app-events/app-events.component.spec.ts +++ b/projects/cobbler-frontend/src/app/app-events/app-events.component.spec.ts @@ -1,12 +1,14 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatListModule } from '@angular/material/list'; -import {provideRouter} from '@angular/router'; +import { provideRouter } from '@angular/router'; import { AppEventsComponent } from './app-events.component'; -import {MatDialogModule} from "@angular/material/dialog"; -import {HttpClientTestingModule, HttpTestingController} from "@angular/common/http/testing"; -import {COBBLER_URL} from 'cobbler-api'; - +import { MatDialogModule } from '@angular/material/dialog'; +import { + HttpClientTestingModule, + HttpTestingController, +} from '@angular/common/http/testing'; +import { COBBLER_URL } from 'cobbler-api'; describe('AppEventsComponent', () => { let component: AppEventsComponent; @@ -25,9 +27,9 @@ describe('AppEventsComponent', () => { provideRouter([]), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] + ], }).compileComponents(); }); @@ -46,8 +48,10 @@ describe('AppEventsComponent', () => { it('should create', () => { // FIXME: Deduplicate stub with API tests // eslint-disable-next-line max-len - const methodResponse = `2023-01-24_075223_Create bootable bootloader images_77c9dbafc9234f018d67ec3295fcc22b1674546743.8418643Create bootable bootloader imagescomplete1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_075801_Replicate_ea7a003a81264039b4277ac55664661a1674547081.1178503Replicatefailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_083001_Build Iso_20fa7d4256fc4f61a2b9c2237c80fb411674549001.176315Build Isofailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_083137_(CLI) ACL Configuration_334327920d2946fda3ac95dbf457e76d1674549097.240632(CLI) ACL Configurationfailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==` - const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + const methodResponse = `2023-01-24_075223_Create bootable bootloader images_77c9dbafc9234f018d67ec3295fcc22b1674546743.8418643Create bootable bootloader imagescomplete1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_075801_Replicate_ea7a003a81264039b4277ac55664661a1674547081.1178503Replicatefailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_083001_Build Iso_20fa7d4256fc4f61a2b9c2237c80fb411674549001.176315Build Isofailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==2023-01-24_083137_(CLI) ACL Configuration_334327920d2946fda3ac95dbf457e76d1674549097.240632(CLI) ACL Configurationfailed1YMw1KxyPQtPM8AVB5ejKFJryEHCtCwYQQ==`; + const mockRequest = httpTestingController.expectOne( + 'http://localhost/cobbler_api', + ); mockRequest.flush(methodResponse); expect(component).toBeTruthy(); }); diff --git a/projects/cobbler-frontend/src/app/app-events/app-events.component.ts b/projects/cobbler-frontend/src/app/app-events/app-events.component.ts index 2a25742c..55586545 100644 --- a/projects/cobbler-frontend/src/app/app-events/app-events.component.ts +++ b/projects/cobbler-frontend/src/app/app-events/app-events.component.ts @@ -1,14 +1,14 @@ -import {CommonModule, DatePipe} from '@angular/common'; +import { CommonModule, DatePipe } from '@angular/common'; import { Component, Inject, OnInit } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; -import {MatIconModule} from '@angular/material/icon'; +import { MatIconModule } from '@angular/material/icon'; import { MatListModule } from '@angular/material/list'; -import {MatMenuModule} from '@angular/material/menu'; +import { MatMenuModule } from '@angular/material/menu'; import { RouterOutlet } from '@angular/router'; -import {MatTableDataSource, MatTableModule} from '@angular/material/table'; -import {MatDialog} from '@angular/material/dialog'; -import {CobblerApiService, Event} from 'cobbler-api'; -import {DialogBoxTextConfirmComponent} from "../common/dialog-box-text-confirm/dialog-box-text-confirm"; +import { MatTableDataSource, MatTableModule } from '@angular/material/table'; +import { MatDialog } from '@angular/material/dialog'; +import { CobblerApiService, Event } from 'cobbler-api'; +import { DialogBoxTextConfirmComponent } from '../common/dialog-box-text-confirm/dialog-box-text-confirm'; @Component({ selector: 'cobbler-app-events', @@ -27,19 +27,24 @@ import {DialogBoxTextConfirmComponent} from "../common/dialog-box-text-confirm/d ], }) export class AppEventsComponent implements OnInit { - displayedColumns: string[] = ['name', 'state', 'statetime', 'readByWho', 'actions']; + displayedColumns: string[] = [ + 'name', + 'state', + 'statetime', + 'readByWho', + 'actions', + ]; cobblerEvents = new MatTableDataSource([]); constructor( @Inject(MatDialog) readonly dialog: MatDialog, private cobblerApiService: CobblerApiService, - ) { - } + ) {} ngOnInit(): void { - this.cobblerApiService.get_events("").subscribe((value: Array) => { - this.cobblerEvents.data = value - }) + this.cobblerApiService.get_events('').subscribe((value: Array) => { + this.cobblerEvents.data = value; + }); } showLogs(eventId: string, name: string) { @@ -48,11 +53,11 @@ export class AppEventsComponent implements OnInit { data: { eventId: eventId, name: name, - eventLog: value - } + eventLog: value, + }, }); dialogRef.afterClosed().subscribe(); - }) + }); } } diff --git a/projects/cobbler-frontend/src/app/app-routing.module.ts b/projects/cobbler-frontend/src/app/app-routing.module.ts index 0637e6db..bf0e708a 100644 --- a/projects/cobbler-frontend/src/app/app-routing.module.ts +++ b/projects/cobbler-frontend/src/app/app-routing.module.ts @@ -1,51 +1,54 @@ - +/* eslint-disable max-len */ import { Routes } from '@angular/router'; import { BuildISOComponent } from './actions/build-iso/build-iso.component'; import { CheckSysComponent } from './actions/check-sys/check-sys.component'; -import {HardlinkComponent} from './actions/hardlink/hardlink.component'; +import { HardlinkComponent } from './actions/hardlink/hardlink.component'; import { ImportDVDComponent } from './actions/import-dvd/import-dvd.component'; -import {ReplicateComponent} from './actions/replicate/replicate.component'; +import { ReplicateComponent } from './actions/replicate/replicate.component'; import { RepoSyncComponent } from './actions/repo-sync/repo-sync.component'; -import {StatusComponent} from './actions/status/status.component'; +import { StatusComponent } from './actions/status/status.component'; import { SyncComponent } from './actions/sync/sync.component'; -import {ValidateAutoinstallsComponent} from './actions/validate-autoinstalls/validate-autoinstalls.component'; +import { ValidateAutoinstallsComponent } from './actions/validate-autoinstalls/validate-autoinstalls.component'; import { AppEventsComponent } from './app-events/app-events.component'; import { AppManageComponent } from './appManage'; -import {DistroEditComponent} from './items/distro/edit/distro-edit.component'; +import { DistroEditComponent } from './items/distro/edit/distro-edit.component'; import { DistrosOverviewComponent } from './items/distro/overview/distros-overview.component'; -import {FileEditComponent} from './items/file/edit/file-edit.component'; +import { FileEditComponent } from './items/file/edit/file-edit.component'; import { FileOverviewComponent } from './items/file/overview/file-overview.component'; -import {ImageEditComponent} from './items/image/edit/image-edit.component'; +import { ImageEditComponent } from './items/image/edit/image-edit.component'; import { ImageOverviewComponent } from './items/image/overview/image-overview.component'; -import {ManagementClassEditComponent} from './items/management-class/edit/management-class-edit.component'; -import {ManagementClassOverviewComponent} from './items/management-class/overview/management-class-overview.component'; -import {PackageEditComponent} from './items/package/edit/package-edit.component'; +import { ManagementClassEditComponent } from './items/management-class/edit/management-class-edit.component'; +import { ManagementClassOverviewComponent } from './items/management-class/overview/management-class-overview.component'; +import { PackageEditComponent } from './items/package/edit/package-edit.component'; import { PackageOverviewComponent } from './items/package/overview/package-overview.component'; -import {ProfileEditComponent} from './items/profile/edit/profile-edit.component'; +import { ProfileEditComponent } from './items/profile/edit/profile-edit.component'; import { ProfileOverviewComponent } from './items/profile/overview/profile-overview.component'; -import {RepositoryEditComponent} from './items/repository/edit/repository-edit.component'; +import { RepositoryEditComponent } from './items/repository/edit/repository-edit.component'; import { RepositoryOverviewComponent } from './items/repository/overview/repository-overview.component'; -import {SnippetEditComponent} from './items/snippet/edit/snippet-edit.component'; +import { SnippetEditComponent } from './items/snippet/edit/snippet-edit.component'; import { SnippetOverviewComponent } from './items/snippet/overview/snippet-overview.component'; -import {SystemEditComponent} from './items/system/edit/system-edit.component'; +import { SystemEditComponent } from './items/system/edit/system-edit.component'; import { SystemOverviewComponent } from './items/system/overview/system-overview.component'; -import {TemplateEditComponent} from './items/template/edit/template-edit.component'; +import { TemplateEditComponent } from './items/template/edit/template-edit.component'; import { TemplateOverviewComponent } from './items/template/overview/template-overview.component'; import { LogInFormComponent } from './login/login.component'; import { NotFoundComponent } from './not-found/not-found.component'; import { AuthGuardService } from './services/auth-guard.service'; import { SettingsViewComponent } from './settings/view/settings-view.component'; import { UnauthorizedComponent } from './unauthorized/unauthorized.component'; -import {SignaturesComponent} from "./signatures/signatures.component"; +import { SignaturesComponent } from './signatures/signatures.component'; import { MkloadersComponent } from './actions/mkloaders/mkloaders.component'; - +/* eslint-enable max-len */ export const routes: Routes = [ - - {path: 'login', component: LogInFormComponent}, - {path: '', pathMatch: 'full', redirectTo: '/login' }, - {path: 'unauthorized', component: UnauthorizedComponent}, - {path: 'manage', component: AppManageComponent, canActivate: [AuthGuardService]}, + { path: 'login', component: LogInFormComponent }, + { path: '', pathMatch: 'full', redirectTo: '/login' }, + { path: 'unauthorized', component: UnauthorizedComponent }, + { + path: 'manage', + component: AppManageComponent, + canActivate: [AuthGuardService], + }, { path: 'items', children: [ @@ -54,98 +57,184 @@ export const routes: Routes = [ component: DistrosOverviewComponent, canActivate: [AuthGuardService], children: [ - {path: ':name', component: DistroEditComponent, canActivate: [AuthGuardService]}, - ] + { + path: ':name', + component: DistroEditComponent, + canActivate: [AuthGuardService], + }, + ], }, { path: 'profile', component: ProfileOverviewComponent, canActivate: [AuthGuardService], children: [ - {path: ':name', component: ProfileEditComponent, canActivate: [AuthGuardService]}, - ] + { + path: ':name', + component: ProfileEditComponent, + canActivate: [AuthGuardService], + }, + ], }, { path: 'system', component: SystemOverviewComponent, canActivate: [AuthGuardService], children: [ - {path: ':name', component: SystemEditComponent, canActivate: [AuthGuardService]}, - ] + { + path: ':name', + component: SystemEditComponent, + canActivate: [AuthGuardService], + }, + ], }, { path: 'repository', component: RepositoryOverviewComponent, canActivate: [AuthGuardService], children: [ - {path: ':name', component: RepositoryEditComponent, canActivate: [AuthGuardService]}, - ] + { + path: ':name', + component: RepositoryEditComponent, + canActivate: [AuthGuardService], + }, + ], }, { path: 'image', component: ImageOverviewComponent, canActivate: [AuthGuardService], children: [ - {path: ':name', component: ImageEditComponent, canActivate: [AuthGuardService]}, - ] + { + path: ':name', + component: ImageEditComponent, + canActivate: [AuthGuardService], + }, + ], }, { path: 'template', component: TemplateOverviewComponent, canActivate: [AuthGuardService], children: [ - {path: ':name', component: TemplateEditComponent, canActivate: [AuthGuardService]}, - ] + { + path: ':name', + component: TemplateEditComponent, + canActivate: [AuthGuardService], + }, + ], }, { path: 'snippet', component: SnippetOverviewComponent, canActivate: [AuthGuardService], children: [ - {path: ':name', component: SnippetEditComponent, canActivate: [AuthGuardService]}, - ] + { + path: ':name', + component: SnippetEditComponent, + canActivate: [AuthGuardService], + }, + ], }, { path: 'management-class', component: ManagementClassOverviewComponent, canActivate: [AuthGuardService], children: [ - {path: ':name', component: ManagementClassEditComponent, canActivate: [AuthGuardService]}, - ] + { + path: ':name', + component: ManagementClassEditComponent, + canActivate: [AuthGuardService], + }, + ], }, { path: 'package', component: PackageOverviewComponent, canActivate: [AuthGuardService], children: [ - {path: ':name', component: PackageEditComponent, canActivate: [AuthGuardService]}, - ] + { + path: ':name', + component: PackageEditComponent, + canActivate: [AuthGuardService], + }, + ], }, { path: 'file', component: FileOverviewComponent, canActivate: [AuthGuardService], children: [ - {path: ':name', component: FileEditComponent, canActivate: [AuthGuardService]}, - ] + { + path: ':name', + component: FileEditComponent, + canActivate: [AuthGuardService], + }, + ], }, - ] + ], + }, + { + path: 'settings', + component: SettingsViewComponent, + canActivate: [AuthGuardService], + }, + { + path: 'import', + component: ImportDVDComponent, + canActivate: [AuthGuardService], + }, + { path: 'sync', component: SyncComponent, canActivate: [AuthGuardService] }, + { + path: 'reposync', + component: RepoSyncComponent, + canActivate: [AuthGuardService], + }, + { + path: 'buildiso', + component: BuildISOComponent, + canActivate: [AuthGuardService], + }, + { + path: 'check', + component: CheckSysComponent, + canActivate: [AuthGuardService], }, - {path: 'settings', component: SettingsViewComponent, canActivate: [AuthGuardService]}, - {path: 'import', component: ImportDVDComponent, canActivate: [AuthGuardService]}, - {path: 'sync', component: SyncComponent, canActivate: [AuthGuardService]}, - {path: 'reposync', component: RepoSyncComponent, canActivate: [AuthGuardService]}, - {path: 'buildiso', component: BuildISOComponent, canActivate: [AuthGuardService]}, - {path: 'check', component: CheckSysComponent, canActivate: [AuthGuardService]}, - {path: 'status', component: StatusComponent, canActivate: [AuthGuardService]}, - {path: 'hardlink', component: HardlinkComponent, canActivate: [AuthGuardService]}, - {path: 'mkloaders', component: MkloadersComponent, canActivate: [AuthGuardService]}, - {path: 'events', component: AppEventsComponent, canActivate: [AuthGuardService]}, - {path: 'signatures', component: SignaturesComponent, canActivate: [AuthGuardService]}, - {path: 'validate-autoinstalls', component: ValidateAutoinstallsComponent, canActivate: [AuthGuardService]}, - {path: 'replicate', component: ReplicateComponent, canActivate: [AuthGuardService]}, - {path: '404', component: NotFoundComponent}, - {path: '**', redirectTo: '/404'}, + { + path: 'status', + component: StatusComponent, + canActivate: [AuthGuardService], + }, + { + path: 'hardlink', + component: HardlinkComponent, + canActivate: [AuthGuardService], + }, + { + path: 'mkloaders', + component: MkloadersComponent, + canActivate: [AuthGuardService], + }, + { + path: 'events', + component: AppEventsComponent, + canActivate: [AuthGuardService], + }, + { + path: 'signatures', + component: SignaturesComponent, + canActivate: [AuthGuardService], + }, + { + path: 'validate-autoinstalls', + component: ValidateAutoinstallsComponent, + canActivate: [AuthGuardService], + }, + { + path: 'replicate', + component: ReplicateComponent, + canActivate: [AuthGuardService], + }, + { path: '404', component: NotFoundComponent }, + { path: '**', redirectTo: '/404' }, ]; - - diff --git a/projects/cobbler-frontend/src/app/app.component.spec.ts b/projects/cobbler-frontend/src/app/app.component.spec.ts index 04433e3a..13aa514c 100644 --- a/projects/cobbler-frontend/src/app/app.component.spec.ts +++ b/projects/cobbler-frontend/src/app/app.component.spec.ts @@ -2,12 +2,11 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { Component } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { AppComponent } from './app.component'; -import {NoopAnimationsModule} from "@angular/platform-browser/animations"; -import {provideRouter} from "@angular/router"; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { provideRouter } from '@angular/router'; -@Component({selector: 'cobbler-manage-menu', template: '', standalone: true}) -class AppManageMenuStubComponent { -} +@Component({ selector: 'cobbler-manage-menu', template: '', standalone: true }) +class AppManageMenuStubComponent {} describe('AppComponent', () => { beforeEach(async () => { @@ -16,9 +15,9 @@ describe('AppComponent', () => { HttpClientTestingModule, AppComponent, AppManageMenuStubComponent, - NoopAnimationsModule + NoopAnimationsModule, ], - providers: [provideRouter([])] + providers: [provideRouter([])], }).compileComponents(); }); diff --git a/projects/cobbler-frontend/src/app/app.component.ts b/projects/cobbler-frontend/src/app/app.component.ts index cf809f3e..60dfb582 100644 --- a/projects/cobbler-frontend/src/app/app.component.ts +++ b/projects/cobbler-frontend/src/app/app.component.ts @@ -1,15 +1,13 @@ -import { Component } from "@angular/core"; -import { ManageMenuComponent } from "./manage-menu/manage-menu.component"; - +import { Component } from '@angular/core'; +import { ManageMenuComponent } from './manage-menu/manage-menu.component'; @Component({ selector: 'cobbler-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], imports: [ManageMenuComponent], - standalone:true + standalone: true, }) export class AppComponent { - constructor() { - } + constructor() {} } diff --git a/projects/cobbler-frontend/src/app/app.module.ts b/projects/cobbler-frontend/src/app/app.module.ts index 43837854..c60d5e67 100644 --- a/projects/cobbler-frontend/src/app/app.module.ts +++ b/projects/cobbler-frontend/src/app/app.module.ts @@ -1,4 +1,3 @@ - // import { NgModule } from '@angular/core'; // import { FormsModule, ReactiveFormsModule } from '@angular/forms'; // import { MatIconModule } from '@angular/material/icon'; diff --git a/projects/cobbler-frontend/src/app/appManage/app-manage.component.ts b/projects/cobbler-frontend/src/app/appManage/app-manage.component.ts index 651f2dc7..429cb542 100644 --- a/projects/cobbler-frontend/src/app/appManage/app-manage.component.ts +++ b/projects/cobbler-frontend/src/app/appManage/app-manage.component.ts @@ -1,5 +1,5 @@ -import {Component} from '@angular/core'; -import {GetObjService} from '../services/get-obj.service'; +import { Component } from '@angular/core'; +import { GetObjService } from '../services/get-obj.service'; @Component({ selector: 'cobbler-app-manage', @@ -13,7 +13,6 @@ export class AppManageComponent { currentObjs; saveObj; - constructor(service: GetObjService) { const user = window.sessionStorage.getItem('user'); const item = window.sessionStorage.getItem('CurrentItem'); diff --git a/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.css b/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.css index c58738b2..8e77d539 100644 --- a/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.css +++ b/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.css @@ -1 +1,3 @@ -.content { white-space: pre-line; } +.content { + white-space: pre-line; +} diff --git a/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.html b/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.html index b180e0fc..24dacd06 100644 --- a/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.html +++ b/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.html @@ -1,7 +1,5 @@

Log for: {{ data.name }}

-
- {{ data.eventLog }} -
+
{{ data.eventLog }}
diff --git a/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.spec.ts b/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.spec.ts index ba4b28c2..8ced5e47 100644 --- a/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.spec.ts +++ b/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.spec.ts @@ -1,7 +1,7 @@ -import {ComponentFixture, TestBed} from "@angular/core/testing"; -import {MatTreeModule} from "@angular/material/tree"; -import {DialogBoxTextConfirmComponent} from "./dialog-box-text-confirm"; -import {MAT_DIALOG_DATA, MatDialogModule} from "@angular/material/dialog"; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatTreeModule } from '@angular/material/tree'; +import { DialogBoxTextConfirmComponent } from './dialog-box-text-confirm'; +import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog'; describe('DialogBoxTextConfirmComponent', () => { let component: DialogBoxTextConfirmComponent; @@ -9,20 +9,15 @@ describe('DialogBoxTextConfirmComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - MatTreeModule, - MatDialogModule, - DialogBoxTextConfirmComponent, - ], + imports: [MatTreeModule, MatDialogModule, DialogBoxTextConfirmComponent], providers: [ { // I was expecting this will pass the desired value provide: MAT_DIALOG_DATA, - useValue: {eventId: "", name: "", eventLog: ""} - } - ] - }) - .compileComponents(); + useValue: { eventId: '', name: '', eventLog: '' }, + }, + ], + }).compileComponents(); }); beforeEach(() => { diff --git a/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.ts b/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.ts index 93504a11..aa04d6e2 100644 --- a/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.ts +++ b/projects/cobbler-frontend/src/app/common/dialog-box-text-confirm/dialog-box-text-confirm.ts @@ -1,17 +1,17 @@ -import {Component, Inject} from "@angular/core"; -import {MatButtonModule} from '@angular/material/button'; +import { Component, Inject } from '@angular/core'; +import { MatButtonModule } from '@angular/material/button'; import { MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, MatDialogContent, - MatDialogTitle + MatDialogTitle, } from '@angular/material/dialog'; export interface DialogData { - eventId: string, - name: string, - eventLog: string, + eventId: string; + name: string; + eventLog: string; } @Component({ @@ -19,12 +19,14 @@ export interface DialogData { templateUrl: './dialog-box-text-confirm.html', styleUrls: ['./dialog-box-text-confirm.css'], standalone: true, - imports: [MatButtonModule, MatDialogActions, MatDialogClose, MatDialogTitle, MatDialogContent] + imports: [ + MatButtonModule, + MatDialogActions, + MatDialogClose, + MatDialogTitle, + MatDialogContent, + ], }) export class DialogBoxTextConfirmComponent { - constructor( - @Inject(MAT_DIALOG_DATA) public data: DialogData - ) { - } - + constructor(@Inject(MAT_DIALOG_DATA) public data: DialogData) {} } diff --git a/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.html b/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.html index 793ab6c5..06a456fe 100644 --- a/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.html +++ b/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.html @@ -7,5 +7,7 @@

Add new Option:

- + diff --git a/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.spec.ts b/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.spec.ts index 4fda9a8d..f5b0cb40 100644 --- a/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.spec.ts +++ b/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.spec.ts @@ -1,6 +1,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {MAT_DIALOG_DATA, MatDialogModule, MatDialogRef} from '@angular/material/dialog'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; +import { + MAT_DIALOG_DATA, + MatDialogModule, + MatDialogRef, +} from '@angular/material/dialog'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { DialogTextInputComponent } from './dialog-text-input.component'; @@ -18,15 +22,14 @@ describe('DialogTextInputComponent', () => { providers: [ { provide: MatDialogRef, - useValue: {} + useValue: {}, }, { provide: MAT_DIALOG_DATA, - useValue: {text: ""} - } - ] - }) - .compileComponents(); + useValue: { text: '' }, + }, + ], + }).compileComponents(); fixture = TestBed.createComponent(DialogTextInputComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.ts b/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.ts index 5c4fc9ee..09a3697b 100644 --- a/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.ts +++ b/projects/cobbler-frontend/src/app/common/dialog-text-input/dialog-text-input.component.ts @@ -1,21 +1,21 @@ -import {Component, inject, model} from '@angular/core'; -import {FormsModule} from '@angular/forms'; -import {MatButton} from '@angular/material/button'; +import { Component, inject, model } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { MatButton } from '@angular/material/button'; import { MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, - MatDialogContent, MatDialogRef, - MatDialogTitle + MatDialogContent, + MatDialogRef, + MatDialogTitle, } from '@angular/material/dialog'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatInput} from '@angular/material/input'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatInput } from '@angular/material/input'; export interface DialogTextInputData { text: string; } - @Component({ selector: 'cobbler-dialog-text-input', standalone: true, @@ -31,15 +31,14 @@ export interface DialogTextInputData { FormsModule, ], templateUrl: './dialog-text-input.component.html', - styleUrl: './dialog-text-input.component.scss' + styleUrl: './dialog-text-input.component.scss', }) export class DialogTextInputComponent { readonly dialogRef = inject(MatDialogRef); readonly data = inject(MAT_DIALOG_DATA); - readonly dialogCloseSignal = model(this.data.text) + readonly dialogCloseSignal = model(this.data.text); onNoClick(): void { this.dialogRef.close(); } - } diff --git a/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.html b/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.html index 8ffd05f4..fdd6e5b5 100644 --- a/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.html +++ b/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.html @@ -1,22 +1,46 @@ - {{label}} + {{ label }} @if (Object.keys(this.keyValueOptions).length === 0) {

Empty list of options

} @else { -
+
@for (key of keyOrder; track key) { -
+ - +  =  - + - - + +
}
diff --git a/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.scss b/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.scss index ee119b33..b75ced1f 100644 --- a/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.scss +++ b/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.scss @@ -28,9 +28,10 @@ border: none; box-sizing: border-box; border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); + box-shadow: + 0 5px 5px -3px rgba(0, 0, 0, 0.2), + 0 8px 10px 1px rgba(0, 0, 0, 0.14), + 0 3px 14px 2px rgba(0, 0, 0, 0.12); } .cdk-drag-placeholder { @@ -48,4 +49,3 @@ .example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); } - diff --git a/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.spec.ts b/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.spec.ts index 9d13fe28..908e2513 100644 --- a/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.spec.ts +++ b/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.spec.ts @@ -8,10 +8,9 @@ describe('KeyValueEditorComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [KeyValueEditorComponent] - }) - .compileComponents(); - + imports: [KeyValueEditorComponent], + }).compileComponents(); + fixture = TestBed.createComponent(KeyValueEditorComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.ts b/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.ts index 8f9c72a7..994f3f08 100644 --- a/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.ts +++ b/projects/cobbler-frontend/src/app/common/key-value-editor/key-value-editor.component.ts @@ -1,18 +1,26 @@ -import {CdkDrag, CdkDragDrop, CdkDropList, moveItemInArray} from '@angular/cdk/drag-drop'; -import {Component, Input, OnInit} from '@angular/core'; +import { + CdkDrag, + CdkDragDrop, + CdkDropList, + moveItemInArray, +} from '@angular/cdk/drag-drop'; +import { Component, Input } from '@angular/core'; import { AbstractControl, - ControlValueAccessor, FormControl, FormGroup, + ControlValueAccessor, + FormControl, + FormGroup, NG_VALIDATORS, - NG_VALUE_ACCESSOR, ReactiveFormsModule, + NG_VALUE_ACCESSOR, + ReactiveFormsModule, ValidationErrors, - Validator + Validator, } from '@angular/forms'; -import {MatIconButton} from '@angular/material/button'; -import {MatCard, MatCardHeader, MatCardTitle} from '@angular/material/card'; -import {MatFormField} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; +import { MatIconButton } from '@angular/material/button'; +import { MatCard, MatCardHeader, MatCardTitle } from '@angular/material/card'; +import { MatFormField } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; @Component({ selector: 'cobbler-key-value-editor', @@ -38,19 +46,21 @@ import {MatInput} from '@angular/material/input'; { provide: NG_VALIDATORS, multi: true, - useExisting: KeyValueEditorComponent + useExisting: KeyValueEditorComponent, }, ], templateUrl: './key-value-editor.component.html', - styleUrl: './key-value-editor.component.scss' + styleUrl: './key-value-editor.component.scss', }) -export class KeyValueEditorComponent implements ControlValueAccessor, Validator{ - @Input() label = ""; - @Input() keyValueOptions = {} +export class KeyValueEditorComponent + implements ControlValueAccessor, Validator +{ + @Input() label = ''; + @Input() keyValueOptions = {}; onChange = (options: string[]) => {}; onTouched = (options: string[]) => {}; keyOrder = Object.keys(this.keyValueOptions); - keyOrderFormGroup = new FormGroup({}) + keyOrderFormGroup = new FormGroup({}); isDisabled = true; registerOnChange(fn: any): void { @@ -61,12 +71,11 @@ export class KeyValueEditorComponent implements ControlValueAccessor, Validator{ this.onTouched = fn; } - registerOnValidatorChange(fn: () => void): void { - } + registerOnValidatorChange(fn: () => void): void {} setDisabledState(isDisabled: boolean): void { this.isDisabled = isDisabled; - this.setFormGroupDisabledState(isDisabled) + this.setFormGroupDisabledState(isDisabled); } setFormGroupDisabledState(isDisabled: boolean): void { @@ -82,20 +91,26 @@ export class KeyValueEditorComponent implements ControlValueAccessor, Validator{ } writeValue(obj: any): void { - this.keyValueOptions = obj + this.keyValueOptions = obj; this.keyOrder = Object.keys(this.keyValueOptions); - this.buildFormGroup() + this.buildFormGroup(); } buildFormGroup(): void { for (let key of this.keyOrder) { const formGroupControls = { - key: new FormControl({value: key, disabled: true}), - value: new FormControl({value: this.keyValueOptions[key], disabled: true}), - } - this.keyOrderFormGroup.addControl(key + "FormGroup", new FormGroup(formGroupControls)) + key: new FormControl({ value: key, disabled: true }), + value: new FormControl({ + value: this.keyValueOptions[key], + disabled: true, + }), + }; + this.keyOrderFormGroup.addControl( + key + 'FormGroup', + new FormGroup(formGroupControls), + ); } - this.setFormGroupDisabledState(this.isDisabled) + this.setFormGroupDisabledState(this.isDisabled); } deleteKey(key: string): void { diff --git a/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.html b/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.html index af674549..a04ab49c 100644 --- a/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.html +++ b/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.html @@ -1,6 +1,6 @@ - {{label}} + {{ label }} @if (multiSelectOptions.length === 0) {

Empty list of options

@@ -12,8 +12,16 @@ --> - {{option}} + {{ option }} } - +
diff --git a/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.spec.ts b/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.spec.ts index a3dfb41a..8038bc68 100644 --- a/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.spec.ts +++ b/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.spec.ts @@ -8,10 +8,9 @@ describe('MultiSelectComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [MultiSelectComponent] - }) - .compileComponents(); - + imports: [MultiSelectComponent], + }).compileComponents(); + fixture = TestBed.createComponent(MultiSelectComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.ts b/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.ts index 08cec709..73a9c27a 100644 --- a/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.ts +++ b/projects/cobbler-frontend/src/app/common/multi-select/multi-select.component.ts @@ -1,25 +1,30 @@ -import {AsyncPipe, NgForOf} from '@angular/common'; -import {ChangeDetectionStrategy, Component, forwardRef, inject, Input, OnInit, signal} from '@angular/core'; +import { AsyncPipe, NgForOf } from '@angular/common'; +import { Component, inject, Input, OnInit, signal } from '@angular/core'; import { AbstractControl, ControlValueAccessor, - FormControl, FormGroup, NG_VALIDATORS, NG_VALUE_ACCESSOR, + FormControl, + FormGroup, + NG_VALIDATORS, + NG_VALUE_ACCESSOR, ReactiveFormsModule, ValidationErrors, - Validator + Validator, } from '@angular/forms'; -import {MatButton, MatFabButton, MatIconButton} from '@angular/material/button'; -import {MatCard, MatCardHeader, MatCardTitle} from '@angular/material/card'; -import {MatCheckbox, MatCheckboxChange} from '@angular/material/checkbox'; -import {MatDialog} from '@angular/material/dialog'; -import {MatFormFieldModule, MatLabel} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; -import {MatListItem} from '@angular/material/list'; -import {MatOption, MatSelectModule} from '@angular/material/select'; -import {DialogTextInputComponent} from '../dialog-text-input/dialog-text-input.component'; - - +import { + MatButton, + MatFabButton, + MatIconButton, +} from '@angular/material/button'; +import { MatCard, MatCardHeader, MatCardTitle } from '@angular/material/card'; +import { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox'; +import { MatDialog } from '@angular/material/dialog'; +import { MatFormFieldModule, MatLabel } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; +import { MatListItem } from '@angular/material/list'; +import { MatOption, MatSelectModule } from '@angular/material/select'; +import { DialogTextInputComponent } from '../dialog-text-input/dialog-text-input.component'; @Component({ selector: 'cobbler-multi-select', @@ -52,16 +57,18 @@ import {DialogTextInputComponent} from '../dialog-text-input/dialog-text-input.c { provide: NG_VALIDATORS, multi: true, - useExisting: MultiSelectComponent - } + useExisting: MultiSelectComponent, + }, ], templateUrl: './multi-select.component.html', - styleUrl: './multi-select.component.scss' + styleUrl: './multi-select.component.scss', }) -export class MultiSelectComponent implements OnInit, ControlValueAccessor, Validator { +export class MultiSelectComponent + implements OnInit, ControlValueAccessor, Validator +{ @Input() multiSelectOptions: Array = []; - @Input() label = ""; - matSelectOptionsFormGroup: FormGroup<{}> = new FormGroup({}) + @Input() label = ''; + matSelectOptionsFormGroup: FormGroup<{}> = new FormGroup({}); onChange = (options: string[]) => {}; onTouched = (options: string[]) => {}; readonly dialog = inject(MatDialog); @@ -69,19 +76,22 @@ export class MultiSelectComponent implements OnInit, ControlValueAccessor, Valid isDisabled = true; ngOnInit(): void { - this.buildFormGroup(this.multiSelectOptions) + this.buildFormGroup(this.multiSelectOptions); } buildFormGroup(options: string[], checked = false): void { - options.forEach(value => { - this.matSelectOptionsFormGroup.addControl(value, new FormControl({value: checked, disabled: this.isDisabled})) - }) + options.forEach((value) => { + this.matSelectOptionsFormGroup.addControl( + value, + new FormControl({ value: checked, disabled: this.isDisabled }), + ); + }); } updateFormGroup(options: string[], checked = false): void { - options.forEach(value => { - this.matSelectOptionsFormGroup.get(value).setValue(checked) - }) + options.forEach((value) => { + this.matSelectOptionsFormGroup.get(value).setValue(checked); + }); } registerOnChange(fn: any): void { @@ -102,44 +112,42 @@ export class MultiSelectComponent implements OnInit, ControlValueAccessor, Valid } writeValue(obj: string[]): void { - this.buildFormGroup(obj) - this.updateFormGroup(obj, true) + this.buildFormGroup(obj); + this.updateFormGroup(obj, true); } - registerOnValidatorChange(fn: () => void): void { - } + registerOnValidatorChange(fn: () => void): void {} validate(control: AbstractControl): ValidationErrors | null { return undefined; } changeValues(e: MatCheckboxChange) { - let options: string[] = [] - Object.keys(this.matSelectOptionsFormGroup.controls).forEach(key => { - const control = this.matSelectOptionsFormGroup.get(key) + let options: string[] = []; + Object.keys(this.matSelectOptionsFormGroup.controls).forEach((key) => { + const control = this.matSelectOptionsFormGroup.get(key); if (control instanceof FormControl) { if (control.value) { - options.push(key) + options.push(key); } } - }) + }); - this.onTouched(options) - this.onChange(options) + this.onTouched(options); + this.onChange(options); } addOption(): void { const dialogRef = this.dialog.open(DialogTextInputComponent, { - data: {data: this.optionSignal()}, + data: { data: this.optionSignal() }, }); - dialogRef.afterClosed().subscribe(result => { + dialogRef.afterClosed().subscribe((result) => { if (result !== undefined) { this.optionSignal.set(result); - this.multiSelectOptions.push(result) - this.buildFormGroup(this.multiSelectOptions) + this.multiSelectOptions.push(result); + this.buildFormGroup(this.multiSelectOptions); } }); } - } diff --git a/projects/cobbler-frontend/src/app/common/viewable-tree/viewable-tree.component.html b/projects/cobbler-frontend/src/app/common/viewable-tree/viewable-tree.component.html index d2f08a7b..04b6439c 100644 --- a/projects/cobbler-frontend/src/app/common/viewable-tree/viewable-tree.component.html +++ b/projects/cobbler-frontend/src/app/common/viewable-tree/viewable-tree.component.html @@ -1,27 +1,33 @@ -@if(inputLength(inputObject) > 0){ - - - - - - {{ node.name }}: {{ node.value }} - - - - + {{ node.name }}: {{ node.value }} + + + - - {{ - viewableTreeControl.isExpanded(node) ? "expand_more" : "chevron_right" - }} - - - {{ node.name }} - - -} @if(inputLength(inputObject) === 0){ - { } + + {{ node.name }} + + +} +@if (inputLength(inputObject) === 0) { + { } } diff --git a/projects/cobbler-frontend/src/app/common/viewable-tree/viewable-tree.component.ts b/projects/cobbler-frontend/src/app/common/viewable-tree/viewable-tree.component.ts index 258d8247..16ee6bae 100644 --- a/projects/cobbler-frontend/src/app/common/viewable-tree/viewable-tree.component.ts +++ b/projects/cobbler-frontend/src/app/common/viewable-tree/viewable-tree.component.ts @@ -5,8 +5,8 @@ import { MatTreeFlattener, MatTreeModule, } from '@angular/material/tree'; -import {MatButtonModule} from "@angular/material/button"; -import {MatIconModule} from "@angular/material/icon"; +import { MatButtonModule } from '@angular/material/button'; +import { MatIconModule } from '@angular/material/icon'; /** * Food data with nested structure. @@ -36,7 +36,7 @@ export class ViewableTreeComponent implements OnInit { @Input() inputObject: object = {}; viewableTreeControl = new FlatTreeControl( (node) => node.level, - (node) => node.expandable + (node) => node.expandable, ); private _transformer = (node: ObjectNode, level: number) => { @@ -52,12 +52,12 @@ export class ViewableTreeComponent implements OnInit { this._transformer, (node) => node.level, (node) => node.expandable, - (node) => node.children + (node) => node.children, ); dataSource = new MatTreeFlatDataSource( this.viewableTreeControl, - this.treeFlattener + this.treeFlattener, ); hasChild = (_: number, node: ExampleFlatNode) => node.expandable; diff --git a/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.html b/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.html index 66439413..44e260dc 100644 --- a/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.html +++ b/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.html @@ -6,28 +6,24 @@

Name: {{ name }}

mat-icon-button (click)="this.refreshData()" matTooltip="Refresh data" - >refresh + > + refresh + - + - + - +
@@ -35,108 +31,161 @@

Name: {{ name }}

Name - + UID - + Last modified time - + Creation time - + Depth - + Architecture - + - Is Subobject? + Is Subobject? Tree Build Time - + - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited Breed - + Comment - + - - Inherited + + Inherited kernel - + initrd - + Remote Boot Initrd - + Remote Boot Kernel - + Remote GRUB Initrd - + Remote GRUB Kernel - + - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited Operating System Version - + - + Inherited RedHat Management Key - + - - Inherited + + Inherited @if (isEditMode) { diff --git a/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.scss b/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.scss index 2a9efa5d..737cd844 100644 --- a/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.scss +++ b/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.scss @@ -27,4 +27,3 @@ .form-field-full-width { width: 100%; } - diff --git a/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.spec.ts b/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.spec.ts index 21384468..a3591c0c 100644 --- a/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.spec.ts @@ -1,9 +1,9 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {ActivatedRoute, provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ActivatedRoute, provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { DistroEditComponent } from './distro-edit.component'; @@ -13,31 +13,27 @@ describe('DistroEditComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - DistroEditComponent, - NoopAnimationsModule, - ], + imports: [DistroEditComponent, NoopAnimationsModule], providers: [ provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, { provide: ActivatedRoute, useValue: { snapshot: { paramMap: { - get: () => "testdistro" + get: () => 'testdistro', }, }, }, }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(DistroEditComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.ts b/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.ts index 06b0b5b7..ea4cad56 100644 --- a/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.ts +++ b/projects/cobbler-frontend/src/app/items/distro/edit/distro-edit.component.ts @@ -1,18 +1,23 @@ -import {Component, inject, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; -import {MatOption, MatSelect} from '@angular/material/select'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {MatTooltip} from '@angular/material/tooltip'; -import {ActivatedRoute, Router} from '@angular/router'; -import {CobblerApiService, Distro} from 'cobbler-api'; -import {KeyValueEditorComponent} from '../../../common/key-value-editor/key-value-editor.component'; -import {MultiSelectComponent} from '../../../common/multi-select/multi-select.component'; -import {UserService} from '../../../services/user.service'; +import { Component, inject, OnInit } from '@angular/core'; +import { + FormBuilder, + FormControl, + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; +import { MatOption, MatSelect } from '@angular/material/select'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatTooltip } from '@angular/material/tooltip'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CobblerApiService, Distro } from 'cobbler-api'; +import { KeyValueEditorComponent } from '../../../common/key-value-editor/key-value-editor.component'; +import { MultiSelectComponent } from '../../../common/multi-select/multi-select.component'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-edit', @@ -34,49 +39,58 @@ import {UserService} from '../../../services/user.service'; KeyValueEditorComponent, ], templateUrl: './distro-edit.component.html', - styleUrl: './distro-edit.component.scss' + styleUrl: './distro-edit.component.scss', }) -export class DistroEditComponent implements OnInit{ +export class DistroEditComponent implements OnInit { name: string; distro: Distro; private readonly _formBuilder = inject(FormBuilder); distroFormGroup = this._formBuilder.group({ - name: new FormControl({value: "", disabled: true}), - uid: new FormControl({value: "", disabled: true}), - mtime: new FormControl({value: "", disabled: true}), - ctime: new FormControl({value: "", disabled: true}), - depth: new FormControl({value: 0, disabled: true}), - arch: new FormControl({value: "", disabled: true}), - is_subobject: new FormControl({value: false, disabled: true}), - tree_build_time: new FormControl({value: "", disabled: true}), - breed: new FormControl({value: "", disabled: true}), - comment: new FormControl({value: "", disabled: true}), - kernel: new FormControl({value: "", disabled: true}), - initrd: new FormControl({value: "", disabled: true}), - remote_boot_initrd: new FormControl({value: "", disabled: true}), - remote_boot_kernel: new FormControl({value: "", disabled: true}), - remote_grub_initrd: new FormControl({value: "", disabled: true}), - remote_grub_kernel: new FormControl({value: "", disabled: true}), - os_version: new FormControl({value: "", disabled: true}), - redhat_management_key: new FormControl({value: "", disabled: true}), - boot_loaders: new FormControl({value: [], disabled: true}), - bootloader_inherited: new FormControl({value: false, disabled: true}), - owners: new FormControl({value: [], disabled: true}), - owners_inherited: new FormControl({value: false, disabled: true}), - mgmt_classes: new FormControl({value: [], disabled: true}), - mgmt_classes_inherited: new FormControl({value: false, disabled: true}), - autoinstall_meta: new FormControl({value: {}, disabled: true}), - autoinstall_meta_inherited: new FormControl({value: false, disabled: true}), - boot_files: new FormControl({value: {}, disabled: true}), - boot_files_inherited: new FormControl({value: false, disabled: true}), - fetchable_files: new FormControl({value: {}, disabled: true}), - fetchable_files_inherited: new FormControl({value: false, disabled: true}), - kernel_options: new FormControl({value: {}, disabled: true}), - kernel_options_inherited: new FormControl({value: false, disabled: true}), - kernel_options_post: new FormControl({value: {}, disabled: true}), - kernel_options_post_inherited: new FormControl({value: false, disabled: true}), - template_files: new FormControl({value: {}, disabled: true}), - template_files_inherited: new FormControl({value: false, disabled: true}), + name: new FormControl({ value: '', disabled: true }), + uid: new FormControl({ value: '', disabled: true }), + mtime: new FormControl({ value: '', disabled: true }), + ctime: new FormControl({ value: '', disabled: true }), + depth: new FormControl({ value: 0, disabled: true }), + arch: new FormControl({ value: '', disabled: true }), + is_subobject: new FormControl({ value: false, disabled: true }), + tree_build_time: new FormControl({ value: '', disabled: true }), + breed: new FormControl({ value: '', disabled: true }), + comment: new FormControl({ value: '', disabled: true }), + kernel: new FormControl({ value: '', disabled: true }), + initrd: new FormControl({ value: '', disabled: true }), + remote_boot_initrd: new FormControl({ value: '', disabled: true }), + remote_boot_kernel: new FormControl({ value: '', disabled: true }), + remote_grub_initrd: new FormControl({ value: '', disabled: true }), + remote_grub_kernel: new FormControl({ value: '', disabled: true }), + os_version: new FormControl({ value: '', disabled: true }), + redhat_management_key: new FormControl({ value: '', disabled: true }), + boot_loaders: new FormControl({ value: [], disabled: true }), + bootloader_inherited: new FormControl({ value: false, disabled: true }), + owners: new FormControl({ value: [], disabled: true }), + owners_inherited: new FormControl({ value: false, disabled: true }), + mgmt_classes: new FormControl({ value: [], disabled: true }), + mgmt_classes_inherited: new FormControl({ value: false, disabled: true }), + autoinstall_meta: new FormControl({ value: {}, disabled: true }), + autoinstall_meta_inherited: new FormControl({ + value: false, + disabled: true, + }), + boot_files: new FormControl({ value: {}, disabled: true }), + boot_files_inherited: new FormControl({ value: false, disabled: true }), + fetchable_files: new FormControl({ value: {}, disabled: true }), + fetchable_files_inherited: new FormControl({ + value: false, + disabled: true, + }), + kernel_options: new FormControl({ value: {}, disabled: true }), + kernel_options_inherited: new FormControl({ value: false, disabled: true }), + kernel_options_post: new FormControl({ value: {}, disabled: true }), + kernel_options_post_inherited: new FormControl({ + value: false, + disabled: true, + }), + template_files: new FormControl({ value: {}, disabled: true }), + template_files_inherited: new FormControl({ value: false, disabled: true }), }); isEditMode: boolean = false; @@ -87,108 +101,177 @@ export class DistroEditComponent implements OnInit{ private _snackBar: MatSnackBar, private router: Router, ) { - this.name = this.route.snapshot.paramMap.get("name"); + this.name = this.route.snapshot.paramMap.get('name'); } ngOnInit(): void { - this.refreshData() + this.refreshData(); } refreshData(): void { - this.cobblerApiService.get_distro(this.name, false, false, this.userService.token).subscribe(value => { - this.distro = value - this.distroFormGroup.controls.name.setValue(this.distro.name) - this.distroFormGroup.controls.uid.setValue(this.distro.uid) - this.distroFormGroup.controls.mtime.setValue(new Date(this.distro.mtime * 1000).toString()) - this.distroFormGroup.controls.ctime.setValue(new Date(this.distro.ctime * 1000).toString()) - this.distroFormGroup.controls.depth.setValue(this.distro.depth) - this.distroFormGroup.controls.arch.setValue(this.distro.arch) - this.distroFormGroup.controls.is_subobject.setValue(this.distro.is_subobject) - this.distroFormGroup.controls.tree_build_time.setValue(new Date(this.distro.tree_build_time * 1000).toString()) - this.distroFormGroup.controls.breed.setValue(this.distro.breed) - this.distroFormGroup.controls.comment.setValue(this.distro.comment) - this.distroFormGroup.controls.kernel.setValue(this.distro.kernel) - this.distroFormGroup.controls.initrd.setValue(this.distro.initrd) - this.distroFormGroup.controls.remote_boot_initrd.setValue(this.distro.remote_boot_initrd) - this.distroFormGroup.controls.remote_boot_kernel.setValue(this.distro.remote_boot_kernel) - this.distroFormGroup.controls.remote_grub_initrd.setValue(this.distro.remote_grub_initrd) - this.distroFormGroup.controls.remote_grub_kernel.setValue(this.distro.remote_grub_kernel) - this.distroFormGroup.controls.os_version.setValue(this.distro.os_version) - this.distroFormGroup.controls.redhat_management_key.setValue(this.distro.redhat_management_key) - if (typeof this.distro.boot_loaders === "string") { - this.distroFormGroup.controls.bootloader_inherited.setValue(true) - } else { - this.distroFormGroup.controls.bootloader_inherited.setValue(false) - this.distroFormGroup.controls.boot_loaders.setValue(this.distro.boot_loaders) - } - if (typeof this.distro.owners === "string") { - this.distroFormGroup.controls.owners_inherited.setValue(true) - } else { - this.distroFormGroup.controls.owners_inherited.setValue(false) - this.distroFormGroup.controls.owners.setValue(this.distro.owners) - } - if (typeof this.distro.autoinstall_meta === "string") { - this.distroFormGroup.controls.autoinstall_meta_inherited.setValue(true) - } else { - this.distroFormGroup.controls.autoinstall_meta_inherited.setValue(false) - this.distroFormGroup.controls.autoinstall_meta.setValue(this.distro.autoinstall_meta) - } - if (typeof this.distro.fetchable_files === "string") { - this.distroFormGroup.controls.fetchable_files_inherited.setValue(true) - } else { - this.distroFormGroup.controls.fetchable_files_inherited.setValue(false) - this.distroFormGroup.controls.fetchable_files.setValue(this.distro.fetchable_files) - } - if (typeof this.distro.kernel_options === "string") { - this.distroFormGroup.controls.kernel_options_inherited.setValue(true) - } else { - this.distroFormGroup.controls.kernel_options_inherited.setValue(false) - this.distroFormGroup.controls.kernel_options.setValue(this.distro.kernel_options) - } - if (typeof this.distro.kernel_options_post === "string") { - this.distroFormGroup.controls.kernel_options_post_inherited.setValue(true) - } else { - this.distroFormGroup.controls.kernel_options_post_inherited.setValue(false) - this.distroFormGroup.controls.kernel_options_post.setValue(this.distro.kernel_options_post) - } - if (typeof this.distro.template_files === "string") { - this.distroFormGroup.controls.template_files_inherited.setValue(true) - } else { - this.distroFormGroup.controls.template_files_inherited.setValue(false) - this.distroFormGroup.controls.template_files.setValue(this.distro.template_files) - } - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .get_distro(this.name, false, false, this.userService.token) + .subscribe( + (value) => { + this.distro = value; + this.distroFormGroup.controls.name.setValue(this.distro.name); + this.distroFormGroup.controls.uid.setValue(this.distro.uid); + this.distroFormGroup.controls.mtime.setValue( + new Date(this.distro.mtime * 1000).toString(), + ); + this.distroFormGroup.controls.ctime.setValue( + new Date(this.distro.ctime * 1000).toString(), + ); + this.distroFormGroup.controls.depth.setValue(this.distro.depth); + this.distroFormGroup.controls.arch.setValue(this.distro.arch); + this.distroFormGroup.controls.is_subobject.setValue( + this.distro.is_subobject, + ); + this.distroFormGroup.controls.tree_build_time.setValue( + new Date(this.distro.tree_build_time * 1000).toString(), + ); + this.distroFormGroup.controls.breed.setValue(this.distro.breed); + this.distroFormGroup.controls.comment.setValue(this.distro.comment); + this.distroFormGroup.controls.kernel.setValue(this.distro.kernel); + this.distroFormGroup.controls.initrd.setValue(this.distro.initrd); + this.distroFormGroup.controls.remote_boot_initrd.setValue( + this.distro.remote_boot_initrd, + ); + this.distroFormGroup.controls.remote_boot_kernel.setValue( + this.distro.remote_boot_kernel, + ); + this.distroFormGroup.controls.remote_grub_initrd.setValue( + this.distro.remote_grub_initrd, + ); + this.distroFormGroup.controls.remote_grub_kernel.setValue( + this.distro.remote_grub_kernel, + ); + this.distroFormGroup.controls.os_version.setValue( + this.distro.os_version, + ); + this.distroFormGroup.controls.redhat_management_key.setValue( + this.distro.redhat_management_key, + ); + if (typeof this.distro.boot_loaders === 'string') { + this.distroFormGroup.controls.bootloader_inherited.setValue(true); + } else { + this.distroFormGroup.controls.bootloader_inherited.setValue(false); + this.distroFormGroup.controls.boot_loaders.setValue( + this.distro.boot_loaders, + ); + } + if (typeof this.distro.owners === 'string') { + this.distroFormGroup.controls.owners_inherited.setValue(true); + } else { + this.distroFormGroup.controls.owners_inherited.setValue(false); + this.distroFormGroup.controls.owners.setValue(this.distro.owners); + } + if (typeof this.distro.autoinstall_meta === 'string') { + this.distroFormGroup.controls.autoinstall_meta_inherited.setValue( + true, + ); + } else { + this.distroFormGroup.controls.autoinstall_meta_inherited.setValue( + false, + ); + this.distroFormGroup.controls.autoinstall_meta.setValue( + this.distro.autoinstall_meta, + ); + } + if (typeof this.distro.fetchable_files === 'string') { + this.distroFormGroup.controls.fetchable_files_inherited.setValue( + true, + ); + } else { + this.distroFormGroup.controls.fetchable_files_inherited.setValue( + false, + ); + this.distroFormGroup.controls.fetchable_files.setValue( + this.distro.fetchable_files, + ); + } + if (typeof this.distro.kernel_options === 'string') { + this.distroFormGroup.controls.kernel_options_inherited.setValue( + true, + ); + } else { + this.distroFormGroup.controls.kernel_options_inherited.setValue( + false, + ); + this.distroFormGroup.controls.kernel_options.setValue( + this.distro.kernel_options, + ); + } + if (typeof this.distro.kernel_options_post === 'string') { + this.distroFormGroup.controls.kernel_options_post_inherited.setValue( + true, + ); + } else { + this.distroFormGroup.controls.kernel_options_post_inherited.setValue( + false, + ); + this.distroFormGroup.controls.kernel_options_post.setValue( + this.distro.kernel_options_post, + ); + } + if (typeof this.distro.template_files === 'string') { + this.distroFormGroup.controls.template_files_inherited.setValue( + true, + ); + } else { + this.distroFormGroup.controls.template_files_inherited.setValue( + false, + ); + this.distroFormGroup.controls.template_files.setValue( + this.distro.template_files, + ); + } + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } removeDistro(): void { - this.cobblerApiService.remove_distro(this.name, this.userService.token, false).subscribe(value => { - if (value) { - this.router.navigate(["/items", "distro"]) - } - // HTML encode the error message since it originates from XML - this._snackBar.open("Delete failed! Check server logs for more information.", 'Close'); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_distro(this.name, this.userService.token, false) + .subscribe( + (value) => { + if (value) { + this.router.navigate(['/items', 'distro']); + } + // HTML encode the error message since it originates from XML + this._snackBar.open( + 'Delete failed! Check server logs for more information.', + 'Close', + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } editDistro(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } copyDistro(): void { - this.cobblerApiService.copy_distro("", "", this.userService.token) - .subscribe(value => { - // TODO - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .copy_distro('', '', this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } saveDistro(): void { @@ -197,76 +280,77 @@ export class DistroEditComponent implements OnInit{ get distroOwners(): string[] { if (this.distro && this.distro.owners) { - const ownersResult = this.distro.owners + const ownersResult = this.distro.owners; if (typeof ownersResult !== 'string') { return ownersResult; } } - return [] + return []; } get distroAutoinstallMeta(): object { if (this.distro && this.distro.autoinstall_meta) { - const autoinstallMetaResult = this.distro.autoinstall_meta + const autoinstallMetaResult = this.distro.autoinstall_meta; if (typeof autoinstallMetaResult !== 'string') { - return autoinstallMetaResult + return autoinstallMetaResult; } } - return {} + return {}; } get distroBootFiles(): object { if (this.distro && this.distro.boot_files) { - const bootFilesResult = this.distro.boot_files + const bootFilesResult = this.distro.boot_files; if (typeof bootFilesResult !== 'string') { - return bootFilesResult + return bootFilesResult; } } - return {} + return {}; } get distroFetchableFiles(): object { if (this.distro && this.distro.fetchable_files) { - const fetchableFilesResult = this.distro.fetchable_files + const fetchableFilesResult = this.distro.fetchable_files; if (typeof fetchableFilesResult !== 'string') { - return fetchableFilesResult + return fetchableFilesResult; } } - return {} + return {}; } get distroKernelOptions(): object { if (this.distro && this.distro.kernel_options) { - const kernelOptionsResult = this.distro.kernel_options + const kernelOptionsResult = this.distro.kernel_options; if (typeof kernelOptionsResult !== 'string') { - return kernelOptionsResult + return kernelOptionsResult; } } - return {} + return {}; } get distroKernelOptionsPost(): object { if (this.distro && this.distro.kernel_options_post) { - const kernelOptionsPostResult = this.distro.kernel_options_post + const kernelOptionsPostResult = this.distro.kernel_options_post; if (typeof kernelOptionsPostResult !== 'string') { - return kernelOptionsPostResult + return kernelOptionsPostResult; } } - return {} + return {}; } get distroTemplateFiles(): object { if (this.distro && this.distro.template_files) { - const templateFilesResult = this.distro.template_files + const templateFilesResult = this.distro.template_files; if (typeof templateFilesResult !== 'string') { - return templateFilesResult + return templateFilesResult; } } - return {} + return {}; } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/distro/overview/distros-overview.component.html b/projects/cobbler-frontend/src/app/items/distro/overview/distros-overview.component.html index dfa12d74..40c2a6b4 100644 --- a/projects/cobbler-frontend/src/app/items/distro/overview/distros-overview.component.html +++ b/projects/cobbler-frontend/src/app/items/distro/overview/distros-overview.component.html @@ -4,25 +4,27 @@

DISTROS

Name - {{element.name}} + {{ element.name }} Breed - {{element.breed}} + {{ element.breed }} Operating System Version - {{element.os_version}} + {{ element.os_version }} - + + > + refresh + - + - + - + @@ -35,56 +31,59 @@

Name: {{ name }}

Name - + UID - + Last modified time - + Creation time - + Depth - + - Is Subobject? + Is Subobject? Comment - + Action - + Group - + Mode - + Owner - + Path - + Template - + - Is Directory? + Is Directory? @if (isEditMode) { } - diff --git a/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.scss b/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.scss index 2a9efa5d..737cd844 100644 --- a/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.scss +++ b/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.scss @@ -27,4 +27,3 @@ .form-field-full-width { width: 100%; } - diff --git a/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.spec.ts b/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.spec.ts index e6a33533..cb11bed1 100644 --- a/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.spec.ts @@ -1,9 +1,9 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {ActivatedRoute, provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ActivatedRoute, provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { FileEditComponent } from './file-edit.component'; @@ -13,31 +13,27 @@ describe('FileEditComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - FileEditComponent, - NoopAnimationsModule, - ], + imports: [FileEditComponent, NoopAnimationsModule], providers: [ provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, { provide: ActivatedRoute, useValue: { snapshot: { paramMap: { - get: () => "testfile" + get: () => 'testfile', }, }, }, }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(FileEditComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.ts b/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.ts index 1de269af..bb3f5574 100644 --- a/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.ts +++ b/projects/cobbler-frontend/src/app/items/file/edit/file-edit.component.ts @@ -1,17 +1,22 @@ -import {Component, inject, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatOption} from '@angular/material/autocomplete'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; -import {MatSelect} from '@angular/material/select'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {MatTooltip} from '@angular/material/tooltip'; -import {ActivatedRoute, Router} from '@angular/router'; -import {CobblerApiService, File} from 'cobbler-api'; -import {UserService} from '../../../services/user.service'; +import { Component, inject, OnInit } from '@angular/core'; +import { + FormBuilder, + FormControl, + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { MatOption } from '@angular/material/autocomplete'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; +import { MatSelect } from '@angular/material/select'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatTooltip } from '@angular/material/tooltip'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CobblerApiService, File } from 'cobbler-api'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-edit', @@ -28,31 +33,31 @@ import {UserService} from '../../../services/user.service'; MatOption, MatSelect, MatTooltip, - ReactiveFormsModule + ReactiveFormsModule, ], templateUrl: './file-edit.component.html', - styleUrl: './file-edit.component.scss' + styleUrl: './file-edit.component.scss', }) export class FileEditComponent implements OnInit { name: string; file: File; private readonly _formBuilder = inject(FormBuilder); fileFormGroup = this._formBuilder.group({ - name: new FormControl({value: "", disabled: true}), - uid: new FormControl({value: "", disabled: true}), - mtime: new FormControl({value: "", disabled: true}), - ctime: new FormControl({value: "", disabled: true}), - depth: new FormControl({value: 0, disabled: true}), - is_subobject: new FormControl({value: false, disabled: true}), - is_dir: new FormControl({value: false, disabled: true}), - comment: new FormControl({value: "", disabled: true}), - redhat_management_key: new FormControl({value: "", disabled: true}), - action: new FormControl({value: "", disabled: true}), - group: new FormControl({value: "", disabled: true}), - mode: new FormControl({value: "", disabled: true}), - owner: new FormControl({value: "", disabled: true}), - path: new FormControl({value: "", disabled: true}), - template: new FormControl({value: "", disabled: true}), + name: new FormControl({ value: '', disabled: true }), + uid: new FormControl({ value: '', disabled: true }), + mtime: new FormControl({ value: '', disabled: true }), + ctime: new FormControl({ value: '', disabled: true }), + depth: new FormControl({ value: 0, disabled: true }), + is_subobject: new FormControl({ value: false, disabled: true }), + is_dir: new FormControl({ value: false, disabled: true }), + comment: new FormControl({ value: '', disabled: true }), + redhat_management_key: new FormControl({ value: '', disabled: true }), + action: new FormControl({ value: '', disabled: true }), + group: new FormControl({ value: '', disabled: true }), + mode: new FormControl({ value: '', disabled: true }), + owner: new FormControl({ value: '', disabled: true }), + path: new FormControl({ value: '', disabled: true }), + template: new FormControl({ value: '', disabled: true }), }); isEditMode: boolean = false; @@ -63,61 +68,82 @@ export class FileEditComponent implements OnInit { private _snackBar: MatSnackBar, private router: Router, ) { - this.name = this.route.snapshot.paramMap.get("name"); + this.name = this.route.snapshot.paramMap.get('name'); } ngOnInit(): void { - this.refreshData() + this.refreshData(); } refreshData(): void { - this.cobblerApiService.get_file(this.name, false, false, this.userService.token).subscribe(value => { - this.file = value - this.fileFormGroup.controls.name.setValue(this.file.name) - this.fileFormGroup.controls.uid.setValue(this.file.uid) - this.fileFormGroup.controls.mtime.setValue(new Date(this.file.mtime * 1000).toString()) - this.fileFormGroup.controls.ctime.setValue(new Date(this.file.ctime * 1000).toString()) - this.fileFormGroup.controls.depth.setValue(this.file.depth) - this.fileFormGroup.controls.is_subobject.setValue(this.file.is_subobject) - this.fileFormGroup.controls.comment.setValue(this.file.comment) - this.fileFormGroup.controls.action.setValue(this.file.action) - this.fileFormGroup.controls.group.setValue(this.file.group) - this.fileFormGroup.controls.mode.setValue(this.file.mode) - this.fileFormGroup.controls.owner.setValue(this.file.owner) - this.fileFormGroup.controls.path.setValue(this.file.path) - this.fileFormGroup.controls.template.setValue(this.file.template) - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .get_file(this.name, false, false, this.userService.token) + .subscribe( + (value) => { + this.file = value; + this.fileFormGroup.controls.name.setValue(this.file.name); + this.fileFormGroup.controls.uid.setValue(this.file.uid); + this.fileFormGroup.controls.mtime.setValue( + new Date(this.file.mtime * 1000).toString(), + ); + this.fileFormGroup.controls.ctime.setValue( + new Date(this.file.ctime * 1000).toString(), + ); + this.fileFormGroup.controls.depth.setValue(this.file.depth); + this.fileFormGroup.controls.is_subobject.setValue( + this.file.is_subobject, + ); + this.fileFormGroup.controls.comment.setValue(this.file.comment); + this.fileFormGroup.controls.action.setValue(this.file.action); + this.fileFormGroup.controls.group.setValue(this.file.group); + this.fileFormGroup.controls.mode.setValue(this.file.mode); + this.fileFormGroup.controls.owner.setValue(this.file.owner); + this.fileFormGroup.controls.path.setValue(this.file.path); + this.fileFormGroup.controls.template.setValue(this.file.template); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } removeFile(): void { - this.cobblerApiService.remove_file(this.name, this.userService.token, false).subscribe(value => { - if (value) { - this.router.navigate(["/items", "file"]) - } - // HTML encode the error message since it originates from XML - this._snackBar.open("Delete failed! Check server logs for more information.", 'Close'); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_file(this.name, this.userService.token, false) + .subscribe( + (value) => { + if (value) { + this.router.navigate(['/items', 'file']); + } + // HTML encode the error message since it originates from XML + this._snackBar.open( + 'Delete failed! Check server logs for more information.', + 'Close', + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } editFile(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } copyFile(): void { - this.cobblerApiService.copy_file("", "", this.userService.token) - .subscribe(value => { + this.cobblerApiService.copy_file('', '', this.userService.token).subscribe( + (value) => { // TODO - }, error => { + }, + (error) => { // HTML encode the error message since it originates from XML this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + }, + ); } saveFile(): void { @@ -126,6 +152,7 @@ export class FileEditComponent implements OnInit { toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/file/overview/file-overview.component.html b/projects/cobbler-frontend/src/app/items/file/overview/file-overview.component.html index 8dbcee25..80c2052f 100644 --- a/projects/cobbler-frontend/src/app/items/file/overview/file-overview.component.html +++ b/projects/cobbler-frontend/src/app/items/file/overview/file-overview.component.html @@ -4,25 +4,27 @@

FILES

Name - {{element.name}} + {{ element.name }} Action - {{element.action}} + {{ element.action }} Path - {{element.path}} + {{ element.path }} - + + > + refresh + - + - + - + @@ -35,67 +31,79 @@

Name: {{ name }}

Name - + UID - + Last modified time - + Creation time - + Depth - + - Is Subobject? + Is Subobject? - - Inherited + + Inherited Comment - + Network Count - + Parent - + Arch - + Autoinstall - + Operating System Breed - + Image File - + Image Type - + Operating System Version - + - + Inherited @if (isEditMode) { diff --git a/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.scss b/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.scss index 2a9efa5d..737cd844 100644 --- a/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.scss +++ b/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.scss @@ -27,4 +27,3 @@ .form-field-full-width { width: 100%; } - diff --git a/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.spec.ts b/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.spec.ts index 494a0b39..014c2cd0 100644 --- a/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.spec.ts @@ -1,9 +1,9 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {ActivatedRoute, provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ActivatedRoute, provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { ImageEditComponent } from './image-edit.component'; @@ -13,31 +13,27 @@ describe('ImageEditComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - ImageEditComponent, - NoopAnimationsModule, - ], + imports: [ImageEditComponent, NoopAnimationsModule], providers: [ provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, { provide: ActivatedRoute, useValue: { snapshot: { paramMap: { - get: () => "testimage" + get: () => 'testimage', }, }, }, }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(ImageEditComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.ts b/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.ts index 15ef8ad8..2dd29608 100644 --- a/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.ts +++ b/projects/cobbler-frontend/src/app/items/image/edit/image-edit.component.ts @@ -1,18 +1,23 @@ -import {Component, inject, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatOption} from '@angular/material/autocomplete'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; -import {MatSelect} from '@angular/material/select'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {MatTooltip} from '@angular/material/tooltip'; -import {ActivatedRoute, Router} from '@angular/router'; -import {CobblerApiService, Image} from 'cobbler-api'; -import {MultiSelectComponent} from '../../../common/multi-select/multi-select.component'; -import {UserService} from '../../../services/user.service'; +import { Component, inject, OnInit } from '@angular/core'; +import { + FormBuilder, + FormControl, + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { MatOption } from '@angular/material/autocomplete'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; +import { MatSelect } from '@angular/material/select'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatTooltip } from '@angular/material/tooltip'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CobblerApiService, Image } from 'cobbler-api'; +import { MultiSelectComponent } from '../../../common/multi-select/multi-select.component'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-image-edit', @@ -30,36 +35,36 @@ import {UserService} from '../../../services/user.service'; MatSelect, MatTooltip, ReactiveFormsModule, - MultiSelectComponent + MultiSelectComponent, ], templateUrl: './image-edit.component.html', - styleUrl: './image-edit.component.scss' + styleUrl: './image-edit.component.scss', }) -export class ImageEditComponent implements OnInit{ +export class ImageEditComponent implements OnInit { name: string; image: Image; private readonly _formBuilder = inject(FormBuilder); imageFormGroup = this._formBuilder.group({ - name: new FormControl({value: "", disabled: true}), - uid: new FormControl({value: "", disabled: true}), - mtime: new FormControl({value: "", disabled: true}), - ctime: new FormControl({value: "", disabled: true}), - depth: new FormControl({value: 0, disabled: true}), - network_count: new FormControl({value: 0, disabled: true}), - is_subobject: new FormControl({value: false, disabled: true}), - comment: new FormControl({value: "", disabled: true}), - redhat_management_key: new FormControl({value: "", disabled: true}), - parent: new FormControl({value: "", disabled: true}), - arch: new FormControl({value: "", disabled: true}), - autoinstall: new FormControl({value: "", disabled: true}), - breed: new FormControl({value: "", disabled: true}), - file: new FormControl({value: "", disabled: true}), - image_type: new FormControl({value: "", disabled: true}), - os_version: new FormControl({value: "", disabled: true}), - boot_loaders: new FormControl({value: [], disabled: true}), - bootloader_inherited: new FormControl({value: false, disabled: true}), - owners: new FormControl({value: [], disabled: true}), - owners_inherited: new FormControl({value: false, disabled: true}), + name: new FormControl({ value: '', disabled: true }), + uid: new FormControl({ value: '', disabled: true }), + mtime: new FormControl({ value: '', disabled: true }), + ctime: new FormControl({ value: '', disabled: true }), + depth: new FormControl({ value: 0, disabled: true }), + network_count: new FormControl({ value: 0, disabled: true }), + is_subobject: new FormControl({ value: false, disabled: true }), + comment: new FormControl({ value: '', disabled: true }), + redhat_management_key: new FormControl({ value: '', disabled: true }), + parent: new FormControl({ value: '', disabled: true }), + arch: new FormControl({ value: '', disabled: true }), + autoinstall: new FormControl({ value: '', disabled: true }), + breed: new FormControl({ value: '', disabled: true }), + file: new FormControl({ value: '', disabled: true }), + image_type: new FormControl({ value: '', disabled: true }), + os_version: new FormControl({ value: '', disabled: true }), + boot_loaders: new FormControl({ value: [], disabled: true }), + bootloader_inherited: new FormControl({ value: false, disabled: true }), + owners: new FormControl({ value: [], disabled: true }), + owners_inherited: new FormControl({ value: false, disabled: true }), }); isEditMode: boolean = false; @@ -70,75 +75,106 @@ export class ImageEditComponent implements OnInit{ private _snackBar: MatSnackBar, private router: Router, ) { - this.name = this.route.snapshot.paramMap.get("name"); + this.name = this.route.snapshot.paramMap.get('name'); } ngOnInit(): void { - this.refreshData() + this.refreshData(); } refreshData(): void { - this.cobblerApiService.get_image(this.name, false, false, this.userService.token).subscribe(value => { - this.image = value - this.imageFormGroup.controls.name.setValue(this.image.name) - this.imageFormGroup.controls.uid.setValue(this.image.uid) - this.imageFormGroup.controls.mtime.setValue(new Date(this.image.mtime * 1000).toString()) - this.imageFormGroup.controls.ctime.setValue(new Date(this.image.ctime * 1000).toString()) - this.imageFormGroup.controls.depth.setValue(this.image.depth) - this.imageFormGroup.controls.network_count.setValue(this.image.network_count) - this.imageFormGroup.controls.is_subobject.setValue(this.image.is_subobject) - this.imageFormGroup.controls.comment.setValue(this.image.comment) - this.imageFormGroup.controls.parent.setValue(this.image.parent) - this.imageFormGroup.controls.arch.setValue(this.image.arch) - this.imageFormGroup.controls.autoinstall.setValue(this.image.autoinstall) - this.imageFormGroup.controls.breed.setValue(this.image.breed) - this.imageFormGroup.controls.file.setValue(this.image.file) - this.imageFormGroup.controls.image_type.setValue(this.image.image_type) - this.imageFormGroup.controls.os_version.setValue(this.image.os_version) - if (typeof this.image.boot_loaders === "string") { - this.imageFormGroup.controls.bootloader_inherited.setValue(true) - } else { - this.imageFormGroup.controls.bootloader_inherited.setValue(false) - this.imageFormGroup.controls.boot_loaders.setValue(this.image.boot_loaders) - } - if (typeof this.image.owners === "string") { - this.imageFormGroup.controls.owners_inherited.setValue(true) - } else { - this.imageFormGroup.controls.owners_inherited.setValue(false) - this.imageFormGroup.controls.owners.setValue(this.image.owners) - } - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .get_image(this.name, false, false, this.userService.token) + .subscribe( + (value) => { + this.image = value; + this.imageFormGroup.controls.name.setValue(this.image.name); + this.imageFormGroup.controls.uid.setValue(this.image.uid); + this.imageFormGroup.controls.mtime.setValue( + new Date(this.image.mtime * 1000).toString(), + ); + this.imageFormGroup.controls.ctime.setValue( + new Date(this.image.ctime * 1000).toString(), + ); + this.imageFormGroup.controls.depth.setValue(this.image.depth); + this.imageFormGroup.controls.network_count.setValue( + this.image.network_count, + ); + this.imageFormGroup.controls.is_subobject.setValue( + this.image.is_subobject, + ); + this.imageFormGroup.controls.comment.setValue(this.image.comment); + this.imageFormGroup.controls.parent.setValue(this.image.parent); + this.imageFormGroup.controls.arch.setValue(this.image.arch); + this.imageFormGroup.controls.autoinstall.setValue( + this.image.autoinstall, + ); + this.imageFormGroup.controls.breed.setValue(this.image.breed); + this.imageFormGroup.controls.file.setValue(this.image.file); + this.imageFormGroup.controls.image_type.setValue( + this.image.image_type, + ); + this.imageFormGroup.controls.os_version.setValue( + this.image.os_version, + ); + if (typeof this.image.boot_loaders === 'string') { + this.imageFormGroup.controls.bootloader_inherited.setValue(true); + } else { + this.imageFormGroup.controls.bootloader_inherited.setValue(false); + this.imageFormGroup.controls.boot_loaders.setValue( + this.image.boot_loaders, + ); + } + if (typeof this.image.owners === 'string') { + this.imageFormGroup.controls.owners_inherited.setValue(true); + } else { + this.imageFormGroup.controls.owners_inherited.setValue(false); + this.imageFormGroup.controls.owners.setValue(this.image.owners); + } + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } removeImage(): void { - this.cobblerApiService.remove_image(this.name, this.userService.token, false).subscribe(value => { - if (value) { - this.router.navigate(["/items", "image"]) - } - // HTML encode the error message since it originates from XML - this._snackBar.open("Delete failed! Check server logs for more information.", 'Close'); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_image(this.name, this.userService.token, false) + .subscribe( + (value) => { + if (value) { + this.router.navigate(['/items', 'image']); + } + // HTML encode the error message since it originates from XML + this._snackBar.open( + 'Delete failed! Check server logs for more information.', + 'Close', + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } editImage(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } copyImage(): void { - this.cobblerApiService.copy_image("", "", this.userService.token) - .subscribe(value => { + this.cobblerApiService.copy_image('', '', this.userService.token).subscribe( + (value) => { // TODO - }, error => { + }, + (error) => { // HTML encode the error message since it originates from XML this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + }, + ); } saveImage(): void { @@ -147,16 +183,17 @@ export class ImageEditComponent implements OnInit{ get imageOwners(): string[] { if (this.image && this.image.owners) { - const ownersResult = this.image.owners + const ownersResult = this.image.owners; if (typeof ownersResult !== 'string') { return ownersResult; } } - return [] + return []; } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/image/overview/image-overview.component.html b/projects/cobbler-frontend/src/app/items/image/overview/image-overview.component.html index 2def2eec..82ceb61a 100644 --- a/projects/cobbler-frontend/src/app/items/image/overview/image-overview.component.html +++ b/projects/cobbler-frontend/src/app/items/image/overview/image-overview.component.html @@ -4,31 +4,33 @@

IMAGES

Name - {{element.name}} + {{ element.name }} Architecture - {{element.arch}} + {{ element.arch }} Breed - {{element.breed}} + {{ element.breed }} Operating System Version - {{element.os_version}} + {{ element.os_version }} - + + > + refresh + - + - + + > + delete + @@ -35,46 +35,66 @@

Name: {{ name }}

Name - + UID - + Last modified time - + Creation time - + Depth - + - Is Subobject? + Is Subobject? Comment - + - Is Definition? + Is Definition? Class Name - + - + - + Inherited - + - + @if (isEditMode) { diff --git a/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.scss b/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.scss index 2a9efa5d..737cd844 100644 --- a/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.scss +++ b/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.scss @@ -27,4 +27,3 @@ .form-field-full-width { width: 100%; } - diff --git a/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.spec.ts b/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.spec.ts index dfc975d3..5f68ba59 100644 --- a/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.spec.ts @@ -1,9 +1,9 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {ActivatedRoute, provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ActivatedRoute, provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { ManagementClassEditComponent } from './management-class-edit.component'; @@ -13,31 +13,27 @@ describe('ManagementClassEditComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - ManagementClassEditComponent, - NoopAnimationsModule, - ], + imports: [ManagementClassEditComponent, NoopAnimationsModule], providers: [ provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, { provide: ActivatedRoute, useValue: { snapshot: { paramMap: { - get: () => "testmgmtclass" + get: () => 'testmgmtclass', }, }, }, }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(ManagementClassEditComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.ts b/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.ts index f2d47ddf..ee342e45 100644 --- a/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.ts +++ b/projects/cobbler-frontend/src/app/items/management-class/edit/management-class-edit.component.ts @@ -1,19 +1,24 @@ -import {Component, inject, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatOption} from '@angular/material/autocomplete'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; -import {MatSelect} from '@angular/material/select'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {MatTooltip} from '@angular/material/tooltip'; -import {ActivatedRoute, Router} from '@angular/router'; -import {CobblerApiService, Mgmgtclass} from 'cobbler-api'; -import {KeyValueEditorComponent} from '../../../common/key-value-editor/key-value-editor.component'; -import {MultiSelectComponent} from '../../../common/multi-select/multi-select.component'; -import {UserService} from '../../../services/user.service'; +import { Component, inject, OnInit } from '@angular/core'; +import { + FormBuilder, + FormControl, + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { MatOption } from '@angular/material/autocomplete'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; +import { MatSelect } from '@angular/material/select'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatTooltip } from '@angular/material/tooltip'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CobblerApiService, Mgmgtclass } from 'cobbler-api'; +import { KeyValueEditorComponent } from '../../../common/key-value-editor/key-value-editor.component'; +import { MultiSelectComponent } from '../../../common/multi-select/multi-select.component'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-edit', @@ -32,31 +37,31 @@ import {UserService} from '../../../services/user.service'; MatTooltip, ReactiveFormsModule, MultiSelectComponent, - KeyValueEditorComponent + KeyValueEditorComponent, ], templateUrl: './management-class-edit.component.html', - styleUrl: './management-class-edit.component.scss' + styleUrl: './management-class-edit.component.scss', }) export class ManagementClassEditComponent implements OnInit { name: string; managementClass: Mgmgtclass; private readonly _formBuilder = inject(FormBuilder); managementClassFormGroup = this._formBuilder.group({ - name: new FormControl({value: "", disabled: true}), - uid: new FormControl({value: "", disabled: true}), - mtime: new FormControl({value: "", disabled: true}), - ctime: new FormControl({value: "", disabled: true}), - depth: new FormControl({value: 0, disabled: true}), - is_subobject: new FormControl({value: false, disabled: true}), - is_definition: new FormControl({value: false, disabled: true}), - comment: new FormControl({value: "", disabled: true}), - redhat_management_key: new FormControl({value: "", disabled: true}), - class_name: new FormControl({value: "", disabled: true}), - owners: new FormControl({value: [], disabled: true}), - owners_inherited: new FormControl({value: false, disabled: true}), - params: new FormControl({value: {}, disabled: true}), - files: new FormControl({value: [], disabled: true}), - packages: new FormControl({value: [], disabled: true}), + name: new FormControl({ value: '', disabled: true }), + uid: new FormControl({ value: '', disabled: true }), + mtime: new FormControl({ value: '', disabled: true }), + ctime: new FormControl({ value: '', disabled: true }), + depth: new FormControl({ value: 0, disabled: true }), + is_subobject: new FormControl({ value: false, disabled: true }), + is_definition: new FormControl({ value: false, disabled: true }), + comment: new FormControl({ value: '', disabled: true }), + redhat_management_key: new FormControl({ value: '', disabled: true }), + class_name: new FormControl({ value: '', disabled: true }), + owners: new FormControl({ value: [], disabled: true }), + owners_inherited: new FormControl({ value: false, disabled: true }), + params: new FormControl({ value: {}, disabled: true }), + files: new FormControl({ value: [], disabled: true }), + packages: new FormControl({ value: [], disabled: true }), }); isEditMode: boolean = false; @@ -67,66 +72,113 @@ export class ManagementClassEditComponent implements OnInit { private _snackBar: MatSnackBar, private router: Router, ) { - this.name = this.route.snapshot.paramMap.get("name"); + this.name = this.route.snapshot.paramMap.get('name'); } ngOnInit(): void { - this.refreshData() + this.refreshData(); } refreshData(): void { - this.cobblerApiService.get_mgmtclass(this.name, false, false, this.userService.token).subscribe(value => { - this.managementClass = value - this.managementClassFormGroup.controls.name.setValue(this.managementClass.name) - this.managementClassFormGroup.controls.uid.setValue(this.managementClass.uid) - this.managementClassFormGroup.controls.mtime.setValue(new Date(this.managementClass.mtime * 1000).toString()) - this.managementClassFormGroup.controls.ctime.setValue(new Date(this.managementClass.ctime * 1000).toString()) - this.managementClassFormGroup.controls.depth.setValue(this.managementClass.depth) - this.managementClassFormGroup.controls.is_subobject.setValue(this.managementClass.is_subobject) - this.managementClassFormGroup.controls.is_definition.setValue(this.managementClass.is_definition) - this.managementClassFormGroup.controls.comment.setValue(this.managementClass.comment) - this.managementClassFormGroup.controls.class_name.setValue(this.managementClass.class_name) - if (typeof this.managementClass.owners === "string") { - this.managementClassFormGroup.controls.owners_inherited.setValue(true) - } else { - this.managementClassFormGroup.controls.owners_inherited.setValue(false) - this.managementClassFormGroup.controls.owners.setValue(this.managementClass.owners) - } - this.managementClassFormGroup.controls.params.setValue(this.managementClass.params) - this.managementClassFormGroup.controls.files.setValue(this.managementClass.files) - this.managementClassFormGroup.controls.packages.setValue(this.managementClass.packages) - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .get_mgmtclass(this.name, false, false, this.userService.token) + .subscribe( + (value) => { + this.managementClass = value; + this.managementClassFormGroup.controls.name.setValue( + this.managementClass.name, + ); + this.managementClassFormGroup.controls.uid.setValue( + this.managementClass.uid, + ); + this.managementClassFormGroup.controls.mtime.setValue( + new Date(this.managementClass.mtime * 1000).toString(), + ); + this.managementClassFormGroup.controls.ctime.setValue( + new Date(this.managementClass.ctime * 1000).toString(), + ); + this.managementClassFormGroup.controls.depth.setValue( + this.managementClass.depth, + ); + this.managementClassFormGroup.controls.is_subobject.setValue( + this.managementClass.is_subobject, + ); + this.managementClassFormGroup.controls.is_definition.setValue( + this.managementClass.is_definition, + ); + this.managementClassFormGroup.controls.comment.setValue( + this.managementClass.comment, + ); + this.managementClassFormGroup.controls.class_name.setValue( + this.managementClass.class_name, + ); + if (typeof this.managementClass.owners === 'string') { + this.managementClassFormGroup.controls.owners_inherited.setValue( + true, + ); + } else { + this.managementClassFormGroup.controls.owners_inherited.setValue( + false, + ); + this.managementClassFormGroup.controls.owners.setValue( + this.managementClass.owners, + ); + } + this.managementClassFormGroup.controls.params.setValue( + this.managementClass.params, + ); + this.managementClassFormGroup.controls.files.setValue( + this.managementClass.files, + ); + this.managementClassFormGroup.controls.packages.setValue( + this.managementClass.packages, + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } removeManagementClass(): void { - this.cobblerApiService.remove_mgmtclass(this.name, this.userService.token, false).subscribe(value => { - if (value) { - this.router.navigate(["/items", "profile"]) - } - // HTML encode the error message since it originates from XML - this._snackBar.open("Delete failed! Check server logs for more information.", 'Close'); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_mgmtclass(this.name, this.userService.token, false) + .subscribe( + (value) => { + if (value) { + this.router.navigate(['/items', 'profile']); + } + // HTML encode the error message since it originates from XML + this._snackBar.open( + 'Delete failed! Check server logs for more information.', + 'Close', + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } editProfile(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } copyProfile(): void { - this.cobblerApiService.copy_mgmtclass("", "", this.userService.token) - .subscribe(value => { - // TODO - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .copy_mgmtclass('', '', this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } saveProfile(): void { @@ -135,16 +187,17 @@ export class ManagementClassEditComponent implements OnInit { get mgmtClassOwners(): string[] { if (this.managementClass && this.managementClass.owners) { - const ownersResult = this.managementClass.owners + const ownersResult = this.managementClass.owners; if (typeof ownersResult !== 'string') { return ownersResult; } } - return [] + return []; } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.html b/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.html index 961469ba..9aa28a23 100644 --- a/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.html +++ b/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.html @@ -4,35 +4,46 @@

MANAGEMENT CLASSES

Name - {{element.name}} + {{ element.name }} Class Name - {{element.class_name}} + {{ element.class_name }} Is Definition? - {{element.is_definition}} + {{ element.is_definition }} - + - - - @@ -41,6 +52,5 @@

MANAGEMENT CLASSES

- + - diff --git a/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.spec.ts b/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.spec.ts index 3e27e522..69be5abd 100644 --- a/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.spec.ts @@ -1,8 +1,8 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { ManagementClassOverviewComponent } from './management-class-overview.component'; @@ -19,11 +19,10 @@ describe('ManagementClassOverviewComponent', () => { provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(ManagementClassOverviewComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.ts b/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.ts index aa43423b..a008f586 100644 --- a/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.ts +++ b/projects/cobbler-frontend/src/app/items/management-class/overview/management-class-overview.component.ts @@ -1,20 +1,23 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; -import {MatIconButton} from '@angular/material/button'; -import {MatIcon} from '@angular/material/icon'; -import {MatMenu, MatMenuItem, MatMenuTrigger} from '@angular/material/menu'; -import {MatSnackBar} from '@angular/material/snack-bar'; +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatIconButton } from '@angular/material/button'; +import { MatIcon } from '@angular/material/icon'; +import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu'; +import { MatSnackBar } from '@angular/material/snack-bar'; import { MatCell, MatCellDef, MatColumnDef, - MatHeaderCell, MatHeaderCellDef, + MatHeaderCell, + MatHeaderCellDef, MatHeaderRow, MatHeaderRowDef, - MatRow, MatRowDef, MatTable + MatRow, + MatRowDef, + MatTable, } from '@angular/material/table'; -import {Router} from '@angular/router'; -import {CobblerApiService, Mgmgtclass} from 'cobbler-api'; -import {UserService} from '../../../services/user.service'; +import { Router } from '@angular/router'; +import { CobblerApiService, Mgmgtclass } from 'cobbler-api'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-overview', @@ -34,13 +37,18 @@ import {UserService} from '../../../services/user.service'; MatRowDef, MatTable, MatHeaderCellDef, - MatMenuTrigger + MatMenuTrigger, ], templateUrl: './management-class-overview.component.html', - styleUrl: './management-class-overview.component.scss' + styleUrl: './management-class-overview.component.scss', }) export class ManagementClassOverviewComponent implements OnInit { - displayedColumns: string[] = ['name', "class_name", "is_definition", "actions"]; + displayedColumns: string[] = [ + 'name', + 'class_name', + 'is_definition', + 'actions', + ]; dataSource: Array = []; @ViewChild(MatTable) table: MatTable; @@ -50,24 +58,26 @@ export class ManagementClassOverviewComponent implements OnInit { private cobblerApiService: CobblerApiService, private _snackBar: MatSnackBar, private router: Router, - ) { - } + ) {} ngOnInit(): void { - this.retrieveManagementClasses() + this.retrieveManagementClasses(); } private retrieveManagementClasses(): void { - this.cobblerApiService.get_mgmtclasses().subscribe(value => { - this.dataSource = value - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService.get_mgmtclasses().subscribe( + (value) => { + this.dataSource = value; + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } showManagementClass(uid: string, name: string): void { - this.router.navigate(["/items", "management-class", name]) + this.router.navigate(['/items', 'management-class', name]); } editManagementClass(uid: string, name: string): void { @@ -75,17 +85,22 @@ export class ManagementClassOverviewComponent implements OnInit { } deleteManagementClass(uid: string, name: string): void { - this.cobblerApiService.remove_mgmtclass(name, this.userService.token, false).subscribe(value => { - this.retrieveManagementClasses() - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_mgmtclass(name, this.userService.token, false) + .subscribe( + (value) => { + this.retrieveManagementClasses(); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } - } diff --git a/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.html b/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.html index 95e086d9..48c2ffd1 100644 --- a/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.html +++ b/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.html @@ -6,28 +6,28 @@

Name: {{ name }}

mat-icon-button (click)="this.refreshData()" matTooltip="Refresh data" - >refresh + > + refresh + - + - + + > + delete + @@ -35,67 +35,72 @@

Name: {{ name }}

Name - + UID - + Last modified time - + Creation time - + Depth - + - Is Subobject? + Is Subobject? Comment - + Mode - + Owner - + Group - + Path - + Template - + Action - + Installer - + Version - + - + Inherited @if (isEditMode) { } - diff --git a/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.scss b/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.scss index 2a9efa5d..737cd844 100644 --- a/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.scss +++ b/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.scss @@ -27,4 +27,3 @@ .form-field-full-width { width: 100%; } - diff --git a/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.spec.ts b/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.spec.ts index d78114d4..abeb9c0b 100644 --- a/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.spec.ts @@ -1,9 +1,9 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {ActivatedRoute, provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ActivatedRoute, provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { PackageEditComponent } from './package-edit.component'; @@ -13,31 +13,27 @@ describe('PackageEditComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - PackageEditComponent, - NoopAnimationsModule, - ], + imports: [PackageEditComponent, NoopAnimationsModule], providers: [ provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, { provide: ActivatedRoute, useValue: { snapshot: { paramMap: { - get: () => "testpackage" + get: () => 'testpackage', }, }, }, }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(PackageEditComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.ts b/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.ts index a65ab926..7e8925c5 100644 --- a/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.ts +++ b/projects/cobbler-frontend/src/app/items/package/edit/package-edit.component.ts @@ -1,63 +1,68 @@ -import {Component, inject, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatOption} from '@angular/material/autocomplete'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; -import {MatSelect} from '@angular/material/select'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {MatTooltip} from '@angular/material/tooltip'; -import {ActivatedRoute, Router} from '@angular/router'; -import {CobblerApiService, Package} from 'cobbler-api'; -import {MultiSelectComponent} from '../../../common/multi-select/multi-select.component'; -import {UserService} from '../../../services/user.service'; +import { Component, inject, OnInit } from '@angular/core'; +import { + FormBuilder, + FormControl, + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { MatOption } from '@angular/material/autocomplete'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; +import { MatSelect } from '@angular/material/select'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatTooltip } from '@angular/material/tooltip'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CobblerApiService, Package } from 'cobbler-api'; +import { MultiSelectComponent } from '../../../common/multi-select/multi-select.component'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-edit', standalone: true, - imports: [ - FormsModule, - MatButton, - MatCheckbox, - MatFormField, - MatIcon, - MatIconButton, - MatInput, - MatLabel, - MatOption, - MatSelect, - MatTooltip, - ReactiveFormsModule, - MultiSelectComponent - ], + imports: [ + FormsModule, + MatButton, + MatCheckbox, + MatFormField, + MatIcon, + MatIconButton, + MatInput, + MatLabel, + MatOption, + MatSelect, + MatTooltip, + ReactiveFormsModule, + MultiSelectComponent, + ], templateUrl: './package-edit.component.html', - styleUrl: './package-edit.component.scss' + styleUrl: './package-edit.component.scss', }) export class PackageEditComponent implements OnInit { name: string; package: Package; private readonly _formBuilder = inject(FormBuilder); packageFormGroup = this._formBuilder.group({ - name: new FormControl({value: "", disabled: true}), - uid: new FormControl({value: "", disabled: true}), - mtime: new FormControl({value: "", disabled: true}), - ctime: new FormControl({value: "", disabled: true}), - depth: new FormControl({value: 0, disabled: true}), - is_subobject: new FormControl({value: false, disabled: true}), - comment: new FormControl({value: "", disabled: true}), - redhat_management_key: new FormControl({value: "", disabled: true}), - mode: new FormControl({value: "", disabled: true}), - owner: new FormControl({value: "", disabled: true}), - group: new FormControl({value: "", disabled: true}), - path: new FormControl({value: "", disabled: true}), - template: new FormControl({value: "", disabled: true}), - action: new FormControl({value: "", disabled: true}), - installer: new FormControl({value: "", disabled: true}), - version: new FormControl({value: "", disabled: true}), - owners: new FormControl({value: [], disabled: true}), - owners_inherited: new FormControl({value: false, disabled: true}), + name: new FormControl({ value: '', disabled: true }), + uid: new FormControl({ value: '', disabled: true }), + mtime: new FormControl({ value: '', disabled: true }), + ctime: new FormControl({ value: '', disabled: true }), + depth: new FormControl({ value: 0, disabled: true }), + is_subobject: new FormControl({ value: false, disabled: true }), + comment: new FormControl({ value: '', disabled: true }), + redhat_management_key: new FormControl({ value: '', disabled: true }), + mode: new FormControl({ value: '', disabled: true }), + owner: new FormControl({ value: '', disabled: true }), + group: new FormControl({ value: '', disabled: true }), + path: new FormControl({ value: '', disabled: true }), + template: new FormControl({ value: '', disabled: true }), + action: new FormControl({ value: '', disabled: true }), + installer: new FormControl({ value: '', disabled: true }), + version: new FormControl({ value: '', disabled: true }), + owners: new FormControl({ value: [], disabled: true }), + owners_inherited: new FormControl({ value: false, disabled: true }), }); isEditMode: boolean = false; @@ -68,69 +73,96 @@ export class PackageEditComponent implements OnInit { private _snackBar: MatSnackBar, private router: Router, ) { - this.name = this.route.snapshot.paramMap.get("name"); + this.name = this.route.snapshot.paramMap.get('name'); } ngOnInit(): void { - this.refreshData() + this.refreshData(); } refreshData(): void { - this.cobblerApiService.get_package(this.name, false, false, this.userService.token).subscribe(value => { - this.package = value - this.packageFormGroup.controls.name.setValue(this.package.name) - this.packageFormGroup.controls.uid.setValue(this.package.uid) - this.packageFormGroup.controls.mtime.setValue(new Date(this.package.mtime * 1000).toString()) - this.packageFormGroup.controls.ctime.setValue(new Date(this.package.ctime * 1000).toString()) - this.packageFormGroup.controls.depth.setValue(this.package.depth) - this.packageFormGroup.controls.is_subobject.setValue(this.package.is_subobject) - this.packageFormGroup.controls.comment.setValue(this.package.comment) - this.packageFormGroup.controls.mode.setValue(this.package.mode) - this.packageFormGroup.controls.owner.setValue(this.package.owner) - this.packageFormGroup.controls.group.setValue(this.package.group) - this.packageFormGroup.controls.path.setValue(this.package.path) - this.packageFormGroup.controls.template.setValue(this.package.template) - this.packageFormGroup.controls.action.setValue(this.package.action) - this.packageFormGroup.controls.installer.setValue(this.package.installer) - this.packageFormGroup.controls.version.setValue(this.package.version) - if (typeof this.package.owners === "string") { - this.packageFormGroup.controls.owners_inherited.setValue(true) - } else { - this.packageFormGroup.controls.owners_inherited.setValue(false) - this.packageFormGroup.controls.owners.setValue(this.package.owners) - } - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .get_package(this.name, false, false, this.userService.token) + .subscribe( + (value) => { + this.package = value; + this.packageFormGroup.controls.name.setValue(this.package.name); + this.packageFormGroup.controls.uid.setValue(this.package.uid); + this.packageFormGroup.controls.mtime.setValue( + new Date(this.package.mtime * 1000).toString(), + ); + this.packageFormGroup.controls.ctime.setValue( + new Date(this.package.ctime * 1000).toString(), + ); + this.packageFormGroup.controls.depth.setValue(this.package.depth); + this.packageFormGroup.controls.is_subobject.setValue( + this.package.is_subobject, + ); + this.packageFormGroup.controls.comment.setValue(this.package.comment); + this.packageFormGroup.controls.mode.setValue(this.package.mode); + this.packageFormGroup.controls.owner.setValue(this.package.owner); + this.packageFormGroup.controls.group.setValue(this.package.group); + this.packageFormGroup.controls.path.setValue(this.package.path); + this.packageFormGroup.controls.template.setValue( + this.package.template, + ); + this.packageFormGroup.controls.action.setValue(this.package.action); + this.packageFormGroup.controls.installer.setValue( + this.package.installer, + ); + this.packageFormGroup.controls.version.setValue(this.package.version); + if (typeof this.package.owners === 'string') { + this.packageFormGroup.controls.owners_inherited.setValue(true); + } else { + this.packageFormGroup.controls.owners_inherited.setValue(false); + this.packageFormGroup.controls.owners.setValue(this.package.owners); + } + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } removePackage(): void { - this.cobblerApiService.remove_package(this.name, this.userService.token, false).subscribe(value => { - if (value) { - this.router.navigate(["/items", "package"]) - } - // HTML encode the error message since it originates from XML - this._snackBar.open("Delete failed! Check server logs for more information.", 'Close'); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_package(this.name, this.userService.token, false) + .subscribe( + (value) => { + if (value) { + this.router.navigate(['/items', 'package']); + } + // HTML encode the error message since it originates from XML + this._snackBar.open( + 'Delete failed! Check server logs for more information.', + 'Close', + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } editPackage(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } copyPackage(): void { - this.cobblerApiService.copy_package("", "", this.userService.token) - .subscribe(value => { - // TODO - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .copy_package('', '', this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } savePackage(): void { @@ -139,16 +171,17 @@ export class PackageEditComponent implements OnInit { get packageOwners(): string[] { if (this.package && this.package.owners) { - const ownersResult = this.package.owners + const ownersResult = this.package.owners; if (typeof ownersResult !== 'string') { return ownersResult; } } - return [] + return []; } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.html b/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.html index e84d1b7a..dc9af5dd 100644 --- a/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.html +++ b/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.html @@ -4,25 +4,27 @@

PACKAGES

Name - {{element.name}} + {{ element.name }} Installer - {{element.installer}} + {{ element.installer }} Version - {{element.version}} + {{ element.version }} - + - @@ -41,6 +46,5 @@

PACKAGES

- + - diff --git a/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.spec.ts b/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.spec.ts index 8453d71f..091c5483 100644 --- a/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.spec.ts @@ -1,8 +1,7 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { COBBLER_URL } from 'cobbler-api'; import { PackageOverviewComponent } from './package-overview.component'; @@ -18,11 +17,10 @@ describe('PackageOverviewComponent', () => { provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(PackageOverviewComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.ts b/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.ts index 6e733691..f11df5e5 100644 --- a/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.ts +++ b/projects/cobbler-frontend/src/app/items/package/overview/package-overview.component.ts @@ -1,20 +1,23 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; -import {MatIconButton} from '@angular/material/button'; -import {MatIcon} from '@angular/material/icon'; -import {MatMenu, MatMenuItem, MatMenuTrigger} from '@angular/material/menu'; -import {MatSnackBar} from '@angular/material/snack-bar'; +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatIconButton } from '@angular/material/button'; +import { MatIcon } from '@angular/material/icon'; +import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu'; +import { MatSnackBar } from '@angular/material/snack-bar'; import { MatCell, MatCellDef, MatColumnDef, - MatHeaderCell, MatHeaderCellDef, + MatHeaderCell, + MatHeaderCellDef, MatHeaderRow, MatHeaderRowDef, - MatRow, MatRowDef, MatTable + MatRow, + MatRowDef, + MatTable, } from '@angular/material/table'; -import {Router} from '@angular/router'; -import {CobblerApiService, Package} from 'cobbler-api'; -import {UserService} from '../../../services/user.service'; +import { Router } from '@angular/router'; +import { CobblerApiService, Package } from 'cobbler-api'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-overview', @@ -34,13 +37,13 @@ import {UserService} from '../../../services/user.service'; MatRowDef, MatTable, MatMenuTrigger, - MatHeaderCellDef + MatHeaderCellDef, ], templateUrl: './package-overview.component.html', - styleUrl: './package-overview.component.scss' + styleUrl: './package-overview.component.scss', }) export class PackageOverviewComponent implements OnInit { - displayedColumns: string[] = ['name', "installer", "version", "actions"]; + displayedColumns: string[] = ['name', 'installer', 'version', 'actions']; dataSource: Array = []; @ViewChild(MatTable) table: MatTable; @@ -50,24 +53,26 @@ export class PackageOverviewComponent implements OnInit { private cobblerApiService: CobblerApiService, private _snackBar: MatSnackBar, private router: Router, - ) { - } + ) {} ngOnInit(): void { - this.retrievePackages() + this.retrievePackages(); } private retrievePackages(): void { - this.cobblerApiService.get_packages().subscribe(value => { - this.dataSource = value - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService.get_packages().subscribe( + (value) => { + this.dataSource = value; + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } showPackage(uid: string, name: string): void { - this.router.navigate(["/items", "package", name]) + this.router.navigate(['/items', 'package', name]); } editPackage(uid: string, name: string): void { @@ -75,16 +80,22 @@ export class PackageOverviewComponent implements OnInit { } deletePackage(uid: string, name: string): void { - this.cobblerApiService.remove_package(name, this.userService.token, false).subscribe(value => { - this.retrievePackages() - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_package(name, this.userService.token, false) + .subscribe( + (value) => { + this.retrievePackages(); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.html b/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.html index fd3ca8ed..f288a587 100644 --- a/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.html +++ b/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.html @@ -6,28 +6,28 @@

Name: {{ name }}

mat-icon-button (click)="this.refreshData()" matTooltip="Refresh data" - >refresh + > + refresh + - + - + + > + delete + @@ -35,121 +35,192 @@

Name: {{ name }}

Name - + UID - + Last modified time - + Creation time - + Depth - + - Is Subobject? + Is Subobject? - - Inherited + + Inherited Comment - + Autoinstall - + DHCP Tag - + Distribution - + Menu - + Next-Server IPv4 - + Next-Server IPv6 - + Filename - + Parent - + Proxy - + RedHat Management Key - + Server - + - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited - + - + - + Inherited - + - - Inherited + + Inherited @if (isEditMode) { diff --git a/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.scss b/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.scss index 2a9efa5d..737cd844 100644 --- a/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.scss +++ b/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.scss @@ -27,4 +27,3 @@ .form-field-full-width { width: 100%; } - diff --git a/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.spec.ts b/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.spec.ts index c7443298..e31f44e5 100644 --- a/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.spec.ts @@ -1,9 +1,9 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {ActivatedRoute, provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ActivatedRoute, provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { ProfileEditComponent } from './profile-edit.component'; @@ -13,31 +13,27 @@ describe('ProfileEditComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - ProfileEditComponent, - NoopAnimationsModule, - ], + imports: [ProfileEditComponent, NoopAnimationsModule], providers: [ provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, { provide: ActivatedRoute, useValue: { snapshot: { paramMap: { - get: () => "testprof" + get: () => 'testprof', }, }, }, }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(ProfileEditComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.ts b/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.ts index 0741cd22..adb42826 100644 --- a/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.ts +++ b/projects/cobbler-frontend/src/app/items/profile/edit/profile-edit.component.ts @@ -1,19 +1,24 @@ -import {Component, inject, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatOption} from '@angular/material/autocomplete'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; -import {MatSelect} from '@angular/material/select'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {MatTooltip} from '@angular/material/tooltip'; -import {ActivatedRoute, Router} from '@angular/router'; -import {CobblerApiService, Profile} from 'cobbler-api'; -import {KeyValueEditorComponent} from '../../../common/key-value-editor/key-value-editor.component'; -import {MultiSelectComponent} from '../../../common/multi-select/multi-select.component'; -import {UserService} from '../../../services/user.service'; +import { Component, inject, OnInit } from '@angular/core'; +import { + FormBuilder, + FormControl, + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { MatOption } from '@angular/material/autocomplete'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; +import { MatSelect } from '@angular/material/select'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatTooltip } from '@angular/material/tooltip'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CobblerApiService, Profile } from 'cobbler-api'; +import { KeyValueEditorComponent } from '../../../common/key-value-editor/key-value-editor.component'; +import { MultiSelectComponent } from '../../../common/multi-select/multi-select.component'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-edit', @@ -32,58 +37,69 @@ import {UserService} from '../../../services/user.service'; MatSelect, ReactiveFormsModule, MultiSelectComponent, - KeyValueEditorComponent + KeyValueEditorComponent, ], templateUrl: './profile-edit.component.html', - styleUrl: './profile-edit.component.scss' + styleUrl: './profile-edit.component.scss', }) -export class ProfileEditComponent implements OnInit{ +export class ProfileEditComponent implements OnInit { name: string; profile: Profile; private readonly _formBuilder = inject(FormBuilder); profileFormGroup = this._formBuilder.group({ - name: new FormControl({value: "", disabled: true}), - uid: new FormControl({value: "", disabled: true}), - mtime: new FormControl({value: "", disabled: true}), - ctime: new FormControl({value: "", disabled: true}), - depth: new FormControl({value: 0, disabled: true}), - is_subobject: new FormControl({value: false, disabled: true}), - comment: new FormControl({value: "", disabled: true}), - redhat_management_key: new FormControl({value: "", disabled: true}), - autoinstall: new FormControl({value: "", disabled: true}), - dhcp_tag: new FormControl({value: "", disabled: true}), - distro: new FormControl({value: "", disabled: true}), - menu: new FormControl({value: "", disabled: true}), - next_server_v4: new FormControl({value: "", disabled: true}), - next_server_v6: new FormControl({value: "", disabled: true}), - filename: new FormControl({value: "", disabled: true}), - parent: new FormControl({value: "", disabled: true}), - proxy: new FormControl({value: "", disabled: true}), - server: new FormControl({value: "", disabled: true}), - boot_loaders: new FormControl({value: [], disabled: true}), - bootloader_inherited: new FormControl({value: false, disabled: true}), - owners: new FormControl({value: [], disabled: true}), - owners_inherited: new FormControl({value: false, disabled: true}), - autoinstall_meta: new FormControl({value: {}, disabled: true}), - autoinstall_meta_inherited: new FormControl({value: false, disabled: true}), - boot_files: new FormControl({value: {}, disabled: true}), - boot_files_inherited: new FormControl({value: false, disabled: true}), - fetchable_files: new FormControl({value: {}, disabled: true}), - fetchable_files_inherited: new FormControl({value: false, disabled: true}), - kernel_options: new FormControl({value: {}, disabled: true}), - kernel_options_inherited: new FormControl({value: false, disabled: true}), - kernel_options_post: new FormControl({value: {}, disabled: true}), - kernel_options_post_inherited: new FormControl({value: false, disabled: true}), - mgmt_classes: new FormControl({value: [], disabled: true}), - mgmt_classes_inherited: new FormControl({value: false, disabled: true}), - mgmt_parameters: new FormControl({value: {}, disabled: true}), - mgmt_parameters_inherited: new FormControl({value: false, disabled: true}), - name_servers: new FormControl({value: [], disabled: true}), - name_servers_search: new FormControl({value: [], disabled: true}), - repos: new FormControl({value: [], disabled: true}), - template_files: new FormControl({value: {}, disabled: true}), - template_files_inherited: new FormControl({value: false, disabled: true}), - + name: new FormControl({ value: '', disabled: true }), + uid: new FormControl({ value: '', disabled: true }), + mtime: new FormControl({ value: '', disabled: true }), + ctime: new FormControl({ value: '', disabled: true }), + depth: new FormControl({ value: 0, disabled: true }), + is_subobject: new FormControl({ value: false, disabled: true }), + comment: new FormControl({ value: '', disabled: true }), + redhat_management_key: new FormControl({ value: '', disabled: true }), + autoinstall: new FormControl({ value: '', disabled: true }), + dhcp_tag: new FormControl({ value: '', disabled: true }), + distro: new FormControl({ value: '', disabled: true }), + menu: new FormControl({ value: '', disabled: true }), + next_server_v4: new FormControl({ value: '', disabled: true }), + next_server_v6: new FormControl({ value: '', disabled: true }), + filename: new FormControl({ value: '', disabled: true }), + parent: new FormControl({ value: '', disabled: true }), + proxy: new FormControl({ value: '', disabled: true }), + server: new FormControl({ value: '', disabled: true }), + boot_loaders: new FormControl({ value: [], disabled: true }), + bootloader_inherited: new FormControl({ value: false, disabled: true }), + owners: new FormControl({ value: [], disabled: true }), + owners_inherited: new FormControl({ value: false, disabled: true }), + autoinstall_meta: new FormControl({ value: {}, disabled: true }), + autoinstall_meta_inherited: new FormControl({ + value: false, + disabled: true, + }), + boot_files: new FormControl({ value: {}, disabled: true }), + boot_files_inherited: new FormControl({ value: false, disabled: true }), + fetchable_files: new FormControl({ value: {}, disabled: true }), + fetchable_files_inherited: new FormControl({ + value: false, + disabled: true, + }), + kernel_options: new FormControl({ value: {}, disabled: true }), + kernel_options_inherited: new FormControl({ value: false, disabled: true }), + kernel_options_post: new FormControl({ value: {}, disabled: true }), + kernel_options_post_inherited: new FormControl({ + value: false, + disabled: true, + }), + mgmt_classes: new FormControl({ value: [], disabled: true }), + mgmt_classes_inherited: new FormControl({ value: false, disabled: true }), + mgmt_parameters: new FormControl({ value: {}, disabled: true }), + mgmt_parameters_inherited: new FormControl({ + value: false, + disabled: true, + }), + name_servers: new FormControl({ value: [], disabled: true }), + name_servers_search: new FormControl({ value: [], disabled: true }), + repos: new FormControl({ value: [], disabled: true }), + template_files: new FormControl({ value: {}, disabled: true }), + template_files_inherited: new FormControl({ value: false, disabled: true }), }); isEditMode: boolean = false; @@ -94,129 +110,214 @@ export class ProfileEditComponent implements OnInit{ private _snackBar: MatSnackBar, private router: Router, ) { - this.name = this.route.snapshot.paramMap.get("name"); + this.name = this.route.snapshot.paramMap.get('name'); } ngOnInit(): void { - this.refreshData() + this.refreshData(); } refreshData(): void { - this.cobblerApiService.get_profile(this.name, false, false, this.userService.token).subscribe(value => { - this.profile = value - this.profileFormGroup.controls.name.setValue(this.profile.name) - this.profileFormGroup.controls.uid.setValue(this.profile.uid) - this.profileFormGroup.controls.mtime.setValue(new Date(this.profile.mtime * 1000).toString()) - this.profileFormGroup.controls.ctime.setValue(new Date(this.profile.ctime * 1000).toString()) - this.profileFormGroup.controls.depth.setValue(this.profile.depth) - this.profileFormGroup.controls.is_subobject.setValue(this.profile.is_subobject) - this.profileFormGroup.controls.comment.setValue(this.profile.comment) - this.profileFormGroup.controls.redhat_management_key.setValue(this.profile.redhat_management_key) - this.profileFormGroup.controls.autoinstall.setValue(this.profile.autoinstall) - this.profileFormGroup.controls.dhcp_tag.setValue(this.profile.dhcp_tag) - this.profileFormGroup.controls.distro.setValue(this.profile.distro) - this.profileFormGroup.controls.menu.setValue(this.profile.menu) - this.profileFormGroup.controls.next_server_v4.setValue(this.profile.next_server_v4) - this.profileFormGroup.controls.next_server_v6.setValue(this.profile.next_server_v6) - this.profileFormGroup.controls.filename.setValue(this.profile.filename) - this.profileFormGroup.controls.parent.setValue(this.profile.parent) - this.profileFormGroup.controls.proxy.setValue(this.profile.proxy) - this.profileFormGroup.controls.server.setValue(this.profile.server) - this.profileFormGroup.controls.name_servers.setValue(this.profile.name_servers) - this.profileFormGroup.controls.name_servers_search.setValue(this.profile.name_servers_search) - this.profileFormGroup.controls.repos.setValue(this.profile.repos) - if (typeof this.profile.boot_loaders === "string") { - this.profileFormGroup.controls.bootloader_inherited.setValue(true) - } else { - this.profileFormGroup.controls.bootloader_inherited.setValue(false) - this.profileFormGroup.controls.boot_loaders.setValue(this.profile.boot_loaders) - } - if (typeof this.profile.owners === "string") { - this.profileFormGroup.controls.owners_inherited.setValue(true) - } else { - this.profileFormGroup.controls.owners_inherited.setValue(false) - this.profileFormGroup.controls.owners.setValue(this.profile.owners) - } - if (typeof this.profile.autoinstall_meta === "string") { - this.profileFormGroup.controls.autoinstall_meta_inherited.setValue(true) - } else { - this.profileFormGroup.controls.autoinstall_meta_inherited.setValue(false) - this.profileFormGroup.controls.autoinstall_meta.setValue(this.profile.autoinstall_meta) - } - if (typeof this.profile.boot_files === "string") { - this.profileFormGroup.controls.boot_files_inherited.setValue(true) - } else { - this.profileFormGroup.controls.boot_files_inherited.setValue(false) - this.profileFormGroup.controls.boot_files.setValue(this.profile.boot_files) - } - if (typeof this.profile.fetchable_files === "string") { - this.profileFormGroup.controls.fetchable_files_inherited.setValue(true) - } else { - this.profileFormGroup.controls.fetchable_files_inherited.setValue(false) - this.profileFormGroup.controls.fetchable_files.setValue(this.profile.fetchable_files) - } - if (typeof this.profile.kernel_options === "string") { - this.profileFormGroup.controls.kernel_options_inherited.setValue(true) - } else { - this.profileFormGroup.controls.kernel_options_inherited.setValue(false) - this.profileFormGroup.controls.kernel_options.setValue(this.profile.kernel_options) - } - if (typeof this.profile.kernel_options_post === "string") { - this.profileFormGroup.controls.kernel_options_post_inherited.setValue(true) - } else { - this.profileFormGroup.controls.kernel_options_post_inherited.setValue(false) - this.profileFormGroup.controls.kernel_options_post.setValue(this.profile.kernel_options_post) - } - if (typeof this.profile.mgmt_classes === "string") { - this.profileFormGroup.controls.mgmt_classes_inherited.setValue(true) - } else { - this.profileFormGroup.controls.mgmt_classes_inherited.setValue(false) - this.profileFormGroup.controls.mgmt_classes.setValue(this.profile.mgmt_classes) - } - if (typeof this.profile.mgmt_parameters === "string") { - this.profileFormGroup.controls.mgmt_parameters_inherited.setValue(true) - } else { - this.profileFormGroup.controls.mgmt_parameters_inherited.setValue(false) - this.profileFormGroup.controls.mgmt_parameters.setValue(this.profile.mgmt_parameters) - } - if (typeof this.profile.template_files === "string") { - this.profileFormGroup.controls.template_files_inherited.setValue(true) - } else { - this.profileFormGroup.controls.template_files_inherited.setValue(false) - this.profileFormGroup.controls.template_files.setValue(this.profile.template_files) - } - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .get_profile(this.name, false, false, this.userService.token) + .subscribe( + (value) => { + this.profile = value; + this.profileFormGroup.controls.name.setValue(this.profile.name); + this.profileFormGroup.controls.uid.setValue(this.profile.uid); + this.profileFormGroup.controls.mtime.setValue( + new Date(this.profile.mtime * 1000).toString(), + ); + this.profileFormGroup.controls.ctime.setValue( + new Date(this.profile.ctime * 1000).toString(), + ); + this.profileFormGroup.controls.depth.setValue(this.profile.depth); + this.profileFormGroup.controls.is_subobject.setValue( + this.profile.is_subobject, + ); + this.profileFormGroup.controls.comment.setValue(this.profile.comment); + this.profileFormGroup.controls.redhat_management_key.setValue( + this.profile.redhat_management_key, + ); + this.profileFormGroup.controls.autoinstall.setValue( + this.profile.autoinstall, + ); + this.profileFormGroup.controls.dhcp_tag.setValue( + this.profile.dhcp_tag, + ); + this.profileFormGroup.controls.distro.setValue(this.profile.distro); + this.profileFormGroup.controls.menu.setValue(this.profile.menu); + this.profileFormGroup.controls.next_server_v4.setValue( + this.profile.next_server_v4, + ); + this.profileFormGroup.controls.next_server_v6.setValue( + this.profile.next_server_v6, + ); + this.profileFormGroup.controls.filename.setValue( + this.profile.filename, + ); + this.profileFormGroup.controls.parent.setValue(this.profile.parent); + this.profileFormGroup.controls.proxy.setValue(this.profile.proxy); + this.profileFormGroup.controls.server.setValue(this.profile.server); + this.profileFormGroup.controls.name_servers.setValue( + this.profile.name_servers, + ); + this.profileFormGroup.controls.name_servers_search.setValue( + this.profile.name_servers_search, + ); + this.profileFormGroup.controls.repos.setValue(this.profile.repos); + if (typeof this.profile.boot_loaders === 'string') { + this.profileFormGroup.controls.bootloader_inherited.setValue(true); + } else { + this.profileFormGroup.controls.bootloader_inherited.setValue(false); + this.profileFormGroup.controls.boot_loaders.setValue( + this.profile.boot_loaders, + ); + } + if (typeof this.profile.owners === 'string') { + this.profileFormGroup.controls.owners_inherited.setValue(true); + } else { + this.profileFormGroup.controls.owners_inherited.setValue(false); + this.profileFormGroup.controls.owners.setValue(this.profile.owners); + } + if (typeof this.profile.autoinstall_meta === 'string') { + this.profileFormGroup.controls.autoinstall_meta_inherited.setValue( + true, + ); + } else { + this.profileFormGroup.controls.autoinstall_meta_inherited.setValue( + false, + ); + this.profileFormGroup.controls.autoinstall_meta.setValue( + this.profile.autoinstall_meta, + ); + } + if (typeof this.profile.boot_files === 'string') { + this.profileFormGroup.controls.boot_files_inherited.setValue(true); + } else { + this.profileFormGroup.controls.boot_files_inherited.setValue(false); + this.profileFormGroup.controls.boot_files.setValue( + this.profile.boot_files, + ); + } + if (typeof this.profile.fetchable_files === 'string') { + this.profileFormGroup.controls.fetchable_files_inherited.setValue( + true, + ); + } else { + this.profileFormGroup.controls.fetchable_files_inherited.setValue( + false, + ); + this.profileFormGroup.controls.fetchable_files.setValue( + this.profile.fetchable_files, + ); + } + if (typeof this.profile.kernel_options === 'string') { + this.profileFormGroup.controls.kernel_options_inherited.setValue( + true, + ); + } else { + this.profileFormGroup.controls.kernel_options_inherited.setValue( + false, + ); + this.profileFormGroup.controls.kernel_options.setValue( + this.profile.kernel_options, + ); + } + if (typeof this.profile.kernel_options_post === 'string') { + this.profileFormGroup.controls.kernel_options_post_inherited.setValue( + true, + ); + } else { + this.profileFormGroup.controls.kernel_options_post_inherited.setValue( + false, + ); + this.profileFormGroup.controls.kernel_options_post.setValue( + this.profile.kernel_options_post, + ); + } + if (typeof this.profile.mgmt_classes === 'string') { + this.profileFormGroup.controls.mgmt_classes_inherited.setValue( + true, + ); + } else { + this.profileFormGroup.controls.mgmt_classes_inherited.setValue( + false, + ); + this.profileFormGroup.controls.mgmt_classes.setValue( + this.profile.mgmt_classes, + ); + } + if (typeof this.profile.mgmt_parameters === 'string') { + this.profileFormGroup.controls.mgmt_parameters_inherited.setValue( + true, + ); + } else { + this.profileFormGroup.controls.mgmt_parameters_inherited.setValue( + false, + ); + this.profileFormGroup.controls.mgmt_parameters.setValue( + this.profile.mgmt_parameters, + ); + } + if (typeof this.profile.template_files === 'string') { + this.profileFormGroup.controls.template_files_inherited.setValue( + true, + ); + } else { + this.profileFormGroup.controls.template_files_inherited.setValue( + false, + ); + this.profileFormGroup.controls.template_files.setValue( + this.profile.template_files, + ); + } + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } removeProfile(): void { - this.cobblerApiService.remove_profile(this.name, this.userService.token, false).subscribe(value => { - if (value) { - this.router.navigate(["/items", "profile"]) - } - // HTML encode the error message since it originates from XML - this._snackBar.open("Delete failed! Check server logs for more information.", 'Close'); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_profile(this.name, this.userService.token, false) + .subscribe( + (value) => { + if (value) { + this.router.navigate(['/items', 'profile']); + } + // HTML encode the error message since it originates from XML + this._snackBar.open( + 'Delete failed! Check server logs for more information.', + 'Close', + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } editProfile(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } copyProfile(): void { - this.cobblerApiService.copy_profile("", "", this.userService.token) - .subscribe(value => { - // TODO - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .copy_profile('', '', this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } saveProfile(): void { @@ -225,87 +326,87 @@ export class ProfileEditComponent implements OnInit{ get profileOwners(): string[] { if (this.profile && this.profile.owners) { - const ownersResult = this.profile.owners + const ownersResult = this.profile.owners; if (typeof ownersResult !== 'string') { return ownersResult; } } - return [] + return []; } get profileAutoinstallMeta(): object { if (this.profile && this.profile.autoinstall_meta) { - const autoinstallMetaResult = this.profile.autoinstall_meta + const autoinstallMetaResult = this.profile.autoinstall_meta; if (typeof autoinstallMetaResult !== 'string') { - return autoinstallMetaResult + return autoinstallMetaResult; } } - return {} + return {}; } get profileKernelOptions(): object { if (this.profile && this.profile.kernel_options) { - const kernelOptionsResult = this.profile.kernel_options + const kernelOptionsResult = this.profile.kernel_options; if (typeof kernelOptionsResult !== 'string') { - return kernelOptionsResult + return kernelOptionsResult; } } - return {} + return {}; } get profileKernelOptionsPost(): object { if (this.profile && this.profile.kernel_options_post) { - const kernelOptionsPost = this.profile.kernel_options_post + const kernelOptionsPost = this.profile.kernel_options_post; if (typeof kernelOptionsPost !== 'string') { - return kernelOptionsPost + return kernelOptionsPost; } } - return {} + return {}; } - get profileBootFiles(): object { if (this.profile && this.profile.boot_files) { - const bootFilesResult = this.profile.boot_files + const bootFilesResult = this.profile.boot_files; if (typeof bootFilesResult !== 'string') { - return bootFilesResult + return bootFilesResult; } } - return {} + return {}; } get profileFetchableFiles(): object { if (this.profile && this.profile.fetchable_files) { - const fetchableFilesResult = this.profile.fetchable_files + const fetchableFilesResult = this.profile.fetchable_files; if (typeof fetchableFilesResult !== 'string') { - return fetchableFilesResult + return fetchableFilesResult; } } - return {} + return {}; } get profileMgmtParameters(): object { if (this.profile && this.profile.mgmt_parameters) { - const mgmtParametersResult = this.profile.mgmt_parameters + const mgmtParametersResult = this.profile.mgmt_parameters; if (typeof mgmtParametersResult !== 'string') { - return mgmtParametersResult + return mgmtParametersResult; } } - return {} + return {}; } get profileTemplateFiles(): object { if (this.profile && this.profile.template_files) { - const templateFilesResult = this.profile.template_files + const templateFilesResult = this.profile.template_files; if (typeof templateFilesResult !== 'string') { - return templateFilesResult + return templateFilesResult; } } - return {} + return {}; } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.html b/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.html index 13eda434..8e7a296b 100644 --- a/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.html +++ b/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.html @@ -4,25 +4,27 @@

PROFILES

Name - {{element.name}} + {{ element.name }} Distro - {{element.distro}} + {{ element.distro }} Server - {{element.server}} + {{ element.server }} - + - @@ -41,6 +46,5 @@

PROFILES

- + - diff --git a/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.spec.ts b/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.spec.ts index 8570ab9a..5d8b5d0f 100644 --- a/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.spec.ts @@ -1,8 +1,8 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { ProfileOverviewComponent } from './profile-overview.component'; @@ -19,11 +19,10 @@ describe('ProfileOverviewComponent', () => { provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(ProfileOverviewComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.ts b/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.ts index 9e9f6dde..c9a9fcc2 100644 --- a/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.ts +++ b/projects/cobbler-frontend/src/app/items/profile/overview/profile-overview.component.ts @@ -1,20 +1,23 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; -import {MatIconButton} from '@angular/material/button'; -import {MatIcon} from '@angular/material/icon'; -import {MatMenu, MatMenuItem, MatMenuTrigger} from '@angular/material/menu'; -import {MatSnackBar} from '@angular/material/snack-bar'; +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatIconButton } from '@angular/material/button'; +import { MatIcon } from '@angular/material/icon'; +import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu'; +import { MatSnackBar } from '@angular/material/snack-bar'; import { MatCell, MatCellDef, MatColumnDef, - MatHeaderCell, MatHeaderCellDef, + MatHeaderCell, + MatHeaderCellDef, MatHeaderRow, MatHeaderRowDef, - MatRow, MatRowDef, MatTable + MatRow, + MatRowDef, + MatTable, } from '@angular/material/table'; -import {Router} from '@angular/router'; -import {CobblerApiService, Profile} from 'cobbler-api'; -import {UserService} from '../../../services/user.service'; +import { Router } from '@angular/router'; +import { CobblerApiService, Profile } from 'cobbler-api'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-overview', @@ -34,13 +37,13 @@ import {UserService} from '../../../services/user.service'; MatRowDef, MatTable, MatMenuTrigger, - MatHeaderCellDef + MatHeaderCellDef, ], templateUrl: './profile-overview.component.html', - styleUrl: './profile-overview.component.scss' + styleUrl: './profile-overview.component.scss', }) export class ProfileOverviewComponent implements OnInit { - displayedColumns: string[] = ['name', "distro", "server", "actions"]; + displayedColumns: string[] = ['name', 'distro', 'server', 'actions']; dataSource: Array = []; @ViewChild(MatTable) table: MatTable; @@ -50,24 +53,26 @@ export class ProfileOverviewComponent implements OnInit { private cobblerApiService: CobblerApiService, private _snackBar: MatSnackBar, private router: Router, - ) { - } + ) {} ngOnInit(): void { - this.retrieveProfiles() + this.retrieveProfiles(); } private retrieveProfiles(): void { - this.cobblerApiService.get_profiles().subscribe(value => { - this.dataSource = value - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService.get_profiles().subscribe( + (value) => { + this.dataSource = value; + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } showProfile(uid: string, name: string): void { - this.router.navigate(["/items", "profile", name]) + this.router.navigate(['/items', 'profile', name]); } editProfile(uid: string, name: string): void { @@ -75,16 +80,22 @@ export class ProfileOverviewComponent implements OnInit { } deleteProfile(uid: string, name: string): void { - this.cobblerApiService.remove_profile(name, this.userService.token, false).subscribe(value => { - this.retrieveProfiles() - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_profile(name, this.userService.token, false) + .subscribe( + (value) => { + this.retrieveProfiles(); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.html b/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.html index 957ae8cb..ced76ba0 100644 --- a/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.html +++ b/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.html @@ -6,28 +6,28 @@

Name: {{ name }}

mat-icon-button (click)="this.refreshData()" matTooltip="Refresh data" - >refresh + > + refresh + - + - + + > + delete + @@ -35,79 +35,108 @@

Name: {{ name }}

Name - + UID - + Last modified time - + Creation time - + Depth - + - Is Subobject? + Is Subobject? Comment - + Operating System Version - + Operating System Breed - + Mirror - + Mirror Type - + Proxy - + Priority - + - Keep updated? - Mirror Locally? + Keep updated? + Mirror Locally? - + - + - + Createrepo Flags - + - + - + - + @if (isEditMode) { } - diff --git a/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.scss b/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.scss index 2a9efa5d..737cd844 100644 --- a/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.scss +++ b/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.scss @@ -27,4 +27,3 @@ .form-field-full-width { width: 100%; } - diff --git a/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.spec.ts b/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.spec.ts index 546d224a..8d051692 100644 --- a/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.spec.ts @@ -1,9 +1,9 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {ActivatedRoute, provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ActivatedRoute, provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { RepositoryEditComponent } from './repository-edit.component'; @@ -13,31 +13,27 @@ describe('RepositoryEditComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - RepositoryEditComponent, - NoopAnimationsModule, - ], + imports: [RepositoryEditComponent, NoopAnimationsModule], providers: [ provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, { provide: ActivatedRoute, useValue: { snapshot: { paramMap: { - get: () => "testrepository" + get: () => 'testrepository', }, }, }, }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(RepositoryEditComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.ts b/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.ts index b50facea..2ac8c371 100644 --- a/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.ts +++ b/projects/cobbler-frontend/src/app/items/repository/edit/repository-edit.component.ts @@ -1,19 +1,24 @@ -import {Component, inject, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatOption} from '@angular/material/autocomplete'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; -import {MatSelect} from '@angular/material/select'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {MatTooltip} from '@angular/material/tooltip'; -import {ActivatedRoute, Router} from '@angular/router'; -import {CobblerApiService, Repo} from 'cobbler-api'; -import {KeyValueEditorComponent} from '../../../common/key-value-editor/key-value-editor.component'; -import {MultiSelectComponent} from '../../../common/multi-select/multi-select.component'; -import {UserService} from '../../../services/user.service'; +import { Component, inject, OnInit } from '@angular/core'; +import { + FormBuilder, + FormControl, + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { MatOption } from '@angular/material/autocomplete'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; +import { MatSelect } from '@angular/material/select'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatTooltip } from '@angular/material/tooltip'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CobblerApiService, Repo } from 'cobbler-api'; +import { KeyValueEditorComponent } from '../../../common/key-value-editor/key-value-editor.component'; +import { MultiSelectComponent } from '../../../common/multi-select/multi-select.component'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-edit', @@ -32,41 +37,41 @@ import {UserService} from '../../../services/user.service'; MatTooltip, ReactiveFormsModule, MultiSelectComponent, - KeyValueEditorComponent + KeyValueEditorComponent, ], templateUrl: './repository-edit.component.html', - styleUrl: './repository-edit.component.scss' + styleUrl: './repository-edit.component.scss', }) export class RepositoryEditComponent implements OnInit { name: string; repository: Repo; private readonly _formBuilder = inject(FormBuilder); repositoryFormGroup = this._formBuilder.group({ - name: new FormControl({value: "", disabled: true}), - uid: new FormControl({value: "", disabled: true}), - mtime: new FormControl({value: "", disabled: true}), - ctime: new FormControl({value: "", disabled: true}), - depth: new FormControl({value: 0, disabled: true}), - priority: new FormControl({value: 0, disabled: true}), - is_subobject: new FormControl({value: false, disabled: true}), - keep_updated: new FormControl({value: false, disabled: true}), - mirror_locally: new FormControl({value: false, disabled: true}), - comment: new FormControl({value: "", disabled: true}), - redhat_management_key: new FormControl({value: "", disabled: true}), - mirror_type: new FormControl({value: "", disabled: true}), - mirror: new FormControl({value: "", disabled: true}), - breed: new FormControl({value: "", disabled: true}), - os_version: new FormControl({value: "", disabled: true}), - proxy: new FormControl({value: "", disabled: true}), - createrepo_flags: new FormControl({value: "", disabled: true}), - owners: new FormControl({value: [], disabled: true}), - owners_inherited: new FormControl({value: false, disabled: true}), - apt_components: new FormControl({value: [], disabled: true}), - apt_dists: new FormControl({value: [], disabled: true}), - rpm_list: new FormControl({value: [], disabled: true}), - environment: new FormControl({value: {}, disabled: true}), - yumopts: new FormControl({value: {}, disabled: true}), - rsyncopts: new FormControl({value: {}, disabled: true}), + name: new FormControl({ value: '', disabled: true }), + uid: new FormControl({ value: '', disabled: true }), + mtime: new FormControl({ value: '', disabled: true }), + ctime: new FormControl({ value: '', disabled: true }), + depth: new FormControl({ value: 0, disabled: true }), + priority: new FormControl({ value: 0, disabled: true }), + is_subobject: new FormControl({ value: false, disabled: true }), + keep_updated: new FormControl({ value: false, disabled: true }), + mirror_locally: new FormControl({ value: false, disabled: true }), + comment: new FormControl({ value: '', disabled: true }), + redhat_management_key: new FormControl({ value: '', disabled: true }), + mirror_type: new FormControl({ value: '', disabled: true }), + mirror: new FormControl({ value: '', disabled: true }), + breed: new FormControl({ value: '', disabled: true }), + os_version: new FormControl({ value: '', disabled: true }), + proxy: new FormControl({ value: '', disabled: true }), + createrepo_flags: new FormControl({ value: '', disabled: true }), + owners: new FormControl({ value: [], disabled: true }), + owners_inherited: new FormControl({ value: false, disabled: true }), + apt_components: new FormControl({ value: [], disabled: true }), + apt_dists: new FormControl({ value: [], disabled: true }), + rpm_list: new FormControl({ value: [], disabled: true }), + environment: new FormControl({ value: {}, disabled: true }), + yumopts: new FormControl({ value: {}, disabled: true }), + rsyncopts: new FormControl({ value: {}, disabled: true }), }); isEditMode: boolean = false; @@ -77,76 +82,133 @@ export class RepositoryEditComponent implements OnInit { private _snackBar: MatSnackBar, private router: Router, ) { - this.name = this.route.snapshot.paramMap.get("name"); + this.name = this.route.snapshot.paramMap.get('name'); } ngOnInit(): void { - this.refreshData() + this.refreshData(); } refreshData(): void { - this.cobblerApiService.get_repo(this.name, false, false, this.userService.token).subscribe(value => { - this.repository = value - this.repositoryFormGroup.controls.name.setValue(this.repository.name) - this.repositoryFormGroup.controls.uid.setValue(this.repository.uid) - this.repositoryFormGroup.controls.mtime.setValue(new Date(this.repository.mtime * 1000).toString()) - this.repositoryFormGroup.controls.ctime.setValue(new Date(this.repository.ctime * 1000).toString()) - this.repositoryFormGroup.controls.depth.setValue(this.repository.depth) - this.repositoryFormGroup.controls.priority.setValue(this.repository.priority) - this.repositoryFormGroup.controls.is_subobject.setValue(this.repository.is_subobject) - this.repositoryFormGroup.controls.keep_updated.setValue(this.repository.keep_updated) - this.repositoryFormGroup.controls.mirror_locally.setValue(this.repository.mirror_locally) - this.repositoryFormGroup.controls.comment.setValue(this.repository.comment) - this.repositoryFormGroup.controls.proxy.setValue(this.repository.proxy) - this.repositoryFormGroup.controls.mirror_type.setValue(this.repository.mirror_type) - this.repositoryFormGroup.controls.mirror.setValue(this.repository.mirror) - this.repositoryFormGroup.controls.breed.setValue(this.repository.breed) - this.repositoryFormGroup.controls.os_version.setValue(this.repository.os_version) - this.repositoryFormGroup.controls.createrepo_flags.setValue(this.repository.createrepo_flags) - this.repositoryFormGroup.controls.rpm_list.setValue(this.repository.rpm_list) - this.repositoryFormGroup.controls.apt_dists.setValue(this.repository.apt_dists) - this.repositoryFormGroup.controls.apt_components.setValue(this.repository.apt_components) - if (typeof this.repository.owners === "string") { - this.repositoryFormGroup.controls.owners_inherited.setValue(true) - } else { - this.repositoryFormGroup.controls.owners_inherited.setValue(false) - this.repositoryFormGroup.controls.owners.setValue(this.repository.owners) - } - this.repositoryFormGroup.controls.environment.setValue(this.repository.environment) - this.repositoryFormGroup.controls.yumopts.setValue(this.repository.yumopts) - this.repositoryFormGroup.controls.rsyncopts.setValue(this.repository.rsyncopts) - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .get_repo(this.name, false, false, this.userService.token) + .subscribe( + (value) => { + this.repository = value; + this.repositoryFormGroup.controls.name.setValue(this.repository.name); + this.repositoryFormGroup.controls.uid.setValue(this.repository.uid); + this.repositoryFormGroup.controls.mtime.setValue( + new Date(this.repository.mtime * 1000).toString(), + ); + this.repositoryFormGroup.controls.ctime.setValue( + new Date(this.repository.ctime * 1000).toString(), + ); + this.repositoryFormGroup.controls.depth.setValue( + this.repository.depth, + ); + this.repositoryFormGroup.controls.priority.setValue( + this.repository.priority, + ); + this.repositoryFormGroup.controls.is_subobject.setValue( + this.repository.is_subobject, + ); + this.repositoryFormGroup.controls.keep_updated.setValue( + this.repository.keep_updated, + ); + this.repositoryFormGroup.controls.mirror_locally.setValue( + this.repository.mirror_locally, + ); + this.repositoryFormGroup.controls.comment.setValue( + this.repository.comment, + ); + this.repositoryFormGroup.controls.proxy.setValue( + this.repository.proxy, + ); + this.repositoryFormGroup.controls.mirror_type.setValue( + this.repository.mirror_type, + ); + this.repositoryFormGroup.controls.mirror.setValue( + this.repository.mirror, + ); + this.repositoryFormGroup.controls.breed.setValue( + this.repository.breed, + ); + this.repositoryFormGroup.controls.os_version.setValue( + this.repository.os_version, + ); + this.repositoryFormGroup.controls.createrepo_flags.setValue( + this.repository.createrepo_flags, + ); + this.repositoryFormGroup.controls.rpm_list.setValue( + this.repository.rpm_list, + ); + this.repositoryFormGroup.controls.apt_dists.setValue( + this.repository.apt_dists, + ); + this.repositoryFormGroup.controls.apt_components.setValue( + this.repository.apt_components, + ); + if (typeof this.repository.owners === 'string') { + this.repositoryFormGroup.controls.owners_inherited.setValue(true); + } else { + this.repositoryFormGroup.controls.owners_inherited.setValue(false); + this.repositoryFormGroup.controls.owners.setValue( + this.repository.owners, + ); + } + this.repositoryFormGroup.controls.environment.setValue( + this.repository.environment, + ); + this.repositoryFormGroup.controls.yumopts.setValue( + this.repository.yumopts, + ); + this.repositoryFormGroup.controls.rsyncopts.setValue( + this.repository.rsyncopts, + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } removeRepository(): void { - this.cobblerApiService.remove_repo(this.name, this.userService.token, false).subscribe(value => { - if (value) { - this.router.navigate(["/items", "repository"]) - } - // HTML encode the error message since it originates from XML - this._snackBar.open("Delete failed! Check server logs for more information.", 'Close'); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_repo(this.name, this.userService.token, false) + .subscribe( + (value) => { + if (value) { + this.router.navigate(['/items', 'repository']); + } + // HTML encode the error message since it originates from XML + this._snackBar.open( + 'Delete failed! Check server logs for more information.', + 'Close', + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } editRepository(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } copyRepository(): void { - this.cobblerApiService.copy_repo("", "", this.userService.token) - .subscribe(value => { + this.cobblerApiService.copy_repo('', '', this.userService.token).subscribe( + (value) => { // TODO - }, error => { + }, + (error) => { // HTML encode the error message since it originates from XML this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + }, + ); } saveRepository(): void { @@ -155,36 +217,37 @@ export class RepositoryEditComponent implements OnInit { get repositoryOwners(): string[] { if (this.repository && this.repository.owners) { - const ownersResult = this.repository.owners + const ownersResult = this.repository.owners; if (typeof ownersResult !== 'string') { return ownersResult; } } - return [] + return []; } get repositoryYumopts(): object { if (this.repository && this.repository.yumopts) { - const yumoptsResult = this.repository.yumopts + const yumoptsResult = this.repository.yumopts; if (typeof yumoptsResult !== 'string') { - return yumoptsResult + return yumoptsResult; } } - return {} + return {}; } get repositoryRsyncopts(): object { if (this.repository && this.repository.rsyncopts) { - const rsyncoptsResult = this.repository.rsyncopts + const rsyncoptsResult = this.repository.rsyncopts; if (typeof rsyncoptsResult !== 'string') { - return rsyncoptsResult + return rsyncoptsResult; } } - return {} + return {}; } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.html b/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.html index f616ff95..95485897 100644 --- a/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.html +++ b/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.html @@ -4,35 +4,46 @@

REPOSITORIES

Name - {{element.name}} + {{ element.name }} Breed - {{element.breed}} + {{ element.breed }} Mirror Type - {{element.mirror_type}} + {{ element.mirror_type }} - + - - - @@ -41,6 +52,5 @@

REPOSITORIES

- + - diff --git a/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.spec.ts b/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.spec.ts index 13c93d1c..5ad99e64 100644 --- a/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.spec.ts @@ -1,8 +1,8 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { RepositoryOverviewComponent } from './repository-overview.component'; @@ -19,11 +19,10 @@ describe('RepositoryOverviewComponent', () => { provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(RepositoryOverviewComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.ts b/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.ts index 136fae32..a7dc8800 100644 --- a/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.ts +++ b/projects/cobbler-frontend/src/app/items/repository/overview/repository-overview.component.ts @@ -1,20 +1,23 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; -import {MatIconButton} from '@angular/material/button'; -import {MatIcon} from '@angular/material/icon'; -import {MatMenu, MatMenuItem, MatMenuTrigger} from '@angular/material/menu'; -import {MatSnackBar} from '@angular/material/snack-bar'; +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatIconButton } from '@angular/material/button'; +import { MatIcon } from '@angular/material/icon'; +import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu'; +import { MatSnackBar } from '@angular/material/snack-bar'; import { MatCell, MatCellDef, MatColumnDef, - MatHeaderCell, MatHeaderCellDef, + MatHeaderCell, + MatHeaderCellDef, MatHeaderRow, MatHeaderRowDef, - MatRow, MatRowDef, MatTable + MatRow, + MatRowDef, + MatTable, } from '@angular/material/table'; -import {Router} from '@angular/router'; -import {CobblerApiService, Repo} from 'cobbler-api'; -import {UserService} from '../../../services/user.service'; +import { Router } from '@angular/router'; +import { CobblerApiService, Repo } from 'cobbler-api'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-overview', @@ -34,13 +37,13 @@ import {UserService} from '../../../services/user.service'; MatRowDef, MatTable, MatHeaderCellDef, - MatMenuTrigger + MatMenuTrigger, ], templateUrl: './repository-overview.component.html', - styleUrl: './repository-overview.component.scss' + styleUrl: './repository-overview.component.scss', }) export class RepositoryOverviewComponent implements OnInit { - displayedColumns: string[] = ['name', "breed", "mirror_type", "actions"]; + displayedColumns: string[] = ['name', 'breed', 'mirror_type', 'actions']; dataSource: Array = []; @ViewChild(MatTable) table: MatTable; @@ -50,24 +53,26 @@ export class RepositoryOverviewComponent implements OnInit { private cobblerApiService: CobblerApiService, private _snackBar: MatSnackBar, private router: Router, - ) { - } + ) {} ngOnInit(): void { - this.retrieveRepositories() + this.retrieveRepositories(); } private retrieveRepositories(): void { - this.cobblerApiService.get_repos().subscribe(value => { - this.dataSource = value - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService.get_repos().subscribe( + (value) => { + this.dataSource = value; + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } showRepository(uid: string, name: string): void { - this.router.navigate(["/items", "repository", name]) + this.router.navigate(['/items', 'repository', name]); } editRepository(uid: string, name: string): void { @@ -75,16 +80,22 @@ export class RepositoryOverviewComponent implements OnInit { } deleteRepository(uid: string, name: string): void { - this.cobblerApiService.remove_repo(name, this.userService.token, false).subscribe(value => { - this.retrieveRepositories() - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_repo(name, this.userService.token, false) + .subscribe( + (value) => { + this.retrieveRepositories(); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.html b/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.html index ff11f0f7..63f78664 100644 --- a/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.html +++ b/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.html @@ -6,28 +6,28 @@

Name: {{ name }}

mat-icon-button (click)="this.refreshData()" matTooltip="Refresh data" - >refresh + > + refresh + - + - + + > + delete + @@ -41,4 +41,3 @@

Name: {{ name }}

} - diff --git a/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.scss b/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.scss index 2a9efa5d..737cd844 100644 --- a/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.scss +++ b/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.scss @@ -27,4 +27,3 @@ .form-field-full-width { width: 100%; } - diff --git a/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.spec.ts b/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.spec.ts index 46395828..e15f3874 100644 --- a/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.spec.ts @@ -1,9 +1,9 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {ActivatedRoute, provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ActivatedRoute, provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { SnippetEditComponent } from './snippet-edit.component'; @@ -13,31 +13,27 @@ describe('SnippetEditComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - SnippetEditComponent, - NoopAnimationsModule, - ], + imports: [SnippetEditComponent, NoopAnimationsModule], providers: [ provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, { provide: ActivatedRoute, useValue: { snapshot: { paramMap: { - get: () => "testsnippet" + get: () => 'testsnippet', }, }, }, }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(SnippetEditComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.ts b/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.ts index 140928cb..151908e7 100644 --- a/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.ts +++ b/projects/cobbler-frontend/src/app/items/snippet/edit/snippet-edit.component.ts @@ -1,17 +1,22 @@ -import {Component, inject, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatOption} from '@angular/material/autocomplete'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; -import {MatSelect} from '@angular/material/select'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {MatTooltip} from '@angular/material/tooltip'; -import {ActivatedRoute, Router} from '@angular/router'; -import {CobblerApiService, Profile} from 'cobbler-api'; -import {UserService} from '../../../services/user.service'; +import { Component, inject, OnInit } from '@angular/core'; +import { + FormBuilder, + FormControl, + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { MatOption } from '@angular/material/autocomplete'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; +import { MatSelect } from '@angular/material/select'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatTooltip } from '@angular/material/tooltip'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CobblerApiService } from 'cobbler-api'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-edit', @@ -28,17 +33,17 @@ import {UserService} from '../../../services/user.service'; MatOption, MatSelect, MatTooltip, - ReactiveFormsModule + ReactiveFormsModule, ], templateUrl: './snippet-edit.component.html', - styleUrl: './snippet-edit.component.scss' + styleUrl: './snippet-edit.component.scss', }) export class SnippetEditComponent implements OnInit { name: string; content: string; private readonly _formBuilder = inject(FormBuilder); snippetFormGroup = this._formBuilder.group({ - content: new FormControl({value: "", disabled: true}), + content: new FormControl({ value: '', disabled: true }), }); isEditMode: boolean = false; @@ -49,58 +54,79 @@ export class SnippetEditComponent implements OnInit { private _snackBar: MatSnackBar, private router: Router, ) { - this.name = this.route.snapshot.paramMap.get("name"); + this.name = this.route.snapshot.paramMap.get('name'); } ngOnInit(): void { - this.refreshData() + this.refreshData(); } refreshData(): void { - this.cobblerApiService.read_autoinstall_snippet(this.name, this.userService.token).subscribe(value => { - this.content = value; - this.snippetFormGroup.controls.content.setValue(this.toHTML(this.content)); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .read_autoinstall_snippet(this.name, this.userService.token) + .subscribe( + (value) => { + this.content = value; + this.snippetFormGroup.controls.content.setValue( + this.toHTML(this.content), + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } removeSnippet(): void { - this.cobblerApiService.remove_autoinstall_snippet(this.name, this.userService.token).subscribe(value => { - if (value) { - this.router.navigate(["/items", "profile"]) - } - // HTML encode the error message since it originates from XML - this._snackBar.open("Delete failed! Check server logs for more information.", 'Close'); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_autoinstall_snippet(this.name, this.userService.token) + .subscribe( + (value) => { + if (value) { + this.router.navigate(['/items', 'profile']); + } + // HTML encode the error message since it originates from XML + this._snackBar.open( + 'Delete failed! Check server logs for more information.', + 'Close', + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } editSnippet(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } copySnippet(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } saveSnippet(): void { // TODO - this.cobblerApiService.write_autoinstall_snippet(this.name, "", this.userService.token).subscribe(value => { - // TODO - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .write_autoinstall_snippet(this.name, '', this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/snippet/overview/snippet-overview.component.html b/projects/cobbler-frontend/src/app/items/snippet/overview/snippet-overview.component.html index 038301c1..71d7a295 100644 --- a/projects/cobbler-frontend/src/app/items/snippet/overview/snippet-overview.component.html +++ b/projects/cobbler-frontend/src/app/items/snippet/overview/snippet-overview.component.html @@ -4,13 +4,15 @@

SNIPPETS

Name - {{element}} + {{ element }} - + + > + refresh + - + - + - + @@ -38,195 +34,274 @@

Name: {{ name }}

Name - + UID - + Last modified time - + Creation time - + Depth - + - Is Subobject? + Is Subobject? - - Inherited + + Inherited Comment - - - IPv6 Auto Configuration? - Repositories enabled? - Network boot enabled? - VM auto boot? - VM PXE boot? + + + IPv6 Auto Configuration? + Repositories enabled? + Network boot enabled? + VM auto boot? + VM PXE boot? Autoinstall - + Parent - + Gateway - + Hostname - + Image - + IPv6 Default Device - + Next Server IPv4 - + Next Server IPv6 - + DHCP Filename - + Power Address - + Power ID - + Power Password - + Power Type - + Power Username - + Power Options - + Power Identity File - + Profile - + Proxy - + RedHat Management Key - + Server - + Status - + VM Disk Driver - + VM Path - + VM Type - + VM CPUs - + VM File Size - + VM RAM - + Serial Device - + Serial Baud Rate - + - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited - - Inherited + + Inherited - + - + - + Inherited - - Inherited + + Inherited @if (isEditMode) { diff --git a/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.scss b/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.scss index 2a9efa5d..737cd844 100644 --- a/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.scss +++ b/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.scss @@ -27,4 +27,3 @@ .form-field-full-width { width: 100%; } - diff --git a/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.spec.ts b/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.spec.ts index 848c1bf8..d8433e16 100644 --- a/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.spec.ts @@ -1,9 +1,9 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {ActivatedRoute, provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ActivatedRoute, provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { SystemEditComponent } from './system-edit.component'; @@ -13,31 +13,27 @@ describe('SystemEditComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - SystemEditComponent, - NoopAnimationsModule, - ], + imports: [SystemEditComponent, NoopAnimationsModule], providers: [ provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, { provide: ActivatedRoute, useValue: { snapshot: { paramMap: { - get: () => "testsystem" + get: () => 'testsystem', }, }, }, }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(SystemEditComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.ts b/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.ts index 6d29cf31..bf379b49 100644 --- a/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.ts +++ b/projects/cobbler-frontend/src/app/items/system/edit/system-edit.component.ts @@ -1,19 +1,24 @@ -import {Component, inject, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatOption} from '@angular/material/autocomplete'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; -import {MatSelect} from '@angular/material/select'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {MatTooltip} from '@angular/material/tooltip'; -import {ActivatedRoute, Router} from '@angular/router'; -import {CobblerApiService, System} from 'cobbler-api'; -import {KeyValueEditorComponent} from '../../../common/key-value-editor/key-value-editor.component'; -import {MultiSelectComponent} from '../../../common/multi-select/multi-select.component'; -import {UserService} from '../../../services/user.service'; +import { Component, inject, OnInit } from '@angular/core'; +import { + FormBuilder, + FormControl, + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { MatOption } from '@angular/material/autocomplete'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; +import { MatSelect } from '@angular/material/select'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatTooltip } from '@angular/material/tooltip'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CobblerApiService, System } from 'cobbler-api'; +import { KeyValueEditorComponent } from '../../../common/key-value-editor/key-value-editor.component'; +import { MultiSelectComponent } from '../../../common/multi-select/multi-select.component'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-edit', @@ -32,79 +37,91 @@ import {UserService} from '../../../services/user.service'; MatTooltip, ReactiveFormsModule, MultiSelectComponent, - KeyValueEditorComponent + KeyValueEditorComponent, ], templateUrl: './system-edit.component.html', - styleUrl: './system-edit.component.scss' + styleUrl: './system-edit.component.scss', }) export class SystemEditComponent implements OnInit { name: string; system: System; private readonly _formBuilder = inject(FormBuilder); systemFormGroup = this._formBuilder.group({ - name: new FormControl({value: "", disabled: true}), - uid: new FormControl({value: "", disabled: true}), - mtime: new FormControl({value: "", disabled: true}), - ctime: new FormControl({value: "", disabled: true}), - depth: new FormControl({value: 0, disabled: true}), - virt_cpus: new FormControl({value: 0, disabled: true}), - virt_file_size: new FormControl({value: 0, disabled: true}), - virt_ram: new FormControl({value: 0, disabled: true}), - serial_device: new FormControl({value: 0, disabled: true}), - serial_baud_rate: new FormControl({value: 0, disabled: true}), - is_subobject: new FormControl({value: false, disabled: true}), - comment: new FormControl({value: "", disabled: true}), - redhat_management_key: new FormControl({value: "", disabled: true}), - autoinstall: new FormControl({value: "", disabled: true}), - parent: new FormControl({value: "", disabled: true}), - gateway: new FormControl({value: "", disabled: true}), - hostname: new FormControl({value: "", disabled: true}), - image: new FormControl({value: "", disabled: true}), - ipv6_default_device: new FormControl({value: "", disabled: true}), - next_server_v4: new FormControl({value: "", disabled: true}), - next_server_v6: new FormControl({value: "", disabled: true}), - filename: new FormControl({value: "", disabled: true}), - power_address: new FormControl({value: "", disabled: true}), - power_id: new FormControl({value: "", disabled: true}), - power_pass: new FormControl({value: "", disabled: true}), - power_type: new FormControl({value: "", disabled: true}), - power_user: new FormControl({value: "", disabled: true}), - power_options: new FormControl({value: "", disabled: true}), - power_identity_file: new FormControl({value: "", disabled: true}), - profile: new FormControl({value: "", disabled: true}), - proxy: new FormControl({value: "", disabled: true}), - server: new FormControl({value: "", disabled: true}), - status: new FormControl({value: "", disabled: true}), - virt_disk_driver: new FormControl({value: "", disabled: true}), - virt_path: new FormControl({value: "", disabled: true}), - virt_type: new FormControl({value: "", disabled: true}), - boot_loaders: new FormControl({value: [], disabled: true}), - bootloader_inherited: new FormControl({value: false, disabled: true}), - ipv6_autoconfiguration: new FormControl({value: false, disabled: true}), - repos_enabled: new FormControl({value: false, disabled: true}), - netboot_enabled: new FormControl({value: false, disabled: true}), - virt_auto_boot: new FormControl({value: false, disabled: true}), - virt_pxe_boot: new FormControl({value: false, disabled: true}), - owners: new FormControl({value: [], disabled: true}), - owners_inherited: new FormControl({value: false, disabled: true}), - boot_files: new FormControl({value: {}, disabled: true}), - boot_files_inherited: new FormControl({value: false, disabled: true}), - fetchable_files: new FormControl({value: {}, disabled: true}), - fetchable_files_inherited: new FormControl({value: false, disabled: true}), - kernel_options: new FormControl({value: {}, disabled: true}), - kernel_options_inherited: new FormControl({value: false, disabled: true}), - kernel_options_post: new FormControl({value: {}, disabled: true}), - kernel_options_post_inherited: new FormControl({value: false, disabled: true}), - mgmt_classes: new FormControl({value: [], disabled: true}), - mgmt_classes_inherited: new FormControl({value: false, disabled: true}), - mgmt_parameters: new FormControl({value: {}, disabled: true}), - mgmt_parameters_inherited: new FormControl({value: false, disabled: true}), - template_files: new FormControl({value: {}, disabled: true}), - template_files_inherited: new FormControl({value: false, disabled: true}), - autoinstall_meta: new FormControl({value: {}, disabled: true}), - autoinstall_meta_inherited: new FormControl({value: false, disabled: true}), - name_servers: new FormControl({value: [], disabled: true}), - name_servers_search: new FormControl({value: [], disabled: true}), + name: new FormControl({ value: '', disabled: true }), + uid: new FormControl({ value: '', disabled: true }), + mtime: new FormControl({ value: '', disabled: true }), + ctime: new FormControl({ value: '', disabled: true }), + depth: new FormControl({ value: 0, disabled: true }), + virt_cpus: new FormControl({ value: 0, disabled: true }), + virt_file_size: new FormControl({ value: 0, disabled: true }), + virt_ram: new FormControl({ value: 0, disabled: true }), + serial_device: new FormControl({ value: 0, disabled: true }), + serial_baud_rate: new FormControl({ value: 0, disabled: true }), + is_subobject: new FormControl({ value: false, disabled: true }), + comment: new FormControl({ value: '', disabled: true }), + redhat_management_key: new FormControl({ value: '', disabled: true }), + autoinstall: new FormControl({ value: '', disabled: true }), + parent: new FormControl({ value: '', disabled: true }), + gateway: new FormControl({ value: '', disabled: true }), + hostname: new FormControl({ value: '', disabled: true }), + image: new FormControl({ value: '', disabled: true }), + ipv6_default_device: new FormControl({ value: '', disabled: true }), + next_server_v4: new FormControl({ value: '', disabled: true }), + next_server_v6: new FormControl({ value: '', disabled: true }), + filename: new FormControl({ value: '', disabled: true }), + power_address: new FormControl({ value: '', disabled: true }), + power_id: new FormControl({ value: '', disabled: true }), + power_pass: new FormControl({ value: '', disabled: true }), + power_type: new FormControl({ value: '', disabled: true }), + power_user: new FormControl({ value: '', disabled: true }), + power_options: new FormControl({ value: '', disabled: true }), + power_identity_file: new FormControl({ value: '', disabled: true }), + profile: new FormControl({ value: '', disabled: true }), + proxy: new FormControl({ value: '', disabled: true }), + server: new FormControl({ value: '', disabled: true }), + status: new FormControl({ value: '', disabled: true }), + virt_disk_driver: new FormControl({ value: '', disabled: true }), + virt_path: new FormControl({ value: '', disabled: true }), + virt_type: new FormControl({ value: '', disabled: true }), + boot_loaders: new FormControl({ value: [], disabled: true }), + bootloader_inherited: new FormControl({ value: false, disabled: true }), + ipv6_autoconfiguration: new FormControl({ value: false, disabled: true }), + repos_enabled: new FormControl({ value: false, disabled: true }), + netboot_enabled: new FormControl({ value: false, disabled: true }), + virt_auto_boot: new FormControl({ value: false, disabled: true }), + virt_pxe_boot: new FormControl({ value: false, disabled: true }), + owners: new FormControl({ value: [], disabled: true }), + owners_inherited: new FormControl({ value: false, disabled: true }), + boot_files: new FormControl({ value: {}, disabled: true }), + boot_files_inherited: new FormControl({ value: false, disabled: true }), + fetchable_files: new FormControl({ value: {}, disabled: true }), + fetchable_files_inherited: new FormControl({ + value: false, + disabled: true, + }), + kernel_options: new FormControl({ value: {}, disabled: true }), + kernel_options_inherited: new FormControl({ value: false, disabled: true }), + kernel_options_post: new FormControl({ value: {}, disabled: true }), + kernel_options_post_inherited: new FormControl({ + value: false, + disabled: true, + }), + mgmt_classes: new FormControl({ value: [], disabled: true }), + mgmt_classes_inherited: new FormControl({ value: false, disabled: true }), + mgmt_parameters: new FormControl({ value: {}, disabled: true }), + mgmt_parameters_inherited: new FormControl({ + value: false, + disabled: true, + }), + template_files: new FormControl({ value: {}, disabled: true }), + template_files_inherited: new FormControl({ value: false, disabled: true }), + autoinstall_meta: new FormControl({ value: {}, disabled: true }), + autoinstall_meta_inherited: new FormControl({ + value: false, + disabled: true, + }), + name_servers: new FormControl({ value: [], disabled: true }), + name_servers_search: new FormControl({ value: [], disabled: true }), }); isEditMode: boolean = false; @@ -115,159 +132,278 @@ export class SystemEditComponent implements OnInit { private _snackBar: MatSnackBar, private router: Router, ) { - this.name = this.route.snapshot.paramMap.get("name"); + this.name = this.route.snapshot.paramMap.get('name'); } ngOnInit(): void { - this.refreshData() + this.refreshData(); } refreshData(): void { - this.cobblerApiService.get_system(this.name, false, false, this.userService.token).subscribe(value => { - this.system = value - this.systemFormGroup.controls.name.setValue(this.system.name) - this.systemFormGroup.controls.uid.setValue(this.system.uid) - this.systemFormGroup.controls.mtime.setValue(new Date(this.system.mtime * 1000).toString()) - this.systemFormGroup.controls.ctime.setValue(new Date(this.system.ctime * 1000).toString()) - this.systemFormGroup.controls.depth.setValue(this.system.depth) - if (typeof this.system.virt_cpus !== "string") { - this.systemFormGroup.controls.virt_cpus.setValue(this.system.virt_cpus) - } - if (typeof this.system.virt_file_size !== "string") { - this.systemFormGroup.controls.virt_file_size.setValue(this.system.virt_file_size) - } - if (typeof this.system.virt_ram !== "string") { - this.systemFormGroup.controls.virt_ram.setValue(this.system.virt_ram) - } - this.systemFormGroup.controls.serial_device.setValue(this.system.serial_device) - this.systemFormGroup.controls.serial_baud_rate.setValue(this.system.serial_baud_rate) - this.systemFormGroup.controls.is_subobject.setValue(this.system.is_subobject) - this.systemFormGroup.controls.ipv6_autoconfiguration.setValue(this.system.ipv6_autoconfiguration) - this.systemFormGroup.controls.repos_enabled.setValue(this.system.repos_enabled) - this.systemFormGroup.controls.netboot_enabled.setValue(this.system.netboot_enabled) - if (typeof this.system.virt_auto_boot !== "string") { - // TODO: Show inheritance if string - this.systemFormGroup.controls.virt_auto_boot.setValue(this.system.virt_auto_boot) - } - this.systemFormGroup.controls.virt_pxe_boot.setValue(this.system.virt_pxe_boot) - this.systemFormGroup.controls.redhat_management_key.setValue(this.system.redhat_management_key) - this.systemFormGroup.controls.autoinstall.setValue(this.system.autoinstall) - this.systemFormGroup.controls.parent.setValue(this.system.parent) - this.systemFormGroup.controls.gateway.setValue(this.system.gateway) - this.systemFormGroup.controls.hostname.setValue(this.system.hostname) - this.systemFormGroup.controls.image.setValue(this.system.image) - this.systemFormGroup.controls.ipv6_default_device.setValue(this.system.ipv6_default_device) - this.systemFormGroup.controls.next_server_v4.setValue(this.system.next_server_v4) - this.systemFormGroup.controls.next_server_v6.setValue(this.system.next_server_v6) - this.systemFormGroup.controls.filename.setValue(this.system.filename) - this.systemFormGroup.controls.power_address.setValue(this.system.power_address) - this.systemFormGroup.controls.power_id.setValue(this.system.power_id) - this.systemFormGroup.controls.power_pass.setValue(this.system.power_pass) - this.systemFormGroup.controls.power_type.setValue(this.system.power_type) - this.systemFormGroup.controls.power_user.setValue(this.system.power_user) - this.systemFormGroup.controls.power_options.setValue(this.system.power_options) - this.systemFormGroup.controls.power_identity_file.setValue(this.system.power_identity_file) - this.systemFormGroup.controls.profile.setValue(this.system.profile) - this.systemFormGroup.controls.proxy.setValue(this.system.proxy) - this.systemFormGroup.controls.server.setValue(this.system.server) - this.systemFormGroup.controls.status.setValue(this.system.status) - this.systemFormGroup.controls.virt_disk_driver.setValue(this.system.virt_disk_driver) - this.systemFormGroup.controls.virt_path.setValue(this.system.virt_path) - this.systemFormGroup.controls.virt_type.setValue(this.system.virt_type) - this.systemFormGroup.controls.name_servers.setValue(this.system.name_servers) - this.systemFormGroup.controls.name_servers_search.setValue(this.system.name_servers_search) - if (typeof this.system.boot_loaders === "string") { - this.systemFormGroup.controls.bootloader_inherited.setValue(true) - } else { - this.systemFormGroup.controls.bootloader_inherited.setValue(false) - this.systemFormGroup.controls.boot_loaders.setValue(this.system.boot_loaders) - } - if (typeof this.system.owners === "string") { - this.systemFormGroup.controls.owners_inherited.setValue(true) - } else { - this.systemFormGroup.controls.owners_inherited.setValue(false) - this.systemFormGroup.controls.owners.setValue(this.system.owners) - } - if (typeof this.system.boot_files === "string") { - this.systemFormGroup.controls.boot_files_inherited.setValue(true) - } else { - this.systemFormGroup.controls.boot_files_inherited.setValue(false) - this.systemFormGroup.controls.boot_files.setValue(this.system.boot_files) - } - if (typeof this.system.fetchable_files === "string") { - this.systemFormGroup.controls.fetchable_files_inherited.setValue(true) - } else { - this.systemFormGroup.controls.fetchable_files_inherited.setValue(false) - this.systemFormGroup.controls.fetchable_files.setValue(this.system.fetchable_files) - } - if (typeof this.system.kernel_options === "string") { - this.systemFormGroup.controls.kernel_options_inherited.setValue(true) - } else { - this.systemFormGroup.controls.kernel_options_inherited.setValue(false) - this.systemFormGroup.controls.kernel_options.setValue(this.system.kernel_options) - } - if (typeof this.system.kernel_options_post === "string") { - this.systemFormGroup.controls.kernel_options_post_inherited.setValue(true) - } else { - this.systemFormGroup.controls.kernel_options_post_inherited.setValue(false) - this.systemFormGroup.controls.kernel_options_post.setValue(this.system.kernel_options_post) - } - if (typeof this.system.mgmt_classes === "string") { - this.systemFormGroup.controls.mgmt_classes_inherited.setValue(true) - } else { - this.systemFormGroup.controls.mgmt_classes_inherited.setValue(false) - this.systemFormGroup.controls.mgmt_classes.setValue(this.system.mgmt_classes) - } - if (typeof this.system.mgmt_parameters === "string") { - this.systemFormGroup.controls.mgmt_parameters_inherited.setValue(true) - } else { - this.systemFormGroup.controls.mgmt_parameters_inherited.setValue(false) - this.systemFormGroup.controls.mgmt_parameters.setValue(this.system.mgmt_parameters) - } - if (typeof this.system.template_files === "string") { - this.systemFormGroup.controls.template_files_inherited.setValue(true) - } else { - this.systemFormGroup.controls.template_files_inherited.setValue(false) - this.systemFormGroup.controls.template_files.setValue(this.system.template_files) - } - if (typeof this.system.autoinstall_meta === "string") { - this.systemFormGroup.controls.autoinstall_meta_inherited.setValue(true) - } else { - this.systemFormGroup.controls.autoinstall_meta_inherited.setValue(false) - this.systemFormGroup.controls.autoinstall_meta.setValue(this.system.autoinstall_meta) - } - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .get_system(this.name, false, false, this.userService.token) + .subscribe( + (value) => { + this.system = value; + this.systemFormGroup.controls.name.setValue(this.system.name); + this.systemFormGroup.controls.uid.setValue(this.system.uid); + this.systemFormGroup.controls.mtime.setValue( + new Date(this.system.mtime * 1000).toString(), + ); + this.systemFormGroup.controls.ctime.setValue( + new Date(this.system.ctime * 1000).toString(), + ); + this.systemFormGroup.controls.depth.setValue(this.system.depth); + if (typeof this.system.virt_cpus !== 'string') { + this.systemFormGroup.controls.virt_cpus.setValue( + this.system.virt_cpus, + ); + } + if (typeof this.system.virt_file_size !== 'string') { + this.systemFormGroup.controls.virt_file_size.setValue( + this.system.virt_file_size, + ); + } + if (typeof this.system.virt_ram !== 'string') { + this.systemFormGroup.controls.virt_ram.setValue( + this.system.virt_ram, + ); + } + this.systemFormGroup.controls.serial_device.setValue( + this.system.serial_device, + ); + this.systemFormGroup.controls.serial_baud_rate.setValue( + this.system.serial_baud_rate, + ); + this.systemFormGroup.controls.is_subobject.setValue( + this.system.is_subobject, + ); + this.systemFormGroup.controls.ipv6_autoconfiguration.setValue( + this.system.ipv6_autoconfiguration, + ); + this.systemFormGroup.controls.repos_enabled.setValue( + this.system.repos_enabled, + ); + this.systemFormGroup.controls.netboot_enabled.setValue( + this.system.netboot_enabled, + ); + if (typeof this.system.virt_auto_boot !== 'string') { + // TODO: Show inheritance if string + this.systemFormGroup.controls.virt_auto_boot.setValue( + this.system.virt_auto_boot, + ); + } + this.systemFormGroup.controls.virt_pxe_boot.setValue( + this.system.virt_pxe_boot, + ); + this.systemFormGroup.controls.redhat_management_key.setValue( + this.system.redhat_management_key, + ); + this.systemFormGroup.controls.autoinstall.setValue( + this.system.autoinstall, + ); + this.systemFormGroup.controls.parent.setValue(this.system.parent); + this.systemFormGroup.controls.gateway.setValue(this.system.gateway); + this.systemFormGroup.controls.hostname.setValue(this.system.hostname); + this.systemFormGroup.controls.image.setValue(this.system.image); + this.systemFormGroup.controls.ipv6_default_device.setValue( + this.system.ipv6_default_device, + ); + this.systemFormGroup.controls.next_server_v4.setValue( + this.system.next_server_v4, + ); + this.systemFormGroup.controls.next_server_v6.setValue( + this.system.next_server_v6, + ); + this.systemFormGroup.controls.filename.setValue(this.system.filename); + this.systemFormGroup.controls.power_address.setValue( + this.system.power_address, + ); + this.systemFormGroup.controls.power_id.setValue(this.system.power_id); + this.systemFormGroup.controls.power_pass.setValue( + this.system.power_pass, + ); + this.systemFormGroup.controls.power_type.setValue( + this.system.power_type, + ); + this.systemFormGroup.controls.power_user.setValue( + this.system.power_user, + ); + this.systemFormGroup.controls.power_options.setValue( + this.system.power_options, + ); + this.systemFormGroup.controls.power_identity_file.setValue( + this.system.power_identity_file, + ); + this.systemFormGroup.controls.profile.setValue(this.system.profile); + this.systemFormGroup.controls.proxy.setValue(this.system.proxy); + this.systemFormGroup.controls.server.setValue(this.system.server); + this.systemFormGroup.controls.status.setValue(this.system.status); + this.systemFormGroup.controls.virt_disk_driver.setValue( + this.system.virt_disk_driver, + ); + this.systemFormGroup.controls.virt_path.setValue( + this.system.virt_path, + ); + this.systemFormGroup.controls.virt_type.setValue( + this.system.virt_type, + ); + this.systemFormGroup.controls.name_servers.setValue( + this.system.name_servers, + ); + this.systemFormGroup.controls.name_servers_search.setValue( + this.system.name_servers_search, + ); + if (typeof this.system.boot_loaders === 'string') { + this.systemFormGroup.controls.bootloader_inherited.setValue(true); + } else { + this.systemFormGroup.controls.bootloader_inherited.setValue(false); + this.systemFormGroup.controls.boot_loaders.setValue( + this.system.boot_loaders, + ); + } + if (typeof this.system.owners === 'string') { + this.systemFormGroup.controls.owners_inherited.setValue(true); + } else { + this.systemFormGroup.controls.owners_inherited.setValue(false); + this.systemFormGroup.controls.owners.setValue(this.system.owners); + } + if (typeof this.system.boot_files === 'string') { + this.systemFormGroup.controls.boot_files_inherited.setValue(true); + } else { + this.systemFormGroup.controls.boot_files_inherited.setValue(false); + this.systemFormGroup.controls.boot_files.setValue( + this.system.boot_files, + ); + } + if (typeof this.system.fetchable_files === 'string') { + this.systemFormGroup.controls.fetchable_files_inherited.setValue( + true, + ); + } else { + this.systemFormGroup.controls.fetchable_files_inherited.setValue( + false, + ); + this.systemFormGroup.controls.fetchable_files.setValue( + this.system.fetchable_files, + ); + } + if (typeof this.system.kernel_options === 'string') { + this.systemFormGroup.controls.kernel_options_inherited.setValue( + true, + ); + } else { + this.systemFormGroup.controls.kernel_options_inherited.setValue( + false, + ); + this.systemFormGroup.controls.kernel_options.setValue( + this.system.kernel_options, + ); + } + if (typeof this.system.kernel_options_post === 'string') { + this.systemFormGroup.controls.kernel_options_post_inherited.setValue( + true, + ); + } else { + this.systemFormGroup.controls.kernel_options_post_inherited.setValue( + false, + ); + this.systemFormGroup.controls.kernel_options_post.setValue( + this.system.kernel_options_post, + ); + } + if (typeof this.system.mgmt_classes === 'string') { + this.systemFormGroup.controls.mgmt_classes_inherited.setValue(true); + } else { + this.systemFormGroup.controls.mgmt_classes_inherited.setValue( + false, + ); + this.systemFormGroup.controls.mgmt_classes.setValue( + this.system.mgmt_classes, + ); + } + if (typeof this.system.mgmt_parameters === 'string') { + this.systemFormGroup.controls.mgmt_parameters_inherited.setValue( + true, + ); + } else { + this.systemFormGroup.controls.mgmt_parameters_inherited.setValue( + false, + ); + this.systemFormGroup.controls.mgmt_parameters.setValue( + this.system.mgmt_parameters, + ); + } + if (typeof this.system.template_files === 'string') { + this.systemFormGroup.controls.template_files_inherited.setValue( + true, + ); + } else { + this.systemFormGroup.controls.template_files_inherited.setValue( + false, + ); + this.systemFormGroup.controls.template_files.setValue( + this.system.template_files, + ); + } + if (typeof this.system.autoinstall_meta === 'string') { + this.systemFormGroup.controls.autoinstall_meta_inherited.setValue( + true, + ); + } else { + this.systemFormGroup.controls.autoinstall_meta_inherited.setValue( + false, + ); + this.systemFormGroup.controls.autoinstall_meta.setValue( + this.system.autoinstall_meta, + ); + } + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } removeSystem(): void { - this.cobblerApiService.remove_system(this.name, this.userService.token, false).subscribe(value => { - if (value) { - this.router.navigate(["/items", "system"]) - } - // HTML encode the error message since it originates from XML - this._snackBar.open("Delete failed! Check server logs for more information.", 'Close'); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_system(this.name, this.userService.token, false) + .subscribe( + (value) => { + if (value) { + this.router.navigate(['/items', 'system']); + } + // HTML encode the error message since it originates from XML + this._snackBar.open( + 'Delete failed! Check server logs for more information.', + 'Close', + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } editSystem(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } copySystem(): void { - this.cobblerApiService.copy_system("", "", this.userService.token) - .subscribe(value => { - // TODO - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .copy_system('', '', this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } saveSystem(): void { @@ -276,87 +412,87 @@ export class SystemEditComponent implements OnInit { get systemOwners(): string[] { if (this.system && this.system.owners) { - const ownersResult = this.system.owners + const ownersResult = this.system.owners; if (typeof ownersResult !== 'string') { return ownersResult; } } - return [] + return []; } get systemAutoinstallMeta(): object { if (this.system && this.system.autoinstall_meta) { - const autoinstallMetaResult = this.system.autoinstall_meta + const autoinstallMetaResult = this.system.autoinstall_meta; if (typeof autoinstallMetaResult !== 'string') { - return autoinstallMetaResult + return autoinstallMetaResult; } } - return {} + return {}; } get systemKernelOptions(): object { if (this.system && this.system.boot_files) { - const kernelOptionsResult = this.system.boot_files + const kernelOptionsResult = this.system.boot_files; if (typeof kernelOptionsResult !== 'string') { - return kernelOptionsResult + return kernelOptionsResult; } } - return {} + return {}; } get systemKernelOptionsPost(): object { if (this.system && this.system.boot_files) { - const kernelOptionsPost = this.system.boot_files + const kernelOptionsPost = this.system.boot_files; if (typeof kernelOptionsPost !== 'string') { - return kernelOptionsPost + return kernelOptionsPost; } } - return {} + return {}; } - get systemBootFiles(): object { if (this.system && this.system.boot_files) { - const bootFilesResult = this.system.boot_files + const bootFilesResult = this.system.boot_files; if (typeof bootFilesResult !== 'string') { - return bootFilesResult + return bootFilesResult; } } - return {} + return {}; } get systemFetchableFiles(): object { if (this.system && this.system.fetchable_files) { - const fetchableFilesResult = this.system.fetchable_files + const fetchableFilesResult = this.system.fetchable_files; if (typeof fetchableFilesResult !== 'string') { - return fetchableFilesResult + return fetchableFilesResult; } } - return {} + return {}; } get systemMgmtParameters(): object { if (this.system && this.system.mgmt_parameters) { - const mgmtParametersResult = this.system.mgmt_parameters + const mgmtParametersResult = this.system.mgmt_parameters; if (typeof mgmtParametersResult !== 'string') { - return mgmtParametersResult + return mgmtParametersResult; } } - return {} + return {}; } get systemTemplateFiles(): object { if (this.system && this.system.template_files) { - const templateFilesResult = this.system.template_files + const templateFilesResult = this.system.template_files; if (typeof templateFilesResult !== 'string') { - return templateFilesResult + return templateFilesResult; } } - return {} + return {}; } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/system/overview/system-overview.component.html b/projects/cobbler-frontend/src/app/items/system/overview/system-overview.component.html index 7975fcfd..54e902c4 100644 --- a/projects/cobbler-frontend/src/app/items/system/overview/system-overview.component.html +++ b/projects/cobbler-frontend/src/app/items/system/overview/system-overview.component.html @@ -4,25 +4,27 @@

SYSTEMS

Name - {{element.name}} + {{ element.name }} Profile - {{element.profile}} + {{ element.profile }} Image - {{element.image}} + {{ element.image }} - + + > + refresh + - + - + + > + delete + @@ -41,4 +41,3 @@

Name: {{ name }}

} - diff --git a/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.scss b/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.scss index 2a9efa5d..737cd844 100644 --- a/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.scss +++ b/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.scss @@ -27,4 +27,3 @@ .form-field-full-width { width: 100%; } - diff --git a/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.spec.ts b/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.spec.ts index 8aa827e0..da73c7a9 100644 --- a/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.spec.ts +++ b/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.spec.ts @@ -1,9 +1,9 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {ActivatedRoute, provideRouter} from '@angular/router'; -import {COBBLER_URL} from 'cobbler-api'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ActivatedRoute, provideRouter } from '@angular/router'; +import { COBBLER_URL } from 'cobbler-api'; import { TemplateEditComponent } from './template-edit.component'; @@ -13,31 +13,27 @@ describe('TemplateEditComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - TemplateEditComponent, - NoopAnimationsModule, - ], + imports: [TemplateEditComponent, NoopAnimationsModule], providers: [ provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, { provide: ActivatedRoute, useValue: { snapshot: { paramMap: { - get: () => "testtemplate" + get: () => 'testtemplate', }, }, }, }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(TemplateEditComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.ts b/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.ts index 7b612d90..fbd30cb5 100644 --- a/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.ts +++ b/projects/cobbler-frontend/src/app/items/template/edit/template-edit.component.ts @@ -1,17 +1,22 @@ -import {Component, inject, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {MatOption} from '@angular/material/autocomplete'; -import {MatButton, MatIconButton} from '@angular/material/button'; -import {MatCheckbox} from '@angular/material/checkbox'; -import {MatFormField, MatLabel} from '@angular/material/form-field'; -import {MatIcon} from '@angular/material/icon'; -import {MatInput} from '@angular/material/input'; -import {MatSelect} from '@angular/material/select'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {MatTooltip} from '@angular/material/tooltip'; -import {ActivatedRoute, Router} from '@angular/router'; -import {CobblerApiService, Profile} from 'cobbler-api'; -import {UserService} from '../../../services/user.service'; +import { Component, inject, OnInit } from '@angular/core'; +import { + FormBuilder, + FormControl, + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { MatOption } from '@angular/material/autocomplete'; +import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatCheckbox } from '@angular/material/checkbox'; +import { MatFormField, MatLabel } from '@angular/material/form-field'; +import { MatIcon } from '@angular/material/icon'; +import { MatInput } from '@angular/material/input'; +import { MatSelect } from '@angular/material/select'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { MatTooltip } from '@angular/material/tooltip'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CobblerApiService } from 'cobbler-api'; +import { UserService } from '../../../services/user.service'; @Component({ selector: 'cobbler-edit', @@ -28,17 +33,17 @@ import {UserService} from '../../../services/user.service'; MatOption, MatSelect, MatTooltip, - ReactiveFormsModule + ReactiveFormsModule, ], templateUrl: './template-edit.component.html', - styleUrl: './template-edit.component.scss' + styleUrl: './template-edit.component.scss', }) export class TemplateEditComponent implements OnInit { name: string; content: string; private readonly _formBuilder = inject(FormBuilder); templateFormGroup = this._formBuilder.group({ - content: new FormControl({value: "", disabled: true}), + content: new FormControl({ value: '', disabled: true }), }); isEditMode: boolean = false; @@ -49,58 +54,79 @@ export class TemplateEditComponent implements OnInit { private _snackBar: MatSnackBar, private router: Router, ) { - this.name = this.route.snapshot.paramMap.get("name"); + this.name = this.route.snapshot.paramMap.get('name'); } ngOnInit(): void { - this.refreshData() + this.refreshData(); } refreshData(): void { - this.cobblerApiService.read_autoinstall_template(this.name, this.userService.token).subscribe(value => { - this.content = value; - this.templateFormGroup.controls.content.setValue(this.toHTML(this.content)); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + this.cobblerApiService + .read_autoinstall_template(this.name, this.userService.token) + .subscribe( + (value) => { + this.content = value; + this.templateFormGroup.controls.content.setValue( + this.toHTML(this.content), + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } removeTemplate(): void { - this.cobblerApiService.remove_autoinstall_template(this.name, this.userService.token).subscribe(value => { - if (value) { - this.router.navigate(["/items", "template"]) - } - // HTML encode the error message since it originates from XML - this._snackBar.open("Delete failed! Check server logs for more information.", 'Close'); - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .remove_autoinstall_template(this.name, this.userService.token) + .subscribe( + (value) => { + if (value) { + this.router.navigate(['/items', 'template']); + } + // HTML encode the error message since it originates from XML + this._snackBar.open( + 'Delete failed! Check server logs for more information.', + 'Close', + ); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } editTemplate(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } copyTemplate(): void { // TODO - this._snackBar.open("Not implemented at the moment!", "Close") + this._snackBar.open('Not implemented at the moment!', 'Close'); } saveTemplate(): void { // TODO - this.cobblerApiService.write_autoinstall_template(this.name, "", this.userService.token).subscribe(value => { - // TODO - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }) + this.cobblerApiService + .write_autoinstall_template(this.name, '', this.userService.token) + .subscribe( + (value) => { + // TODO + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/items/template/overview/template-overview.component.html b/projects/cobbler-frontend/src/app/items/template/overview/template-overview.component.html index 42bd3c82..aca7e47f 100644 --- a/projects/cobbler-frontend/src/app/items/template/overview/template-overview.component.html +++ b/projects/cobbler-frontend/src/app/items/template/overview/template-overview.component.html @@ -4,13 +4,15 @@

TEMPLATES

Name - {{element}} + {{ element }} - + - @if(message){ -
- {{ message }} -
+ @if (message) { +
+ {{ message }} +
} diff --git a/projects/cobbler-frontend/src/app/login/login.component.ts b/projects/cobbler-frontend/src/app/login/login.component.ts index b2d911f0..82b096b7 100644 --- a/projects/cobbler-frontend/src/app/login/login.component.ts +++ b/projects/cobbler-frontend/src/app/login/login.component.ts @@ -29,9 +29,8 @@ import { MatButtonModule } from '@angular/material/button'; ReactiveFormsModule, MatFormFieldModule, MatInputModule, - MatButtonModule + MatButtonModule, ], - }) export class LogInFormComponent implements OnDestroy { subs = new Subscription(); @@ -69,27 +68,37 @@ export class LogInFormComponent implements OnDestroy { private router: Router, private guard: AuthGuardService, @Inject(COBBLER_URL) url: URL, - private cobblerApiService: CobblerApiService + private cobblerApiService: CobblerApiService, ) { this.server_prefilled = url.toString(); this.login_form.get('server').setValue(this.server_prefilled); this.subs.add( - merge(this.login_form.controls['server'].statusChanges, this.login_form.controls['server'].valueChanges) + merge( + this.login_form.controls['server'].statusChanges, + this.login_form.controls['server'].valueChanges, + ) .pipe(distinctUntilChanged()) - .subscribe(() => this.updateErrServer()) + .subscribe(() => this.updateErrServer()), ); this.subs.add( - merge(this.login_form.controls['username'].statusChanges, this.login_form.controls['username'].valueChanges) + merge( + this.login_form.controls['username'].statusChanges, + this.login_form.controls['username'].valueChanges, + ) .pipe(distinctUntilChanged()) - .subscribe(() => {this.updateErrUser()}) + .subscribe(() => { + this.updateErrUser(); + }), ); this.subs.add( - merge(this.login_form.controls['password'].statusChanges, this.login_form.controls['password'].valueChanges) + merge( + this.login_form.controls['password'].statusChanges, + this.login_form.controls['password'].valueChanges, + ) .pipe(distinctUntilChanged()) - .subscribe(() => this.updateErrPassword()) + .subscribe(() => this.updateErrPassword()), ); - } ngOnDestroy(): void { @@ -130,38 +139,40 @@ export class LogInFormComponent implements OnDestroy { }, () => (this.message = - 'Server, Username or Password did not Validate. Please try again.') - ) + 'Server, Username or Password did not Validate. Please try again.'), + ), ); } updateErrServer() { - if(this.login_form.controls['server'].hasError('required')){ - this.errMsgServer.set('Server is required') - }else if(this.login_form.controls['server'].hasError('pattern')){ - this.errMsgServer.set('Server must be a valid URL.') - }else{ - this.errMsgServer.set('') + if (this.login_form.controls['server'].hasError('required')) { + this.errMsgServer.set('Server is required'); + } else if (this.login_form.controls['server'].hasError('pattern')) { + this.errMsgServer.set('Server must be a valid URL.'); + } else { + this.errMsgServer.set(''); } } updateErrUser() { - if(this.login_form.controls['username'].hasError('required')||this.login_form.controls['username'].touched){ - this.errMsgUser.set('Username is required') - }else if(this.login_form.controls['username'].hasError('minlength')){ - this.errMsgUser.set(`Username must be minimum - ${ this.login_form.controls['username'].errors.minlength.requiredLength } characters.`) - }else{ - this.errMsgUser.set('') + if ( + this.login_form.controls['username'].hasError('required') || + this.login_form.controls['username'].touched + ) { + this.errMsgUser.set('Username is required'); + } else if (this.login_form.controls['username'].hasError('minlength')) { + this.errMsgUser.set(`Username must be minimum + ${this.login_form.controls['username'].errors.minlength.requiredLength} characters.`); + } else { + this.errMsgUser.set(''); } } updateErrPassword() { - if(this.login_form.controls['password'].hasError('required')){ - this.errMsgPassword.set('Password is required') - }else{ - this.errMsgServer.set('') + if (this.login_form.controls['password'].hasError('required')) { + this.errMsgPassword.set('Password is required'); + } else { + this.errMsgServer.set(''); } - } } diff --git a/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.html b/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.html index 94d994c7..94771d69 100644 --- a/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.html +++ b/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.html @@ -138,7 +138,11 @@

Actions

Mkloaders - + Validate Autoinstalls @@ -185,8 +189,8 @@

Cobbler

- @if(router.url !== '/login'){ - + @if (router.url !== "/login") { + }
diff --git a/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.spec.ts b/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.spec.ts index a1e688aa..89befb31 100644 --- a/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.spec.ts +++ b/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.spec.ts @@ -7,15 +7,13 @@ import { MatListModule } from '@angular/material/list'; import { MatSidenavModule } from '@angular/material/sidenav'; import { MatToolbarModule } from '@angular/material/toolbar'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import {provideRouter} from '@angular/router'; +import { provideRouter } from '@angular/router'; import { ManageMenuComponent } from './manage-menu.component'; -import {COBBLER_URL} from "cobbler-api"; +import { COBBLER_URL } from 'cobbler-api'; - -@Component({selector: 'cobbler-navbar', template: '', standalone: true}) -class NavbarStubComponent { -} +@Component({ selector: 'cobbler-navbar', template: '', standalone: true }) +class NavbarStubComponent {} describe('ManageMenuComponent', () => { let component: ManageMenuComponent; @@ -40,9 +38,8 @@ describe('ManageMenuComponent', () => { provide: COBBLER_URL, useValue: new URL('https://localhost/cobbler_api'), }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); }); beforeEach(() => { diff --git a/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.ts b/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.ts index c35e83a9..ff4691de 100644 --- a/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.ts +++ b/projects/cobbler-frontend/src/app/manage-menu/manage-menu.component.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { Component } from '@angular/core'; import { MatDividerModule } from '@angular/material/divider'; -import {MatListModule, MatNavList} from '@angular/material/list'; +import { MatListModule, MatNavList } from '@angular/material/list'; import { MatSidenavModule } from '@angular/material/sidenav'; import { MatToolbarModule } from '@angular/material/toolbar'; import { Router, RouterModule, RouterOutlet } from '@angular/router'; @@ -23,7 +23,7 @@ import { MatIconModule } from '@angular/material/icon'; MatNavList, NavbarComponent, MatListModule, - MatIconModule + MatIconModule, ], }) export class ManageMenuComponent { diff --git a/projects/cobbler-frontend/src/app/navbar/navbar.component.html b/projects/cobbler-frontend/src/app/navbar/navbar.component.html index 91d7d328..592b942a 100644 --- a/projects/cobbler-frontend/src/app/navbar/navbar.component.html +++ b/projects/cobbler-frontend/src/app/navbar/navbar.component.html @@ -21,18 +21,21 @@ diff --git a/projects/cobbler-frontend/src/app/navbar/navbar.component.spec.js b/projects/cobbler-frontend/src/app/navbar/navbar.component.spec.js deleted file mode 100644 index 559d75bc..00000000 --- a/projects/cobbler-frontend/src/app/navbar/navbar.component.spec.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var testing_1 = require("@angular/core/testing"); -var navbar_component_1 = require("./navbar.component"); -describe('NavbarComponent', function () { - var component; - var fixture; - beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, testing_1.TestBed.configureTestingModule({ - declarations: [navbar_component_1.NavbarComponent] - }) - .compileComponents()]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }); }); - beforeEach(function () { - fixture = testing_1.TestBed.createComponent(navbar_component_1.NavbarComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - it('should create', function () { - expect(component).toBeTruthy(); - }); -}); -//# sourceMappingURL=navbar.component.spec.js.map \ No newline at end of file diff --git a/projects/cobbler-frontend/src/app/navbar/navbar.component.spec.ts b/projects/cobbler-frontend/src/app/navbar/navbar.component.spec.ts index d7f312f9..a37d5001 100644 --- a/projects/cobbler-frontend/src/app/navbar/navbar.component.spec.ts +++ b/projects/cobbler-frontend/src/app/navbar/navbar.component.spec.ts @@ -7,8 +7,8 @@ import { COBBLER_URL } from 'cobbler-api'; import { UserService } from '../services/user.service'; import { NavbarComponent } from './navbar.component'; -import {provideRouter} from "@angular/router"; -import {MatButtonModule} from "@angular/material/button"; +import { provideRouter } from '@angular/router'; +import { MatButtonModule } from '@angular/material/button'; describe('NavbarComponent', () => { let component: NavbarComponent; diff --git a/projects/cobbler-frontend/src/app/navbar/navbar.component.ts b/projects/cobbler-frontend/src/app/navbar/navbar.component.ts index 58e3f857..d97db4b1 100644 --- a/projects/cobbler-frontend/src/app/navbar/navbar.component.ts +++ b/projects/cobbler-frontend/src/app/navbar/navbar.component.ts @@ -1,30 +1,29 @@ -import {Component, EventEmitter, Output} from '@angular/core'; -import {MatIconModule, MatIconRegistry} from '@angular/material/icon'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {DomSanitizer} from '@angular/platform-browser'; -import {Router, RouterLink} from '@angular/router'; -import {CobblerApiService} from 'cobbler-api'; -import {Subscription} from 'rxjs'; -import {AuthGuardService} from '../services/auth-guard.service'; -import {UserService} from '../services/user.service'; +import { Component, EventEmitter, Output } from '@angular/core'; +import { MatIconModule, MatIconRegistry } from '@angular/material/icon'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { DomSanitizer } from '@angular/platform-browser'; +import { Router, RouterLink } from '@angular/router'; +import { CobblerApiService } from 'cobbler-api'; +import { Subscription } from 'rxjs'; +import { AuthGuardService } from '../services/auth-guard.service'; +import { UserService } from '../services/user.service'; import { MatToolbarModule } from '@angular/material/toolbar'; import { CommonModule } from '@angular/common'; -import {MatButtonModule} from "@angular/material/button"; +import { MatButtonModule } from '@angular/material/button'; @Component({ selector: 'cobbler-navbar', templateUrl: './navbar.component.html', styleUrls: ['./navbar.component.css'], - standalone:true, + standalone: true, imports: [ RouterLink, MatToolbarModule, MatIconModule, CommonModule, MatButtonModule, - ] + ], }) - export class NavbarComponent { @Output() toggleSidenav = new EventEmitter(); cobbler_version: String = 'Unknown'; @@ -38,11 +37,13 @@ export class NavbarComponent { public router: Router, private guard: AuthGuardService, private _snackBar: MatSnackBar, - private cobblerApiService: CobblerApiService + private cobblerApiService: CobblerApiService, ) { iconRegistry.addSvgIcon( 'cobbler-logo', - sanitizer.bypassSecurityTrustResourceUrl('https://cobbler.github.io/images/logo-cobbler-new.svg') + sanitizer.bypassSecurityTrustResourceUrl( + 'https://cobbler.github.io/images/logo-cobbler-new.svg', + ), ); this.subscription = this.authO.authorized.subscribe((value) => { @@ -52,13 +53,15 @@ export class NavbarComponent { this.islogged = false; } }); - cobblerApiService.extended_version().subscribe((value) => { - this.cobbler_version = value.version + cobblerApiService.extended_version().subscribe( + (value) => { + this.cobbler_version = value.version; }, (error) => { - this.cobbler_version = 'Error' - this._snackBar.open(error.message, 'Close') - }) + this.cobbler_version = 'Error'; + this._snackBar.open(error.message, 'Close'); + }, + ); } logout(): void { diff --git a/projects/cobbler-frontend/src/app/not-found/not-found.component.html b/projects/cobbler-frontend/src/app/not-found/not-found.component.html index 6eb6ea6c..847ec34e 100644 --- a/projects/cobbler-frontend/src/app/not-found/not-found.component.html +++ b/projects/cobbler-frontend/src/app/not-found/not-found.component.html @@ -1,5 +1,5 @@
-

Path not found, Or unavailable.

-

Please Log in.

+

Path not found, Or unavailable.

+

Please Log in.

Login
diff --git a/projects/cobbler-frontend/src/app/not-found/not-found.component.spec.ts b/projects/cobbler-frontend/src/app/not-found/not-found.component.spec.ts index c79b1698..7710e19e 100644 --- a/projects/cobbler-frontend/src/app/not-found/not-found.component.spec.ts +++ b/projects/cobbler-frontend/src/app/not-found/not-found.component.spec.ts @@ -1,7 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { NotFoundComponent } from './not-found.component'; -import {provideRouter} from "@angular/router"; +import { provideRouter } from '@angular/router'; describe('NotFoundComponent', () => { let component: NotFoundComponent; @@ -9,10 +9,9 @@ describe('NotFoundComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ NotFoundComponent ], - providers: [provideRouter([])] - }) - .compileComponents(); + imports: [NotFoundComponent], + providers: [provideRouter([])], + }).compileComponents(); }); beforeEach(() => { diff --git a/projects/cobbler-frontend/src/app/not-found/not-found.component.ts b/projects/cobbler-frontend/src/app/not-found/not-found.component.ts index f0a94bc7..eddd6828 100644 --- a/projects/cobbler-frontend/src/app/not-found/not-found.component.ts +++ b/projects/cobbler-frontend/src/app/not-found/not-found.component.ts @@ -5,13 +5,10 @@ import { RouterLink } from '@angular/router'; selector: 'cobbler-not-found', templateUrl: './not-found.component.html', styleUrls: ['./not-found.component.css'], - + standalone: true, imports: [RouterLink], }) export class NotFoundComponent { - - constructor() { - } - + constructor() {} } diff --git a/projects/cobbler-frontend/src/app/services/auth-guard.service.spec.js b/projects/cobbler-frontend/src/app/services/auth-guard.service.spec.js deleted file mode 100644 index 94f3bbb0..00000000 --- a/projects/cobbler-frontend/src/app/services/auth-guard.service.spec.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var testing_1 = require("@angular/core/testing"); -var auth_guard_service_1 = require("./auth-guard.service"); -describe('AuthGuardService', function () { - var service; - beforeEach(function () { - testing_1.TestBed.configureTestingModule({}); - service = testing_1.TestBed.inject(auth_guard_service_1.AuthGuardService); - }); - it('should be created', function () { - expect(service).toBeTruthy(); - }); -}); -//# sourceMappingURL=auth-guard.service.spec.js.map \ No newline at end of file diff --git a/projects/cobbler-frontend/src/app/services/auth-guard.service.spec.ts b/projects/cobbler-frontend/src/app/services/auth-guard.service.spec.ts index 2f7578bf..9001d681 100644 --- a/projects/cobbler-frontend/src/app/services/auth-guard.service.spec.ts +++ b/projects/cobbler-frontend/src/app/services/auth-guard.service.spec.ts @@ -1,16 +1,15 @@ import { TestBed } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; +import { provideRouter } from '@angular/router'; import { AuthGuardService } from './auth-guard.service'; -import {UserService} from './user.service'; +import { UserService } from './user.service'; describe('AuthGuardService', () => { let service: AuthGuardService; beforeEach(() => { TestBed.configureTestingModule({ - imports: [RouterTestingModule], - providers: [UserService] + providers: [provideRouter([]), UserService], }); service = TestBed.inject(AuthGuardService); }); diff --git a/projects/cobbler-frontend/src/app/services/auth-guard.service.ts b/projects/cobbler-frontend/src/app/services/auth-guard.service.ts index a7072cbb..0fd0f9c5 100644 --- a/projects/cobbler-frontend/src/app/services/auth-guard.service.ts +++ b/projects/cobbler-frontend/src/app/services/auth-guard.service.ts @@ -1,17 +1,19 @@ -import {Injectable} from '@angular/core'; +import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; -import {Subscription} from 'rxjs'; -import {UserService} from './user.service'; +import { Subscription } from 'rxjs'; +import { UserService } from './user.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) -export class AuthGuardService { +export class AuthGuardService { loggedIN = false; subscription: Subscription; - constructor(private userService: UserService, private router: Router) { - } + constructor( + private userService: UserService, + private router: Router, + ) {} canActivate(): boolean { const sessionLIVE = this.checkSession(); @@ -39,7 +41,7 @@ export class AuthGuardService { checkSession(): boolean { try { const value = window.sessionStorage.getItem('loggedIn'); - return (value === 'true'); + return value === 'true'; } catch { return false; } diff --git a/projects/cobbler-frontend/src/app/services/get-obj.service.ts b/projects/cobbler-frontend/src/app/services/get-obj.service.ts index c9323b4d..c56ce2cc 100644 --- a/projects/cobbler-frontend/src/app/services/get-obj.service.ts +++ b/projects/cobbler-frontend/src/app/services/get-obj.service.ts @@ -1,6 +1,6 @@ -import {Injectable} from '@angular/core'; -import {BehaviorSubject} from 'rxjs'; -import {Observable} from 'rxjs'; +import { Injectable } from '@angular/core'; +import { BehaviorSubject } from 'rxjs'; +import { Observable } from 'rxjs'; /* Item returned from XMLrpc will be an object that @@ -33,10 +33,9 @@ See docs-additonal for each components data structure. */ @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class GetObjService { - MockObject = []; MockValues = ['Item 0x1', 'Item 1x2', 'Item 2x3']; // If MockObjname is not left blank/undefined, the value hear overrides the session value on construction. @@ -44,10 +43,11 @@ export class GetObjService { // ERROR is thrown if MockObjname is Left undefined before constructor - public CurrentITEM: BehaviorSubject = new BehaviorSubject(this.MockObjname); + public CurrentITEM: BehaviorSubject = new BehaviorSubject( + this.MockObjname, + ); CurrentITEM$: Observable = this.CurrentITEM.asObservable(); - constructor() { // Add authorization check?? const current = window.sessionStorage.getItem('CurrentItem'); @@ -56,7 +56,10 @@ export class GetObjService { this.MockObjname = current; } - window.sessionStorage.setItem('CobblerITEMS', JSON.stringify(this.MockValues)); + window.sessionStorage.setItem( + 'CobblerITEMS', + JSON.stringify(this.MockValues), + ); } getITEMS(): string[] { diff --git a/projects/cobbler-frontend/src/app/services/item-settings.service.spec.js b/projects/cobbler-frontend/src/app/services/item-settings.service.spec.js deleted file mode 100644 index d750af32..00000000 --- a/projects/cobbler-frontend/src/app/services/item-settings.service.spec.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var testing_1 = require("@angular/core/testing"); -var item_settings_service_1 = require("./item-settings.service"); -describe('ItemSettingsService', function () { - var service; - beforeEach(function () { - testing_1.TestBed.configureTestingModule({}); - service = testing_1.TestBed.inject(item_settings_service_1.ItemSettingsService); - }); - it('should be created', function () { - expect(service).toBeTruthy(); - }); -}); -//# sourceMappingURL=item-settings.service.spec.js.map \ No newline at end of file diff --git a/projects/cobbler-frontend/src/app/services/item-settings.service.spec.ts b/projects/cobbler-frontend/src/app/services/item-settings.service.spec.ts index 744ea9da..aca67d8f 100644 --- a/projects/cobbler-frontend/src/app/services/item-settings.service.spec.ts +++ b/projects/cobbler-frontend/src/app/services/item-settings.service.spec.ts @@ -1,8 +1,8 @@ -import {HttpClientTestingModule} from '@angular/common/http/testing'; -import {TestBed} from '@angular/core/testing'; -import {COBBLER_URL} from 'cobbler-api'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { TestBed } from '@angular/core/testing'; +import { COBBLER_URL } from 'cobbler-api'; -import {ItemSettingsService} from './item-settings.service'; +import { ItemSettingsService } from './item-settings.service'; describe('ItemSettingsService', () => { let service: ItemSettingsService; @@ -12,10 +12,10 @@ describe('ItemSettingsService', () => { providers: [ { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') - } + useValue: new URL('http://localhost/cobbler_api'), + }, ], - imports: [HttpClientTestingModule] + imports: [HttpClientTestingModule], }); service = TestBed.inject(ItemSettingsService); }); diff --git a/projects/cobbler-frontend/src/app/services/item-settings.service.ts b/projects/cobbler-frontend/src/app/services/item-settings.service.ts index c183a652..ea877393 100644 --- a/projects/cobbler-frontend/src/app/services/item-settings.service.ts +++ b/projects/cobbler-frontend/src/app/services/item-settings.service.ts @@ -1,18 +1,17 @@ -import {Injectable} from '@angular/core'; -import {CobblerApiService} from 'cobbler-api'; -import {Observable} from 'rxjs'; -import {map} from 'rxjs/operators'; -import {Settings} from 'cobbler-api'; -import {UserService} from './user.service'; +import { Injectable } from '@angular/core'; +import { CobblerApiService } from 'cobbler-api'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { Settings } from 'cobbler-api'; +import { UserService } from './user.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ItemSettingsService { - constructor( public authO: UserService, - private cobblerApiService: CobblerApiService + private cobblerApiService: CobblerApiService, ) { // Nothing to see here } @@ -22,14 +21,13 @@ export class ItemSettingsService { } getitem(name: string): Observable { - return this.cobblerApiService.get_settings(this.authO.token) - .pipe( - map((data: Settings) => { - if (name in data) { - return data[name] - } - throw new Error('Requested name not found in the settings!') - }) - ) + return this.cobblerApiService.get_settings(this.authO.token).pipe( + map((data: Settings) => { + if (name in data) { + return data[name]; + } + throw new Error('Requested name not found in the settings!'); + }), + ); } } diff --git a/projects/cobbler-frontend/src/app/services/user.service.ts b/projects/cobbler-frontend/src/app/services/user.service.ts index 228b011d..e43c7e93 100644 --- a/projects/cobbler-frontend/src/app/services/user.service.ts +++ b/projects/cobbler-frontend/src/app/services/user.service.ts @@ -1,54 +1,54 @@ -import {Injectable} from '@angular/core'; -import {BehaviorSubject} from 'rxjs'; +import { Injectable } from '@angular/core'; +import { BehaviorSubject } from 'rxjs'; -const COBBLER_URL_KEY_NAME = "COBBLER_URL" +const COBBLER_URL_KEY_NAME = 'COBBLER_URL'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class UserService { - private _username: string - private _token: string - private _active: boolean - private _roles: [] - authorized: BehaviorSubject + private _username: string; + private _token: string; + private _active: boolean; + private _roles: []; + authorized: BehaviorSubject; constructor() { // Apply https://stackoverflow.com/a/50067730/4730773 to this service - this._username = "unknown user" - this._token = "" - this._active = false - this.authorized = new BehaviorSubject(false) - this._roles = [] + this._username = 'unknown user'; + this._token = ''; + this._active = false; + this.authorized = new BehaviorSubject(false); + this._roles = []; } get server(): string { - const server_value = localStorage.getItem(COBBLER_URL_KEY_NAME) + const server_value = localStorage.getItem(COBBLER_URL_KEY_NAME); if (server_value) { - return server_value + return server_value; } - return "http://localhost/cobbler_api" + return 'http://localhost/cobbler_api'; } set server(url: string) { - window.localStorage.setItem(COBBLER_URL_KEY_NAME, url) + window.localStorage.setItem(COBBLER_URL_KEY_NAME, url); } get username(): string { - return this._username + return this._username; } get token(): string { - return this._token + return this._token; } set token(token: string) { - this._token = token + this._token = token; } set username(name: string) { this._username = name; - this._token = "" + this._token = ''; } set active(bool: boolean) { @@ -60,6 +60,6 @@ export class UserService { } changeAuthorizedState(authorized: boolean) { - this.authorized.next(authorized) + this.authorized.next(authorized); } } diff --git a/projects/cobbler-frontend/src/app/settings/view/settings-view.component.html b/projects/cobbler-frontend/src/app/settings/view/settings-view.component.html index 2b943096..95120fa8 100644 --- a/projects/cobbler-frontend/src/app/settings/view/settings-view.component.html +++ b/projects/cobbler-frontend/src/app/settings/view/settings-view.component.html @@ -37,28 +37,31 @@

Settings

Value - @if(element.type === 'string' || element.type === 'number'){ - "{{ element.value }}" } + @if (element.type === "string" || element.type === "number") { + "{{ element.value }}" + } - @if(element.type === 'boolean'){ - - } + @if (element.type === "boolean") { + + + } - @if(isArray(element.value)){ - - @for(c of element.value;track c){ - - {{ c }} } } + @if (isArray(element.value)) { + + @for (c of element.value; track c) { + {{ c }} + } + + } - @if(element.type === 'object' && !isArray(element.value)){ - } + @if (element.type === "object" && !isArray(element.value)) { + + } diff --git a/projects/cobbler-frontend/src/app/settings/view/settings-view.component.spec.ts b/projects/cobbler-frontend/src/app/settings/view/settings-view.component.spec.ts index 07ffe634..82763747 100644 --- a/projects/cobbler-frontend/src/app/settings/view/settings-view.component.spec.ts +++ b/projects/cobbler-frontend/src/app/settings/view/settings-view.component.spec.ts @@ -3,12 +3,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatPaginatorModule } from '@angular/material/paginator'; import { MatTableModule } from '@angular/material/table'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import {provideRouter} from '@angular/router'; +import { provideRouter } from '@angular/router'; import { COBBLER_URL } from 'cobbler-api'; import { SettingsViewComponent } from './settings-view.component'; - describe('AppSettingsComponent', () => { let component: SettingsViewComponent; let fixture: ComponentFixture; @@ -26,12 +25,11 @@ describe('AppSettingsComponent', () => { providers: [ { provide: COBBLER_URL, - useValue: new URL("https://localhost/cobbler_api") + useValue: new URL('https://localhost/cobbler_api'), }, - provideRouter([]) - ] - }) - .compileComponents(); + provideRouter([]), + ], + }).compileComponents(); }); beforeEach(() => { diff --git a/projects/cobbler-frontend/src/app/settings/view/settings-view.component.ts b/projects/cobbler-frontend/src/app/settings/view/settings-view.component.ts index 1b273e95..c719edfc 100644 --- a/projects/cobbler-frontend/src/app/settings/view/settings-view.component.ts +++ b/projects/cobbler-frontend/src/app/settings/view/settings-view.component.ts @@ -1,18 +1,18 @@ import { AfterViewInit, Component, ViewChild } from '@angular/core'; import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator'; -import {MatTableDataSource, MatTableModule} from '@angular/material/table'; -import {MatSort, MatSortModule} from '@angular/material/sort'; +import { MatTableDataSource, MatTableModule } from '@angular/material/table'; +import { MatSort, MatSortModule } from '@angular/material/sort'; import { Settings } from '../../../../../cobbler-api/src/lib/custom-types/settings'; import { ItemSettingsService } from '../../services/item-settings.service'; import { RouterOutlet } from '@angular/router'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatIconModule } from '@angular/material/icon'; -import {MatSlideToggleModule} from "@angular/material/slide-toggle"; -import {MatListModule} from "@angular/material/list"; -import {ViewableTreeComponent} from "../../common/viewable-tree/viewable-tree.component"; -import {MatInputModule} from "@angular/material/input"; -import {MatButtonModule} from "@angular/material/button"; -import {MatTooltipModule} from "@angular/material/tooltip"; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; +import { MatListModule } from '@angular/material/list'; +import { ViewableTreeComponent } from '../../common/viewable-tree/viewable-tree.component'; +import { MatInputModule } from '@angular/material/input'; +import { MatButtonModule } from '@angular/material/button'; +import { MatTooltipModule } from '@angular/material/tooltip'; interface SettingsTableRowData { name: string; diff --git a/projects/cobbler-frontend/src/app/signatures/signatures.component.html b/projects/cobbler-frontend/src/app/signatures/signatures.component.html index ea1db638..b0c00e6f 100644 --- a/projects/cobbler-frontend/src/app/signatures/signatures.component.html +++ b/projects/cobbler-frontend/src/app/signatures/signatures.component.html @@ -2,12 +2,14 @@

Signatures

- +
- + @@ -17,17 +19,26 @@

Signatures

{{ node.data }} - - {{ node.data }} - + @for (column of columns; track column) { @@ -41,7 +52,7 @@

Signatures

} - +
diff --git a/projects/cobbler-frontend/src/app/signatures/signatures.component.spec.ts b/projects/cobbler-frontend/src/app/signatures/signatures.component.spec.ts index 26f20902..15531394 100644 --- a/projects/cobbler-frontend/src/app/signatures/signatures.component.spec.ts +++ b/projects/cobbler-frontend/src/app/signatures/signatures.component.spec.ts @@ -1,11 +1,11 @@ -import {provideHttpClient} from '@angular/common/http'; -import {provideHttpClientTesting} from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import {MatDividerModule} from '@angular/material/divider'; -import {MatIconModule} from '@angular/material/icon'; -import {MatTableModule} from '@angular/material/table'; -import {MatTreeModule} from '@angular/material/tree'; -import {COBBLER_URL} from 'cobbler-api'; +import { MatDividerModule } from '@angular/material/divider'; +import { MatIconModule } from '@angular/material/icon'; +import { MatTableModule } from '@angular/material/table'; +import { MatTreeModule } from '@angular/material/tree'; +import { COBBLER_URL } from 'cobbler-api'; import { SignaturesComponent } from './signatures.component'; @@ -27,11 +27,10 @@ describe('SignaturesComponent', () => { provideHttpClientTesting(), { provide: COBBLER_URL, - useValue: new URL('http://localhost/cobbler_api') + useValue: new URL('http://localhost/cobbler_api'), }, - ] - }) - .compileComponents(); + ], + }).compileComponents(); fixture = TestBed.createComponent(SignaturesComponent); component = fixture.componentInstance; diff --git a/projects/cobbler-frontend/src/app/signatures/signatures.component.ts b/projects/cobbler-frontend/src/app/signatures/signatures.component.ts index 9e3b7269..2dc0fd56 100644 --- a/projects/cobbler-frontend/src/app/signatures/signatures.component.ts +++ b/projects/cobbler-frontend/src/app/signatures/signatures.component.ts @@ -1,32 +1,36 @@ -import {AsyncPipe, NgForOf, NgIf} from '@angular/common'; -import {Component, OnInit} from '@angular/core'; -import {MatDivider} from '@angular/material/divider'; -import {MatList, MatListItem} from '@angular/material/list'; -import {MatProgressSpinner} from '@angular/material/progress-spinner'; -import {MatSnackBar} from '@angular/material/snack-bar'; +import { AsyncPipe, NgForOf, NgIf } from '@angular/common'; +import { Component, OnInit } from '@angular/core'; +import { MatDivider } from '@angular/material/divider'; +import { MatList, MatListItem } from '@angular/material/list'; +import { MatProgressSpinner } from '@angular/material/progress-spinner'; +import { MatSnackBar } from '@angular/material/snack-bar'; import { - MatCell, MatCellDef, + MatCell, + MatCellDef, MatColumnDef, MatHeaderCell, MatHeaderCellDef, - MatHeaderRow, MatHeaderRowDef, - MatRow, MatRowDef, - MatTable + MatHeaderRow, + MatHeaderRowDef, + MatRow, + MatRowDef, + MatTable, } from '@angular/material/table'; -import {filter, repeat, take} from 'rxjs/operators'; -import {UserService} from '../services/user.service'; -import {CobblerApiService} from 'cobbler-api'; +import { filter, repeat, take } from 'rxjs/operators'; +import { UserService } from '../services/user.service'; +import { CobblerApiService } from 'cobbler-api'; import { MatTree, MatTreeFlatDataSource, MatTreeFlattener, - MatTreeNode, MatTreeNodeDef, + MatTreeNode, + MatTreeNodeDef, MatTreeNodePadding, - MatTreeNodeToggle + MatTreeNodeToggle, } from '@angular/material/tree'; -import {FlatTreeControl} from '@angular/cdk/tree'; -import {MatIcon} from '@angular/material/icon'; -import {MatIconButton} from '@angular/material/button'; +import { FlatTreeControl } from '@angular/cdk/tree'; +import { MatIcon } from '@angular/material/icon'; +import { MatIconButton } from '@angular/material/button'; interface TableRow { key: string; @@ -76,10 +80,10 @@ interface OsBreedFlatNode { MatListItem, MatProgressSpinner, NgForOf, - NgIf + NgIf, ], templateUrl: './signatures.component.html', - styleUrl: './signatures.component.scss' + styleUrl: './signatures.component.scss', }) export class SignaturesComponent implements OnInit { // Table @@ -96,7 +100,7 @@ export class SignaturesComponent implements OnInit { }, ]; - displayedColumns = this.columns.map(c => c.columnDef); + displayedColumns = this.columns.map((c) => c.columnDef); // Tree private _transformer = (node: OsNode, level: number) => { @@ -108,15 +112,15 @@ export class SignaturesComponent implements OnInit { }; treeControl = new FlatTreeControl( - node => node.level, - node => node.expandable, + (node) => node.level, + (node) => node.expandable, ); treeFlattener = new MatTreeFlattener( this._transformer, - node => node.level, - node => node.expandable, - node => node.children, + (node) => node.level, + (node) => node.expandable, + (node) => node.children, ); dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener); @@ -127,8 +131,7 @@ export class SignaturesComponent implements OnInit { public userService: UserService, private cobblerApiService: CobblerApiService, private _snackBar: MatSnackBar, - ) { - } + ) {} ngOnInit(): void { this.generateSignatureUiData(); @@ -136,51 +139,67 @@ export class SignaturesComponent implements OnInit { hasChild = (_: number, node: OsBreedFlatNode) => node.expandable; - hasOsVersion = (_: number, node: OsBreedFlatNode) => typeof node.data !== 'string'; + hasOsVersion = (_: number, node: OsBreedFlatNode) => + typeof node.data !== 'string'; generateSignatureUiData(): void { - this.cobblerApiService.get_signatures(this.userService.token).subscribe(value => { - const newData: Array = []; - for (const k in value.breeds) { - const children: Array = []; - for (const j in value.breeds[k]) { - const osVersionData: Array = []; - for (const i in value.breeds[k][j]) { - osVersionData.push({key: i, value: value.breeds[k][j][i]}); + this.cobblerApiService.get_signatures(this.userService.token).subscribe( + (value) => { + const newData: Array = []; + for (const k in value.breeds) { + const children: Array = []; + for (const j in value.breeds[k]) { + const osVersionData: Array = []; + for (const i in value.breeds[k][j]) { + osVersionData.push({ key: i, value: value.breeds[k][j][i] }); + } + children.push({ + data: j, + children: [{ data: osVersionData, children: [] }], + }); } - children.push({data: j, children: [{data: osVersionData, children: []}]}); + newData.push({ data: k, children: children }); } - newData.push({data: k, children: children}); - } - this.dataSource.data = newData; - this.isLoading = false - }, error => { - // HTML encode the error message since it originates from XML - this._snackBar.open(this.toHTML(error.message), 'Close'); - }); - } - - updateSignatures(): void { - this.isLoading = true - this.cobblerApiService.background_signature_update(this.userService.token).subscribe( - value => { - this.cobblerApiService.get_task_status(value).pipe( - repeat(), - filter(data => data.state === "failed" || data.state === "complete"), - take(1) - ).subscribe(value1 => { - this.isLoading = false - this.generateSignatureUiData() - }) + this.dataSource.data = newData; + this.isLoading = false; }, - error => { + (error) => { // HTML encode the error message since it originates from XML this._snackBar.open(this.toHTML(error.message), 'Close'); - }); + }, + ); + } + + updateSignatures(): void { + this.isLoading = true; + this.cobblerApiService + .background_signature_update(this.userService.token) + .subscribe( + (value) => { + this.cobblerApiService + .get_task_status(value) + .pipe( + repeat(), + filter( + (data) => data.state === 'failed' || data.state === 'complete', + ), + take(1), + ) + .subscribe((value1) => { + this.isLoading = false; + this.generateSignatureUiData(); + }); + }, + (error) => { + // HTML encode the error message since it originates from XML + this._snackBar.open(this.toHTML(error.message), 'Close'); + }, + ); } toHTML(input: string): any { // FIXME: Deduplicate method - return new DOMParser().parseFromString(input, 'text/html').documentElement.textContent; + return new DOMParser().parseFromString(input, 'text/html').documentElement + .textContent; } } diff --git a/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.html b/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.html index 316c806f..71719d0b 100644 --- a/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.html +++ b/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.html @@ -1,5 +1,5 @@
-

You are not authorized to continue.

-

Please Log in.

+

You are not authorized to continue.

+

Please Log in.

Login
diff --git a/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.spec.ts b/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.spec.ts index 35560bcb..c8f23001 100644 --- a/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.spec.ts +++ b/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.spec.ts @@ -1,7 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UnauthorizedComponent } from './unauthorized.component'; -import {provideRouter} from "@angular/router"; +import { provideRouter } from '@angular/router'; describe('UnauthorizedComponent', () => { let component: UnauthorizedComponent; @@ -9,10 +9,9 @@ describe('UnauthorizedComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ UnauthorizedComponent ], - providers: [provideRouter([])] - }) - .compileComponents(); + imports: [UnauthorizedComponent], + providers: [provideRouter([])], + }).compileComponents(); }); beforeEach(() => { diff --git a/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.ts b/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.ts index de2bbfe2..d1897ae9 100644 --- a/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.ts +++ b/projects/cobbler-frontend/src/app/unauthorized/unauthorized.component.ts @@ -1,4 +1,4 @@ -import {Component} from '@angular/core'; +import { Component } from '@angular/core'; import { RouterLink } from '@angular/router'; @Component({ @@ -9,8 +9,5 @@ import { RouterLink } from '@angular/router'; imports: [RouterLink], }) export class UnauthorizedComponent { - - constructor() { - } - + constructor() {} } diff --git a/projects/cobbler-frontend/src/environments/environment.prod.ts b/projects/cobbler-frontend/src/environments/environment.prod.ts index 3612073b..c9669790 100644 --- a/projects/cobbler-frontend/src/environments/environment.prod.ts +++ b/projects/cobbler-frontend/src/environments/environment.prod.ts @@ -1,3 +1,3 @@ export const environment = { - production: true + production: true, }; diff --git a/projects/cobbler-frontend/src/environments/environment.ts b/projects/cobbler-frontend/src/environments/environment.ts index 30d7bccb..31cb7855 100644 --- a/projects/cobbler-frontend/src/environments/environment.ts +++ b/projects/cobbler-frontend/src/environments/environment.ts @@ -3,7 +3,7 @@ // The list of file replacements can be found in `angular.json`. export const environment = { - production: false + production: false, }; /* diff --git a/projects/cobbler-frontend/src/index.html b/projects/cobbler-frontend/src/index.html index 9e6ca53b..70309e34 100644 --- a/projects/cobbler-frontend/src/index.html +++ b/projects/cobbler-frontend/src/index.html @@ -1,25 +1,35 @@ - - - Cobbler - - - - - - - - - - - + + + Cobbler + + + + + + + + + + + + + - - - - -