Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
synergy-components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
synergy-components
Commits
e57e7d3b
Commit
e57e7d3b
authored
May 04, 2023
by
Samir Sadyhov
🤔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
appAPI.js - add registry doc api
parent
84d95ecf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
1 deletion
+53
-1
constructor/library/appAPI.js
constructor/library/appAPI.js
+53
-1
No files found.
constructor/library/appAPI.js
View file @
e57e7d3b
...
...
@@ -548,12 +548,64 @@ this.appAPI = {
});
},
modifyDoc
:
async
function
(
dataUUID
)
{
createDoc
:
async
function
(
registryCode
)
{
return
new
Promise
(
resolve
=>
{
rest
.
synergyGet
(
`api/registry/create_doc?registryCode=
${
registryCode
}
`
,
resolve
,
err
=>
{
console
.
log
(
`ERROR [ createDoc ]:
${
JSON
.
stringify
(
err
)}
`
);
resolve
(
null
);
});
});
},
createDocRCC
:
async
function
(
registryCode
,
asfData
,
sendToActivation
=
false
)
{
return
new
Promise
(
async
resolve
=>
{
try
{
const
{
login
,
password
}
=
Cons
.
creds
;
const
auth
=
"
Basic
"
+
btoa
(
unescape
(
encodeURIComponent
(
`
${
login
}
:
${
password
}
`
)));
const
url
=
`../Synergy/rest/api/registry/create_doc_rcc`
;
const
response
=
await
fetch
(
url
,
{
method
:
'
POST
'
,
headers
:
{
"
Authorization
"
:
auth
,
"
Content-Type
"
:
"
application/json; charset=UTF-8
"
},
body
:
JSON
.
stringify
({
registryCode
:
registryCode
,
data
:
asfData
,
sendToActivation
:
sendToActivation
})
});
if
(
!
response
.
ok
)
throw
new
Error
(
`HTTP:
${
response
.
status
}
, message:
${
response
.
statusText
}
[
${
response
.
text
()}
]`
);
resolve
(
response
.
json
());
}
catch
(
err
)
{
console
.
log
(
`ERROR [ createDocRCC ]:
${
JSON
.
stringify
(
err
)}
`
);
resolve
(
null
);
}
});
},
activateDoc
:
async
function
(
dataUUID
)
{
return
new
Promise
(
resolve
=>
{
rest
.
synergyGet
(
`api/registry/activate_doc?dataUUID=
${
dataUUID
}
&locale=
${
AS
.
OPTIONS
.
locale
}
`
,
resolve
,
err
=>
{
console
.
log
(
`ERROR [ activateDoc ]:
${
JSON
.
stringify
(
err
)}
`
);
resolve
(
null
);
});
});
},
modifyDoc
:
async
function
(
dataUUID
)
{
return
new
Promise
(
resolve
=>
{
rest
.
synergyGet
(
`api/registry/modify_doc?dataUUID=
${
dataUUID
}
&locale=
${
AS
.
OPTIONS
.
locale
}
`
,
resolve
,
err
=>
{
console
.
log
(
`ERROR [ modifyDoc ]:
${
JSON
.
stringify
(
err
)}
`
);
resolve
(
null
);
});
});
},
loadAsfData
:
async
function
(
dataUUID
,
version
=
null
)
{
const
url
=
version
==
null
?
`api/asforms/data/
${
dataUUID
}
?locale=
${
AS
.
OPTIONS
.
locale
}
`
:
`api/asforms/data/
${
dataUUID
}
?version=
${
version
}
&locale=
${
AS
.
OPTIONS
.
locale
}
`
;
return
new
Promise
(
resolve
=>
{
rest
.
synergyGet
(
url
,
resolve
,
err
=>
{
console
.
log
(
`ERROR [ loadAsfData ]:
${
JSON
.
stringify
(
err
)}
`
);
resolve
(
null
);
});
});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment