Skip to content

Commit 5090a6b

Browse files
authored
Support Renaming Containers (#153)
1 parent 5c91a9c commit 5090a6b

File tree

5 files changed

+49
-22
lines changed

5 files changed

+49
-22
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
## 1.19.2 - 2023-04-XX
1+
## 1.20.0 - 2023-05-02
2+
- Add `renameContainer()` to `Security` API
3+
4+
## 1.19.2 - 2023-04-26
25
- Add skipReselectRows parameter to IQueryRequestOptions
36

47
## 1.19.1 - 2023-04-19

package-lock.json

Lines changed: 11 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@labkey/api",
3-
"version": "1.19.2",
3+
"version": "1.20.0",
44
"description": "JavaScript client API for LabKey Server",
55
"scripts": {
66
"build": "npm run build:dist && npm run build:docs",

src/labkey/Security.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ import {
4747
ModuleProperty,
4848
moveContainer,
4949
MoveContainerOptions,
50+
renameContainer,
51+
RenameContainerOptions,
5052
} from './security/Container';
5153
import {
5254
getGroupPermissions,
@@ -163,6 +165,7 @@ export {
163165
PermissionsResponse,
164166
Policy,
165167
RemoveGroupMembersOptions,
168+
RenameContainerOptions,
166169
RenameGroupOptions,
167170
RenameGroupResponse,
168171
Role,
@@ -201,6 +204,7 @@ export {
201204
hasPermission,
202205
moveContainer,
203206
removeGroupMembers,
207+
renameContainer,
204208
renameGroup,
205209
savePolicy,
206210
};

src/labkey/security/Container.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,35 @@ export function deleteContainer(config: DeleteContainerOptions): XMLHttpRequest
8585
});
8686
}
8787

88+
export interface RenameContainerOptions extends RequestCallbackOptions<Container> {
89+
/** If set to true, adds an alias for the container's current name. */
90+
addAlias?: boolean;
91+
/** The container which should be renamed. If not specified the current container path will be renamed. */
92+
containerPath?: string;
93+
/** The new container name. If not specified, defaults to existing name. */
94+
name?: string;
95+
/** The new container title. If not specified, defaults to name. */
96+
title?: string;
97+
}
98+
99+
/**
100+
* Updates the container name, title, or both. Either the name or the title must be supplied.
101+
*
102+
* @returns {Mixed} In client-side scripts, this method will return a transaction id
103+
* for the async request that can be used to cancel the request.
104+
* In server-side scripts, this method will return the JSON response object
105+
* (first parameter of the success or failure callbacks.)
106+
*/
107+
export function renameContainer(config: RenameContainerOptions): XMLHttpRequest {
108+
return request({
109+
url: buildURL('admin', 'renameContainer.api', config.containerPath),
110+
method: 'POST',
111+
jsonData: { name: config.name, title: config.title, addAlias: config.addAlias },
112+
success: getCallbackWrapper(getOnSuccess(config), config.scope),
113+
failure: getCallbackWrapper(getOnFailure(config), config.scope, true),
114+
});
115+
}
116+
88117
export interface ModuleProperty {
89118
/** The value of the property, including a value potentially inherited from parent containers. */
90119
effectiveValue: any;

0 commit comments

Comments
 (0)