@steedos/service-package-registry 2.3.2-beta.5 → 2.3.2-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/project.package.service.js +0 -12
- package/main/default/objects/steedos_packages/buttons/disable.button.js +0 -45
- package/main/default/objects/steedos_packages/buttons/disable.button.yml +0 -4
- package/main/default/objects/steedos_packages/buttons/enable.button.js +0 -44
- package/main/default/objects/steedos_packages/buttons/enable.button.yml +0 -4
- package/main/default/objects/steedos_packages/buttons/installPackageFromUrl.button.js +0 -73
- package/main/default/objects/steedos_packages/buttons/installPackageFromUrl.button.yml +0 -4
- package/main/default/objects/steedos_packages/buttons/install_purchased_packages.button.js +0 -72
- package/main/default/objects/steedos_packages/buttons/install_purchased_packages.button.yml +0 -5
- package/main/default/objects/steedos_packages/buttons/reload.button.js +0 -33
- package/main/default/objects/steedos_packages/buttons/reload.button.yml +0 -4
- package/main/default/objects/steedos_packages/buttons/show_packages_store.button.js +0 -161
- package/main/default/objects/steedos_packages/buttons/show_packages_store.button.yml +0 -5
- package/main/default/objects/steedos_packages/buttons/uninstall.button.js +0 -47
- package/main/default/objects/steedos_packages/buttons/uninstall.button.yml +0 -4
- package/main/default/objects/steedos_packages/buttons/upgradePackage.button.js +0 -95
- package/main/default/objects/steedos_packages/buttons/upgradePackage.button.yml +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-package-registry",
|
|
3
|
-
"version": "2.3.2-beta.
|
|
3
|
+
"version": "2.3.2-beta.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "package.service.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@steedos/auth": "2.3.2-beta.
|
|
13
|
-
"@steedos/core": "2.3.2-beta.
|
|
14
|
-
"@steedos/metadata-core": "2.3.2-beta.
|
|
15
|
-
"@steedos/objectql": "2.3.2-beta.
|
|
16
|
-
"@steedos/service-package-license": "2.3.2-beta.
|
|
17
|
-
"@steedos/service-package-loader": "2.3.2-beta.
|
|
12
|
+
"@steedos/auth": "2.3.2-beta.7",
|
|
13
|
+
"@steedos/core": "2.3.2-beta.7",
|
|
14
|
+
"@steedos/metadata-core": "2.3.2-beta.7",
|
|
15
|
+
"@steedos/objectql": "2.3.2-beta.7",
|
|
16
|
+
"@steedos/service-package-license": "2.3.2-beta.7",
|
|
17
|
+
"@steedos/service-package-loader": "2.3.2-beta.7",
|
|
18
18
|
"fs-extra": "8.1.0",
|
|
19
19
|
"i18next": "20.3.2",
|
|
20
20
|
"json-stringify-safe": "5.0.1",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "1e2a0049e4a1bb5e7b09d020f32b60514bdc1bd9"
|
|
36
36
|
}
|
|
@@ -163,10 +163,6 @@ module.exports = {
|
|
|
163
163
|
}
|
|
164
164
|
},
|
|
165
165
|
getCloudSaasPurchasedPackages:{
|
|
166
|
-
rest: {
|
|
167
|
-
method: "GET",
|
|
168
|
-
path: "/cloud/saas/packages/purchased"
|
|
169
|
-
},
|
|
170
166
|
async handler(ctx) {
|
|
171
167
|
try {
|
|
172
168
|
|
|
@@ -181,10 +177,6 @@ module.exports = {
|
|
|
181
177
|
}
|
|
182
178
|
},
|
|
183
179
|
installPurchasedPackages: {
|
|
184
|
-
rest: {
|
|
185
|
-
method: "POST",
|
|
186
|
-
path: "/cloud/saas/packages/purchased"
|
|
187
|
-
},
|
|
188
180
|
async handler(ctx){
|
|
189
181
|
const installErrors = {};
|
|
190
182
|
const installPackages = [];
|
|
@@ -249,10 +241,6 @@ module.exports = {
|
|
|
249
241
|
}
|
|
250
242
|
},
|
|
251
243
|
installPackageFromUrl: {
|
|
252
|
-
rest: {
|
|
253
|
-
method: "POST",
|
|
254
|
-
path: "/cloud/saas/packages/url"
|
|
255
|
-
},
|
|
256
244
|
async handler(ctx){
|
|
257
245
|
try {
|
|
258
246
|
const user = ctx.meta.user;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
disable: function (object_name, record_id) {
|
|
3
|
-
const record = Creator.odata.get(object_name, record_id);
|
|
4
|
-
const nodesSelect = Steedos.PackageRegistry.getNodesSelect();
|
|
5
|
-
swal({
|
|
6
|
-
title: `停用`,
|
|
7
|
-
text: `确定要停用${record.name}?${nodesSelect}`,
|
|
8
|
-
html: true,
|
|
9
|
-
showCancelButton: true,
|
|
10
|
-
confirmButtonText: '停用',
|
|
11
|
-
cancelButtonText: TAPi18n.__('Cancel')
|
|
12
|
-
}, function (option) {
|
|
13
|
-
if (option) {
|
|
14
|
-
toastr.info('停用中,请稍后...', null, {timeOut: false});
|
|
15
|
-
Steedos.authRequest(Steedos.absoluteUrl('/api/nodes/disable'), {
|
|
16
|
-
type: 'post', async: false, data: JSON.stringify({
|
|
17
|
-
module: record.name,
|
|
18
|
-
nodeID: window.$("#steedos_package_main_node").val()
|
|
19
|
-
}),
|
|
20
|
-
success: function(){
|
|
21
|
-
setTimeout(function(){
|
|
22
|
-
if (record_id) {
|
|
23
|
-
SteedosUI.reloadRecord(object_name, record_id)
|
|
24
|
-
}
|
|
25
|
-
toastr.clear();
|
|
26
|
-
toastr.success('已停用');
|
|
27
|
-
FlowRouter.reload()
|
|
28
|
-
}, 1000 * 5)
|
|
29
|
-
},
|
|
30
|
-
error: function(XMLHttpRequest){
|
|
31
|
-
toastr.clear();
|
|
32
|
-
toastr.error(XMLHttpRequest.responseJSON.error);
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
},
|
|
38
|
-
disableVisible: function (object_name, record_id) {
|
|
39
|
-
const record = Creator.odata.get(object_name, record_id);
|
|
40
|
-
if (record.status === 'enable') {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
return false
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
enable: function (object_name, record_id) {
|
|
3
|
-
const record = Creator.odata.get(object_name,record_id);
|
|
4
|
-
const nodesSelect = Steedos.PackageRegistry.getNodesSelect();
|
|
5
|
-
swal({
|
|
6
|
-
title: `启用`,
|
|
7
|
-
text: `确定要启用${record.name}?${nodesSelect}`,
|
|
8
|
-
html: true,
|
|
9
|
-
showCancelButton: true,
|
|
10
|
-
confirmButtonText: '启用',
|
|
11
|
-
cancelButtonText: TAPi18n.__('Cancel')
|
|
12
|
-
}, function (option) {
|
|
13
|
-
if (option) {
|
|
14
|
-
toastr.info('启用中,请稍后...', null, {timeOut: false});
|
|
15
|
-
Steedos.authRequest(Steedos.absoluteUrl('/api/nodes/enable'), {type: 'post', async: false, data: JSON.stringify({
|
|
16
|
-
module: record.name,
|
|
17
|
-
nodeID: window.$("#steedos_package_main_node").val()
|
|
18
|
-
}),
|
|
19
|
-
success: function(){
|
|
20
|
-
setTimeout(function(){
|
|
21
|
-
if (FlowRouter.current().params.record_id) {
|
|
22
|
-
SteedosUI.reloadRecord(object_name, record_id)
|
|
23
|
-
}
|
|
24
|
-
toastr.clear();
|
|
25
|
-
toastr.success('已启用');
|
|
26
|
-
FlowRouter.reload()
|
|
27
|
-
}, 1000 * 8)
|
|
28
|
-
},
|
|
29
|
-
error: function(XMLHttpRequest){
|
|
30
|
-
toastr.clear();
|
|
31
|
-
toastr.error(XMLHttpRequest.responseJSON.error);
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
},
|
|
37
|
-
enableVisible: function (object_name,record_id) {
|
|
38
|
-
const record = Creator.odata.get(object_name,record_id);
|
|
39
|
-
if(record.status !== 'enable'){
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
return false
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
installPackageFromUrl: function (object_name, record_id) {
|
|
3
|
-
SteedosUI.showModal(stores.ComponentRegistry.components.ObjectForm, {
|
|
4
|
-
name: "install_package_from_url",
|
|
5
|
-
title: '手动安装软件包',
|
|
6
|
-
objectSchema: {
|
|
7
|
-
fields: {
|
|
8
|
-
module: {
|
|
9
|
-
type: 'text',
|
|
10
|
-
is_wide: true,
|
|
11
|
-
required: true,
|
|
12
|
-
label: "软件包名称",
|
|
13
|
-
inlineHelpText: 'package.json 中的 name值',
|
|
14
|
-
},
|
|
15
|
-
version: {
|
|
16
|
-
// required: "{{formData.url ? false : true}}",
|
|
17
|
-
type: 'text',
|
|
18
|
-
is_wide: true,
|
|
19
|
-
label: "版本号",
|
|
20
|
-
inlineHelpText: "如果未填写, 则安装最新正式版",
|
|
21
|
-
help: "latest",
|
|
22
|
-
value: undefined,
|
|
23
|
-
visible_on: "{{formData.url ? false : true}}"
|
|
24
|
-
},
|
|
25
|
-
url: {
|
|
26
|
-
// required: "{{formData.version ? false : true}}",
|
|
27
|
-
type: 'text',
|
|
28
|
-
is_wide: true,
|
|
29
|
-
label: "软件包URL",
|
|
30
|
-
visible_on: "{{formData.version ? false : true}}"
|
|
31
|
-
},
|
|
32
|
-
auth: {
|
|
33
|
-
// required: "{{formData.version ? false : true}}",
|
|
34
|
-
type: 'password',
|
|
35
|
-
is_wide: true,
|
|
36
|
-
label: "认证信息"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
onFinish: async (values = {}) => {
|
|
41
|
-
return new Promise((resolve, reject) => {
|
|
42
|
-
Steedos.authRequest(Steedos.absoluteUrl('service/api/~packages-project-server/cloud/saas/packages/url'), {
|
|
43
|
-
type: 'post', async: true, data: JSON.stringify({
|
|
44
|
-
module: values.module,
|
|
45
|
-
version: values.version,
|
|
46
|
-
url: values.url,
|
|
47
|
-
auth: values.auth
|
|
48
|
-
}),
|
|
49
|
-
success: function () {
|
|
50
|
-
setTimeout(function () {
|
|
51
|
-
toastr.clear();
|
|
52
|
-
toastr.success('安装成功');
|
|
53
|
-
if (record_id) {
|
|
54
|
-
SteedosUI.reloadRecord(object_name, record_id)
|
|
55
|
-
}
|
|
56
|
-
FlowRouter.reload()
|
|
57
|
-
resolve(true)
|
|
58
|
-
}, 1000 * 10)
|
|
59
|
-
},
|
|
60
|
-
error: function (XMLHttpRequest) {
|
|
61
|
-
toastr.clear();
|
|
62
|
-
toastr.error(XMLHttpRequest.responseJSON.error);
|
|
63
|
-
reject(false);
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
}, null, { iconPath: '/assets/icons' })
|
|
69
|
-
},
|
|
70
|
-
installPackageFromUrlVisible: function (object_name, record_id) {
|
|
71
|
-
return Steedos.isSpaceAdmin();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
install_purchased_packages: function (object_name, record_id) {
|
|
3
|
-
const result = Steedos.authRequest(Steedos.absoluteUrl('service/api/~packages-project-server/cloud/saas/packages/purchased'), {async: false, type: 'get'});
|
|
4
|
-
if(result && result.packages.length === 0){
|
|
5
|
-
return toastr.info('您还未购买任何软件包')
|
|
6
|
-
}else{
|
|
7
|
-
toastr.info('安装中,请稍后...', '', {
|
|
8
|
-
timeOut: 0,
|
|
9
|
-
progressBar: true,
|
|
10
|
-
})
|
|
11
|
-
Steedos.authRequest(Steedos.absoluteUrl('service/api/~packages-project-server/cloud/saas/packages/purchased'), {type: 'post', error: function(XMLHttpRequest, textStatus, errorThrown){
|
|
12
|
-
toastr.clear()
|
|
13
|
-
if (XMLHttpRequest.responseJSON && XMLHttpRequest.responseJSON.error) {
|
|
14
|
-
toastr.error(XMLHttpRequest.responseJSON.error)
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
toastr.error(XMLHttpRequest.responseJSON)
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
success: function(result){
|
|
21
|
-
try {
|
|
22
|
-
toastr.clear()
|
|
23
|
-
const installErrors = result.installErrors;
|
|
24
|
-
let errorsHtml = '';
|
|
25
|
-
let index = 0;
|
|
26
|
-
_.each(installErrors, function(v, k){
|
|
27
|
-
index ++
|
|
28
|
-
errorsHtml = `${errorsHtml}<li class="py-4">
|
|
29
|
-
<div class="flex space-x-3">
|
|
30
|
-
<div class="flex-1 space-y-1">
|
|
31
|
-
<div class="flex items-center justify-between">
|
|
32
|
-
<h3 class="text-sm font-medium"><b>${k}</b></h3>
|
|
33
|
-
<p class="text-sm text-gray-500"><span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-pink-100 text-pink-800">
|
|
34
|
-
Error ${index}
|
|
35
|
-
</span></p>
|
|
36
|
-
</div>
|
|
37
|
-
<p class="text-sm text-gray-500">${v}</p>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</li>`
|
|
41
|
-
})
|
|
42
|
-
if(!_.isEmpty(installErrors)){
|
|
43
|
-
swal({
|
|
44
|
-
title: "安装软件包异常",
|
|
45
|
-
text: `<div>
|
|
46
|
-
<ul role="list" class="divide-y divide-gray-200">
|
|
47
|
-
${errorsHtml}
|
|
48
|
-
</ul>
|
|
49
|
-
</div>`,
|
|
50
|
-
html: true,
|
|
51
|
-
showCancelButton: false,
|
|
52
|
-
closeOnConfirm: false,
|
|
53
|
-
cancelButtonText: t('Cancel'),
|
|
54
|
-
confirmButtonText: t('OK')
|
|
55
|
-
});
|
|
56
|
-
}else{
|
|
57
|
-
toastr.success('安装完成')
|
|
58
|
-
}
|
|
59
|
-
FlowRouter.reload();
|
|
60
|
-
} catch (error) {
|
|
61
|
-
toastr.error(XMLHttpRequest.responseJSON.error)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
},
|
|
69
|
-
install_purchased_packagesVisible: function (object_name, record_id) {
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
reload: function (object_name, record_id) {
|
|
3
|
-
toastr.info('重新加载中,请稍后...', null, {timeOut: false});
|
|
4
|
-
const record = Creator.odata.get(object_name,record_id);
|
|
5
|
-
//TODO nodeID
|
|
6
|
-
Steedos.authRequest(Steedos.absoluteUrl('/api/nodes/reload'), {type: 'post', async: false, data: JSON.stringify({
|
|
7
|
-
module: record.name,
|
|
8
|
-
nodeID: record.node_id
|
|
9
|
-
}),
|
|
10
|
-
success: function(){
|
|
11
|
-
setTimeout(function(){
|
|
12
|
-
if (FlowRouter.current().params.record_id) {
|
|
13
|
-
SteedosUI.reloadRecord(object_name, record_id)
|
|
14
|
-
}
|
|
15
|
-
toastr.clear();
|
|
16
|
-
toastr.success('已重新加载');
|
|
17
|
-
FlowRouter.reload()
|
|
18
|
-
}, 1000 * 5)
|
|
19
|
-
},
|
|
20
|
-
error: function(XMLHttpRequest){
|
|
21
|
-
toastr.clear();
|
|
22
|
-
toastr.error(XMLHttpRequest.responseJSON.error);
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
},
|
|
26
|
-
reloadVisible: function (object_name,record_id) {
|
|
27
|
-
const record = Creator.odata.get(object_name,record_id);
|
|
28
|
-
if(record.status === 'enable'){
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
return false
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
show_packages_store: function () {
|
|
3
|
-
let packageService = "https://www.steedos.cn";
|
|
4
|
-
|
|
5
|
-
if(Meteor.settings.public.webservices.app_exchange && Meteor.settings.public.webservices.app_exchange.url){
|
|
6
|
-
packageService = Meteor.settings.public.webservices.app_exchange.url;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
return window.open(`${packageService}?client=${window.btoa(Meteor.absoluteUrl('', window.location.origin))}&install_nodes=${window.btoa(Steedos.PackageRegistry.getNodes().join(','))}`);
|
|
10
|
-
// return window.open(`${packageService}/app-store?client=${window.btoa(Meteor.absoluteUrl('', window.location.origin))}&install_nodes=${window.btoa(Steedos.PackageRegistry.getNodes().join(','))}`)
|
|
11
|
-
|
|
12
|
-
SteedosUI.showModal(stores.ComponentRegistry.components.ObjectTable, {
|
|
13
|
-
title: '安装软件包',
|
|
14
|
-
listSchema:{
|
|
15
|
-
columns: [
|
|
16
|
-
{field: "name"},
|
|
17
|
-
{field: "module"},
|
|
18
|
-
{field: "version"},
|
|
19
|
-
{field: "description"},
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
objectSchema: {
|
|
23
|
-
fields: {
|
|
24
|
-
name: {
|
|
25
|
-
type: 'text'
|
|
26
|
-
},
|
|
27
|
-
module: {
|
|
28
|
-
type: 'text'
|
|
29
|
-
},
|
|
30
|
-
version: {
|
|
31
|
-
type: 'text'
|
|
32
|
-
},
|
|
33
|
-
description: {
|
|
34
|
-
type: 'textare'
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
rows: function(){
|
|
39
|
-
let result = []
|
|
40
|
-
var defOptions = {
|
|
41
|
-
type: "get",
|
|
42
|
-
url: `${packageService}/api/public/steedos_packages.json`,
|
|
43
|
-
dataType: "json",
|
|
44
|
-
contentType: 'application/json',
|
|
45
|
-
async: false,
|
|
46
|
-
success: function (data) {
|
|
47
|
-
result = data;
|
|
48
|
-
},
|
|
49
|
-
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
50
|
-
console.error(XMLHttpRequest.responseJSON);
|
|
51
|
-
if (XMLHttpRequest.responseJSON && XMLHttpRequest.responseJSON.error) {
|
|
52
|
-
toastr.error(t(XMLHttpRequest.responseJSON.error.replace(/:/g, ':')))
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
toastr.error(XMLHttpRequest.responseJSON)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
$.ajax(Object.assign({}, defOptions));
|
|
60
|
-
return result.modules || [];
|
|
61
|
-
}(),
|
|
62
|
-
checkboxSelection: false,
|
|
63
|
-
rowButtons: [
|
|
64
|
-
{
|
|
65
|
-
name: 'install',
|
|
66
|
-
label: '安装',
|
|
67
|
-
visible: true,
|
|
68
|
-
todo: function (object_name, record_id) {
|
|
69
|
-
let result = {}
|
|
70
|
-
var defOptions = {
|
|
71
|
-
type: "get",
|
|
72
|
-
url: `${packageService}/api/public/steedos_packages/${record_id}`,
|
|
73
|
-
dataType: "json",
|
|
74
|
-
contentType: 'application/json',
|
|
75
|
-
async: false,
|
|
76
|
-
success: function (data) {
|
|
77
|
-
result = data;
|
|
78
|
-
},
|
|
79
|
-
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
80
|
-
console.error(XMLHttpRequest.responseJSON);
|
|
81
|
-
if (XMLHttpRequest.responseJSON && XMLHttpRequest.responseJSON.error) {
|
|
82
|
-
toastr.error(t(XMLHttpRequest.responseJSON.error.replace(/:/g, ':')))
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
toastr.error(XMLHttpRequest.responseJSON)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
$.ajax(Object.assign({}, defOptions));
|
|
90
|
-
const record = result;
|
|
91
|
-
const nodesSelect = Steedos.PackageRegistry.getNodesSelect();
|
|
92
|
-
swal({
|
|
93
|
-
title: `安装`,
|
|
94
|
-
text: `确定要安装 <a href="${packageService}/app-store/${record.name}" target="_blank">${record.name}</a>?${nodesSelect}`,
|
|
95
|
-
html: true,
|
|
96
|
-
showCancelButton: true,
|
|
97
|
-
confirmButtonText: '安装',
|
|
98
|
-
cancelButtonText: TAPi18n.__('Cancel')
|
|
99
|
-
}, function (option) {
|
|
100
|
-
if (option) {
|
|
101
|
-
toastr.info('安装中,请稍后...', null, {timeOut: false});
|
|
102
|
-
Steedos.authRequest(Steedos.absoluteUrl('/api/nodes/install'), {type: 'post', async: false, data: JSON.stringify({
|
|
103
|
-
module: record.name,
|
|
104
|
-
version: record.version,
|
|
105
|
-
label: record.label,
|
|
106
|
-
description: record.description,
|
|
107
|
-
nodeID: $("#steedos_package_main_node").val()
|
|
108
|
-
}),
|
|
109
|
-
success: function(){
|
|
110
|
-
setTimeout(function(){
|
|
111
|
-
toastr.clear();
|
|
112
|
-
toastr.success('已安装');
|
|
113
|
-
FlowRouter.reload()
|
|
114
|
-
}, 1000 * 10)
|
|
115
|
-
},
|
|
116
|
-
error: function(XMLHttpRequest){
|
|
117
|
-
toastr.clear();
|
|
118
|
-
toastr.error(XMLHttpRequest.responseJSON.error);
|
|
119
|
-
}
|
|
120
|
-
})
|
|
121
|
-
}
|
|
122
|
-
})
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: 'show_readme',
|
|
127
|
-
label: '查看',
|
|
128
|
-
visible: true,
|
|
129
|
-
todo: function (object_name, record_id) {
|
|
130
|
-
let result = {}
|
|
131
|
-
var defOptions = {
|
|
132
|
-
type: "get",
|
|
133
|
-
url: `${packageService}/api/public/steedos_packages/${record_id}`,
|
|
134
|
-
dataType: "json",
|
|
135
|
-
contentType: 'application/json',
|
|
136
|
-
async: false,
|
|
137
|
-
success: function (data) {
|
|
138
|
-
result = data;
|
|
139
|
-
},
|
|
140
|
-
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
141
|
-
console.error(XMLHttpRequest.responseJSON);
|
|
142
|
-
if (XMLHttpRequest.responseJSON && XMLHttpRequest.responseJSON.error) {
|
|
143
|
-
toastr.error(t(XMLHttpRequest.responseJSON.error.replace(/:/g, ':')))
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
toastr.error(XMLHttpRequest.responseJSON)
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
$.ajax(Object.assign({}, defOptions));
|
|
151
|
-
const record = result;
|
|
152
|
-
window.open(`${packageService}/app-store/${record.name}`)
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
],
|
|
156
|
-
})
|
|
157
|
-
},
|
|
158
|
-
show_packages_storeVisible: function () {
|
|
159
|
-
return true
|
|
160
|
-
}
|
|
161
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
uninstall: function (object_name, record_id) {
|
|
3
|
-
const record = Creator.odata.get(object_name,record_id);
|
|
4
|
-
const nodesSelect = Steedos.PackageRegistry.getNodesSelect();
|
|
5
|
-
swal({
|
|
6
|
-
title: `卸载`,
|
|
7
|
-
text: `确定要卸载${record.name}?${nodesSelect}`,
|
|
8
|
-
html: true,
|
|
9
|
-
showCancelButton: true,
|
|
10
|
-
confirmButtonText: '卸载',
|
|
11
|
-
cancelButtonText: TAPi18n.__('Cancel')
|
|
12
|
-
}, function (option) {
|
|
13
|
-
if (option) {
|
|
14
|
-
toastr.info('卸载中,请稍后...', null, {timeOut: false});
|
|
15
|
-
Steedos.authRequest(Steedos.absoluteUrl('/api/nodes/uninstall'), {type: 'post', async: false, data: JSON.stringify({
|
|
16
|
-
module: record.name,
|
|
17
|
-
nodeID: window.$("#steedos_package_main_node").val()
|
|
18
|
-
}),
|
|
19
|
-
success: function(){
|
|
20
|
-
setTimeout(function(){
|
|
21
|
-
if (FlowRouter.current().params.record_id) {
|
|
22
|
-
return FlowRouter.go("/app/admin/steedos_packages/grid/all")
|
|
23
|
-
}
|
|
24
|
-
toastr.clear();
|
|
25
|
-
toastr.success('已卸载');
|
|
26
|
-
FlowRouter.reload()
|
|
27
|
-
}, 1000 * 10)
|
|
28
|
-
},
|
|
29
|
-
error: function(XMLHttpRequest){
|
|
30
|
-
toastr.clear();
|
|
31
|
-
toastr.error(XMLHttpRequest.responseJSON.error);
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
},
|
|
37
|
-
uninstallVisible: function (object_name,record_id) {
|
|
38
|
-
const record = Creator.odata.get(object_name,record_id);
|
|
39
|
-
if(record.local){
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
if(record.status){
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
return false
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
upgradePackage: function (object_name, record_id) {
|
|
3
|
-
const record = Creator.odata.get(object_name, record_id);
|
|
4
|
-
console.log(`upgradePackage record`, record)
|
|
5
|
-
$("body").addClass('loading')
|
|
6
|
-
SteedosUI.showModal(stores.ComponentRegistry.components.ObjectTable, {
|
|
7
|
-
title: `请选择升级 ${record.label || record.name} 的版本`,
|
|
8
|
-
listSchema:{
|
|
9
|
-
columns: [
|
|
10
|
-
{field: "version"},
|
|
11
|
-
{field: "tag"},
|
|
12
|
-
],
|
|
13
|
-
},
|
|
14
|
-
objectSchema: {
|
|
15
|
-
fields: {
|
|
16
|
-
version: {
|
|
17
|
-
type: 'text',
|
|
18
|
-
label: '版本号'
|
|
19
|
-
},
|
|
20
|
-
tag: {
|
|
21
|
-
type: 'select',
|
|
22
|
-
label: '标签',
|
|
23
|
-
options: [
|
|
24
|
-
{label: '正式版', value: 'latest', color:"3df53d"},
|
|
25
|
-
{label: '测试版', value: 'next', color: "f89406"}
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
rows: function(){
|
|
31
|
-
var versions = []
|
|
32
|
-
try {
|
|
33
|
-
versions = Steedos.authRequest(`/api/nodes/versions?module=${record.name}`, { type: 'get', async: false});
|
|
34
|
-
} catch (error) {
|
|
35
|
-
toastr.error(error.message);
|
|
36
|
-
}
|
|
37
|
-
$("body").removeClass("loading")
|
|
38
|
-
return versions;
|
|
39
|
-
}(),
|
|
40
|
-
rowSelection: 'single',
|
|
41
|
-
rowKey: 'version',
|
|
42
|
-
onFinish: async (selectedRowKeys, selectedRows) => {
|
|
43
|
-
if(selectedRowKeys.length < 1){
|
|
44
|
-
throw new Error(`请选择要升级的版本`);
|
|
45
|
-
}
|
|
46
|
-
const installVersion = selectedRowKeys[0];
|
|
47
|
-
if(record.version == installVersion ){
|
|
48
|
-
toastr.info(`您已安装版本${installVersion}`);
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
swal({
|
|
53
|
-
title: `升级`,
|
|
54
|
-
text: `确定要升级到 ${installVersion}?`,
|
|
55
|
-
html: true,
|
|
56
|
-
showCancelButton: true,
|
|
57
|
-
confirmButtonText: '升级',
|
|
58
|
-
cancelButtonText: TAPi18n.__('Cancel')
|
|
59
|
-
}, function (option) {
|
|
60
|
-
if (option) {
|
|
61
|
-
toastr.info('升级中,请稍后...', null, {timeOut: false});
|
|
62
|
-
Steedos.authRequest(Steedos.absoluteUrl('/api/nodes/upgrade'), {type: 'post', async: false, data: JSON.stringify({
|
|
63
|
-
module: record.name,
|
|
64
|
-
version: installVersion
|
|
65
|
-
}),
|
|
66
|
-
success: function(){
|
|
67
|
-
setTimeout(function(){
|
|
68
|
-
toastr.clear();
|
|
69
|
-
toastr.success('升级成功');
|
|
70
|
-
if (FlowRouter.current().params.record_id) {
|
|
71
|
-
SteedosUI.reloadRecord(object_name, record_id)
|
|
72
|
-
}
|
|
73
|
-
FlowRouter.reload()
|
|
74
|
-
}, 1000 * 10)
|
|
75
|
-
},
|
|
76
|
-
error: function(XMLHttpRequest){
|
|
77
|
-
toastr.clear();
|
|
78
|
-
toastr.error(XMLHttpRequest.responseJSON.error);
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
},
|
|
88
|
-
upgradePackageVisible: function (object_name, record_id) {
|
|
89
|
-
const record = Creator.odata.get(object_name, record_id);
|
|
90
|
-
if (record.status === 'enable' && !record.local) {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
return false
|
|
94
|
-
}
|
|
95
|
-
}
|