Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
50da623
test
GiorunoGiovanna Jun 2, 2021
e2f6e2a
Merge branch 'main' of https://github.com/GiorunoGiovanna/function-st…
GiorunoGiovanna Jun 2, 2021
72b4333
test
GiorunoGiovanna Jun 3, 2021
b534dd4
test
GiorunoGiovanna Jun 3, 2021
2087e36
Support multi input topics config
GiorunoGiovanna Jun 3, 2021
6beab86
Support multi-input-topics config
GiorunoGiovanna Jun 3, 2021
54cac9c
[#6]Support multi-input-topics config
GiorunoGiovanna Jun 4, 2021
a4362db
create images management
GiorunoGiovanna Jun 8, 2021
d21b190
create images management
GiorunoGiovanna Jun 8, 2021
59f1452
create images management
GiorunoGiovanna Jun 8, 2021
17b66e7
Merge pull request #1 from FunctionStream/main
GiorunoGiovanna Jun 8, 2021
bc6b191
update inputs
GiorunoGiovanna Jun 12, 2021
d63c7bb
update inputs
GiorunoGiovanna Jun 13, 2021
1b662be
Merge branch 'main' into main
GiorunoGiovanna Jun 13, 2021
9ce15cb
Delete index.vue
GiorunoGiovanna Jun 13, 2021
ccfd358
Merge pull request #2 from GiorunoGiovanna/0.2-images
GiorunoGiovanna Jun 13, 2021
dbc90c3
Delete AddForm.vue
GiorunoGiovanna Jun 13, 2021
0ad2ed4
Delete FunctionDetail.vue
GiorunoGiovanna Jun 13, 2021
511e5dc
Delete FunctionTable.vue
GiorunoGiovanna Jun 13, 2021
1950e43
Delete Trigger.vue
GiorunoGiovanna Jun 13, 2021
cb882af
Update router.config.js
GiorunoGiovanna Jun 13, 2021
deb436d
Update func.js
GiorunoGiovanna Jun 13, 2021
ac6f628
Update func.js
GiorunoGiovanna Jun 13, 2021
bee1f79
Update front-end/src/mock/services/func.js
GiorunoGiovanna Jun 13, 2021
b9a136c
Update front-end/src/views/function/components/AddForm.vue
GiorunoGiovanna Jun 13, 2021
f690162
Update front-end/src/views/function/components/AddForm.vue
GiorunoGiovanna Jun 13, 2021
dcc42a1
Update front-end/src/views/function/components/AddForm.vue
GiorunoGiovanna Jun 13, 2021
b613efe
fix bug and clean up comment
GiorunoGiovanna Jun 13, 2021
b9584a5
Update front-end/src/views/function/components/AddForm.vue
GiorunoGiovanna Jun 13, 2021
0f30c13
Update front-end/src/views/function/components/AddForm.vue
GiorunoGiovanna Jun 13, 2021
dad86a2
clean up comments
GiorunoGiovanna Jun 13, 2021
ddb837e
add Function Name field
GiorunoGiovanna Jun 14, 2021
6801742
Revert "add Function Name field"
GiorunoGiovanna Jun 16, 2021
b1c3397
Merge branch 'FunctionStream:main' into main
GiorunoGiovanna Jun 16, 2021
b39d59e
add Function Name field
GiorunoGiovanna Jun 16, 2021
0492016
resolve conflicts
GiorunoGiovanna Jun 18, 2021
56b0794
resolve conflicts
GiorunoGiovanna Jun 18, 2021
6117040
Merge branch 'FunctionStream:main' into main
GiorunoGiovanna Jun 18, 2021
a1eee5d
fix problems
GiorunoGiovanna Jun 18, 2021
abc407a
Update .env.api
GiorunoGiovanna Jun 19, 2021
055b749
Update .env.api
GiorunoGiovanna Jun 19, 2021
efd15d4
Update .gitignore
GiorunoGiovanna Jun 19, 2021
c2d3110
Update .gitignore
GiorunoGiovanna Jun 19, 2021
7d2c87b
Update .gitignore
GiorunoGiovanna Jun 19, 2021
8db18fd
Update .gitignore
GiorunoGiovanna Jun 19, 2021
e95034c
resolve conflicts
GiorunoGiovanna Jun 19, 2021
157cdad
resolve conflicts
GiorunoGiovanna Jun 19, 2021
379ac30
resolve conflicts
GiorunoGiovanna Jun 19, 2021
474b6fd
resolve conflicts
GiorunoGiovanna Jun 19, 2021
0adfc7b
Merge branch 'FunctionStream:main' into main
GiorunoGiovanna Jun 19, 2021
aabb6fd
fix problems
GiorunoGiovanna Jun 19, 2021
a4d6dd8
Merge branch 'FunctionStream:main' into main
GiorunoGiovanna Jun 22, 2021
5c562ee
fix problems
GiorunoGiovanna Jun 22, 2021
81a5c08
API joint for pulsar backend: update
GiorunoGiovanna Jun 22, 2021
4a0df0c
Solve the problem of refresh
GiorunoGiovanna Jun 23, 2021
982e596
Merge branch 'main' into main
GiorunoGiovanna Jun 24, 2021
bec9c18
Update FunctionTable.vue
GiorunoGiovanna Jun 24, 2021
6819a83
resolve problems
GiorunoGiovanna Jun 24, 2021
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
13 changes: 9 additions & 4 deletions front-end/src/api/func.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import request from '@/utils/request'

const { post, get } = request
const { post, get, put } = request

export const funcApi = {
list: '/admin/v3/functions/public/default',
create: '/admin/v3/functions/public/default/myfunc',
create: ({ funcName }) => `/admin/v3/functions/public/default/${funcName}`,
update: ({ funcName }) => `/admin/v3/functions/public/default/${funcName}`,
info: ({ funcName }) => `/admin/v3/functions/public/default/${funcName}`,
stats: ({ funcName }) => `/admin/v3/functions/public/default/${funcName}/stats`,
status: ({ funcName }) => `/admin/v3/functions/public/default/${funcName}/status`,
Expand All @@ -18,8 +19,12 @@ export function getList () {
return get(funcApi.list)
}

export function createFunc (data) {
return post(funcApi.create, { data })
export function create (funcName, data) {
return post(funcApi.create({ funcName }), data, { headers: { 'Content-Type': 'multipart/form-data' } })
}

export function update (funcName, data) {
return put(funcApi.update({ funcName }), data, { headers: { 'Content-Type': 'multipart/form-data' } })
}

export function getInfo (funcName) {
Expand Down
8 changes: 1 addition & 7 deletions front-end/src/mock/services/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,18 @@ const trigger = (option) => {
return `${data}!!!`;
}

const addFunc = (option) => {
console.log("Test value return to the frontend:",option)
return 0
}

const startFunc = {result: 0};

const stopFunc = {result: 0};

const deleteFunc = { result: 0 };

get(/\/admin\/v3\/functions\/public\/default/, list);
get(/function\/create/, createFunc);
get(/\/admin\/v3\/functions\/public\/default\/[^/]*/, info);
get(/\/admin\/v3\/functions\/public\/default\/[^/]*\/stats/, stats);
get(/\/admin\/v3\/functions\/public\/default\/[^/]*\/status/, status);
post(/\/admin\/v3\/functions\/public\/default\/[^/]*\/trigger/, trigger);
post(/\/admin\/v3\/functions\/public\/default\/[^/]*\/delete/, deleteFunc);
post(/\/admin\/v3\/functions\/public\/default\/[^/]*\/add/, addFunc);
post(/\/admin\/v3\/functions\/public\/default\/[^/]*/, createFunc);
post(/\/admin\/v3\/functions\/public\/default\/[^/]*\/start/, startFunc);
post(/\/admin\/v3\/functions\/public\/default\/[^/]*\/stop/, stopFunc);
19 changes: 13 additions & 6 deletions front-end/src/views/function/components/AddForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,20 +194,28 @@ import { create } from '@/api/func'
onSub () {
this.form.validateFields((err, values) => {
if (err) return
console.log(values)
const functionName = values.FunctionName
const data = new FormData()
data.append('data', this.fileList)
const functionConfig = values
delete functionConfig.data
delete functionConfig.FunctionName //参数处理
data.append('functionConfig', new Blob([JSON.stringify(functionConfig)], { type: 'application/json' }))
const _this = this
this.$confirm({
title: 'Are you sure to create this function?',
content: 'Some descriptions',
okType: 'primary',
async onOk () {
try {
await create(values.FunctionName, values)
await create(functionName, data)
.then((res) => {
_this.$notification.success({ message: ` "${values.FunctionName}" function created successfully` })
_this.$parent.refresh()
_this.$parent.closeDrawer()
_this.$notification.success({ message: `function "${functionName}" created successfully` })
})
} catch (error) {
_this.$notification.error({ message: ` "${values.FunctionName}" funciton creation failed` })
_this.$notification.error({ message: ` funciton "${functionName}" creation failed` })
}
}
})
Expand All @@ -226,8 +234,7 @@ import { create } from '@/api/func'
return []
},
fbeforeUpload (file) {
this.fileList = [...this.fileList, file]
console.log(this.fileList)
this.fileList = file
return false
},
addInput () {
Expand Down
61 changes: 42 additions & 19 deletions front-end/src/views/function/components/FunctionDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
}
]"
class="inputDefault"
:disabled="!editable"
:class="{editable:!editable}" />
:disabled="true"
:class="{editable:true}" />
</a-form-item>
</a-descriptions-item>
<a-descriptions-item label="Runtime"
Expand Down Expand Up @@ -72,7 +72,7 @@
shape="circle"
type="dashed"
size="small"
v-show="editable"
v-show="false"
@click="addInput" />
</span>
<a-form-item :wrapper-col="{ span: 24 }"
Expand All @@ -88,8 +88,8 @@
}
]"
class="inputDefault"
:disabled="!editable"
:class="{editable:!editable}" />
:disabled="true"
:class="{editable:true}" />
</a-col>
<a-col>
<a-button icon="minus"
Expand Down Expand Up @@ -182,14 +182,16 @@
</template>
<script>
import { uid } from 'uid'
import { update } from '@/api/func'

export default {
data () {
return {
editable: false,
form: this.$form.createForm(this),
loadingSave: false,
inputs: []
inputs: [],
file: ''
}
},
props: {
Expand Down Expand Up @@ -251,19 +253,39 @@ export default {
this.inputs = this.inputs?.filter(input => input.key !== key)
},
saveEdit () {
const _this = this
this.loadingSave = true
this.form.validateFields((err, values) => {
if (!err) {
console.log('Received values of form: ', values)
setTimeout(() => {
this.loadingSave = false
_this.$notification.success({ message: `"${_this.currentFuncionInfo?.name}" function Modified successfully` })
}, 1000)
} else {
this.loadingSave = false
}
})
if (err) return
console.log(values)
const functionName = values.name
const data = new FormData()
if(values.data){
data.append('data', this.file)
}
const functionConfig = values
delete functionConfig.data
delete functionConfig.Name //参数处理
data.append('functionConfig', new Blob([JSON.stringify(functionConfig)], { type: 'application/json' }))
const _this = this
this.$confirm({
title: 'Are you sure to create this function?',
content: 'Some descriptions',
okType: 'primary',
async onOk () {
try {
await update(functionName, data)
.then((res) => {
_this.$parent.refresh()
_this.$parent.closeDetail()
_this.$notification.success({ message: `function "${functionName}" created successfully` })
})
} catch (error) {
const errMessage = error.response.data.reason
_this.$notification.error({ message: ` funciton "${functionName}" creation failed, because ${errMessage}` })
}
}
})
this.file = ''
})
},
normFile (e) {
console.log('Upload event:', e)
Expand All @@ -273,7 +295,8 @@ export default {
if (e && e.fileList.length > 0) return [e.fileList[e.fileList.length - 1]]
return []
},
fbeforeUpload () {
fbeforeUpload (file) {
this.file = file
return false
}
},
Expand Down
16 changes: 16 additions & 0 deletions front-end/src/views/function/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ export default {
this.refreshFunc()
},
methods: {
async refresh () {
this.loadingList = true
try {
const res = await getList()
if (Array.isArray(res)) {
this.functionList = res?.map((name) => ({ key: name, name }))
// get status
res?.map(async (name, i) => {
const res = await getStatus(name)
this.$set(this.functionList[i], 'status', !!res?.instances?.[0]?.status?.running)
this.$set(this.functionList[i], 'statusInfo', res)
})
}
} catch (e) { }
this.loadingList = false
},
formatDate (date) {
return moment(date).format('YYYY/MM/DD')
},
Expand Down