Skip to content

Commit

Permalink
feat(replicate): impl replicate_auth page
Browse files Browse the repository at this point in the history
  • Loading branch information
walle233 committed May 1, 2022
1 parent 6eb9c70 commit 6f24b70
Show file tree
Hide file tree
Showing 13 changed files with 731 additions and 18 deletions.
11 changes: 11 additions & 0 deletions packages/app-console/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/app-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"axios": "^0.21.1",
"bson": "^4.5.3",
"clipboard": "2.0.4",
"dayjs": "^1.11.1",
"element-ui": "2.13.2",
"file-saver": "2.0.1",
"js-cookie": "2.2.0",
Expand Down Expand Up @@ -97,4 +98,4 @@
"type": "git",
"url": "git+https://github.com/Maslow/less-framework.git"
}
}
}
92 changes: 92 additions & 0 deletions packages/app-console/src/api/replicate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import store from '@/store'
import request from '@/utils/request'
import axios from 'axios'

/**
* Get replicated auths
* @returns
*/
export function getReplicateAuths() {
const appid = store.state.app.appid
return request({
url: `/apps/${appid}/replicate/replicate_auth`,
method: 'get'
})
}

/**
* Create a replicated auth
*
* @returns
*/
export function createReplicateAuth(target_appid) {
const appid = store.state.app.appid
return request({
url: `/apps/${appid}/replicate/replicate_auth`,
method: 'put',
data: {
target_appid
}
})
}

/**
* Update a replicated auth
* @returns
*/
export function updateReplicateAuth(auth_id, status) {
const appid = store.state.app.appid
return request({
url: `/apps/${appid}/replicate/replicate_auth/${auth_id}`,
method: 'post',
data: {
status
}
})
}

/**
* Remove a replicated auth
* @param {string} auth_id
* @returns
*/
export function deleteReplicateAuth(auth_id) {
const appid = store.state.app.appid
return request({
url: `/apps/${appid}/replicate/replicate_auth/${auth_id}`,
method: 'delete'
})
}

/**
* apply a replicated auth
* @param {string} target_appid
* @param {object} functions
* @param {object} policies
* @returns
*/
export function applyReplicateAuth({ target_appid, functions, policies }) {
const appid = store.state.app.appid
return request({
url: `/apps/${appid}/replicate/replicas`,
method: 'put',
data: {
target_appid,
functions,
policies
}
})
}

/**
* accept a replicated auth
* @param {string} auth_id
* @returns
*/
export function acceptReplicateAuth(auth_id) {
const appid = store.state.app.appid
return request({
url: `/apps/${appid}/replicate/replicas/${auth_id}`,
method: 'put'
})
}
32 changes: 32 additions & 0 deletions packages/app-console/src/router/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,38 @@ export const asyncRoutes = [
}
]
},
{
path: '/app/:appid/replicate',
component: Layout,
redirect: '/replicate/auth',
meta: {
title: '应用部署', icon: 'guide'
},
children: [
{
path: 'auth',
component: () => import('@/views/replicate/auth'),
name: 'ReplicateAuth',
meta: {
title: '应用授权',
icon: 'guide',
noCache: true
// permissions: ['admin.read']
}
},
{
path: 'replicas',
component: () => import('@/views/replicate/replicas'),
name: 'ReplicateReplicas',
meta: {
title: '请求部署',
icon: 'guide',
noCache: true
// permissions: ['admin.read']
}
}
]
},
{
path: '/app/:appid/deploy',
component: Layout,
Expand Down
1 change: 0 additions & 1 deletion packages/app-console/src/store/modules/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ const actions = {
assert(res.data?.application, 'empty `res.data?.application` got')
assert(res.data?.roles, 'empty `res.data?.roles` got')
assert(res.data?.permissions, 'empty `res.data?.permissions` got')
console.log('loadCurrentApplication', res.data)

commit('SET_APPLICATION', res.data?.application)
commit('SET_APP_ROLES', res.data?.roles)
Expand Down
Loading

0 comments on commit 6f24b70

Please sign in to comment.