screen(title = "{t('new_job_window.new_job_rustploy')}") {
resources {
component(name = SemProjetosParaJob) {
text("{t('common.no_projects_yet')}", class = u-muted)
}
link(rel = import, href = "components/picker_row.component.gv", as = PickerRow)
link(rel = import, href = "components/tab_button.component.gv", as = TabButton)
link(rel = import, href = "components/job_env_panel.component.gv", as = JobEnvPanel)
script(src = "scripts/new_job_window.luau")
}
column(class = dialog__screen) {
row(class = titlebar) {
row(class = titlebar__drag, on_press = window:drag) {
text("●", class = titlebar__dot)
text("{t('new_job_window.new_job_rustploy')}", class = titlebar__title)
}
button("—", class = titlebar__btn, on_click = window:minimize)
button("✕", class = "titlebar__btn titlebar__btn--close", on_click = window:close)
}
scrollable(class = dialog__body, direction = vertical) {
column(class = form-panel) {
if @new_job_step == "pick_project" {
text("{t('new_job_window.choose_the_project')}", class = u-label-cap)
text(
"{t('new_job_window.the_job_brings_up_its_own')}",
class = u-muted,
)
column(class = kv-list) {
each @new_job_projects as p (fallback = SemProjetosParaJob) {
PickerRow(
title = @p.name,
subtitle = "",
button_label = "{t('common.select')}",
action = new_job_pick_project:@p.id,
)
}
}
row(class = dialog__actions) {
column(class = u-fill)
button(
"{t('common.cancel')}",
class = "btn btn--ghost",
on_click = cancel,
disabled = @busy_cancel
)
}
}
if @new_job_step == "pick_service" {
text(
"{t('new_job_window.trigger_service_optional', new_job_project_name=new_job_project_name)}",
class = u-label-cap,
)
text(
"{t('new_job_window.lends_base_env_vars_secrets_to')}",
class = u-muted,
)
row(class = env__add) {
button(
"{t('new_job_window.none_standalone_job')}",
class = "btn btn--ghost",
on_click = new_job_pick_no_service,
disabled = @busy_new_job_pick_no_service
)
}
text(
"{t('new_job_window.this_project_has_no_services')}",
if = @new_job_services_filtered,
equals = "[]",
class = u-muted,
)
column(class = kv-list) {
PickerRow(
:for_each = new_job_services_filtered,
var = s,
title = @s.name,
subtitle = "",
button_label = "{t('common.select')}",
action = new_job_pick_service:@s.id,
)
}
row(class = dialog__actions) {
column(class = u-fill)
button(
"{t('common.back')}",
class = "btn btn--ghost",
on_click = new_job_back,
disabled = @busy_new_job_back
)
}
}
if @new_job_step == "form" {
if @new_job_edit_id != "" {
text(
"{t('new_job_window.edit_job', new_job_name=new_job_name)}",
class = u-label-cap
)
} else {
text(
"{t('new_job_window.new_job', new_job_project_name=new_job_project_name, new_job_service_name=new_job_service_name)}",
class = u-label-cap,
)
}
form(
error_prefix = error_,
name = new_job_form,
on_submit = new_job_create,
class = "form form--gap-10",
) {
field(label = "{t('common.name')}") {
input(
class = dialog__input,
form_control = new_job_name,
:value = new_job_name,
on_change = field:new_job_name,
placeholder = "{t('new_job_window.e_g_backup_db')}",
)
}
field(label = "{t('new_job_window.compose_source')}", label_class = u-label-cap) {
scroll(class = tabs__scroll, direction = horizontal) {
row(class = tabs__main) {
TabButton(
label = "{t('common.compose')}",
current = @new_job_source,
target = compose,
action = new_job_source:compose,
)
TabButton(
label = "{t('common.git')}",
current = @new_job_source,
target = git,
action = new_job_source:git,
)
}
}
}
if @new_job_source == "compose" {
field(label = "{t('new_job_window.docker_compose_yml')}") {
textarea(
class = env__editor,
font = mono,
:value = new_job_compose,
placeholder = l"""
services:
job:
image: busybox
command: ["sh", "-c", "echo ok"]
""",
)
}
}
if @new_job_source == "git" {
text(
"{t('new_job_window.select_the_connected_account_the_repository')}",
class = u-muted,
)
row(class = busy-row, if = @new_job_git_message, not_equals = "") {
spinner(class = busy-row__spin, if = @new_job_git_busy)
text("@new_job_git_message", class = u-muted)
}
field(
label = "{t('new_job_window.git_account')}",
description = "{t('common.connect_accounts_in_settings_git')}",
) {
select(
class = form-select,
:options = new_job_git_providers,
:value = new_job_git_provider_id,
on_change = new_job_git_provider_pick,
placeholder = "{t('common.select_the_account')}",
label_field = display,
value_field = id,
)
}
field(label = "{t('common.repository')}") {
select(
class = form-select,
:options = new_job_git_repos,
:value = new_job_git_repo,
on_change = new_job_git_repo_pick,
placeholder = "{t('common.select_the_repository')}",
label_field = full_name,
value_field = full_name,
)
}
field(label = "{t('common.branch')}") {
select(
class = form-select,
:options = new_job_git_branches,
:value = new_job_git_branch,
on_change = field:new_job_git_branch,
placeholder = "{t('common.select_the_branch')}",
label_field = name,
value_field = name,
)
}
field(label = "{t('new_job_window.compose_path_in_the_repo')}") {
input(
class = dialog__input,
form_control = new_job_compose_path,
:value = new_job_compose_path,
on_change = field:new_job_compose_path,
placeholder = "{t('new_job_window.docker_compose_yml_2')}",
)
}
}
field(label = "{t('new_job_window.main_service_name_inside_the')}") {
input(
class = dialog__input,
form_control = new_job_main_service,
:value = new_job_main_service,
on_change = field:new_job_main_service,
placeholder = "{t('new_job_window.e_g_job')}",
)
}
field(label = "{t('new_job_window.env_section')}") {
if @new_job_edit_id != "" {
text("{t('new_job_window.env_hint_edit')}", class = u-muted)
row(class = env__add) {
button(
"{t('new_job_window.open_env')}",
class = "btn btn--ghost",
on_click = new_job_open_env,
disabled = @busy_new_job_open_env
)
}
} else {
text("{t('new_job_window.env_hint_create')}", class = u-muted)
row(class = env__add) {
input(
class = env__input-key,
:value = new_job_env_key,
on_change = field:new_job_env_key,
placeholder = "{t('common.key')}",
)
if @new_job_env_is_secret == "true" {
select(
class = form-select,
:options = new_job_env_secret_options,
:value = new_job_env_value,
on_change = field:new_job_env_value,
label_field = label,
value_field = name,
placeholder = "{t('environment.pick_secret')}",
)
} else {
input(
class = env__input,
:value = new_job_env_value,
on_change = field:new_job_env_value,
placeholder = "{t('common.value')}",
)
}
}
row(class = env__add) {
checkbox(
class = env__use-secret,
:checked = new_job_env_is_secret,
on_toggle = new_job_env_use_secret,
label = "{t('environment.use_secret')}",
)
column(class = u-fill)
button(
"{t('common.add')}",
class = "btn btn--primary",
on_click = new_job_env_add,
disabled = @busy_new_job_env_add
)
}
column(class = kv-list, if = @new_job_env_count, not_equals = "0") {
each @new_job_env_rows as e {
row(class = kv-list__row) {
button(
"✕",
class = env__del,
on_click = new_job_env_delete:@e.index,
disabled = @busy_new_job_env_delete
)
text(class = env__sep)
input(
class = env__inline-key,
:value = "@e.bind_key",
on_change = new_job_env_row_key:@e.index,
placeholder = "{t('common.key')}",
)
if @e.is_secret == "true" {
text("🔒 @e.secret", class = "kv-list__val kv-list__val--compact")
} else {
input(
class = env__inline,
:value = "@e.bind_value",
on_change = new_job_env_row_value:@e.index,
placeholder = "{t('common.value')}",
)
}
}
}
}
}
}
field(label = "{t('common.recurrence')}", label_class = u-label-cap) {
scroll(class = tabs__scroll, direction = horizontal) {
row(class = tabs__main) {
TabButton(
label = "{t('new_job_window.manual')}",
current = @new_job_kind,
target = manual,
action = new_job_kind:manual,
)
TabButton(
label = "{t('new_job_window.interval')}",
current = @new_job_kind,
target = interval,
action = new_job_kind:interval,
)
TabButton(
label = "{t('new_job_window.daily')}",
current = @new_job_kind,
target = daily,
action = new_job_kind:daily,
)
TabButton(
label = "{t('new_job_window.weekly')}",
current = @new_job_kind,
target = weekly,
action = new_job_kind:weekly,
)
}
}
}
if @new_job_kind == "interval" {
field(label = "{t('new_job_window.every_how_many_hours')}") {
spinbox(
field_class = field__spin,
form_control = new_job_hours,
:value = new_job_hours,
min = 1,
max = 168,
width = 90,
placeholder = 6,
)
}
}
if @new_job_kind == "daily" {
row(class = env__add) {
field(label = "{t('common.time')}") {
timeedit(:value = new_job_time)
}
}
}
if @new_job_kind == "weekly" {
field(label = "{t('new_job_window.day_of_the_week')}") {
scroll(class = tabs__scroll, direction = horizontal) {
row(class = tabs__main) {
radiogroup(
:value = new_job_weekday,
:items = weekdays,
layout = row,
)
}
}
}
row(class = env__add) {
field(label = "{t('common.time')}") {
timeedit(:value = new_job_time)
}
}
}
text(
"@new_job_error",
if = @new_job_error,
not_equals = "",
class = u-error,
)
row(class = busy-row, if = @new_job_message, not_equals = "") {
spinner(class = busy-row__spin, if = @new_job_busy)
text("@new_job_message", class = u-muted)
}
row(class = dialog__actions) {
column(class = u-fill)
button(
"{t('common.close')}",
class = "btn btn--ghost",
if = @new_job_edit_id,
not_equals = "",
on_click = new_job_back,
disabled = @busy_new_job_back
)
button(
"{t('common.back')}",
class = "btn btn--ghost",
if = @new_job_edit_id,
equals = "",
on_click = new_job_back,
disabled = @busy_new_job_back
)
button(
"{t('common.save')}",
class = "btn btn--primary",
if = @new_job_edit_id,
not_equals = "",
type = submit,
disabled = @busy_new_job_create
)
button(
"{t('new_job_window.create_job')}",
class = "btn btn--primary",
if = @new_job_edit_id,
equals = "",
type = submit,
disabled = @busy_new_job_create
)
}
}
}
if @new_job_step == "env" {
column(class = form-panel) {
text("{t('job_env.title', job_env_name=job_env_name)}", class = "u-label-cap")
text(
"{t('new_job_window.job_created')}",
class = u-muted,
if = @new_job_created_id,
not_equals = "",
)
JobEnvPanel
row(class = dialog__actions) {
column(class = u-fill)
button(
"{t('common.back')}",
class = "btn btn--ghost",
if = @new_job_edit_id,
not_equals = "",
on_click = new_job_env_back,
disabled = @busy_new_job_env_back
)
button(
"{t('new_job_window.done')}",
class = "btn btn--primary",
on_click = cancel,
disabled = @busy_cancel
)
}
}
}
}
}
}
}