forked from labring/laf
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(system-server): add policy CRUD routers;
- Loading branch information
Showing
14 changed files
with
446 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import store from '@/store' | ||
import request from '@/utils/request' | ||
|
||
/** | ||
* Get policy list | ||
* @param {*} query | ||
* @param {*} page | ||
* @param {*} pageSize | ||
*/ | ||
export function getPolicies(query, page, pageSize) { | ||
const appid = store.state.app.appid | ||
return request({ | ||
url: `/apps/${appid}/policy`, | ||
method: 'get', | ||
params: { | ||
...query, | ||
page, | ||
limit: pageSize | ||
} | ||
}) | ||
} | ||
|
||
/** | ||
* Get a policy | ||
* @param {*} query | ||
* @param {*} page | ||
* @param {*} pageSize | ||
*/ | ||
export function getPolicyById(policy_id) { | ||
const appid = store.state.app.appid | ||
return request({ | ||
url: `/apps/${appid}/policy/${policy_id}`, | ||
method: 'get' | ||
}) | ||
} | ||
|
||
/** | ||
* Create a policy | ||
* @param {string} appid | ||
* @param {object} data | ||
* @returns | ||
*/ | ||
export function createPolicy(data) { | ||
const appid = store.state.app.appid | ||
return request({ | ||
url: `/apps/${appid}/policy/create`, | ||
method: 'post', | ||
data: data | ||
}) | ||
} | ||
|
||
/** | ||
* Update a policy | ||
* @param {*} policy_id | ||
* @param {*} data | ||
* @returns | ||
*/ | ||
export function updatePolicy(policy_id, data) { | ||
const appid = store.state.app.appid | ||
return request({ | ||
url: `/apps/${appid}/policy/${policy_id}/info`, | ||
method: 'post', | ||
data: data | ||
}) | ||
} | ||
|
||
/** | ||
* Delete a policy | ||
* @param {*} policy_id | ||
* @param {*} data | ||
* @returns | ||
*/ | ||
export function deletePolicy(policy_id) { | ||
const appid = store.state.app.appid | ||
return request({ | ||
url: `/apps/${appid}/policy/${policy_id}`, | ||
method: 'delete' | ||
}) | ||
} | ||
|
||
/** | ||
* Publish policies | ||
*/ | ||
export function publishPolicies() { | ||
const appid = store.state.app.appid | ||
return request({ | ||
url: `/apps/${appid}/policy/publish`, | ||
method: 'post' | ||
}) | ||
} |
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
Oops, something went wrong.