Skip to content

Commit

Permalink
Refactor to new actions. (#98)
Browse files Browse the repository at this point in the history
Refactor to new actions.
  • Loading branch information
lexbritvin authored Jan 16, 2025
1 parent 3cabc03 commit 907a30b
Show file tree
Hide file tree
Showing 36 changed files with 294 additions and 199 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SWAGGER_UI_DIR:=./swagger-ui

# Build available information.
GIT_HASH:=$(shell git log --format="%h" -n 1 2> /dev/null)
GIT_BRANCH:=$(shell git branch 2> /dev/null | grep '*' | cut -f2 -d' ')
GIT_BRANCH:=$(shell git rev-parse --abbrev-ref HEAD)
APP_VERSION:="$(GIT_BRANCH)-$(GIT_HASH)"
GOPKG:=github.com/launchrctl/launchr

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ To run Launchr Web server:
```shell
# Run web server on http://localhost:8080
bin/launchr web
# To use example as base dir for actions discovery.
LAUNCHR_ACTIONS_PATH=example bin/launchr web
# Run web server on http://localhost:3000
bin/launchr web -p 3000
# Serve swagger-ui and swagger.json
Expand Down
35 changes: 35 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
runtime: plugin
action:
title: Web UI
description: >-
Starts Web UI. Example: "web", "web --foreground", "web stop"
alias:
- ui
arguments:
- name: op
title: Operation
description: "Operates the web server. Optional. Allowed: [stop]"
type: string
enum: [stop]
options:
- name: port
shorthand: p
title: Port
description: Web server port
type: integer
default: 8080
- name: foreground
title: Foreground
description: Run server in foreground. By default Web UI starts in background.
type: boolean
default: false
- name: proxy-client
title: Proxy client
description: Proxies to client web server, useful in local development
type: string
default: ""
- name: swagger-ui
title: Swagger UI
description: Serve swagger.json on /api/swagger.json and Swagger UI on /api/swagger-ui
type: boolean
default: false
2 changes: 1 addition & 1 deletion client/openapi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export interface components {
};
JSONSchema: Record<string, never>;
Error: {
/** Format: int32 */
/** Format: int */
code: number;
message: string;
};
Expand Down
6 changes: 5 additions & 1 deletion client/src/utils/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ export const sentenceCase = (a: string) => {
}

export const splitActionId = (actionId: string) => {
if (!actionId.includes(':') && !actionId.includes('.')) {
return { levels: [], id: actionId }
}

const [path, id] = actionId.split(':')
const levels = path?.split('.') || []
const levels = path ? path.split('.') : []
return { levels, id }
}

Expand Down
12 changes: 12 additions & 0 deletions client/src/utils/react-flow-builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ const layerColorSchemesHSL = [
[346.93, 83.26, 57.84],
[160.47, 68.42, 51.57],
[252.15, 91.86, 66.27],
[214.79, 87.25, 50.78],
[346.93, 83.26, 57.84],
[160.47, 68.42, 51.57],
[252.15, 91.86, 66.27],
[214.79, 87.25, 50.78],
[346.93, 83.26, 57.84],
[160.47, 68.42, 51.57],
[252.15, 91.86, 66.27],
[214.79, 87.25, 50.78],
[346.93, 83.26, 57.84],
[160.47, 68.42, 51.57],
[252.15, 91.86, 66.27],
]

export const buildNodeColor = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ action:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option
Expand All @@ -30,6 +30,9 @@ action:
title: Option 4
description: Some additional info for option
type: array

runtime:
type: container
# image: python:3.7-slim
image: ubuntu
# command: python3 {{ .opt4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ action:
- name: arg2
title: Argument 2
description: Some additional info for arg
options: # TODO Use json schema. By default string. Do not allow complex data.
options:
- name: opt1
title: Option 1
description: Some additional info for option

runtime:
type: container
image: python:3.7-slim
command: python3 %s
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
action:
title: RJSF Example of Arrays
description: RJSF Arrays arguments
image: alpine:latest
command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"]
arguments:
- name: optarr
title: Array
description: Some additional info for option
type: array
type: array

runtime:
type: container
image: alpine:latest
command: [ "sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done" ]
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
action:
title: RJSF Example of Enumeration
description: RJSF Enumeration arguments
image: alpine:latest
command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"]
arguments:
- name: select
title: Select
Expand All @@ -11,4 +9,9 @@ action:
- name: radio
title: Radio
type: string
enum: [ Ola, Hello, Bonjour, Buongiorno, GutenTag ]
enum: [ Ola, Hello, Bonjour, Buongiorno, GutenTag ]

runtime:
type: container
image: alpine:latest
command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
action:
title: RJSF Example of Numbers
description: RJSF Numbers arguments
image: alpine:latest
command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"]
arguments:
- name: float
title: Float
Expand All @@ -26,3 +24,8 @@ action:
minimum: -50
maximum: 50
multipleOf: 25

runtime:
type: container
image: alpine:latest
command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
action:
title: RJSF Example of strings
description: RJSF Example of strings arguments
image: alpine:latest
command: ["sh", "-c", "for i in $(seq 60); do echo -e \"\\033[32m$$i\\033[0m\"; sleep 1; done"]
arguments:
- name: simpleString
title: Simple inline string
Expand Down Expand Up @@ -30,3 +28,7 @@ action:
title: Label with word passphrase
type: string

runtime:
type: container
image: alpine:latest
command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"]
File renamed without changes.
Loading

0 comments on commit 907a30b

Please sign in to comment.