-
Notifications
You must be signed in to change notification settings - Fork 131
Support for local and server profiles and actions #2341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 7 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
803747a
Support for local and server profiles
worksofliam 0300298
Ability to copy configurable profiles as JSON
worksofliam 6e3137b
Merge branch 'master' into feature/enhanced_profiles
worksofliam 06c31d9
Refactor profile handling to load configurations from a dedicated con…
worksofliam 190c80c
Refactor action handling to load configurations from a dedicated conf…
worksofliam c230fbd
Add 'type' property to actions schema and update actions configuration
worksofliam 3029ec5
Refactor configuration loading and enhance settings UI with reload op…
worksofliam 5ad9021
Remove redundant serverData check in config retrieval and correct err…
worksofliam c435b8b
Update to schemas
worksofliam 66afb89
Refactor configuration handling to include fallback values and stream…
worksofliam 51bc3df
Enhance configuration loading by adding 'invalid' state and improving…
worksofliam 0831672
Add configuration file tests and ensure proper validation and merging…
worksofliam 4a4579b
Additional test cases for merging
worksofliam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "definitions": { | ||
| "FilterType": { | ||
| "type": "string", | ||
| "enum": ["simple", "regex"] | ||
| }, | ||
| "ObjectFilters": { | ||
| "type": "object", | ||
| "properties": { | ||
| "name": { "type": "string" }, | ||
| "filterType": { "$ref": "#/definitions/FilterType" }, | ||
| "library": { "type": "string" }, | ||
| "object": { "type": "string" }, | ||
| "types": { | ||
| "type": "array", | ||
| "items": { "type": "string" } | ||
| }, | ||
| "member": { "type": "string" }, | ||
| "memberType": { "type": "string" }, | ||
| "protected": { "type": "boolean" } | ||
| }, | ||
| "required": ["name", "filterType", "library", "object", "types", "member", "memberType", "protected"] | ||
| }, | ||
| "CustomVariable": { | ||
| "type": "object", | ||
| "properties": { | ||
| "name": { "type": "string" }, | ||
| "value": { "type": "string" } | ||
| }, | ||
| "required": ["name", "value"] | ||
| }, | ||
| "ConnectionProfile": { | ||
| "type": "object", | ||
| "properties": { | ||
| "name": { "type": "string" }, | ||
| "homeDirectory": { "type": "string" }, | ||
| "currentLibrary": { "type": "string" }, | ||
| "libraryList": { | ||
| "type": "array", | ||
| "items": { "type": "string" } | ||
| }, | ||
| "objectFilters": { | ||
| "type": "array", | ||
| "items": { "$ref": "#/definitions/ObjectFilters" } | ||
| }, | ||
| "ifsShortcuts": { | ||
| "type": "array", | ||
| "items": { "type": "string" } | ||
| }, | ||
| "customVariables": { | ||
| "type": "array", | ||
| "items": { "$ref": "#/definitions/CustomVariable" } | ||
| } | ||
| }, | ||
| "required": ["name"] | ||
| }, | ||
| "TopLevel": { | ||
| "type": "object", | ||
| "properties": { | ||
| "profiles": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "object", | ||
| "properties": { | ||
| "name": { "type": "string" }, | ||
| "homeDirectory": { "type": "string" }, | ||
| "currentLibrary": { "type": "string" }, | ||
| "libraryList": { | ||
| "type": "array", | ||
| "items": { "type": "string" } | ||
| }, | ||
| "objectFilters": { | ||
| "type": "array", | ||
| "items": { "$ref": "#/definitions/ObjectFilters" } | ||
| }, | ||
| "ifsShortcuts": { | ||
| "type": "array", | ||
| "items": { "type": "string" } | ||
| }, | ||
| "customVariables": { | ||
| "type": "array", | ||
| "items": { "$ref": "#/definitions/CustomVariable" } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "required": ["profiles"] | ||
| } | ||
| }, | ||
| "$ref": "#/definitions/TopLevel" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { Action } from "../../typings"; | ||
| import { ConnectionConfiguration } from "../Configuration"; | ||
| import IBMi from "../IBMi"; | ||
| import { ConfigFile } from "./configFile"; | ||
|
|
||
| export function getActionsConfig(connection: IBMi) { | ||
| const ActionsConfig = new ConfigFile<Action[]>(connection, `actions`); | ||
|
|
||
| ActionsConfig.hasServerFile = true; | ||
| ActionsConfig.mergeArrays = true; | ||
|
|
||
| ActionsConfig.validateAndCleanInPlace = (loadedConfig) => { | ||
| let actions: Action[] = []; | ||
| // Maybe one day replace this with real schema validation | ||
| if (Array.isArray(loadedConfig)) { | ||
| loadedConfig.forEach((action, index) => { | ||
| if ( | ||
| typeof action.name === `string` && | ||
| typeof action.command === `string` && | ||
| [`ile`, `pase`, `qsh`].includes(action.environment) && | ||
| Array.isArray(action.extensions) | ||
| ) { | ||
| actions.push({ | ||
| type: `file`, | ||
| ...action, | ||
| }); | ||
| } else { | ||
| throw new Error(`Invalid Action defined at index ${index}.`); | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| return actions; | ||
| } | ||
|
|
||
| return ActionsConfig; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.