Skip to content
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

WIP environments UI + scenario #58

Merged
merged 8 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .fastn/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1597,8 +1597,8 @@
},
"components/label-text.ftd": {
"name": "components/label-text.ftd",
"checksum": "2FD6F02B7A1A3B41417BA48F378B2ED076C494B955F6FB53DCCE061A0B0250B1",
"size": 1628
"checksum": "7287117D126182A09923CDBC063531F298C124FA9206100084531B4F139B0C12",
"size": 1606
},
"components/toggle.ftd": {
"name": "components/toggle.ftd",
Expand Down Expand Up @@ -1692,8 +1692,8 @@
},
"record.ftd": {
"name": "record.ftd",
"checksum": "9EB82634CCE4C7B004510FBC5C65310AF12584C1BEEA481F6B2C4B88AAF1F100",
"size": 291
"checksum": "50E29512E4B805A9E862DA2D94AC2C1275DDE4C3B146F3F326D6ACA3D497699E",
"size": 320
},
"slide.ftd": {
"name": "slide.ftd",
Expand All @@ -1706,8 +1706,8 @@
"size": 10641
}
},
"zip_url": "https://github.com/fastn-community/design-system/archive/028b055c914d1ece067673b469d9153cd11b62b9.zip",
"checksum": "B68DF5316FE058131C1EB36FFDAF999AB0847EF109B56D800B9C2882EE114AEB"
"zip_url": "https://github.com/fastn-community/design-system/archive/f5cfb371265e664227dbf8d901f8b12e4d2bd7af.zip",
"checksum": "8BA06F13E94D7FE4196332F6A4E8DCC3C22D724F158AA95B4EBCF9AA273C664D"
},
"fastn-community.github.io/doc-site": {
"files": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ string value:
text-placement placement: horizontal
ftd.align align-content: left

-- ds.section-row:
margin: $ds.spaces.vertical-gap.zero
-- ds.container:
width: hug-content

-- ds.row:
if: { label-text.placement == horizontal }
Expand All @@ -44,7 +44,7 @@ align-content: left

-- end: ds.column

-- end: ds.section-row
-- end: ds.container

-- end: label-text

Expand Down
12 changes: 6 additions & 6 deletions .packages/fastn-community.github.io/design-system/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@
},
"components/label-text.ftd": {
"name": "components/label-text.ftd",
"checksum": "2FD6F02B7A1A3B41417BA48F378B2ED076C494B955F6FB53DCCE061A0B0250B1",
"size": 1628
"checksum": "7287117D126182A09923CDBC063531F298C124FA9206100084531B4F139B0C12",
"size": 1606
},
"components/toggle.ftd": {
"name": "components/toggle.ftd",
Expand Down Expand Up @@ -382,8 +382,8 @@
},
"record.ftd": {
"name": "record.ftd",
"checksum": "9EB82634CCE4C7B004510FBC5C65310AF12584C1BEEA481F6B2C4B88AAF1F100",
"size": 291
"checksum": "50E29512E4B805A9E862DA2D94AC2C1275DDE4C3B146F3F326D6ACA3D497699E",
"size": 320
},
"slide.ftd": {
"name": "slide.ftd",
Expand All @@ -396,6 +396,6 @@
"size": 10641
}
},
"zip_url": "https://github.com/fastn-community/design-system/archive/028b055c914d1ece067673b469d9153cd11b62b9.zip",
"checksum": "B68DF5316FE058131C1EB36FFDAF999AB0847EF109B56D800B9C2882EE114AEB"
"zip_url": "https://github.com/fastn-community/design-system/archive/f5cfb371265e664227dbf8d901f8b12e4d2bd7af.zip",
"checksum": "8BA06F13E94D7FE4196332F6A4E8DCC3C22D724F158AA95B4EBCF9AA273C664D"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ optional string template-name:
optional body desc:
optional string updated-on:
optional string preview-url:
optional string domain-name:
optional string github-url:
string list features:
string list pages:
24 changes: 24 additions & 0 deletions actions/sites/settings/environment.ftd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- optional string $key-error:
-- optional string $value-error:

-- void update(id, key, value):
integer id:
string key:
string value:
js: $assets.files.assets.functions.js

callAlert("updating env: " + id + " " + key + " " + value)


-- void create-env(key, value):
string key:
string value:
js: $assets.files.assets.functions.js

callAlert("creating env: " + key + " " + value)

-- void remove(id):
integer id:
js: $assets.files.assets.functions.js

callAlert("deleting env: " + id)
7 changes: 6 additions & 1 deletion components/sites/setting/page.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ sites-records.site-common-data site:
is-active if { setting-left-column.current-page == "github" }: true
link: $setting-left-column.site.github-url

-- sites-header.tab-link: Environments
is-active if { setting-left-column.current-page == "environments" }: true
link: $setting-left-column.site.environments-url

-- end: ds.column

-- end: setting-left-column
-- end: setting-left-column

1 change: 1 addition & 0 deletions index.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ spacing: $ds.spaces.vertical-gap.medium.gap
- [Github (Un-configured)](/scenarios/sites/setting/github/)
- [Github (Configured)](/scenarios/sites/setting/github-configured/)
- [Site Tokens](/scenarios/sites/setting/tokens/)
- [Environments](/scenarios/sites/setting/environments/)

-- page-block: Site Editor Pages

Expand Down
166 changes: 166 additions & 0 deletions pages/sites/setting/environments.ftd
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
-- import: ui.fifthtry.com/components/sites/setting/page as p
-- import: ui.fifthtry.com/site-data
-- import: ui.fifthtry.com/records/user-data as ud
-- import: ui.fifthtry.com/records/sites as sites-records
-- import: ui.fifthtry.com/actions/sites/settings/environment
-- import: fastn/processors as pr


-- component page:
module site-data: site-data
module action: environment
ud.user-data user-data:
sites-records.site-common-data site:
string dashboard-url:
optional string top-message:
private boolean $reveal: false
private string $current-key: *$ftd.empty
private string $current-value: *$ftd.empty

-- p.page:
site-data: $page.site-data
user-data: $page.user-data
site: $page.site
current-page: environments
dashboard-url: $page.dashboard-url
top-message: $page.top-message

-- ds.section-column:
inset: $ds.spaces.inset-tall.large

-- ds.primary-button: Reveal Config Vars
title if { page.reveal }: Hide Config Vars
radius: curved
$on-click$: $ftd.toggle($a = $page.reveal)

-- env-row:
action: environment
env: $env
for: $env in $envs
if: { page.reveal }

-- ds.row:
if: { page.reveal }

-- ftd.column:

-- ftd.text-input:
type: text
$on-input$: $ftd.set-string($a = $page.current-key, v = $VALUE)
height.fixed.px: 32
border-radius.px: 4
placeholder: KEY
background.solid: transparent
border-width.px: 1
border-color: $inherited.colors.border
border-color if { page.action.key-error != NULL }: $inherited.colors.error.border
padding.px: 8
color: $inherited.colors.text-strong
margin-right.px: 8

-- ds.copy-small: $page.action.key-error
if: { page.action.key-error != NULL }
color: $ds.colors.error.text

-- end: ftd.column

-- ftd.column:

-- ftd.text-input:
type: text
$on-input$: $ftd.set-string($a = $page.current-value, v = $VALUE)
height.fixed.px: 32
border-radius.px: 4
placeholder: VALUE
background.solid: transparent
border-width.px: 1
border-color: $inherited.colors.border
border-color if { page.action.value-error != NULL }: $inherited.colors.error.border
padding.px: 8
color: $inherited.colors.text-strong
margin-right.px: 8

-- ds.copy-small: $page.action.key-error
if: { page.action.key-error != NULL }
color: $ds.colors.error.text

-- end: ftd.column

-- ds.primary-button: Add
$on-click$: $page.action.create-env(key = $page.current-key, value = $page.current-value)

-- end: ds.row

-- end: ds.section-column

-- end: p.page

-- end: page

-- sites-records.Environment list envs:
$processor$: pr.http
url: http://127.0.0.1:8080/test.json ;; TODO: make this configurable
siddhantk232 marked this conversation as resolved.
Show resolved Hide resolved



-- component env-row:
module action: environment
sites-records.Environment env:
private string $current-key: *$env-row.env.key
private string $current-value: *$env-row.env.value

-- ds.row:

-- ftd.column:

-- ftd.text-input:
type: text
$on-input$: $ftd.set-string($a = $env-row.current-key, v = $VALUE)
height.fixed.px: 32
border-radius.px: 4
value: $env-row.env.key
background.solid: transparent
border-width.px: 1
border-color: $inherited.colors.border
border-color if { env-row.action.key-error != NULL }: $inherited.colors.error.border
padding.px: 8
color: $inherited.colors.text-strong
margin-right.px: 8

-- ds.copy-small: $env-row.action.key-error
if: { env-row.action.key-error != NULL }
color: $ds.colors.error.text

-- end: ftd.column

-- ftd.column:

-- ftd.text-input:
type: text
height.fixed.px: 32
border-radius.px: 4
$on-input$: $ftd.set-string($a = $env-row.current-value, v = $VALUE)
value: $env-row.env.value
background.solid: transparent
border-width.px: 1
border-color: $inherited.colors.border
border-color if { env-row.action.value-error != NULL }: $inherited.colors.error.border
padding.px: 8
color: $inherited.colors.text-strong
margin-right.px: 8

-- ds.copy-small: $env-row.action.value-error
if: { env-row.action.value-error != NULL }
color: $ds.colors.error.text

-- end: ftd.column

-- ds.primary-button: Save
$on-click$: $env-row.action.update(id = $env-row.env.id, key = $env-row.current-key, value = $env-row.current-value)

-- ds.primary-button: Remove
$on-click$: $env-row.action.remove(id = $env-row.env.id)

-- end: ds.row

-- end: env-row
6 changes: 6 additions & 0 deletions records/sites.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ string cr-list-url:
string domains-url:
string updated-on:
ftd.image-src preview-image:
string environments-url:



Expand Down Expand Up @@ -58,3 +59,8 @@ string url:
optional file-text text:
optional string error:
string updated-at:

-- record Environment:
integer id:
string key:
string value:
11 changes: 11 additions & 0 deletions scenarios/sites/setting/environments.ftd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- import: ui.fifthtry.com/pages/sites/setting/environments
-- import: ui.fifthtry.com/scenarios/john-doe
-- import: ui.fifthtry.com/records/sites as sites-records
-- import: ui.fifthtry.com/scenarios/sites/site-info
-- import: ui.fifthtry.com/scenarios/scenario-site

-- environments.page:
site-data: scenario-site
user-data: $john-doe.jd
site: $site-info.acme-site
dashboard-url: /scenarios/user/dashboard/
siddhantk232 marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion scenarios/sites/site-info.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ cr-list-url: /scenarios/sites/cr-list/
tokens-url: /scenarios/sites/setting/tokens/
updated-on: 14th Feb
preview-image: /-/ui.fifthtry.com/assets/sites/placeholder-preview.svg

environments-url: /scenarios/sites/setting/environments/
1 change: 1 addition & 0 deletions scenarios/user/dashboard.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ tokens-url: /scenarios/sites/tokens/
setting-url: /scenarios/sites/setting/domains/
domains-url: /scenarios/sites/domains/
cr-list-url: /scenarios/sites/cr-list/
environments-url: /scenarios/sites/setting/environments/
updated-on: 14th Feb
preview-image: /-/ui.fifthtry.com/assets/sites/placeholder-preview.svg

Expand Down