-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable/disable Export and Duplicate (#2820)
- Loading branch information
Showing
2 changed files
with
70 additions
and
6 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
55 changes: 55 additions & 0 deletions
55
services/web/client/source/class/osparc/utils/DisabledPlugins.js
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,55 @@ | ||
/* ************************************************************************ | ||
osparc - the simcore frontend | ||
https://osparc.io | ||
Copyright: | ||
2022 IT'IS Foundation, https://itis.swiss | ||
License: | ||
MIT: https://opensource.org/licenses/MIT | ||
Authors: | ||
* Odei Maiz (odeimaiz) | ||
************************************************************************ */ | ||
|
||
/** | ||
* Collection of methods for studies | ||
*/ | ||
|
||
qx.Class.define("osparc.utils.DisabledPlugins", { | ||
type: "static", | ||
|
||
statics: { | ||
EXPORT: "WEBSERVER_EXPORTER", | ||
DUPLICATE: "WEBSERVER_EXPORTER", | ||
SCICRUNCH: "WEBSERVER_SCICRUNCH", | ||
|
||
isExportDisabled: function() { | ||
return this.self().isPluginDisabled(this.self().EXPORT); | ||
}, | ||
|
||
isDuplicateDisabled: function() { | ||
return this.self().isPluginDisabled(this.self().EXPORT); | ||
}, | ||
|
||
isScicrunchDisabled: function() { | ||
return this.self().isPluginDisabled(this.self().SCICRUNCH); | ||
}, | ||
|
||
isPluginDisabled: function(key) { | ||
return new Promise((resolve, reject) => { | ||
osparc.data.Resources.get("statics") | ||
.then(statics => { | ||
if ("pluginsDisabled" in statics) { | ||
resolve(statics["pluginsDisabled"].includes(key)); | ||
} | ||
resolve(false); | ||
}) | ||
.catch(err => reject(err)); | ||
}); | ||
} | ||
} | ||
}); |