Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
294d3e0
update api/func.js
better1719 Jun 2, 2021
b5f263a
update api/func.js
better1719 Jun 3, 2021
9ff813a
Update front-end/src/views/function/components/FunctionTable.vue
better1719 Jun 4, 2021
4d88dae
Update front-end/src/views/function/components/FunctionTable.vue
better1719 Jun 4, 2021
2775521
update FunctionTable.vue
better1719 Jun 4, 2021
7473ae3
Merge branch 'table' of github.com:better1719/function-stream into table
better1719 Jun 4, 2021
80341f3
Update front-end/src/views/function/components/FunctionTable.vue
better1719 Jun 6, 2021
2b7481b
Update front-end/src/views/function/components/FunctionTable.vue
better1719 Jun 6, 2021
979e42c
Update front-end/src/views/function/components/FunctionTable.vue
better1719 Jun 6, 2021
e9d433e
Update front-end/src/views/function/components/FunctionTable.vue
better1719 Jun 6, 2021
c8b6525
update FunctionTable.vue
better1719 Jun 6, 2021
54eba3b
Merge branch 'table' of github.com:better1719/function-stream into table
better1719 Jun 6, 2021
568af07
update FunctionTable.vue
better1719 Jun 12, 2021
a2c5555
Merge branch 'main' into table
better1719 Jun 14, 2021
dbfb839
update FunctionTable.vue
better1719 Jun 17, 2021
321c057
Merge branch 'table' of github.com:better1719/function-stream into table
better1719 Jun 17, 2021
b287612
update FunctionTable.vue
better1719 Jun 19, 2021
cac79e1
Merge branch 'main' into table
RobertIndie Jun 19, 2021
797ee60
Merge branch 'main' into table
RobertIndie Jun 19, 2021
5f234e5
fix mock
RobertIndie Jun 19, 2021
e468b67
update FunctionTable.vue
better1719 Jun 19, 2021
257c969
Merge branch 'table' of github.com:better1719/function-stream-1 into …
better1719 Jun 19, 2021
4c1d899
update FunctionTable.vue
better1719 Jun 19, 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
10 changes: 10 additions & 0 deletions front-end/src/api/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const funcApi = {
status: ({ funcName }) => `/admin/v3/functions/public/default/${funcName}/status`,
trigger: ({ funcName }) => `/admin/v3/functions/public/default/${funcName}/trigger`,
deleteFunc: ({ funcName }) => `/admin/v3/functions/public/default/${funcName}/delete`,
startFunc: ({ funcName }) => `/admin/v3/functions/public/default/${funcName}/start`,
stopFunc: ({ funcName }) => `/admin/v3/functions/public/default/${funcName}/stop`,
}

export function getList () {
Expand Down Expand Up @@ -39,3 +41,11 @@ export function triggerFunc (funcName, data) {
export function deleteFunc (funcName) {
return post(funcApi.deleteFunc({ funcName }))
}

export function startFunc(funcName) {
return post(funcApi.startFunc({ funcName }));
}

export function stopFunc(funcName) {
return post(funcApi.stopFunc({ funcName }));
}
6 changes: 6 additions & 0 deletions front-end/src/mock/services/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ const addFunc = (option) => {
return 0
}

const startFunc = {result: 0};

const stopFunc = {result: 0};

const deleteFunc = { result: 0 };

get(/\/admin\/v3\/functions\/public\/default/, list);
Expand All @@ -130,3 +134,5 @@ 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\/[^/]*\/start/, startFunc);
post(/\/admin\/v3\/functions\/public\/default\/[^/]*\/stop/, stopFunc);
54 changes: 51 additions & 3 deletions front-end/src/views/function/components/FunctionTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
<a-divider type="vertical" />
<a @click="onShowDetail(text)">Detail</a>
<a-divider type="vertical" />
<a @click="onStart(text)" v-show="!text.status">Start</a>
<a @click="onStop(text)" v-show="text.status">Stop</a>
<a-divider type="vertical" />
<a @click="onDelete(text)">Delete</a>
</span>
</a-table>
</template>

<script>
// import moment from 'moment';
import { deleteFunc } from '@/api/func'
import { deleteFunc, startFunc, stopFunc } from '@/api/func'

const columns = [
{
Expand Down Expand Up @@ -80,7 +83,52 @@ export default {
}
}
})
}
}
},
onStart(text) {
const { name = '' } = text
const _this = this
async function Start() {
try {
const res = await startFunc(name)
text.status = true
_this.$message.success('Function was started successfully.')
} catch (error) {
_this.$message.error('Function startup failed!')
console.error(error)
}
}
Start()
},
onStop(text) {
const { name = '' } = text
const _this = this
async function Stop() {
try {
const res = await stopFunc(name)
text.status = false
_this.$message.success('Function was stopped successfully.')
} catch (error) {
_this.$message.error('Function stop failed!')
console.error(error)
}
}
Stop()
},
},
}
</script>

<style>
.ant-table-thead > tr >th,.ant-table-tbody > tr >td{
text-align: center;
}
.ant-table-thead > tr >th:nth-child(1),.ant-table-tbody > tr >td:nth-child(1){
text-align: left;
}
.ant-table-thead > tr >th:nth-child(2),.ant-table-tbody > tr >td:nth-child(2){
width: 15%;
}
.ant-table-thead > tr >th:nth-child(3),.ant-table-tbody > tr >td:nth-child(3){
width: 30%;
}
</style>