-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b1c999
commit fe10820
Showing
7 changed files
with
121 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1 +1 @@ | ||
export { db, setDb} from './db.js' | ||
export { db } from './db.js' |
This file contains 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 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 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 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,89 @@ | ||
import { Form, Input, Modal, Page, Select } from "#components"; | ||
import { DataTable } from "./dataTable.js"; | ||
|
||
|
||
const functionFields = [ | ||
{ | ||
slug: 'name', | ||
label: 'Name', | ||
type: 'input', | ||
default: true, | ||
}, | ||
{ | ||
slug: 'slug', | ||
label: 'Slug', | ||
type: 'input', | ||
default: true, | ||
}, | ||
{ | ||
slug: 'status', | ||
label: 'Status', | ||
type: 'select', | ||
items: [ | ||
"Enabled", | ||
"Disabled" | ||
] | ||
} | ||
] | ||
|
||
function FunctionsDataTable({functions}) { | ||
const items = { | ||
perPage: Object.keys(functions).length, | ||
page: 1, | ||
data: Object.keys(functions).map(x => functions[x]) | ||
} | ||
|
||
const actions = [ | ||
{ | ||
text: "Change Status", | ||
action: 'open-update-function-modal', | ||
dataset: { | ||
'modal-name': 'update-function' | ||
} | ||
}, | ||
{ | ||
text: "Call" | ||
}, | ||
|
||
] | ||
|
||
return DataTable({filters: [], selectable: false, items, fields: functionFields, actions, relationFilters: false}) | ||
} | ||
|
||
export function FunctionListPage({functions}) { | ||
return Page({ | ||
title: 'Functions', | ||
body: [ | ||
FunctionsDataTable({functions}), | ||
ChangeFunctionStatusModal() | ||
] | ||
}) | ||
} | ||
|
||
function ChangeFunctionStatusModal() { | ||
return Modal({ | ||
name: 'update-function', | ||
title: "Change function status", | ||
body: Form({ | ||
handler: 'function.changeStatus', | ||
cancelAction: 'modal.close', | ||
card: false, | ||
fields: [ | ||
`<input name="id" type="hidden" value="">`, | ||
Input({ | ||
name: 'name', | ||
label: 'Function Name', | ||
type: 'text' | ||
}), | ||
Select({ | ||
name: 'status', | ||
label: 'New Status', | ||
items: [ | ||
'Enabled', | ||
"Disabled" | ||
] | ||
}) | ||
] | ||
}) | ||
}) | ||
} |