diff --git a/frontend/front-srv/assets/access.settings/res/dist/AdminWorkspaces.min.js b/frontend/front-srv/assets/access.settings/res/dist/AdminWorkspaces.min.js index 1f66cef872..f92f479e50 100644 --- a/frontend/front-srv/assets/access.settings/res/dist/AdminWorkspaces.min.js +++ b/frontend/front-srv/assets/access.settings/res/dist/AdminWorkspaces.min.js @@ -1 +1 @@ -(()=>{"use strict";var e={173:e=>{e.exports=require("material-ui/styles")},880:e=>{e.exports=require("pydio/http/api")},590:e=>{e.exports=require("pydio/lang/observable")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{n.r(r),n.d(r,{DataSource:()=>dt,DataSourceEditor:()=>An,DataSourcesBoard:()=>Rr,MetadataBoard:()=>Fr,TemplatePath:()=>ot,TemplatePathEditor:()=>ht,VirtualNodes:()=>Ct,Workspace:()=>C,WsAutoComplete:()=>J,WsDashboard:()=>$e});const e=require("react");var t=n.n(e);const o=require("create-react-class");var i=n.n(o);const a=require("prop-types");var l=n.n(a);const s=require("pydio");var c=n.n(s);const u=require("material-ui"),d=require("pydio/util/xml");var p=n.n(d),f=n(173),y=n(880),m=n.n(y);const h=require("pydio/util/lang");var g=n.n(h),b=n(590),v=n.n(b);const S=require("cells-sdk");function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function E(e,t){for(var n=0;n0}},{key:"hasFolderRoots",value:function(){var e=this;return Object.keys(this.model.RootNodes).filter((function(t){return!l.rootIsTemplatePath(e.model.RootNodes[t])})).length>0}},{key:"save",value:function(){var e=this;return this.model.Attributes=JSON.stringify(this.internalAttributes),new S.WorkspaceServiceApi(m().getRestClient()).putWorkspace(this.model.Slug,this.model).then((function(t){e.initModel(t),e.observableModel=e.buildProxy(e.model)}))}},{key:"remove",value:function(){return new S.WorkspaceServiceApi(m().getRestClient()).deleteWorkspace(this.model.Slug)}},{key:"revert",value:function(){var e=S.IdmWorkspace.constructFromObject(this.snapshot||{});this.initModel(e),this.observableModel=this.buildProxy(this.model)}},{key:"isValid",value:function(){return this.model.Slug&&this.model.Label&&Object.keys(this.model.RootNodes).length>0}},{key:"isDirty",value:function(){return this.dirty}}])&&E(t.prototype,n),r&&E(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(v());const P=require("lodash.debounce");var j=n.n(P);const x=require("pydio/util/path");var T=n.n(x),R=["muiTheme","children"];function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function A(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,R),i=q(n);return t().createElement("div",K({style:i.fillBlockV2Right},o),r)})),J=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(s,e);var n,r,o,i,a,l=(i=s,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=V(i);if(a){var n=V(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),t=l.call(this,e);var n=e.value,r=void 0===n?"":n;return t.debounced=j()((function(){var e=t.state.value;t.loadValues(e)}),300),t.state={nodes:[],value:r},t}return n=s,r=[{key:"componentDidMount",value:function(){var e=this,t=this.props.validateOnLoad,n=this.state.value;this.loadValues(n,(function(){var n=e.state,r=n.nodes,o=n.value;r.filter((function(e){return e.Path===o&&(!e.Type||"COLLECTION"==e.Type&&!e.MetaStore&&!e.MetaStore.resolution)})).map((function(t){e.loadValues(o+"/")})),t&&e.handleNewRequest(o)}))}},{key:"handleUpdateInput",value:function(e){this.debounced(),this.setState({value:e})}},{key:"handleNewRequest",value:function(e){var t,n,r=this.state.nodes,o=this.props,i=o.onChange,a=void 0===i?function(){}:i,l=o.onDelete,s=void 0===l?function(){}:l,c=o.onError,u=void 0===c?function(){}:c;if("string"==typeof e){if(""===e)return void s();t=e,(n=r.filter((function(t){return t.Path===e}))[0])||(n=r.filter((function(t){return 0===t.Path.indexOf(e)}))[0])}else"object"===I(e)&&(t=e.key,n=e.node);if(!n)return u();this.setState({value:t}),a(t,n)}},{key:"loadValues",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=e.lastIndexOf("/"),o=e.substr(0,r);if(null===this.lastSearch||this.lastSearch!==o){this.lastSearch=o,this.setState({loading:!0});var i=new S.AdminTreeServiceApi(PydioApi.getRestClient()),a=new S.TreeListNodesRequest,l=new S.TreeNode;l.Path=o+"/",a.Node=l,i.listAdminTree(a).then((function(e){t.setState({nodes:e.Children||[],loading:!1},(function(){return n()}))})).catch((function(){t.setState({loading:!1},(function(){return n()}))}))}}},{key:"render",value:function(){var e=this,n=this.state,r=n.value,o=n.nodes,i=n.loading,a=this.props,l=a.pydio,c=a.onDelete,d=a.skipTemplates,p=a.label,f=a.zDepth,y=void 0===f?0:f,m=function(e){return l.MessageHash["ajxp_admin."+e]||e},h=[];if(o){var g={};if(o.forEach((function(e){if(!(e.MetaStore&&e.MetaStore.resolution&&"cells"===e.Uuid||T().getBasename(e.Path).startsWith("."))){var t=s.renderNode(e,m);g[t.categ]||(g[t.categ]=[]),g[t.categ].push(t)}})),Object.keys(g).length>1){h.push({key:"h1",text:"",value:t().createElement(u.MenuItem,{primaryText:m("ws.complete.datasources"),style:{fontSize:13,fontWeight:500},disabled:!0})});var b=g[Object.keys(g)[0]];if(b.sort(LangUtils.arraySorter("text")),h.push.apply(h,M(b)),!d){h.push({key:"h2",text:"",value:t().createElement(u.MenuItem,{primaryText:m("ws.complete.templates"),style:{fontSize:13,fontWeight:500},disabled:!0})});var v=g[Object.keys(g)[1]];v.sort(LangUtils.arraySorter("text")),h.push.apply(h,M(v))}}else 1===Object.keys(g).length&&h.push.apply(h,M(g[Object.keys(g)[0]]))}return t().createElement(u.Paper,{zDepth:y,style:A({display:"flex",alignItems:"center",margin:"2px 0"},this.props.style)},t().createElement("div",{style:{position:"relative",flex:1,height:60}},t().createElement("div",{style:{position:"absolute",right:0,top:30,width:30}},t().createElement(u.RefreshIndicator,{size:30,left:0,top:0,status:i?"loading":"hide"})),t().createElement(U,{fullWidth:!0,searchText:r,onUpdateInput:function(t){return e.handleUpdateInput(t)},onNewRequest:function(t){return e.handleNewRequest(t)},onClose:function(){return e.handleNewRequest(r)},dataSource:h,filter:function(e,t){return 0===t.toLowerCase().indexOf(e.toLowerCase())},floatingLabelText:p||m("ws.complete.label"),openOnFocus:!0,menuProps:{maxHeight:200},hasRightBlock:!0})),t().createElement(H,null,t().createElement(u.IconButton,{style:{marginTop:2},iconStyle:{color:c?"#9e9e9e":"#eee"},iconClassName:"mdi mdi-delete",onClick:c,disabled:!c})))}}],o=[{key:"renderNode",value:function(e,n){var r=t().createElement("span",null,e.Path),o="mdi mdi-folder",i="folder";if(e.MetaStore&&e.MetaStore.resolution){o="mdi mdi-file-tree",i="templatePath";var a=e.MetaStore.resolution.split("\n").pop();r=t().createElement("span",null,e.Path," ",t().createElement("i",{style:{color:"#9e9e9e"}},"- ",n("ws.complete.resolves")," ",a))}else"LEAF"===e.Type&&(o="mdi mdi-file");return{key:e.Path,text:e.Path,node:e,categ:i,value:t().createElement(u.MenuItem,null,t().createElement(u.FontIcon,{className:o,color:"#607d8b",style:{float:"left",marginRight:8}})," ",r)}}}],r&&_(n.prototype,r),o&&_(n,o),Object.defineProperty(n,"prototype",{writable:!1}),s}(t().Component);const z=require("pydio/http/resources-manager");var Y=n.n(z);function G(e){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(e)}function Q(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!e)return Promise.resolve(t);var n=e.split("."),r=n.shift(),o=n.join(".");return Y().loadClass(r).then((function(n){var i=Z().getFunctionByName(o,n);if(!i){if("object"===ye(n)&&n[r]){var a=Z().getFunctionByName(o,n[r]);if(a)return a}if(t)return console.error("Cannot find editor component, using default instead",e,t),t;throw new Error("cannot find editor component")}return i})).catch((function(n){if(t)return console.error("Cannot find editor component, using default instead",e,t),t;throw n}))}var we=function(n){ue(o,n);var r=pe(o);function o(e){return ae(this,o),r.call(this,e)}return se(o,[{key:"togglePolicies",value:function(e,t){var n=this.props,r=n.policies,o=void 0===r?[]:r,i=n.onChangePolicies,a=o.filter((function(t){return t.Action!==e}));a.push(S.ServiceResourcePolicy.constructFromObject({Action:e,Effect:"allow",Subject:t?"profile:admin":"*"})),"READ"===e&&t&&(a=a.filter((function(e){return"WRITE"!==e.Action}))).push(S.ServiceResourcePolicy.constructFromObject({Action:"WRITE",Effect:"allow",Subject:"profile:admin"})),i(a)}},{key:"render",value:function(){var n,r,o=this,i=this.props,a=i.readonly,l=i.policies,s=i.pydio,c=i.muiTheme,d=function(e){return s.MessageHash["ajxp_admin.metadata."+e]||e},p=be(c);return l&&l.map((function(e){"profile:admin"===e.Subject&&"READ"===e.Action&&(n=!0),"profile:admin"===e.Subject&&"WRITE"===e.Action&&(r=!0)})),t().createElement(e.Fragment,null,t().createElement("div",null,t().createElement(u.Toggle,ie({label:d("toggle.read"),disabled:a,labelPosition:"left",toggled:n,onToggle:function(e,t){o.togglePolicies("READ",t)}},p.toggleFieldV2))),t().createElement("div",null,t().createElement(u.Toggle,ie({label:d("toggle.write"),labelPosition:"left",disabled:n||a,toggled:r,onToggle:function(e,t){o.togglePolicies("WRITE",t)}},p.toggleFieldV2))))}}]),o}(t().Component);we=(0,f.muiThemeable)()(we);var Ee=function(e){ue(r,e);var n=pe(r);function r(e){var t;return ae(this,r),(t=n.call(this,e)).state={namespace:t.cloneNs(e.namespace),m:function(t){return e.pydio.MessageHash["ajxp_admin.metadata."+t]||t},selectorNewKey:"",selectorNewValue:"",PoliciesBuilder:we},Y().loadClass("ReactMeta").then((function(e){t.setState({metaModule:e});var n=t.props.policiesBuilder;n&&Se(n,we).then((function(e){return t.setState({PoliciesBuilder:e})}))})),t}return se(r,[{key:"cloneNs",value:function(e){return S.IdmUserMetaNamespace.constructFromObject(JSON.parse(JSON.stringify(e)))}},{key:"componentWillReceiveProps",value:function(e){if(e.open!==this.props.open){var t=e.create,n=e.namespaces,r=this.cloneNs(e.namespace);t&&n.length&&(r.Order=n.map((function(e){return e.Order||0})).reduce((function(e,t){return Math.max(e,t)}),0)+1),this.setState({namespace:r})}}},{key:"save",value:function(){var e=this,t=this.state.namespace;$.putNS(t).then((function(){e.props.onRequestClose(),e.props.reloadList()}))}},{key:"getHideValue",value:function(){var e=this.state.namespace;try{return JSON.parse(e.JsonDefinition).hide}catch(e){return!1}}},{key:"setHideValue",value:function(e){var t=this.state.namespace,n=JSON.parse(t.JsonDefinition);t.JsonDefinition=JSON.stringify(re(re({},n),{},{hide:e})),this.setState({namespace:t})}},{key:"setGroupValue",value:function(e){var t=this.state.namespace,n=JSON.parse(t.JsonDefinition);t.JsonDefinition=JSON.stringify(re(re({},n),{},{groupName:e})),this.setState({namespace:t})}},{key:"getAdditionalData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.state.namespace;try{var n=JSON.parse(t.JsonDefinition).data||e;if(e.items&&n.split){var r=n.split(",").map((function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||ee(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e.split("|"),2);return{key:t[0],value:t[1]}}));return{items:r}}return n}catch(e){}return e}},{key:"setAdditionalDataKey",value:function(e,t){var n=this.state.namespace,r=JSON.parse(n.JsonDefinition),o=oe({},e,t);r.data=re(re({},r.data),o),n.JsonDefinition=JSON.stringify(r),this.setState({namespace:n})}},{key:"togglePolicies",value:function(e,t){var n=this,r=this.state.namespace,o=(r.Policies||[]).filter((function(t){return t.Action!==e}));o.push(S.ServiceResourcePolicy.constructFromObject({Action:e,Effect:"allow",Subject:t?"profile:admin":"*"})),r.Policies=o,this.setState({namespace:r},(function(){"READ"===e&&t&&n.togglePolicies("WRITE",!0)}))}},{key:"render",value:function(){var e=this,n=this.props,r=n.create,o=n.namespaces,i=n.pydio,a=n.readonly,l=n.muiTheme,s=this.state,d=s.namespace,p=s.m,f=s.PoliciesBuilder,y=s.metaModule,h=be(l);if(!y)return null;var g,b=y.TypeEditor;g=d.Label?d.Label:p("editor.title.create");var v="string";d.JsonDefinition&&(v=JSON.parse(d.JsonDefinition).type);var w,E,O=!1;if(d.Label?d.Namespace&&"usermeta-"!==d.Namespace||(O=!0,w=p("editor.ns.error")):(O=!0,E=p("editor.label.error")),r&&o.filter((function(e){return e.Namespace===d.Namespace})).length&&(O=!0,w=p("editor.ns.exists")),"choice"===v){var k=this.getAdditionalData({items:[]}).items;k&&k.length||(O=!0)}var C,P=function(e){if(Array.isArray(e))return te(e)}(C=new Set(o.map((function(e){return ve(e)})).filter((function(e){return e}))))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(C)||ee(C)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();d.Policies&&d.Policies.map((function(e){"profile:admin"===e.Subject&&e.Action,"profile:admin"===e.Subject&&e.Action}));var j=[t().createElement(u.FlatButton,{primary:!0,label:i.MessageHash[54],onClick:this.props.onRequestClose}),t().createElement(u.FlatButton,{primary:!0,disabled:O||a,label:i.MessageHash[53],onClick:function(){e.save()}})];"tags"!==v||a||j.unshift(t().createElement(u.FlatButton,{primary:!1,label:p("editor.tags.reset"),onClick:function(){new S.UserMetaServiceApi(m().getRestClient()).deleteUserMetaTags(d.Namespace,"*").then((function(){i.UI.displayMessage("SUCCESS",p("editor.tags.cleared").replace("%s",d.Namespace))})).catch((function(e){i.UI.displayMessage("ERROR",e.message)}))}}));var x={section:{marginTop:10,fontWeight:500,fontSize:12}};return t().createElement(u.Dialog,{title:g,actions:j,modal:!1,contentStyle:{width:520},open:this.props.open,onRequestClose:this.props.onRequestClose,autoScrollBodyContent:!0,bodyStyle:{padding:20}},t().createElement(b,{m:p,pydio:i,namespace:d,forcePrefix:"usermeta-",onChange:function(t){return e.setState({namespace:t})},readonly:a,create:r,labelError:E,nameError:w,styles:x}),t().createElement("div",{style:x.section},c().getInstance().MessageHash[310]),t().createElement(u.Toggle,ie({label:p("toggle.list-visibility"),disabled:a,labelPosition:"left",toggled:!this.getHideValue(),onToggle:function(t,n){e.setHideValue(!n)}},h.toggleFieldV2)),t().createElement(u.Toggle,ie({label:p("toggle.index"),disabled:a,labelPosition:"left",toggled:d.Indexable,onToggle:function(t,n){d.Indexable=n,e.setState({namespace:d})}},h.toggleFieldV2)),f&&t().createElement(f,{policies:d.Policies,readonly:a,onChangePolicies:function(t){return e.setState({namespace:re(re({},d),{},{Policies:t})})},pydio:i}),t().createElement("div",{style:x.section},p("order")),t().createElement(he,{floatingLabelText:p("order"),value:d.Order?d.Order:"0",onChange:function(t,n){d.Order=parseInt(n),e.setState({namespace:d})},fullWidth:!0,type:"number",readOnly:a,variant:"v2"}),t().createElement(ge,{floatingLabelFixed:!0,fullWidth:!0,floatingLabelText:p("groupName"),filter:function(e,t){return!e.indexOf||0===t.toLowerCase().indexOf(e.toLowerCase())},openOnFocus:!0,dataSource:P,searchText:ve(d)||"",onNewRequest:function(t,n){e.setGroupValue(t)},onUpdateInput:function(t){e.setGroupValue(t)},menuProps:{maxHeight:300,overflowY:"auto"}}))}}]),r}(t().Component);(Ee=(0,f.muiThemeable)()(Ee)).PropTypes={namespace:l().instanceOf(S.IdmUserMetaNamespace).isRequired,namespaces:l().arrayOf(S.IdmUserMetaNamespace),create:l().bool,reloadList:l().func,onRequestClose:l().func};const Oe=Ee;function ke(e){return ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ke(e)}function Ce(){return Ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?c.Attributes.QUOTA=e+"":(c.Attributes.QUOTA="0",delete c.Attributes.QUOTA)}}),t().createElement("hr",{style:k.divider}),t().createElement("div",{style:je({},k.legend)},v("ws.editor.other.layout")),t().createElement(Le,{fullWidth:!0,floatingLabelText:v("ws.editor.other.layout"),variant:"v2",value:c.Attributes.META_LAYOUT||"",onChange:function(e,t,n){c.Attributes.META_LAYOUT=n}},t().createElement(u.MenuItem,{primaryText:v("ws.editor.other.layout.default"),value:""}),t().createElement(u.MenuItem,{primaryText:v("ws.editor.other.layout.easy"),value:"meta.layout_sendfile"})))),h&&t().createElement(u.Paper,{zDepth:0,style:k.section},t().createElement("div",{style:k.title},"Workspace Visibility"),t().createElement("div",{style:je({},k.legend)},"WARNING: this is a dangerous zone, modify only if you know what you are doing!",!g&&t().createElement("span",{style:{fontWeight:500,cursor:"pointer"},onClick:function(){return n.setState({policiesEdit:!0})}}," - Edit Now")),t().createElement(h,{pydio:i,policies:c.Policies,onChangePolicies:function(e){return c.Policies=e},readonly:!g,showHeader:!1,forceCustom:!0,advancedLegend:t().createElement("span",null),advancedContainerStyle:g?{paddingBottom:300}:{},allowedActions:{READ:"Read",WRITE:"Write"}})))}}])&&Te(r.prototype,o),Object.defineProperty(r,"prototype",{writable:!1}),s}(e.Component);Ke=(0,f.muiThemeable)()(Ke);const We=require("pydio/model/data-model");var Ue=n.n(We);const qe=require("pydio/model/node");var He=n.n(qe),Je=c().requireLib("components").MaterialTable;const ze=i()({displayName:"WorkspaceList",mixins:[AdminComponents.MessagesConsumerMixin],propTypes:{dataModel:l().instanceOf(Ue()).isRequired,rootNode:l().instanceOf(He()).isRequired,currentNode:l().instanceOf(He()).isRequired,openSelection:l().func,advanced:l().boolean},getInitialState:function(){return{workspaces:[],loading:!1}},startLoad:function(){this.props.onLoadState&&this.props.onLoadState(!0),this.setState({loading:!0})},endLoad:function(){this.props.onLoadState&&this.props.onLoadState(!1),this.setState({loading:!1})},reload:function(){var e=this;this.startLoad(),C.listWorkspaces().then((function(t){e.endLoad(),e.setState({workspaces:t.Workspaces||[]})})).catch((function(t){e.endLoad()}))},componentDidMount:function(){this.reload()},openTableRows:function(e){e.length&&this.props.openSelection(e[0].workspace)},deleteAction:function(e){var t=this,n=this.props.pydio;n.UI.openConfirmDialog({message:n.MessageHash["settings.35"],destructive:[e.Label],validCallback:function(){new C(e).remove().then((function(){t.reload()}))}})},computeTableData:function(){var e=[],t=this.props.filterString;return this.state.workspaces.map((function(n){var r="";n.RootNodes&&(r=Object.keys(n.RootNodes).map((function(e){return g().trimRight(n.RootNodes[e].Path,"/")})).join(", "));var o=!1;if(n.Attributes)try{var i=JSON.parse(n.Attributes);!0!==i.ALLOW_SYNC&&"true"!==i.ALLOW_SYNC||(o=!0)}catch(e){}if(t){var a=t.toLowerCase(),l=n.Label&&n.Label.toLowerCase().indexOf(a)>=0,s=n.Description&&n.Description.toLowerCase().indexOf(a)>=0,c=r&&r.toLowerCase().indexOf(a)>=0;if(!(l||s||c))return}e.push({workspace:n,label:n.Label,description:n.Description,slug:n.Slug,summary:r,syncable:o})})),e.sort(g().arraySorter("label",!1,!0)),e},render:function(){var e=this,n=this.props,r=n.pydio,o=n.advanced,i=n.editable,a=n.tableStyles,l=n.openSelection,s=function(e){return r.MessageHash["ajxp_admin."+e]},c=function(e){return r.MessageHash["settings."+e]},u=[{name:"label",label:c("8"),style:{width:"20%",fontSize:15},headerStyle:{width:"20%"},sorter:{type:"string",default:"true"}},{name:"description",label:c("103"),hideSmall:!0,style:{width:"25%"},headerStyle:{width:"25%"},sorter:{type:"string"}},{name:"summary",label:s("ws.board.summary"),hideSmall:!0,style:{width:"25%"},headerStyle:{width:"25%"},sorter:{type:"string"}}];o&&u.push({name:"syncable",label:s("ws.board.syncable"),style:{width:"10%",textAlign:"center"},headerStyle:{width:"10%",textAlign:"center"},sorter:{type:"number",sortValue:function(e){return e.syncable?1:0}},renderCell:function(e){return t().createElement("span",{className:"mdi mdi-check",style:{fontSize:18,opacity:e.syncable?1:0}})}}),u.push({name:"slug",label:s("ws.5"),style:{width:"20%"},headerStyle:{width:"20%"},sorter:{type:"string"}});var d=this.state.loading,p=this.computeTableData(),f=[];i&&f.push({iconClassName:"mdi mdi-pencil",tooltip:"Edit Workspace",onClick:function(e){l(e.workspace)},disable:function(e){return!e.workspace.PoliciesContextEditable}});var y=r.user.getRepositoriesList();return f.push({iconClassName:"mdi mdi-open-in-new",tooltip:"Open this workspace...",onClick:function(e){r.triggerRepositoryChange(e.workspace.UUID)},disable:function(e){return!y.has(e.workspace.UUID)}}),i&&f.push({iconClassName:"mdi mdi-delete",onClick:function(t){e.deleteAction(t.workspace)},disable:function(e){return!e.workspace.PoliciesContextEditable}}),t().createElement(Je,{data:p,columns:u,actions:f,onSelectRows:i?this.openTableRows.bind(this):null,deselectOnClickAway:!0,showCheckboxes:!1,emptyStateString:s(d?"loading":"ws.board.empty"),masterStyles:a,paginate:[10,25,50,100],defaultPageSize:25,storageKey:"console.workspaces.list"})}});function Ye(){return Ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"flat";if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=a.call(this)).internalInvalid=!1,t.nameInvalid=!1,t.existingNames=n,e)t.model=e,e.StorageConfiguration||(e.StorageConfiguration={}),t.snapshot=JSON.parse(JSON.stringify(e));else switch(t.model=new S.ObjectDataSource,t.model.EncryptionMode=S.ObjectEncryptionMode.constructFromObject("CLEAR"),t.model.StorageType=S.ObjectStorageType.constructFromObject("LOCAL"),r){case"flat":t.model.StorageConfiguration={folder:"",normalize:"false"},t.model.FlatStorage=!0;break;case"structured":t.model.StorageConfiguration={folder:"",normalize:"false"},t.model.FlatStorage=!1;break;case"internal":t.model.StorageConfiguration={folder:"",normalize:"false",cellsInternal:"true"},t.model.FlatStorage=!0}return t.observableModel=t.buildProxy(t.model),t}return t=l,n=[{key:"buildProxy",value:function(e){var t=this;return new Proxy(e,{set:function(e,n,r){var o=r;if("StorageType"===n)e.StorageConfiguration={},"LOCAL"===o?e.StorageConfiguration={folder:"",normalize:"false"}:"S3"===o?e.StorageConfiguration={customEndpoint:""}:"GCS"===o&&(e.StorageConfiguration={jsonCredentials:""}),t.internalInvalid=!1,e.ApiKey=e.ApiSecret="";else if("Name"===n)o=g().computeStringSlug(o).replace("-","").substr(0,33),t.existingNames&&t.existingNames.indexOf(o)>-1?t.nameInvalid=!0:t.nameInvalid=!1;else if("folder"===n)"/"!==o[0]&&(o="/"+o);else{if("invalid"===n)return t.internalInvalid=r,t.notify("update"),!0;"PeerAddress"===n&&"ANY"===r&&(o="")}return e[n]=o,t.notify("update"),!0},get:function(e,n){var r=e[n];return r instanceof Array?r:r instanceof Object?t.buildProxy(r):"StorageType"===n?r||"LOCAL":"PeerAddress"===n?r||"ANY":r}})}},{key:"getModel",value:function(){return this.observableModel}},{key:"isValid",value:function(){return!this.internalInvalid&&!this.nameInvalid&&("S3"===this.model.StorageType||"AZURE"===this.model.StorageType?this.model.ApiKey&&this.model.ApiSecret&&this.model.Name&&(this.model.ObjectsBucket||this.model.StorageConfiguration.bucketsRegexp):"GCS"===this.model.StorageType?this.model.Name&&this.model.ObjectsBucket&&this.model.StorageConfiguration&&this.model.StorageConfiguration.jsonCredentials:this.model.Name&&this.model.StorageConfiguration&&this.model.StorageConfiguration.folder)}},{key:"getNameError",value:function(e){return this.nameInvalid?e("name.inuse"):null}},{key:"deleteSource",value:function(){return new S.ConfigServiceApi(ut.getRestClient()).deleteDataSource(this.model.Name)}},{key:"resyncSource",value:function(){var e=new S.JobsServiceApi(ut.getRestClient()),t=new S.RestUserJobRequest;return t.JobName="datasource-resync",t.JsonParameters=JSON.stringify({dsName:this.model.Name}),e.userCreateJob("datasource-resync",t)}},{key:"revert",value:function(){return this.model=this.snapshot,this.observableModel=this.buildProxy(this.model),this.snapshot=JSON.parse(JSON.stringify(this.model)),this.observableModel}},{key:"saveSource",value:function(){var e=this;return new S.ConfigServiceApi(ut.getRestClient()).putDataSource(this.model.Name,this.model).then((function(t){e.snapshot=JSON.parse(JSON.stringify(e.model)),e.notify("update")}))}},{key:"stripPrefix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!t)return e;var n={};return Object.keys(e).map((function(r){n[r.replace(t,"")]=e[r]})),n}},{key:"getDataWithPrefix",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(""===t)return this.model;var n={};return Object.keys(this.model).forEach((function(r){n[t+r]=e.model[r],"EncryptionMode"!==r||e.model[r]||(n[t+r]="CLEAR")})),n}}],r=[{key:"loadDatasources",value:function(){return new S.ConfigServiceApi(ut.getRestClient()).listDataSources()}},{key:"loadVersioningPolicies",value:function(){return new S.ConfigServiceApi(ut.getRestClient()).listVersioningPolicies()}},{key:"loadStatuses",value:function(){return new S.ConfigServiceApi(ut.getRestClient()).listServices("STARTED")}},{key:"loadEncryptionKeys",value:function(){return new S.ConfigServiceApi(ut.getRestClient()).listEncryptionKeys(new S.EncryptionAdminListKeysRequest)}},{key:"loadBuckets",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=new S.ConfigServiceApi(ut.getRestClient()),r=new S.RestListStorageBucketsRequest;return r.DataSource=e,t&&(r.BucketsRegexp=t),n.listStorageBuckets(r)}},{key:"createBucket",value:function(e,t){var n=new S.ConfigServiceApi(ut.getRestClient()),r=new S.RestCreateStorageBucketRequest;return r.DataSource=e,n.createStorageBucket(t,r)}}],n&&at(t.prototype,n),r&&at(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(ct);function pt(e){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pt(e)}function ft(e,t){for(var n=0;n=0;return v?f||(b=t().createElement("span",null,b," ",t().createElement("span",{className:"mdi mdi-alert"})," ",y("card.cleanOnDelete-legend-on"))):b=t().createElement("span",null,b," ",t().createElement("span",{className:"mdi mdi-alert"})," ",y("card.cleanOnDelete-legend-off")),a?t().createElement("div",{style:{display:"flex"}},t().createElement("div",{style:{flex:1,lineHeight:"40px"}},g),t().createElement("div",{style:{display:"flex"}},t().createElement(u.IconButton,{iconClassName:"mdi mdi-content-save",onClick:this.save.bind(this),disabled:!p,tooltip:"Save"}),t().createElement(u.IconButton,{iconClassName:"mdi mdi-close",onClick:function(){return s()},tooltip:"Close"}))):t().createElement("div",{style:{backgroundColor:"#f5f5f5",paddingBottom:12}},t().createElement("div",{style:{padding:i?"16px 24px 8px":"10px 24px 0",fontWeight:500,display:"flex",alignItems:"center"}},t().createElement("div",{style:{flex:1}},y("card.title")),!i&&t().createElement(u.FlatButton,{onClick:this.save.bind(this),primary:!0,disabled:!p,label:y("save")})),t().createElement("div",{style:{margin:"6px 24px 0 24px",border:"1px solid #e0e0e0"}},g),t().createElement("div",{style:{margin:"12px 24px",opacity:v?1:.4}},t().createElement(u.Checkbox,{disabled:i,checked:f,onCheck:function(t,n){e.setState({cleanOnDelete:n,dirty:!0})},label:b})))}}])&&ft(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),l}(t().Component);function gt(e){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gt(e)}function bt(){return bt=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:"",n=this.props.peerAddress,r=this.state.searchText,o=t;if(!t&&r){var i=r.lastIndexOf("/");o=r.substr(0,i)}if(null!==this.lastSearch&&this.lastSearch===o)return Promise.resolve();this.lastSearch=o;var a=new S.ConfigServiceApi(m().getRestClient()),l=new S.RestListPeerFoldersRequest;return l.PeerAddress="ANY"===n?"":n,l.Path=o,this.setState({loading:!0}),a.listPeerFolders(n,l).then((function(t){var n=t.Children||[];n=n.map((function(e){return"/"!==e.Path[0]&&(e.Path="/"+e.Path),e})),e.setState({nodes:n,loading:!1})})).catch((function(){e.setState({loading:!1})}))}},{key:"createFolder",value:function(e){var t=this,n=this.props,r=n.peerAddress,o=n.pydio,i=this.state.value,a=new S.ConfigServiceApi(m().getRestClient()),l=new S.RestCreatePeerFolderRequest;l.PeerAddress="ANY"===r?"":r,l.Path=i+"/"+e,a.createPeerFolder(r,l).then((function(e){t.lastSearch=null,t.loadValues(i).then((function(){t.handleNewRequest({key:l.Path}),t.setState({searchText:l.Path})}))})).catch((function(e){o.UI.displayMessage("ERROR",e.message)}))}},{key:"renderNode",value:function(e){var n=T().getBasename(e.Path),r=T().getDirname(e.Path),o=t().createElement("span",null,e.Path);return g().computeStringSlug(n)!==n?o=t().createElement("span",null,t().createElement("span",null,r),"/",t().createElement("span",{style:{color:"#c62828"}},n)):e.MetaStore&&e.MetaStore.symlink&&(o=t().createElement("span",null,t().createElement("span",null,r),"/",t().createElement("span",{style:{color:"#1976d2"}},n))),{key:e.Path,text:e.Path,invalid:!1,value:t().createElement(u.MenuItem,null,t().createElement(u.FontIcon,{className:"mdi mdi-folder",color:"#616161",style:{float:"left",marginRight:8}})," ",o)}}},{key:"showCreateDialog",value:function(){var e=this,t=this.props.pydio,n=this.state.value,r=function(e){return t.MessageHash["ajxp_admin.ds.editor.selector."+e]||e};t.UI.openComponentInModal("PydioReactUI","PromptDialog",{dialogTitle:r("mkdir"),legendId:r("mkdir.legend").replace("%s",n),fieldLabelId:r("mkdir.field"),submitValue:function(t){t&&e.createFolder(t)}})}},{key:"render",value:function(){var e=this,n=this.state,r=n.nodes,o=n.loading,i=n.exist,a=n.value,l=n.searchText,s=this.props,c=s.fieldLabel,d=s.pydio,p=[];r&&r.forEach((function(t){p.push(e.renderNode(t))}));var f=l||a;return t().createElement("div",{style:{position:"relative",marginTop:-5}},t().createElement("div",{style:{position:"absolute",right:6,top:29,width:30,zIndex:1}},t().createElement(u.RefreshIndicator,{size:25,left:0,top:0,status:o?"loading":"hide"})),a&&i&&!o&&(!l||l===a)&&t().createElement("div",{style:{position:"absolute",right:0,zIndex:1,top:18}},t().createElement(u.IconButton,{iconClassName:"mdi mdi-folder-plus",iconStyle:{color:"#9e9e9e"},onClick:function(){return e.showCreateDialog()},tooltip:d.MessageHash["ajxp_admin.ds.editor.selector.mkdir"],tooltipPosition:"top-center"})),t().createElement(qt,{fullWidth:!0,searchText:f,onUpdateInput:this.handleUpdateInput.bind(this),onNewRequest:this.handleNewRequest.bind(this),dataSource:p,hintText:c,filter:function(e,t){return 0===t.toLowerCase().indexOf(e.toLowerCase())},openOnFocus:!0,menuProps:{maxHeight:200}}))}}]),r}(t().Component),Jt=function(e){It(r,e);var n=Bt(r);function r(e){var t;return At(this,r),(t=n.call(this,e)).state={peerAddresses:[],invalid:!1,m:function(t){return e.pydio.MessageHash["ajxp_admin.ds.editor."+t]||t}},t}return Mt(r,[{key:"compareAddresses",value:function(e,t){var n=e.split("|"),r=t.split("|");return r.filter((function(e){return n.indexOf(e)>-1})).length||n.filter((function(e){return r.indexOf(e)>-1})).length}},{key:"componentDidMount",value:function(){var e=this,t=this.props.model;new S.ConfigServiceApi(m().getRestClient()).listPeersAddresses().then((function(n){var r=n.PeerAddresses||[];if(1!==r||t.PeerAddress||(t.PeerAddress=r[0]),e.setState({peerAddresses:r}),t.PeerAddress&&-1===r.indexOf(t.PeerAddress)){var o=r.filter((function(n){return e.compareAddresses(n,t.PeerAddress)}));o.length?t.PeerAddress=o[0]:e.setState({invalidAddress:t.PeerAddress})}}))}},{key:"baseIsInvalid",value:function(e){var t=this.state.m,n=!1,r=T().getBasename(e);return g().trim(e,"/").split("/").length<2?n=t("selector.error.depth"):g().computeStringSlug(r)!==r&&(n=t("selector.error.dnsname")),n}},{key:"onPathChange",value:function(e,t){var n=this.props.model,r=this.baseIsInvalid(e);n.invalid=r,n.StorageConfiguration.folder=e,t?void 0!==n.StorageConfiguration.create&&delete n.StorageConfiguration.create:n.StorageConfiguration.create="true",this.setState({invalid:r})}},{key:"onPeerChange",value:function(e){var t=this.props.model,n=this.state.invalidAddress;e!==n&&(t.PeerAddress=e,n&&this.setState({invalidAddress:null}))}},{key:"render",value:function(){var e=this,n=this.props,r=n.model,o=n.pydio,i=n.styles,a=this.state,l=a.peerAddresses,s=a.invalidAddress,c=a.invalid,d=a.m,p=Rt(l);return p=["ANY"].concat(Rt(p)),s&&"ANY"!==s&&(p=[s].concat(Rt(p))),t().createElement("div",null,t().createElement("div",{style:{paddingBottom:8}},t().createElement("div",{style:i.subLegend},d("storage.legend.fs.peer")),t().createElement(Ut,{value:r.PeerAddress||"",variant:"v2",hintText:d("selector.peer")+" *",onChange:function(t,n,r){return e.onPeerChange(r)},fullWidth:!0},p.map((function(e){var n=d("selector.peer.any");return"ANY"!==e&&(n=d("selector.peer.word")+" : "+e.replace("|"," | ")+(e===s?" ("+d("selector.peer.invalid")+")":"")),t().createElement(u.MenuItem,{value:e,primaryText:n})})))),t().createElement("div",null,t().createElement("div",{style:xt(xt({},i.subLegend),{},{paddingBottom:6})},d("storage.legend.fs.path")),r.PeerAddress&&t().createElement(Ht,{pydio:o,value:r.StorageConfiguration.folder,peerAddress:r.PeerAddress,onChange:this.onPathChange.bind(this),fieldLabel:d("selector.completer")+(r.StorageConfiguration.create?" ("+d("selector.completer.create")+")":"")+" *",hintText:d("selector.completer.hint")}),!r.PeerAddress&&t().createElement(Wt,{style:{marginTop:-3},fullWidth:!0,variant:"v2",disabled:!0,value:r.StorageConfiguration.folder,floatingLabelText:d("selector.folder")+" *",hintText:d("selector.folder.hint")})),c&&t().createElement("div",{style:{color:"#c62828"}},c))}}]),r}(t().Component);const zt=require("pydio/util/dom");var Yt=n.n(zt);function Gt(e){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gt(e)}function Qt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $t(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&this.setState({currentPane:Nn[n-1]})}},{key:"stepperNext",value:function(){var e=this.state.currentPane,t=void 0===e?"main":e,n=Nn.indexOf(t);n-1&&o0;)r.pop(),i--}n.KeepPeriods=r,this.setState({saveValue:n,dirty:!0})}},{key:"updateValidStatus",value:function(e){}},{key:"render",value:function(){var e,n=this,r=this.props,o=r.create,i=r.readonly,a=r.pydio,l=r.muiTheme,c=r.internalSources,d=this.state,p=d.loaded,f=d.policy,y=d.saveValue,m=d.m,h=this.state.parameters,g=l.palette,b=Qn(g);if(h&&p){c&&(h=h.map((function(e){return"VersionsDataSourceName"===e.name&&(e.choices+=","+c.map((function(e){return e+"|DataSource "+e})).join(",")),e})));var v=s.TreeVersioningPolicyToValues(f);y&&(v=s.TreeVersioningPolicyToValues(y)),e=t().createElement(zn,{parameters:h,values:v,className:"full-width",onChange:this.onFormChange.bind(this),onValidStatusChange:this.updateValidStatus.bind(this),disabled:i,depth:-2,variant:"v2"})}var S=[];i||(o||(S.push(Gn.actionButton(m("delete"),"mdi mdi-delete",(function(){n.deleteSource()}))),S.push(Gn.actionButton(a.MessageHash["ajxp_admin.plugins.6"],"mdi mdi-undo",(function(){n.resetForm()}),!this.state.dirty))),S.push(Gn.actionButton(a.MessageHash[53],"mdi mdi-content-save",(function(){n.saveSource()}),!this.state.valid||!this.state.dirty)));var w=y?y.Name:f.Name;return w||(w=""),t().createElement(Gn,{title:p&&h?m("title").replace("%s",w):a.MessageHash["ajxp_admin.loading"],titleLeftIcon:"mdi mdi-clock-start",titleActionBar:S,closeAction:this.props.closeEditor,className:"workspace-editor",contentFill:!0},t().createElement(u.Paper,{zDepth:0,style:{backgroundColor:b.body.block.header.backgroundColor,padding:"0px 20px",height:64,display:"flex",alignItems:"center"}},t().createElement("div",{style:{overflowX:"auto",width:"100%"}},t().createElement(_n,{pydio:a,policy:y||f}))),e,b.formSimpleCss())}}],o=[{key:"valuesToTreeVersioningPolicy",value:function(e){for(var t=[],n="IntervalStart",r="MaxNumber",o=n,i=r,a=0;void 0!==e[o]&&void 0!==e[i];){var l=new S.TreeVersioningKeepPeriod;l.IntervalStart=e[o],l.MaxNumber=e[i],t.push(l),delete e[i],delete e[o],o=n+"_"+ ++a,i=r+"_"+a}return e.KeepPeriods=t,S.TreeVersioningPolicy.constructFromObject(e)}},{key:"TreeVersioningPolicyToValues",value:function(e){var t=function(e){for(var t=1;t0?(t["IntervalStart_"+n]=e.IntervalStart||0,t["MaxNumber_"+n]=e.MaxNumber||0):(t.IntervalStart=e.IntervalStart||0,t.MaxNumber=e.MaxNumber||0),n++}))}return t.NodeDeletedStrategy||(t.NodeDeletedStrategy="KeepAll"),t}}],r&&Kn(n.prototype,r),o&&Kn(n,o),Object.defineProperty(n,"prototype",{writable:!1}),s}(t().Component);$n=(0,f.muiThemeable)()($n);var Xn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),Zn=new Uint8Array(16);function er(){if(!Xn)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xn(Zn)}for(var tr=[],nr=0;nr<256;++nr)tr[nr]=(nr+256).toString(16).substr(1);const rr=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||er)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var i=0;i<16;++i)t[r+i]=o[i];return t||function(e,t){var n=t||0,r=tr;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}(o)};function or(e){return or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},or(e)}function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:null;this.setState({dsLoaded:!1,versionsLoaded:!1,newDsName:t}),dt.loadDatasources().then((function(t){e.setState({dataSources:t.DataSources||[],dsLoaded:!0},(function(){e.syncStatuses()}))})),dt.loadVersioningPolicies().then((function(t){e.setState({versioningPolicies:t.Policies||[],versionsLoaded:!0})})),dt.loadStatuses().then((function(t){e.setState({startedServices:t.Services})})),this.refs&&this.refs.encKeys&&this.refs.encKeys.load()}},{key:"syncStatuses",value:function(){var e=this,t=this.state.dataSources,n=void 0===t?[]:t;n.length&&xr.getInstance().getAdminJobs(null,null,n.map((function(e){return"resync-ds-"+e.Name})),1).then((function(t){var n={};(t.Jobs||[]).forEach((function(e){e.Tasks&&e.Tasks.length&&(n[e.ID.replace("resync-ds-","")]=e)})),e.setState({resyncJobs:n})}))}},{key:"closeEditor",value:function(){this.props.closeRightPane()}},{key:"openDataSource",value:function(e){if(e.length){var t=e[0],n=this.props,r=n.openRightPane,o=n.accessByName,i=n.pydio,a=n.storageTypes;r({COMPONENT:An,PROPS:{ref:"editor",pydio:i,dataSource:t,storageTypes:a,readonly:!o("CreateDatasource"),closeEditor:this.closeEditor.bind(this),reloadList:this.load.bind(this)}})}}},{key:"makeStatusLabel",value:function(e,n){switch(e){case"error":return t().createElement("span",{style:{color:"#e53935"}},t().createElement("span",{className:"mdi mdi-alert"})," ",n);case"running":return t().createElement("span",{style:{color:"#ef6c00"}},t().createElement("span",{className:"mdi mdi-timer-sand"})," ",n);default:return t().createElement("span",{style:{color:"#1b5e20"}},t().createElement("span",{className:"mdi mdi-check"})," ",n)}}},{key:"computeStatus",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n&&e.Disabled)return-1;var r,o,i,a=this.state,l=a.startedServices,s=void 0===l?[]:l,c=a.peerAddresses,u=void 0===c?[]:c,d=a.m,p=a.newDsName;if(!s.length)return d("status.na");if(s.map((function(t){t.Name==="pydio.grpc.data.sync."+e.Name&&"STARTED"===t.Status?o=!0:t.Name==="pydio.grpc.data.index."+e.Name&&"STARTED"===t.Status?r=!0:t.Name==="pydio.grpc.data.objects."+e.ObjectsServiceName&&"STARTED"===t.Status&&(i=!0)})),r&&o&&i)return p&&e.Name===p&&setTimeout((function(){t.setState({newDsName:null})}),100),n?0:this.makeStatusLabel("ok",d("status.ok"));if(p&&e.Name===p)return n?1:this.makeStatusLabel("running",d("status.starting"));if(r||o||i){var f=[];return r||f.push(d("status.index")),o||f.push(d("status.sync")),i||f.push(d("status.object")),n?3:this.makeStatusLabel("error",f.join(" - "))}var y=d("status.ko");return u&&-1===u.indexOf(e.PeerAddress)&&(y=d("status.ko-peers").replace("%s",e.PeerAddress)),n?2:this.makeStatusLabel("error",y)}},{key:"computeJobStatus",value:function(e){var t=e.Tasks[0];switch(t.Status){case"Finished":return this.makeStatusLabel("ok",Tr(new Date(1e3*parseInt(t.EndTime))).fromNow());case"Running":return this.makeStatusLabel("running",t.StatusMessage||"Running...");case"Error":return this.makeStatusLabel("error",t.StatusMessage);case"Queued":return this.makeStatusLabel("running",t.StatusMessage)}return this.makeStatusLabel("ok",t.StatusMessage)}},{key:"openVersionPolicy",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===e||e.length){var n,r=!1;if(void 0===e){r=!0,(n=new S.TreeVersioningPolicy).Uuid=rr(),n.VersionsDataSourceName="versions",n.NodeDeletedStrategy="KeepAll";var o=new S.TreeVersioningKeepPeriod;o.IntervalStart="0",o.MaxNumber=-1,n.KeepPeriods=[o]}else n=e[0],t&&(r=!0,(n=S.TreeVersioningPolicy.constructFromObject(JSON.parse(JSON.stringify(n)))).Uuid=rr(),n.Name+=" (Copy)");var i=this.props,a=i.openRightPane,l=i.pydio,s=i.versioningReadonly,c=i.accessByName,u=this.state.dataSources;a({COMPONENT:$n,PROPS:{ref:"editor",versionPolicy:n,create:r,pydio:l,internalSources:u.filter((function(e){return e.StorageConfiguration&&e.StorageConfiguration.cellsInternal})).map((function(e){return e.Name})),readonly:s||!c("CreateVersioning"),closeEditor:this.closeEditor.bind(this),reloadList:this.load.bind(this)}})}}},{key:"deleteVersionPolicy",value:function(e){var t=this,n=this.props.pydio;n.UI.openConfirmDialog({message:n.MessageHash["ajxp_admin.versions.editor.delete.confirm"],destructive:[e.Name],validCallback:function(){Y().loadClass("EnterpriseSDK").then((function(n){new n.EnterpriseConfigServiceApi(m().getRestClient()).deleteVersioningPolicy(e.Uuid).then((function(e){t.load()}))}))}})}},{key:"createDataSource",value:function(e){var t=this.props,n=t.pydio,r=t.storageTypes,o=this.state.dataSources;this.props.openRightPane({COMPONENT:An,PROPS:{ref:"editor",create:!0,createStructure:e,existingNames:o.map((function(e){return e.Name})),pydio:n,storageTypes:r,closeEditor:this.closeEditor.bind(this),reloadList:this.load.bind(this)}})}},{key:"resyncDataSource",value:function(e,t,n){e.UI.openConfirmDialog({message:t("editor.legend.resync"),skipNext:"datasource.resync.confirm",validCallback:function(){new dt(n).resyncSource()}})}},{key:"deleteDataSource",value:function(e,t,n){var r=this;e.UI.openConfirmDialog({message:t("editor.delete.warning"),validCallback:function(){new dt(n).deleteSource().then((function(){r.load()}))},destructive:[n.Name]})}},{key:"createWorkspaceFromDatasource",value:function(e,t,n){var r=new C,o=r.getModel(),i=n.Name;o.Label=i,o.Description="Root of "+i,o.Slug=i,o.Attributes.DEFAULT_RIGHTS="";var a={Uuid:"DATASOURCE:"+i,Path:i};o.RootNodes[a.Uuid]=a,e.UI.openComponentInModal("PydioReactUI","PromptDialog",{dialogTitle:t("board.wsfromds.title"),legendId:t("board.wsfromds.legend").replace("%s",i),fieldLabelId:t("board.wsfromds.field"),defaultValue:t("board.wsfromds.defaultPrefix").replace("%s",i),submitValue:function(t){o.Label=t,r.save().then((function(){e.goTo("/data/workspaces")}))}})}},{key:"render",value:function(){var n=this,r=this.state,o=r.dataSources,i=r.resyncJobs,a=r.versioningPolicies,l=r.m,s=r.createDialog;o.sort(g().arraySorter("Name"));var c=o.filter((function(e){return!(e.StorageConfiguration&&e.StorageConfiguration.cellsInternal)})),d=o.filter((function(e){return e.StorageConfiguration&&e.StorageConfiguration.cellsInternal}));a.sort(g().arraySorter("Name"));var p=AdminComponents.AdminStyles(this.props.muiTheme.palette),f=p.body,y=f.tableMaster,m=f.block.props,h=f.block.container,b=this.props,v=b.currentNode,S=b.pydio,w=b.versioningReadonly,E=b.accessByName,O=[{name:"Name",label:l("name"),style:{fontSize:15,width:"15%"},headerStyle:{width:"15%"},sorter:{type:"string",default:!0}},{name:"StorageType",label:l("storage"),style:{width:"15%"},headerStyle:{width:"15%"},renderCell:function(e){var t="storage.fs";switch(e.StorageType){case"S3":t="storage.s3";break;case"AZURE":t="storage.azure";break;case"GCS":t="storage.gcs"}return l(t)},sorter:{type:"string"}},{name:"Status",label:l("status"),hideSmall:!0,renderCell:function(e){return e.Disabled?t().createElement("span",{style:{color:"#757575"}},t().createElement("span",{className:"mdi mdi-checkbox-blank-circle-outline"})," ",l("status.disabled")):n.computeStatus(e)},sorter:{type:"number",value:function(e){return n.computeStatus(e,!0)}}},{name:"SyncStatus",label:l("syncStatus"),hideSmall:!0,renderCell:function(e){return i&&i[e.Name]?n.computeJobStatus(i[e.Name]):"n/a"},sorter:{type:"number",value:function(e){return i&&i[e.Name]?i[e.Name].Tasks[0].EndTime:0}}},{name:"VersioningPolicyName",label:l("versioning"),style:{width:"15%"},headerStyle:{width:"15%"},hideSmall:!0,renderCell:function(e){var t=a.find((function(t){return t.Uuid===e.VersioningPolicyName}));return t?t.Name:e.VersioningPolicyName||"-"},sorter:{type:"string"}},{name:"EncryptionMode",label:l("encryption"),hideSmall:!0,style:{width:"8%",textAlign:"center"},headerStyle:{width:"8%"},renderCell:function(e){return"MASTER"===e.EncryptionMode?t().createElement("span",{className:"mdi mdi-check"}):"-"},sorter:{type:"number",value:function(e){return"MASTER"===e.EncryptionMode?1:0}}}];c.filter((function(e){return!e.FlatStorage})).length||(O=O.filter((function(e){return"SyncStatus"!==e.name})));var k=O.filter((function(e){return"VersioningPolicyName"!==e.name&&"SyncStatus"!==e.name})),C=v.getLabel(),P=v.getMetadata().get("icon_class"),j=[];E("CreateDatasource")&&j.push(t().createElement(u.FlatButton,wr({primary:!0,label:S.MessageHash["ajxp_admin.ws.4"],onClick:function(){return n.setState({createDialog:!0})}},p.props.header.flatButton)));var x=!w&&E("CreateVersioning");x&&j.push(t().createElement(u.FlatButton,wr({primary:!0,label:S.MessageHash["ajxp_admin.ws.4b"],onClick:function(){n.openVersionPolicy()}},p.props.header.flatButton)));var T=[{name:"Name",label:l("versioning.name"),style:{width:180,fontSize:15},headerStyle:{width:180},sorter:{type:"string",default:!0}},{name:"Description",label:l("versioning.description"),sorter:{type:"string"}},{name:"KeepPeriods",hideSmall:!0,label:l("versioning.periods"),renderCell:function(e){return t().createElement(_n,{rendering:"short",policy:e,pydio:S})}},{name:"VersionsDataSourceName",style:{width:180},headerStyle:{width:180},label:l("versioning.storage"),sorter:{type:"string"},hideSmall:!0}],R=[];E("CreateDatasource")&&R.push({iconClassName:"mdi mdi-pencil",tooltip:"Edit datasource",onClick:function(e){n.openDataSource([e])}}),R.push({iconClassName:"mdi mdi-folder-plus",tooltip:"Create workspace here",onClick:function(e){return n.createWorkspaceFromDatasource(S,l,e)}}),E("CreateDatasource")&&R.push({iconClassName:"mdi mdi-delete",tooltip:l("editor.legend.delete.button"),onClick:function(e){return n.deleteDataSource(S,l,e)}});var N=[].concat(R);c.filter((function(e){return!e.FlatStorage})).length>0&&R.push({iconClassName:"mdi mdi-sync",tooltip:l("editor.legend.resync.button"),onClick:function(e){return n.resyncDataSource(S,l,e)},disable:function(e){return e.FlatStorage}});var A=[];return A.push({iconClassName:x?"mdi mdi-pencil":"mdi mdi-eye",tooltip:x?"Edit policy":"Display policy",onClick:function(e){n.openVersionPolicy([e])}}),x&&(A.push({iconClassName:"mdi mdi-content-copy",tooltip:"Duplicate policy",onClick:function(e){return n.openVersionPolicy([e],!0)}}),A.push({iconClassName:"mdi mdi-delete",tooltip:"Delete policy",destructive:!0,onClick:function(e){return n.deleteVersionPolicy(e)}})),t().createElement("div",{className:"main-layout-nav-to-stack workspaces-board"},t().createElement("div",{className:"vertical-layout",style:{width:"100%"}},t().createElement(AdminComponents.Header,{title:C,icon:P,actions:j,reloadAction:this.load.bind(this),loading:!(this.state.dsLoaded&&this.state.versionsLoaded)}),t().createElement(hr,{open:s,onRequestClose:function(){n.setState({createDialog:!1})},onSubmit:function(e){n.createDataSource(e)}}),t().createElement("div",{className:"layout-fill"},t().createElement(AdminComponents.SubHeader,{title:l("board.ds.title"),legend:l("board.ds.legend")}),t().createElement(u.Paper,wr({},m,{style:vr({},h)}),t().createElement(Pr,{data:c,columns:O,actions:R,onSelectRows:this.openDataSource.bind(this),deselectOnClickAway:!0,showCheckboxes:!1,emptyStateString:l("emptyState"),masterStyles:y,storageKey:"console.datasources.list"})),d.length>0&&t().createElement(e.Fragment,null,t().createElement("div",{style:{padding:"0px 20px"}},"Internal DataSources are used to store binaries like files versions"),t().createElement(u.Paper,wr({},m,{style:vr({},h)}),t().createElement(Pr,{data:d,columns:k,actions:N,onSelectRows:this.openDataSource.bind(this),deselectOnClickAway:!0,showCheckboxes:!1,emptyStateString:l("emptyState"),masterStyles:y,storageKey:"console.internalsources.list"}))),t().createElement(AdminComponents.SubHeader,{title:l("board.versioning.title"),legend:l("board.versioning.legend")}),t().createElement(u.Paper,wr({},m,{style:vr({},h)}),t().createElement(Pr,{data:a,columns:T,actions:A,onSelectRows:this.openVersionPolicy.bind(this),deselectOnClickAway:!0,showCheckboxes:!1,masterStyles:y,storageKey:"console.versioning.policies.list"})),t().createElement(AdminComponents.SubHeader,{title:l("board.enc.title"),legend:l("board.enc.legend")}),t().createElement(dr,{pydio:S,ref:"encKeys",accessByName:E,adminStyles:p}))))}}],o&&Er(r.prototype,o),Object.defineProperty(r,"prototype",{writable:!1}),s}(t().Component);function Nr(e){return Nr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nr(e)}function Ar(){return Ar=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);nr?1:-1}));var v=[{name:"Order",label:h("order"),style:{width:30},headerStyle:{width:30},hideSmall:!0,renderCell:function(e){return e.Order||"0"},sorter:{type:"number"}},{name:"Namespace",label:h("namespace"),style:{fontSize:15},sorter:{type:"string"}},{name:"Label",label:h("label"),style:{width:"25%"},headerStyle:{width:"25%"},sorter:{type:"string"}},{name:"Indexable",label:h("indexable"),style:{width:"10%"},headerStyle:{width:"10%"},hideSmall:!0,renderCell:function(e){return e.Indexable?"Yes":"No"},sorter:{type:"number",value:function(e){return e.Indexable?1:0}}},{name:"JsonDefinition",label:h("definition"),hideSmall:!0,renderCell:function(e){var t=e.JsonDefinition;if(!t)return"";var n=JSON.parse(t);return $.MetaTypes[n.type]||n.type},sorter:{type:"string"}}],S={};b.length?d.map((function(e){var t=ve(e);S[t]||(S[t]=[]),S[t].push(e)})):S[""]=d;var w=o.getLabel(),E=o.getMetadata().get("icon_class"),O=[],k=[];return a("Create")&&(O.push(t().createElement(u.FlatButton,Ar({primary:!0,label:h("namespace.add"),onClick:function(){e.create()}},s.props.header.flatButton))),k.push({iconClassName:"mdi mdi-pencil",onClick:function(t){e.open([t])}},{iconClassName:"mdi mdi-delete",onClick:function(t){e.deleteNs(t)}})),t().createElement("div",{className:"main-layout-nav-to-stack workspaces-board"},t().createElement(Oe,{pydio:i,open:f,create:m,namespace:y,onRequestClose:function(){return e.close()},reloadList:function(){return e.load()},namespaces:d,readonly:!a("Create"),policiesBuilder:l}),t().createElement("div",{className:"vertical-layout",style:{width:"100%"}},t().createElement(AdminComponents.Header,{title:w,icon:E,actions:O,reloadAction:this.load.bind(this),loading:p}),t().createElement("div",{className:"layout-fill"},t().createElement(AdminComponents.SubHeader,{title:h("namespaces"),legend:h("namespaces.legend")}),Object.keys(S).sort().map((function(n){return t().createElement(t().Fragment,null,n&&t().createElement("div",{style:{padding:20,fontWeight:500,paddingBottom:0}},"["+h("group")+"] "+n),!n&&b.length>0&&t().createElement("div",{style:{padding:20,fontWeight:500,paddingBottom:0}},h("default-group")),t().createElement(u.Paper,s.body.block.props,t().createElement(Br,{data:S[n],columns:v,actions:k,onSelectRows:e.open.bind(e),deselectOnClickAway:!0,showCheckboxes:!1,emptyStateString:h("empty"),masterStyles:s.body.tableMaster,storageKey:"console.metadata.list"})))})))))}}])&&Mr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),l}(t().Component);Fr=_r()(Fr)})(),window.AdminWorkspaces=r})(); \ No newline at end of file +(()=>{"use strict";var e={173:e=>{e.exports=require("material-ui/styles")},880:e=>{e.exports=require("pydio/http/api")},590:e=>{e.exports=require("pydio/lang/observable")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{n.r(r),n.d(r,{DataSource:()=>dt,DataSourceEditor:()=>An,DataSourcesBoard:()=>Rr,MetadataBoard:()=>Fr,TemplatePath:()=>ot,TemplatePathEditor:()=>ht,VirtualNodes:()=>Ct,Workspace:()=>C,WsAutoComplete:()=>J,WsDashboard:()=>$e});const e=require("react");var t=n.n(e);const o=require("create-react-class");var i=n.n(o);const a=require("prop-types");var l=n.n(a);const s=require("pydio");var c=n.n(s);const u=require("material-ui"),d=require("pydio/util/xml");var p=n.n(d),f=n(173),y=n(880),m=n.n(y);const h=require("pydio/util/lang");var g=n.n(h),b=n(590),v=n.n(b);const S=require("cells-sdk");function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function E(e,t){for(var n=0;n0}},{key:"hasFolderRoots",value:function(){var e=this;return Object.keys(this.model.RootNodes).filter((function(t){return!l.rootIsTemplatePath(e.model.RootNodes[t])})).length>0}},{key:"save",value:function(){var e=this;return this.model.Attributes=JSON.stringify(this.internalAttributes),new S.WorkspaceServiceApi(m().getRestClient()).putWorkspace(this.model.Slug,this.model).then((function(t){e.initModel(t),e.observableModel=e.buildProxy(e.model)}))}},{key:"remove",value:function(){return new S.WorkspaceServiceApi(m().getRestClient()).deleteWorkspace(this.model.Slug)}},{key:"revert",value:function(){var e=S.IdmWorkspace.constructFromObject(this.snapshot||{});this.initModel(e),this.observableModel=this.buildProxy(this.model)}},{key:"isValid",value:function(){return this.model.Slug&&this.model.Label&&Object.keys(this.model.RootNodes).length>0}},{key:"isDirty",value:function(){return this.dirty}}])&&E(t.prototype,n),r&&E(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(v());const P=require("lodash.debounce");var j=n.n(P);const x=require("pydio/util/path");var T=n.n(x),R=["muiTheme","children"];function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function A(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,R),i=q(n);return t().createElement("div",K({style:i.fillBlockV2Right},o),r)})),J=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(s,e);var n,r,o,i,a,l=(i=s,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=V(i);if(a){var n=V(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),t=l.call(this,e);var n=e.value,r=void 0===n?"":n;return t.debounced=j()((function(){var e=t.state.value;t.loadValues(e)}),300),t.state={nodes:[],value:r},t}return n=s,r=[{key:"componentDidMount",value:function(){var e=this,t=this.props.validateOnLoad,n=this.state.value;this.loadValues(n,(function(){var n=e.state,r=n.nodes,o=n.value;r.filter((function(e){return e.Path===o&&(!e.Type||"COLLECTION"==e.Type&&!e.MetaStore&&!e.MetaStore.resolution)})).map((function(t){e.loadValues(o+"/")})),t&&e.handleNewRequest(o)}))}},{key:"handleUpdateInput",value:function(e){this.debounced(),this.setState({value:e})}},{key:"handleNewRequest",value:function(e){var t,n,r=this.state.nodes,o=this.props,i=o.onChange,a=void 0===i?function(){}:i,l=o.onDelete,s=void 0===l?function(){}:l,c=o.onError,u=void 0===c?function(){}:c;if("string"==typeof e){if(""===e)return void s();t=e,(n=r.filter((function(t){return t.Path===e}))[0])||(n=r.filter((function(t){return 0===t.Path.indexOf(e)}))[0])}else"object"===I(e)&&(t=e.key,n=e.node);if(!n)return u();this.setState({value:t}),a(t,n)}},{key:"loadValues",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=e.lastIndexOf("/"),o=e.substr(0,r);if(null===this.lastSearch||this.lastSearch!==o){this.lastSearch=o,this.setState({loading:!0});var i=new S.AdminTreeServiceApi(PydioApi.getRestClient()),a=new S.TreeListNodesRequest,l=new S.TreeNode;l.Path=o+"/",a.Node=l,i.listAdminTree(a).then((function(e){t.setState({nodes:e.Children||[],loading:!1},(function(){return n()}))})).catch((function(){t.setState({loading:!1},(function(){return n()}))}))}}},{key:"render",value:function(){var e=this,n=this.state,r=n.value,o=n.nodes,i=n.loading,a=this.props,l=a.pydio,c=a.onDelete,d=a.skipTemplates,p=a.label,f=a.zDepth,y=void 0===f?0:f,m=function(e){return l.MessageHash["ajxp_admin."+e]||e},h=[];if(o){var g={};if(o.forEach((function(e){if(!(e.MetaStore&&e.MetaStore.resolution&&"cells"===e.Uuid||T().getBasename(e.Path).startsWith("."))){var t=s.renderNode(e,m);g[t.categ]||(g[t.categ]=[]),g[t.categ].push(t)}})),Object.keys(g).length>1){h.push({key:"h1",text:"",value:t().createElement(u.MenuItem,{primaryText:m("ws.complete.datasources"),style:{fontSize:13,fontWeight:500},disabled:!0})});var b=g[Object.keys(g)[0]];if(b.sort(LangUtils.arraySorter("text")),h.push.apply(h,M(b)),!d){h.push({key:"h2",text:"",value:t().createElement(u.MenuItem,{primaryText:m("ws.complete.templates"),style:{fontSize:13,fontWeight:500},disabled:!0})});var v=g[Object.keys(g)[1]];v.sort(LangUtils.arraySorter("text")),h.push.apply(h,M(v))}}else 1===Object.keys(g).length&&h.push.apply(h,M(g[Object.keys(g)[0]]))}return t().createElement(u.Paper,{zDepth:y,style:A({display:"flex",alignItems:"center",margin:"2px 0"},this.props.style)},t().createElement("div",{style:{position:"relative",flex:1,height:60}},t().createElement("div",{style:{position:"absolute",right:0,top:30,width:30}},t().createElement(u.RefreshIndicator,{size:30,left:0,top:0,status:i?"loading":"hide"})),t().createElement(U,{fullWidth:!0,searchText:r,onUpdateInput:function(t){return e.handleUpdateInput(t)},onNewRequest:function(t){return e.handleNewRequest(t)},onClose:function(){return e.handleNewRequest(r)},dataSource:h,filter:function(e,t){return 0===t.toLowerCase().indexOf(e.toLowerCase())},floatingLabelText:p||m("ws.complete.label"),openOnFocus:!0,menuProps:{maxHeight:200},hasRightBlock:!0})),t().createElement(H,null,t().createElement(u.IconButton,{style:{marginTop:2},iconStyle:{color:c?"#9e9e9e":"#eee"},iconClassName:"mdi mdi-delete",onClick:c,disabled:!c})))}}],o=[{key:"renderNode",value:function(e,n){var r=t().createElement("span",null,e.Path),o="mdi mdi-folder",i="folder";if(e.MetaStore&&e.MetaStore.resolution){o="mdi mdi-file-tree",i="templatePath";var a=e.MetaStore.resolution.split("\n").pop();r=t().createElement("span",null,e.Path," ",t().createElement("i",{style:{color:"#9e9e9e"}},"- ",n("ws.complete.resolves")," ",a))}else"LEAF"===e.Type&&(o="mdi mdi-file");return{key:e.Path,text:e.Path,node:e,categ:i,value:t().createElement(u.MenuItem,null,t().createElement(u.FontIcon,{className:o,color:"#607d8b",style:{float:"left",marginRight:8}})," ",r)}}}],r&&_(n.prototype,r),o&&_(n,o),Object.defineProperty(n,"prototype",{writable:!1}),s}(t().Component);const z=require("pydio/http/resources-manager");var Y=n.n(z);function G(e){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(e)}function Q(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!e)return Promise.resolve(t);var n=e.split("."),r=n.shift(),o=n.join(".");return Y().loadClass(r).then((function(n){var i=Z().getFunctionByName(o,n);if(!i){if("object"===ye(n)&&n[r]){var a=Z().getFunctionByName(o,n[r]);if(a)return a}if(t)return console.error("Cannot find editor component, using default instead",e,t),t;throw new Error("cannot find editor component")}return i})).catch((function(n){if(t)return console.error("Cannot find editor component, using default instead",e,t),t;throw n}))}var we=function(n){ue(o,n);var r=pe(o);function o(e){return ae(this,o),r.call(this,e)}return se(o,[{key:"togglePolicies",value:function(e,t){var n=this.props,r=n.policies,o=void 0===r?[]:r,i=n.onChangePolicies,a=o.filter((function(t){return t.Action!==e}));a.push(S.ServiceResourcePolicy.constructFromObject({Action:e,Effect:"allow",Subject:t?"profile:admin":"*"})),"READ"===e&&t&&(a=a.filter((function(e){return"WRITE"!==e.Action}))).push(S.ServiceResourcePolicy.constructFromObject({Action:"WRITE",Effect:"allow",Subject:"profile:admin"})),i(a)}},{key:"render",value:function(){var n,r,o=this,i=this.props,a=i.readonly,l=i.policies,s=i.pydio,c=i.muiTheme,d=function(e){return s.MessageHash["ajxp_admin.metadata."+e]||e},p=be(c);return l&&l.map((function(e){"profile:admin"===e.Subject&&"READ"===e.Action&&(n=!0),"profile:admin"===e.Subject&&"WRITE"===e.Action&&(r=!0)})),t().createElement(e.Fragment,null,t().createElement("div",null,t().createElement(u.Toggle,ie({label:d("toggle.read"),disabled:a,labelPosition:"left",toggled:n,onToggle:function(e,t){o.togglePolicies("READ",t)}},p.toggleFieldV2))),t().createElement("div",null,t().createElement(u.Toggle,ie({label:d("toggle.write"),labelPosition:"left",disabled:n||a,toggled:r,onToggle:function(e,t){o.togglePolicies("WRITE",t)}},p.toggleFieldV2))))}}]),o}(t().Component);we=(0,f.muiThemeable)()(we);var Ee=function(e){ue(r,e);var n=pe(r);function r(e){var t;return ae(this,r),(t=n.call(this,e)).state={namespace:t.cloneNs(e.namespace),m:function(t){return e.pydio.MessageHash["ajxp_admin.metadata."+t]||t},selectorNewKey:"",selectorNewValue:"",PoliciesBuilder:we},Y().loadClass("ReactMeta").then((function(e){t.setState({metaModule:e});var n=t.props.policiesBuilder;n&&Se(n,we).then((function(e){return t.setState({PoliciesBuilder:e})}))})),t}return se(r,[{key:"cloneNs",value:function(e){return S.IdmUserMetaNamespace.constructFromObject(JSON.parse(JSON.stringify(e)))}},{key:"componentWillReceiveProps",value:function(e){if(e.open!==this.props.open){var t=e.create,n=e.namespaces,r=this.cloneNs(e.namespace);t&&n.length&&(r.Order=n.map((function(e){return e.Order||0})).reduce((function(e,t){return Math.max(e,t)}),0)+1),this.setState({namespace:r})}}},{key:"save",value:function(){var e=this,t=this.state.namespace;$.putNS(t).then((function(){e.props.onRequestClose(),e.props.reloadList()}))}},{key:"getHideValue",value:function(){var e=this.state.namespace;try{return JSON.parse(e.JsonDefinition).hide}catch(e){return!1}}},{key:"setHideValue",value:function(e){var t=this.state.namespace,n=JSON.parse(t.JsonDefinition);t.JsonDefinition=JSON.stringify(re(re({},n),{},{hide:e})),this.setState({namespace:t})}},{key:"setGroupValue",value:function(e){var t=this.state.namespace,n=JSON.parse(t.JsonDefinition);t.JsonDefinition=JSON.stringify(re(re({},n),{},{groupName:e})),this.setState({namespace:t})}},{key:"getAdditionalData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.state.namespace;try{var n=JSON.parse(t.JsonDefinition).data||e;if(e.items&&n.split){var r=n.split(",").map((function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||ee(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e.split("|"),2);return{key:t[0],value:t[1]}}));return{items:r}}return n}catch(e){}return e}},{key:"setAdditionalDataKey",value:function(e,t){var n=this.state.namespace,r=JSON.parse(n.JsonDefinition),o=oe({},e,t);r.data=re(re({},r.data),o),n.JsonDefinition=JSON.stringify(r),this.setState({namespace:n})}},{key:"togglePolicies",value:function(e,t){var n=this,r=this.state.namespace,o=(r.Policies||[]).filter((function(t){return t.Action!==e}));o.push(S.ServiceResourcePolicy.constructFromObject({Action:e,Effect:"allow",Subject:t?"profile:admin":"*"})),r.Policies=o,this.setState({namespace:r},(function(){"READ"===e&&t&&n.togglePolicies("WRITE",!0)}))}},{key:"render",value:function(){var e=this,n=this.props,r=n.create,o=n.namespaces,i=n.pydio,a=n.readonly,l=n.muiTheme,s=this.state,d=s.namespace,p=s.m,f=s.PoliciesBuilder,y=s.metaModule,h=be(l);if(!y)return null;var g,b=y.TypeEditor;g=d.Label?d.Label:p("editor.title.create");var v="string";d.JsonDefinition&&(v=JSON.parse(d.JsonDefinition).type);var w,E,O=!1;if(d.Label?d.Namespace&&"usermeta-"!==d.Namespace||(O=!0,w=p("editor.ns.error")):(O=!0,E=p("editor.label.error")),r&&o.filter((function(e){return e.Namespace===d.Namespace})).length&&(O=!0,w=p("editor.ns.exists")),"choice"===v){var k=this.getAdditionalData({items:[]}).items;k&&k.length||(O=!0)}var C,P=function(e){if(Array.isArray(e))return te(e)}(C=new Set(o.map((function(e){return ve(e)})).filter((function(e){return e}))))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(C)||ee(C)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();d.Policies&&d.Policies.map((function(e){"profile:admin"===e.Subject&&e.Action,"profile:admin"===e.Subject&&e.Action}));var j=[t().createElement(u.FlatButton,{primary:!0,label:i.MessageHash[54],onClick:this.props.onRequestClose}),t().createElement(u.FlatButton,{primary:!0,disabled:O||a,label:i.MessageHash[53],onClick:function(){e.save()}})];"tags"!==v||a||j.unshift(t().createElement(u.FlatButton,{primary:!1,label:p("editor.tags.reset"),onClick:function(){new S.UserMetaServiceApi(m().getRestClient()).deleteUserMetaTags(d.Namespace,"*").then((function(){i.UI.displayMessage("SUCCESS",p("editor.tags.cleared").replace("%s",d.Namespace))})).catch((function(e){i.UI.displayMessage("ERROR",e.message)}))}}));var x={section:{marginTop:10,fontWeight:500,fontSize:12}};return t().createElement(u.Dialog,{title:g,actions:j,modal:!1,contentStyle:{width:520},open:this.props.open,onRequestClose:this.props.onRequestClose,autoScrollBodyContent:!0,bodyStyle:{padding:20}},t().createElement(b,{m:p,pydio:i,namespace:d,forcePrefix:"usermeta-",onChange:function(t){return e.setState({namespace:t})},readonly:a,create:r,labelError:E,nameError:w,styles:x}),t().createElement("div",{style:x.section},c().getInstance().MessageHash[310]),t().createElement(u.Toggle,ie({label:p("toggle.list-visibility"),disabled:a,labelPosition:"left",toggled:!this.getHideValue(),onToggle:function(t,n){e.setHideValue(!n)}},h.toggleFieldV2)),t().createElement(u.Toggle,ie({label:p("toggle.index"),disabled:a,labelPosition:"left",toggled:d.Indexable,onToggle:function(t,n){d.Indexable=n,e.setState({namespace:d})}},h.toggleFieldV2)),f&&t().createElement(f,{policies:d.Policies,readonly:a,onChangePolicies:function(t){return e.setState({namespace:re(re({},d),{},{Policies:t})})},pydio:i}),t().createElement("div",{style:x.section},p("order")),t().createElement(he,{floatingLabelText:p("order"),value:d.Order?d.Order:"0",onChange:function(t,n){d.Order=parseInt(n),e.setState({namespace:d})},fullWidth:!0,type:"number",readOnly:a,variant:"v2"}),t().createElement(ge,{floatingLabelFixed:!0,fullWidth:!0,floatingLabelText:p("groupName"),filter:function(e,t){return!e.indexOf||0===t.toLowerCase().indexOf(e.toLowerCase())},openOnFocus:!0,dataSource:P,searchText:ve(d)||"",onNewRequest:function(t,n){e.setGroupValue(t)},onUpdateInput:function(t){e.setGroupValue(t)},menuProps:{maxHeight:300,overflowY:"auto"}}))}}]),r}(t().Component);(Ee=(0,f.muiThemeable)()(Ee)).PropTypes={namespace:l().instanceOf(S.IdmUserMetaNamespace).isRequired,namespaces:l().arrayOf(S.IdmUserMetaNamespace),create:l().bool,reloadList:l().func,onRequestClose:l().func};const Oe=Ee;function ke(e){return ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ke(e)}function Ce(){return Ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?c.Attributes.QUOTA=e+"":(c.Attributes.QUOTA="0",delete c.Attributes.QUOTA)}}),t().createElement("hr",{style:P.divider}),t().createElement("div",{style:je({},P.legend)},v("ws.editor.other.layout")),t().createElement(Le,{fullWidth:!0,floatingLabelText:v("ws.editor.other.layout"),variant:"v2",value:c.Attributes.META_LAYOUT||"",onChange:function(e,t,n){c.Attributes.META_LAYOUT=n}},t().createElement(u.MenuItem,{primaryText:v("ws.editor.other.layout.default"),value:""}),t().createElement(u.MenuItem,{primaryText:v("ws.editor.other.layout.easy"),value:"meta.layout_sendfile"})))),h&&t().createElement(u.Paper,{zDepth:0,style:P.section},t().createElement("div",{style:P.title},w("editor.visibility.workspace")),t().createElement("div",{style:je({},P.legend)},w("editor.visibility.warning"),!g&&t().createElement("span",{style:{fontWeight:500,cursor:"pointer"},onClick:function(){return n.setState({policiesEdit:!0})}}," - ",w("editor.visibility.edit"))),t().createElement(h,{pydio:i,policies:c.Policies,onChangePolicies:function(e){return c.Policies=e},readonly:!g,showHeader:!1,forceCustom:!0,advancedLegend:t().createElement("span",null),advancedContainerStyle:g?{paddingBottom:300}:{},allowedActions:{READ:w("policies.builder.action.read"),WRITE:w("policies.builder.action.write")}})))}}])&&Te(r.prototype,o),Object.defineProperty(r,"prototype",{writable:!1}),s}(e.Component);Ke=(0,f.muiThemeable)()(Ke);const We=require("pydio/model/data-model");var Ue=n.n(We);const qe=require("pydio/model/node");var He=n.n(qe),Je=c().requireLib("components").MaterialTable;const ze=i()({displayName:"WorkspaceList",mixins:[AdminComponents.MessagesConsumerMixin],propTypes:{dataModel:l().instanceOf(Ue()).isRequired,rootNode:l().instanceOf(He()).isRequired,currentNode:l().instanceOf(He()).isRequired,openSelection:l().func,advanced:l().boolean},getInitialState:function(){return{workspaces:[],loading:!1}},startLoad:function(){this.props.onLoadState&&this.props.onLoadState(!0),this.setState({loading:!0})},endLoad:function(){this.props.onLoadState&&this.props.onLoadState(!1),this.setState({loading:!1})},reload:function(){var e=this;this.startLoad(),C.listWorkspaces().then((function(t){e.endLoad(),e.setState({workspaces:t.Workspaces||[]})})).catch((function(t){e.endLoad()}))},componentDidMount:function(){this.reload()},openTableRows:function(e){e.length&&this.props.openSelection(e[0].workspace)},deleteAction:function(e){var t=this,n=this.props.pydio;n.UI.openConfirmDialog({message:n.MessageHash["settings.35"],destructive:[e.Label],validCallback:function(){new C(e).remove().then((function(){t.reload()}))}})},computeTableData:function(){var e=[],t=this.props.filterString;return this.state.workspaces.map((function(n){var r="";n.RootNodes&&(r=Object.keys(n.RootNodes).map((function(e){return g().trimRight(n.RootNodes[e].Path,"/")})).join(", "));var o=!1;if(n.Attributes)try{var i=JSON.parse(n.Attributes);!0!==i.ALLOW_SYNC&&"true"!==i.ALLOW_SYNC||(o=!0)}catch(e){}if(t){var a=t.toLowerCase(),l=n.Label&&n.Label.toLowerCase().indexOf(a)>=0,s=n.Description&&n.Description.toLowerCase().indexOf(a)>=0,c=r&&r.toLowerCase().indexOf(a)>=0;if(!(l||s||c))return}e.push({workspace:n,label:n.Label,description:n.Description,slug:n.Slug,summary:r,syncable:o})})),e.sort(g().arraySorter("label",!1,!0)),e},render:function(){var e=this,n=this.props,r=n.pydio,o=n.advanced,i=n.editable,a=n.tableStyles,l=n.openSelection,s=function(e){return r.MessageHash["ajxp_admin."+e]},c=function(e){return r.MessageHash["settings."+e]},u=[{name:"label",label:c("8"),style:{width:"20%",fontSize:15},headerStyle:{width:"20%"},sorter:{type:"string",default:"true"}},{name:"description",label:c("103"),hideSmall:!0,style:{width:"25%"},headerStyle:{width:"25%"},sorter:{type:"string"}},{name:"summary",label:s("ws.board.summary"),hideSmall:!0,style:{width:"25%"},headerStyle:{width:"25%"},sorter:{type:"string"}}];o&&u.push({name:"syncable",label:s("ws.board.syncable"),style:{width:"10%",textAlign:"center"},headerStyle:{width:"10%",textAlign:"center"},sorter:{type:"number",sortValue:function(e){return e.syncable?1:0}},renderCell:function(e){return t().createElement("span",{className:"mdi mdi-check",style:{fontSize:18,opacity:e.syncable?1:0}})}}),u.push({name:"slug",label:s("ws.5"),style:{width:"20%"},headerStyle:{width:"20%"},sorter:{type:"string"}});var d=this.state.loading,p=this.computeTableData(),f=[];i&&f.push({iconClassName:"mdi mdi-pencil",tooltip:"Edit Workspace",onClick:function(e){l(e.workspace)},disable:function(e){return!e.workspace.PoliciesContextEditable}});var y=r.user.getRepositoriesList();return f.push({iconClassName:"mdi mdi-open-in-new",tooltip:"Open this workspace...",onClick:function(e){r.triggerRepositoryChange(e.workspace.UUID)},disable:function(e){return!y.has(e.workspace.UUID)}}),i&&f.push({iconClassName:"mdi mdi-delete",onClick:function(t){e.deleteAction(t.workspace)},disable:function(e){return!e.workspace.PoliciesContextEditable}}),t().createElement(Je,{data:p,columns:u,actions:f,onSelectRows:i?this.openTableRows.bind(this):null,deselectOnClickAway:!0,showCheckboxes:!1,emptyStateString:s(d?"loading":"ws.board.empty"),masterStyles:a,paginate:[10,25,50,100],defaultPageSize:25,storageKey:"console.workspaces.list"})}});function Ye(){return Ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"flat";if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=a.call(this)).internalInvalid=!1,t.nameInvalid=!1,t.existingNames=n,e)t.model=e,e.StorageConfiguration||(e.StorageConfiguration={}),t.snapshot=JSON.parse(JSON.stringify(e));else switch(t.model=new S.ObjectDataSource,t.model.EncryptionMode=S.ObjectEncryptionMode.constructFromObject("CLEAR"),t.model.StorageType=S.ObjectStorageType.constructFromObject("LOCAL"),r){case"flat":t.model.StorageConfiguration={folder:"",normalize:"false"},t.model.FlatStorage=!0;break;case"structured":t.model.StorageConfiguration={folder:"",normalize:"false"},t.model.FlatStorage=!1;break;case"internal":t.model.StorageConfiguration={folder:"",normalize:"false",cellsInternal:"true"},t.model.FlatStorage=!0}return t.observableModel=t.buildProxy(t.model),t}return t=l,n=[{key:"buildProxy",value:function(e){var t=this;return new Proxy(e,{set:function(e,n,r){var o=r;if("StorageType"===n)e.StorageConfiguration={},"LOCAL"===o?e.StorageConfiguration={folder:"",normalize:"false"}:"S3"===o?e.StorageConfiguration={customEndpoint:""}:"GCS"===o&&(e.StorageConfiguration={jsonCredentials:""}),t.internalInvalid=!1,e.ApiKey=e.ApiSecret="";else if("Name"===n)o=g().computeStringSlug(o).replace("-","").substr(0,33),t.existingNames&&t.existingNames.indexOf(o)>-1?t.nameInvalid=!0:t.nameInvalid=!1;else if("folder"===n)"/"!==o[0]&&(o="/"+o);else{if("invalid"===n)return t.internalInvalid=r,t.notify("update"),!0;"PeerAddress"===n&&"ANY"===r&&(o="")}return e[n]=o,t.notify("update"),!0},get:function(e,n){var r=e[n];return r instanceof Array?r:r instanceof Object?t.buildProxy(r):"StorageType"===n?r||"LOCAL":"PeerAddress"===n?r||"ANY":r}})}},{key:"getModel",value:function(){return this.observableModel}},{key:"isValid",value:function(){return!this.internalInvalid&&!this.nameInvalid&&("S3"===this.model.StorageType||"AZURE"===this.model.StorageType?this.model.ApiKey&&this.model.ApiSecret&&this.model.Name&&(this.model.ObjectsBucket||this.model.StorageConfiguration.bucketsRegexp):"GCS"===this.model.StorageType?this.model.Name&&this.model.ObjectsBucket&&this.model.StorageConfiguration&&this.model.StorageConfiguration.jsonCredentials:this.model.Name&&this.model.StorageConfiguration&&this.model.StorageConfiguration.folder)}},{key:"getNameError",value:function(e){return this.nameInvalid?e("name.inuse"):null}},{key:"deleteSource",value:function(){return new S.ConfigServiceApi(ut.getRestClient()).deleteDataSource(this.model.Name)}},{key:"resyncSource",value:function(){var e=new S.JobsServiceApi(ut.getRestClient()),t=new S.RestUserJobRequest;return t.JobName="datasource-resync",t.JsonParameters=JSON.stringify({dsName:this.model.Name}),e.userCreateJob("datasource-resync",t)}},{key:"revert",value:function(){return this.model=this.snapshot,this.observableModel=this.buildProxy(this.model),this.snapshot=JSON.parse(JSON.stringify(this.model)),this.observableModel}},{key:"saveSource",value:function(){var e=this;return new S.ConfigServiceApi(ut.getRestClient()).putDataSource(this.model.Name,this.model).then((function(t){e.snapshot=JSON.parse(JSON.stringify(e.model)),e.notify("update")}))}},{key:"stripPrefix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!t)return e;var n={};return Object.keys(e).map((function(r){n[r.replace(t,"")]=e[r]})),n}},{key:"getDataWithPrefix",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(""===t)return this.model;var n={};return Object.keys(this.model).forEach((function(r){n[t+r]=e.model[r],"EncryptionMode"!==r||e.model[r]||(n[t+r]="CLEAR")})),n}}],r=[{key:"loadDatasources",value:function(){return new S.ConfigServiceApi(ut.getRestClient()).listDataSources()}},{key:"loadVersioningPolicies",value:function(){return new S.ConfigServiceApi(ut.getRestClient()).listVersioningPolicies()}},{key:"loadStatuses",value:function(){return new S.ConfigServiceApi(ut.getRestClient()).listServices("STARTED")}},{key:"loadEncryptionKeys",value:function(){return new S.ConfigServiceApi(ut.getRestClient()).listEncryptionKeys(new S.EncryptionAdminListKeysRequest)}},{key:"loadBuckets",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=new S.ConfigServiceApi(ut.getRestClient()),r=new S.RestListStorageBucketsRequest;return r.DataSource=e,t&&(r.BucketsRegexp=t),n.listStorageBuckets(r)}},{key:"createBucket",value:function(e,t){var n=new S.ConfigServiceApi(ut.getRestClient()),r=new S.RestCreateStorageBucketRequest;return r.DataSource=e,n.createStorageBucket(t,r)}}],n&&at(t.prototype,n),r&&at(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(ct);function pt(e){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pt(e)}function ft(e,t){for(var n=0;n=0;return v?f||(b=t().createElement("span",null,b," ",t().createElement("span",{className:"mdi mdi-alert"})," ",y("card.cleanOnDelete-legend-on"))):b=t().createElement("span",null,b," ",t().createElement("span",{className:"mdi mdi-alert"})," ",y("card.cleanOnDelete-legend-off")),a?t().createElement("div",{style:{display:"flex"}},t().createElement("div",{style:{flex:1,lineHeight:"40px"}},g),t().createElement("div",{style:{display:"flex"}},t().createElement(u.IconButton,{iconClassName:"mdi mdi-content-save",onClick:this.save.bind(this),disabled:!p,tooltip:"Save"}),t().createElement(u.IconButton,{iconClassName:"mdi mdi-close",onClick:function(){return s()},tooltip:"Close"}))):t().createElement("div",{style:{backgroundColor:"#f5f5f5",paddingBottom:12}},t().createElement("div",{style:{padding:i?"16px 24px 8px":"10px 24px 0",fontWeight:500,display:"flex",alignItems:"center"}},t().createElement("div",{style:{flex:1}},y("card.title")),!i&&t().createElement(u.FlatButton,{onClick:this.save.bind(this),primary:!0,disabled:!p,label:y("save")})),t().createElement("div",{style:{margin:"6px 24px 0 24px",border:"1px solid #e0e0e0"}},g),t().createElement("div",{style:{margin:"12px 24px",opacity:v?1:.4}},t().createElement(u.Checkbox,{disabled:i,checked:f,onCheck:function(t,n){e.setState({cleanOnDelete:n,dirty:!0})},label:b})))}}])&&ft(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),l}(t().Component);function gt(e){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gt(e)}function bt(){return bt=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:"",n=this.props.peerAddress,r=this.state.searchText,o=t;if(!t&&r){var i=r.lastIndexOf("/");o=r.substr(0,i)}if(null!==this.lastSearch&&this.lastSearch===o)return Promise.resolve();this.lastSearch=o;var a=new S.ConfigServiceApi(m().getRestClient()),l=new S.RestListPeerFoldersRequest;return l.PeerAddress="ANY"===n?"":n,l.Path=o,this.setState({loading:!0}),a.listPeerFolders(n,l).then((function(t){var n=t.Children||[];n=n.map((function(e){return"/"!==e.Path[0]&&(e.Path="/"+e.Path),e})),e.setState({nodes:n,loading:!1})})).catch((function(){e.setState({loading:!1})}))}},{key:"createFolder",value:function(e){var t=this,n=this.props,r=n.peerAddress,o=n.pydio,i=this.state.value,a=new S.ConfigServiceApi(m().getRestClient()),l=new S.RestCreatePeerFolderRequest;l.PeerAddress="ANY"===r?"":r,l.Path=i+"/"+e,a.createPeerFolder(r,l).then((function(e){t.lastSearch=null,t.loadValues(i).then((function(){t.handleNewRequest({key:l.Path}),t.setState({searchText:l.Path})}))})).catch((function(e){o.UI.displayMessage("ERROR",e.message)}))}},{key:"renderNode",value:function(e){var n=T().getBasename(e.Path),r=T().getDirname(e.Path),o=t().createElement("span",null,e.Path);return g().computeStringSlug(n)!==n?o=t().createElement("span",null,t().createElement("span",null,r),"/",t().createElement("span",{style:{color:"#c62828"}},n)):e.MetaStore&&e.MetaStore.symlink&&(o=t().createElement("span",null,t().createElement("span",null,r),"/",t().createElement("span",{style:{color:"#1976d2"}},n))),{key:e.Path,text:e.Path,invalid:!1,value:t().createElement(u.MenuItem,null,t().createElement(u.FontIcon,{className:"mdi mdi-folder",color:"#616161",style:{float:"left",marginRight:8}})," ",o)}}},{key:"showCreateDialog",value:function(){var e=this,t=this.props.pydio,n=this.state.value,r=function(e){return t.MessageHash["ajxp_admin.ds.editor.selector."+e]||e};t.UI.openComponentInModal("PydioReactUI","PromptDialog",{dialogTitle:r("mkdir"),legendId:r("mkdir.legend").replace("%s",n),fieldLabelId:r("mkdir.field"),submitValue:function(t){t&&e.createFolder(t)}})}},{key:"render",value:function(){var e=this,n=this.state,r=n.nodes,o=n.loading,i=n.exist,a=n.value,l=n.searchText,s=this.props,c=s.fieldLabel,d=s.pydio,p=[];r&&r.forEach((function(t){p.push(e.renderNode(t))}));var f=l||a;return t().createElement("div",{style:{position:"relative",marginTop:-5}},t().createElement("div",{style:{position:"absolute",right:6,top:29,width:30,zIndex:1}},t().createElement(u.RefreshIndicator,{size:25,left:0,top:0,status:o?"loading":"hide"})),a&&i&&!o&&(!l||l===a)&&t().createElement("div",{style:{position:"absolute",right:0,zIndex:1,top:18}},t().createElement(u.IconButton,{iconClassName:"mdi mdi-folder-plus",iconStyle:{color:"#9e9e9e"},onClick:function(){return e.showCreateDialog()},tooltip:d.MessageHash["ajxp_admin.ds.editor.selector.mkdir"],tooltipPosition:"top-center"})),t().createElement(qt,{fullWidth:!0,searchText:f,onUpdateInput:this.handleUpdateInput.bind(this),onNewRequest:this.handleNewRequest.bind(this),dataSource:p,hintText:c,filter:function(e,t){return 0===t.toLowerCase().indexOf(e.toLowerCase())},openOnFocus:!0,menuProps:{maxHeight:200}}))}}]),r}(t().Component),Jt=function(e){It(r,e);var n=Bt(r);function r(e){var t;return At(this,r),(t=n.call(this,e)).state={peerAddresses:[],invalid:!1,m:function(t){return e.pydio.MessageHash["ajxp_admin.ds.editor."+t]||t}},t}return Mt(r,[{key:"compareAddresses",value:function(e,t){var n=e.split("|"),r=t.split("|");return r.filter((function(e){return n.indexOf(e)>-1})).length||n.filter((function(e){return r.indexOf(e)>-1})).length}},{key:"componentDidMount",value:function(){var e=this,t=this.props.model;new S.ConfigServiceApi(m().getRestClient()).listPeersAddresses().then((function(n){var r=n.PeerAddresses||[];if(1!==r||t.PeerAddress||(t.PeerAddress=r[0]),e.setState({peerAddresses:r}),t.PeerAddress&&-1===r.indexOf(t.PeerAddress)){var o=r.filter((function(n){return e.compareAddresses(n,t.PeerAddress)}));o.length?t.PeerAddress=o[0]:e.setState({invalidAddress:t.PeerAddress})}}))}},{key:"baseIsInvalid",value:function(e){var t=this.state.m,n=!1,r=T().getBasename(e);return g().trim(e,"/").split("/").length<2?n=t("selector.error.depth"):g().computeStringSlug(r)!==r&&(n=t("selector.error.dnsname")),n}},{key:"onPathChange",value:function(e,t){var n=this.props.model,r=this.baseIsInvalid(e);n.invalid=r,n.StorageConfiguration.folder=e,t?void 0!==n.StorageConfiguration.create&&delete n.StorageConfiguration.create:n.StorageConfiguration.create="true",this.setState({invalid:r})}},{key:"onPeerChange",value:function(e){var t=this.props.model,n=this.state.invalidAddress;e!==n&&(t.PeerAddress=e,n&&this.setState({invalidAddress:null}))}},{key:"render",value:function(){var e=this,n=this.props,r=n.model,o=n.pydio,i=n.styles,a=this.state,l=a.peerAddresses,s=a.invalidAddress,c=a.invalid,d=a.m,p=Rt(l);return p=["ANY"].concat(Rt(p)),s&&"ANY"!==s&&(p=[s].concat(Rt(p))),t().createElement("div",null,t().createElement("div",{style:{paddingBottom:8}},t().createElement("div",{style:i.subLegend},d("storage.legend.fs.peer")),t().createElement(Ut,{value:r.PeerAddress||"",variant:"v2",hintText:d("selector.peer")+" *",onChange:function(t,n,r){return e.onPeerChange(r)},fullWidth:!0},p.map((function(e){var n=d("selector.peer.any");return"ANY"!==e&&(n=d("selector.peer.word")+" : "+e.replace("|"," | ")+(e===s?" ("+d("selector.peer.invalid")+")":"")),t().createElement(u.MenuItem,{value:e,primaryText:n})})))),t().createElement("div",null,t().createElement("div",{style:xt(xt({},i.subLegend),{},{paddingBottom:6})},d("storage.legend.fs.path")),r.PeerAddress&&t().createElement(Ht,{pydio:o,value:r.StorageConfiguration.folder,peerAddress:r.PeerAddress,onChange:this.onPathChange.bind(this),fieldLabel:d("selector.completer")+(r.StorageConfiguration.create?" ("+d("selector.completer.create")+")":"")+" *",hintText:d("selector.completer.hint")}),!r.PeerAddress&&t().createElement(Wt,{style:{marginTop:-3},fullWidth:!0,variant:"v2",disabled:!0,value:r.StorageConfiguration.folder,floatingLabelText:d("selector.folder")+" *",hintText:d("selector.folder.hint")})),c&&t().createElement("div",{style:{color:"#c62828"}},c))}}]),r}(t().Component);const zt=require("pydio/util/dom");var Yt=n.n(zt);function Gt(e){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gt(e)}function Qt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $t(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&this.setState({currentPane:Nn[n-1]})}},{key:"stepperNext",value:function(){var e=this.state.currentPane,t=void 0===e?"main":e,n=Nn.indexOf(t);n-1&&o0;)r.pop(),i--}n.KeepPeriods=r,this.setState({saveValue:n,dirty:!0})}},{key:"updateValidStatus",value:function(e){}},{key:"render",value:function(){var e,n=this,r=this.props,o=r.create,i=r.readonly,a=r.pydio,l=r.muiTheme,c=r.internalSources,d=this.state,p=d.loaded,f=d.policy,y=d.saveValue,m=d.m,h=this.state.parameters,g=l.palette,b=Qn(g);if(h&&p){c&&(h=h.map((function(e){return"VersionsDataSourceName"===e.name&&(e.choices+=","+c.map((function(e){return e+"|DataSource "+e})).join(",")),e})));var v=s.TreeVersioningPolicyToValues(f);y&&(v=s.TreeVersioningPolicyToValues(y)),e=t().createElement(zn,{parameters:h,values:v,className:"full-width",onChange:this.onFormChange.bind(this),onValidStatusChange:this.updateValidStatus.bind(this),disabled:i,depth:-2,variant:"v2"})}var S=[];i||(o||(S.push(Gn.actionButton(m("delete"),"mdi mdi-delete",(function(){n.deleteSource()}))),S.push(Gn.actionButton(a.MessageHash["ajxp_admin.plugins.6"],"mdi mdi-undo",(function(){n.resetForm()}),!this.state.dirty))),S.push(Gn.actionButton(a.MessageHash[53],"mdi mdi-content-save",(function(){n.saveSource()}),!this.state.valid||!this.state.dirty)));var w=y?y.Name:f.Name;return w||(w=""),t().createElement(Gn,{title:p&&h?m("title").replace("%s",w):a.MessageHash["ajxp_admin.loading"],titleLeftIcon:"mdi mdi-clock-start",titleActionBar:S,closeAction:this.props.closeEditor,className:"workspace-editor",contentFill:!0},t().createElement(u.Paper,{zDepth:0,style:{backgroundColor:b.body.block.header.backgroundColor,padding:"0px 20px",height:64,display:"flex",alignItems:"center"}},t().createElement("div",{style:{overflowX:"auto",width:"100%"}},t().createElement(_n,{pydio:a,policy:y||f}))),e,b.formSimpleCss())}}],o=[{key:"valuesToTreeVersioningPolicy",value:function(e){for(var t=[],n="IntervalStart",r="MaxNumber",o=n,i=r,a=0;void 0!==e[o]&&void 0!==e[i];){var l=new S.TreeVersioningKeepPeriod;l.IntervalStart=e[o],l.MaxNumber=e[i],t.push(l),delete e[i],delete e[o],o=n+"_"+ ++a,i=r+"_"+a}return e.KeepPeriods=t,S.TreeVersioningPolicy.constructFromObject(e)}},{key:"TreeVersioningPolicyToValues",value:function(e){var t=function(e){for(var t=1;t0?(t["IntervalStart_"+n]=e.IntervalStart||0,t["MaxNumber_"+n]=e.MaxNumber||0):(t.IntervalStart=e.IntervalStart||0,t.MaxNumber=e.MaxNumber||0),n++}))}return t.NodeDeletedStrategy||(t.NodeDeletedStrategy="KeepAll"),t}}],r&&Kn(n.prototype,r),o&&Kn(n,o),Object.defineProperty(n,"prototype",{writable:!1}),s}(t().Component);$n=(0,f.muiThemeable)()($n);var Xn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),Zn=new Uint8Array(16);function er(){if(!Xn)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xn(Zn)}for(var tr=[],nr=0;nr<256;++nr)tr[nr]=(nr+256).toString(16).substr(1);const rr=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||er)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var i=0;i<16;++i)t[r+i]=o[i];return t||function(e,t){var n=t||0,r=tr;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}(o)};function or(e){return or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},or(e)}function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:null;this.setState({dsLoaded:!1,versionsLoaded:!1,newDsName:t}),dt.loadDatasources().then((function(t){e.setState({dataSources:t.DataSources||[],dsLoaded:!0},(function(){e.syncStatuses()}))})),dt.loadVersioningPolicies().then((function(t){e.setState({versioningPolicies:t.Policies||[],versionsLoaded:!0})})),dt.loadStatuses().then((function(t){e.setState({startedServices:t.Services})})),this.refs&&this.refs.encKeys&&this.refs.encKeys.load()}},{key:"syncStatuses",value:function(){var e=this,t=this.state.dataSources,n=void 0===t?[]:t;n.length&&xr.getInstance().getAdminJobs(null,null,n.map((function(e){return"resync-ds-"+e.Name})),1).then((function(t){var n={};(t.Jobs||[]).forEach((function(e){e.Tasks&&e.Tasks.length&&(n[e.ID.replace("resync-ds-","")]=e)})),e.setState({resyncJobs:n})}))}},{key:"closeEditor",value:function(){this.props.closeRightPane()}},{key:"openDataSource",value:function(e){if(e.length){var t=e[0],n=this.props,r=n.openRightPane,o=n.accessByName,i=n.pydio,a=n.storageTypes;r({COMPONENT:An,PROPS:{ref:"editor",pydio:i,dataSource:t,storageTypes:a,readonly:!o("CreateDatasource"),closeEditor:this.closeEditor.bind(this),reloadList:this.load.bind(this)}})}}},{key:"makeStatusLabel",value:function(e,n){switch(e){case"error":return t().createElement("span",{style:{color:"#e53935"}},t().createElement("span",{className:"mdi mdi-alert"})," ",n);case"running":return t().createElement("span",{style:{color:"#ef6c00"}},t().createElement("span",{className:"mdi mdi-timer-sand"})," ",n);default:return t().createElement("span",{style:{color:"#1b5e20"}},t().createElement("span",{className:"mdi mdi-check"})," ",n)}}},{key:"computeStatus",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n&&e.Disabled)return-1;var r,o,i,a=this.state,l=a.startedServices,s=void 0===l?[]:l,c=a.peerAddresses,u=void 0===c?[]:c,d=a.m,p=a.newDsName;if(!s.length)return d("status.na");if(s.map((function(t){t.Name==="pydio.grpc.data.sync."+e.Name&&"STARTED"===t.Status?o=!0:t.Name==="pydio.grpc.data.index."+e.Name&&"STARTED"===t.Status?r=!0:t.Name==="pydio.grpc.data.objects."+e.ObjectsServiceName&&"STARTED"===t.Status&&(i=!0)})),r&&o&&i)return p&&e.Name===p&&setTimeout((function(){t.setState({newDsName:null})}),100),n?0:this.makeStatusLabel("ok",d("status.ok"));if(p&&e.Name===p)return n?1:this.makeStatusLabel("running",d("status.starting"));if(r||o||i){var f=[];return r||f.push(d("status.index")),o||f.push(d("status.sync")),i||f.push(d("status.object")),n?3:this.makeStatusLabel("error",f.join(" - "))}var y=d("status.ko");return u&&-1===u.indexOf(e.PeerAddress)&&(y=d("status.ko-peers").replace("%s",e.PeerAddress)),n?2:this.makeStatusLabel("error",y)}},{key:"computeJobStatus",value:function(e){var t=e.Tasks[0];switch(t.Status){case"Finished":return this.makeStatusLabel("ok",Tr(new Date(1e3*parseInt(t.EndTime))).fromNow());case"Running":return this.makeStatusLabel("running",t.StatusMessage||"Running...");case"Error":return this.makeStatusLabel("error",t.StatusMessage);case"Queued":return this.makeStatusLabel("running",t.StatusMessage)}return this.makeStatusLabel("ok",t.StatusMessage)}},{key:"openVersionPolicy",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===e||e.length){var n,r=!1;if(void 0===e){r=!0,(n=new S.TreeVersioningPolicy).Uuid=rr(),n.VersionsDataSourceName="versions",n.NodeDeletedStrategy="KeepAll";var o=new S.TreeVersioningKeepPeriod;o.IntervalStart="0",o.MaxNumber=-1,n.KeepPeriods=[o]}else n=e[0],t&&(r=!0,(n=S.TreeVersioningPolicy.constructFromObject(JSON.parse(JSON.stringify(n)))).Uuid=rr(),n.Name+=" (Copy)");var i=this.props,a=i.openRightPane,l=i.pydio,s=i.versioningReadonly,c=i.accessByName,u=this.state.dataSources;a({COMPONENT:$n,PROPS:{ref:"editor",versionPolicy:n,create:r,pydio:l,internalSources:u.filter((function(e){return e.StorageConfiguration&&e.StorageConfiguration.cellsInternal})).map((function(e){return e.Name})),readonly:s||!c("CreateVersioning"),closeEditor:this.closeEditor.bind(this),reloadList:this.load.bind(this)}})}}},{key:"deleteVersionPolicy",value:function(e){var t=this,n=this.props.pydio;n.UI.openConfirmDialog({message:n.MessageHash["ajxp_admin.versions.editor.delete.confirm"],destructive:[e.Name],validCallback:function(){Y().loadClass("EnterpriseSDK").then((function(n){new n.EnterpriseConfigServiceApi(m().getRestClient()).deleteVersioningPolicy(e.Uuid).then((function(e){t.load()}))}))}})}},{key:"createDataSource",value:function(e){var t=this.props,n=t.pydio,r=t.storageTypes,o=this.state.dataSources;this.props.openRightPane({COMPONENT:An,PROPS:{ref:"editor",create:!0,createStructure:e,existingNames:o.map((function(e){return e.Name})),pydio:n,storageTypes:r,closeEditor:this.closeEditor.bind(this),reloadList:this.load.bind(this)}})}},{key:"resyncDataSource",value:function(e,t,n){e.UI.openConfirmDialog({message:t("editor.legend.resync"),skipNext:"datasource.resync.confirm",validCallback:function(){new dt(n).resyncSource()}})}},{key:"deleteDataSource",value:function(e,t,n){var r=this;e.UI.openConfirmDialog({message:t("editor.delete.warning"),validCallback:function(){new dt(n).deleteSource().then((function(){r.load()}))},destructive:[n.Name]})}},{key:"createWorkspaceFromDatasource",value:function(e,t,n){var r=new C,o=r.getModel(),i=n.Name;o.Label=i,o.Description="Root of "+i,o.Slug=i,o.Attributes.DEFAULT_RIGHTS="";var a={Uuid:"DATASOURCE:"+i,Path:i};o.RootNodes[a.Uuid]=a,e.UI.openComponentInModal("PydioReactUI","PromptDialog",{dialogTitle:t("board.wsfromds.title"),legendId:t("board.wsfromds.legend").replace("%s",i),fieldLabelId:t("board.wsfromds.field"),defaultValue:t("board.wsfromds.defaultPrefix").replace("%s",i),submitValue:function(t){o.Label=t,r.save().then((function(){e.goTo("/data/workspaces")}))}})}},{key:"render",value:function(){var n=this,r=this.state,o=r.dataSources,i=r.resyncJobs,a=r.versioningPolicies,l=r.m,s=r.createDialog;o.sort(g().arraySorter("Name"));var c=o.filter((function(e){return!(e.StorageConfiguration&&e.StorageConfiguration.cellsInternal)})),d=o.filter((function(e){return e.StorageConfiguration&&e.StorageConfiguration.cellsInternal}));a.sort(g().arraySorter("Name"));var p=AdminComponents.AdminStyles(this.props.muiTheme.palette),f=p.body,y=f.tableMaster,m=f.block.props,h=f.block.container,b=this.props,v=b.currentNode,S=b.pydio,w=b.versioningReadonly,E=b.accessByName,O=[{name:"Name",label:l("name"),style:{fontSize:15,width:"15%"},headerStyle:{width:"15%"},sorter:{type:"string",default:!0}},{name:"StorageType",label:l("storage"),style:{width:"15%"},headerStyle:{width:"15%"},renderCell:function(e){var t="storage.fs";switch(e.StorageType){case"S3":t="storage.s3";break;case"AZURE":t="storage.azure";break;case"GCS":t="storage.gcs"}return l(t)},sorter:{type:"string"}},{name:"Status",label:l("status"),hideSmall:!0,renderCell:function(e){return e.Disabled?t().createElement("span",{style:{color:"#757575"}},t().createElement("span",{className:"mdi mdi-checkbox-blank-circle-outline"})," ",l("status.disabled")):n.computeStatus(e)},sorter:{type:"number",value:function(e){return n.computeStatus(e,!0)}}},{name:"SyncStatus",label:l("syncStatus"),hideSmall:!0,renderCell:function(e){return i&&i[e.Name]?n.computeJobStatus(i[e.Name]):"n/a"},sorter:{type:"number",value:function(e){return i&&i[e.Name]?i[e.Name].Tasks[0].EndTime:0}}},{name:"VersioningPolicyName",label:l("versioning"),style:{width:"15%"},headerStyle:{width:"15%"},hideSmall:!0,renderCell:function(e){var t=a.find((function(t){return t.Uuid===e.VersioningPolicyName}));return t?t.Name:e.VersioningPolicyName||"-"},sorter:{type:"string"}},{name:"EncryptionMode",label:l("encryption"),hideSmall:!0,style:{width:"8%",textAlign:"center"},headerStyle:{width:"8%"},renderCell:function(e){return"MASTER"===e.EncryptionMode?t().createElement("span",{className:"mdi mdi-check"}):"-"},sorter:{type:"number",value:function(e){return"MASTER"===e.EncryptionMode?1:0}}}];c.filter((function(e){return!e.FlatStorage})).length||(O=O.filter((function(e){return"SyncStatus"!==e.name})));var k=O.filter((function(e){return"VersioningPolicyName"!==e.name&&"SyncStatus"!==e.name})),C=v.getLabel(),P=v.getMetadata().get("icon_class"),j=[];E("CreateDatasource")&&j.push(t().createElement(u.FlatButton,wr({primary:!0,label:S.MessageHash["ajxp_admin.ws.4"],onClick:function(){return n.setState({createDialog:!0})}},p.props.header.flatButton)));var x=!w&&E("CreateVersioning");x&&j.push(t().createElement(u.FlatButton,wr({primary:!0,label:S.MessageHash["ajxp_admin.ws.4b"],onClick:function(){n.openVersionPolicy()}},p.props.header.flatButton)));var T=[{name:"Name",label:l("versioning.name"),style:{width:180,fontSize:15},headerStyle:{width:180},sorter:{type:"string",default:!0}},{name:"Description",label:l("versioning.description"),sorter:{type:"string"}},{name:"KeepPeriods",hideSmall:!0,label:l("versioning.periods"),renderCell:function(e){return t().createElement(_n,{rendering:"short",policy:e,pydio:S})}},{name:"VersionsDataSourceName",style:{width:180},headerStyle:{width:180},label:l("versioning.storage"),sorter:{type:"string"},hideSmall:!0}],R=[];E("CreateDatasource")&&R.push({iconClassName:"mdi mdi-pencil",tooltip:"Edit datasource",onClick:function(e){n.openDataSource([e])}}),R.push({iconClassName:"mdi mdi-folder-plus",tooltip:"Create workspace here",onClick:function(e){return n.createWorkspaceFromDatasource(S,l,e)}}),E("CreateDatasource")&&R.push({iconClassName:"mdi mdi-delete",tooltip:l("editor.legend.delete.button"),onClick:function(e){return n.deleteDataSource(S,l,e)}});var N=[].concat(R);c.filter((function(e){return!e.FlatStorage})).length>0&&R.push({iconClassName:"mdi mdi-sync",tooltip:l("editor.legend.resync.button"),onClick:function(e){return n.resyncDataSource(S,l,e)},disable:function(e){return e.FlatStorage}});var A=[];return A.push({iconClassName:x?"mdi mdi-pencil":"mdi mdi-eye",tooltip:x?"Edit policy":"Display policy",onClick:function(e){n.openVersionPolicy([e])}}),x&&(A.push({iconClassName:"mdi mdi-content-copy",tooltip:"Duplicate policy",onClick:function(e){return n.openVersionPolicy([e],!0)}}),A.push({iconClassName:"mdi mdi-delete",tooltip:"Delete policy",destructive:!0,onClick:function(e){return n.deleteVersionPolicy(e)}})),t().createElement("div",{className:"main-layout-nav-to-stack workspaces-board"},t().createElement("div",{className:"vertical-layout",style:{width:"100%"}},t().createElement(AdminComponents.Header,{title:C,icon:P,actions:j,reloadAction:this.load.bind(this),loading:!(this.state.dsLoaded&&this.state.versionsLoaded)}),t().createElement(hr,{open:s,onRequestClose:function(){n.setState({createDialog:!1})},onSubmit:function(e){n.createDataSource(e)}}),t().createElement("div",{className:"layout-fill"},t().createElement(AdminComponents.SubHeader,{title:l("board.ds.title"),legend:l("board.ds.legend")}),t().createElement(u.Paper,wr({},m,{style:vr({},h)}),t().createElement(Pr,{data:c,columns:O,actions:R,onSelectRows:this.openDataSource.bind(this),deselectOnClickAway:!0,showCheckboxes:!1,emptyStateString:l("emptyState"),masterStyles:y,storageKey:"console.datasources.list"})),d.length>0&&t().createElement(e.Fragment,null,t().createElement("div",{style:{padding:"0px 20px"}},"Internal DataSources are used to store binaries like files versions"),t().createElement(u.Paper,wr({},m,{style:vr({},h)}),t().createElement(Pr,{data:d,columns:k,actions:N,onSelectRows:this.openDataSource.bind(this),deselectOnClickAway:!0,showCheckboxes:!1,emptyStateString:l("emptyState"),masterStyles:y,storageKey:"console.internalsources.list"}))),t().createElement(AdminComponents.SubHeader,{title:l("board.versioning.title"),legend:l("board.versioning.legend")}),t().createElement(u.Paper,wr({},m,{style:vr({},h)}),t().createElement(Pr,{data:a,columns:T,actions:A,onSelectRows:this.openVersionPolicy.bind(this),deselectOnClickAway:!0,showCheckboxes:!1,masterStyles:y,storageKey:"console.versioning.policies.list"})),t().createElement(AdminComponents.SubHeader,{title:l("board.enc.title"),legend:l("board.enc.legend")}),t().createElement(dr,{pydio:S,ref:"encKeys",accessByName:E,adminStyles:p}))))}}],o&&Er(r.prototype,o),Object.defineProperty(r,"prototype",{writable:!1}),s}(t().Component);function Nr(e){return Nr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nr(e)}function Ar(){return Ar=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);nr?1:-1}));var v=[{name:"Order",label:h("order"),style:{width:30},headerStyle:{width:30},hideSmall:!0,renderCell:function(e){return e.Order||"0"},sorter:{type:"number"}},{name:"Namespace",label:h("namespace"),style:{fontSize:15},sorter:{type:"string"}},{name:"Label",label:h("label"),style:{width:"25%"},headerStyle:{width:"25%"},sorter:{type:"string"}},{name:"Indexable",label:h("indexable"),style:{width:"10%"},headerStyle:{width:"10%"},hideSmall:!0,renderCell:function(e){return e.Indexable?"Yes":"No"},sorter:{type:"number",value:function(e){return e.Indexable?1:0}}},{name:"JsonDefinition",label:h("definition"),hideSmall:!0,renderCell:function(e){var t=e.JsonDefinition;if(!t)return"";var n=JSON.parse(t);return $.MetaTypes[n.type]||n.type},sorter:{type:"string"}}],S={};b.length?d.map((function(e){var t=ve(e);S[t]||(S[t]=[]),S[t].push(e)})):S[""]=d;var w=o.getLabel(),E=o.getMetadata().get("icon_class"),O=[],k=[];return a("Create")&&(O.push(t().createElement(u.FlatButton,Ar({primary:!0,label:h("namespace.add"),onClick:function(){e.create()}},s.props.header.flatButton))),k.push({iconClassName:"mdi mdi-pencil",onClick:function(t){e.open([t])}},{iconClassName:"mdi mdi-delete",onClick:function(t){e.deleteNs(t)}})),t().createElement("div",{className:"main-layout-nav-to-stack workspaces-board"},t().createElement(Oe,{pydio:i,open:f,create:m,namespace:y,onRequestClose:function(){return e.close()},reloadList:function(){return e.load()},namespaces:d,readonly:!a("Create"),policiesBuilder:l}),t().createElement("div",{className:"vertical-layout",style:{width:"100%"}},t().createElement(AdminComponents.Header,{title:w,icon:E,actions:O,reloadAction:this.load.bind(this),loading:p}),t().createElement("div",{className:"layout-fill"},t().createElement(AdminComponents.SubHeader,{title:h("namespaces"),legend:h("namespaces.legend")}),Object.keys(S).sort().map((function(n){return t().createElement(t().Fragment,null,n&&t().createElement("div",{style:{padding:20,fontWeight:500,paddingBottom:0}},"["+h("group")+"] "+n),!n&&b.length>0&&t().createElement("div",{style:{padding:20,fontWeight:500,paddingBottom:0}},h("default-group")),t().createElement(u.Paper,s.body.block.props,t().createElement(Br,{data:S[n],columns:v,actions:k,onSelectRows:e.open.bind(e),deselectOnClickAway:!0,showCheckboxes:!1,emptyStateString:h("empty"),masterStyles:s.body.tableMaster,storageKey:"console.metadata.list"})))})))))}}])&&Mr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),l}(t().Component);Fr=_r()(Fr)})(),window.AdminWorkspaces=r})(); \ No newline at end of file diff --git a/frontend/front-srv/assets/access.settings/res/dist/AdminWorkspaces.min.js.gz b/frontend/front-srv/assets/access.settings/res/dist/AdminWorkspaces.min.js.gz index 6c77c46f7d..9ac552731a 100644 Binary files a/frontend/front-srv/assets/access.settings/res/dist/AdminWorkspaces.min.js.gz and b/frontend/front-srv/assets/access.settings/res/dist/AdminWorkspaces.min.js.gz differ diff --git a/frontend/front-srv/assets/access.settings/res/js/AdminWorkspaces/editor/WsEditor.js b/frontend/front-srv/assets/access.settings/res/js/AdminWorkspaces/editor/WsEditor.js index bed419f615..791d5425ed 100644 --- a/frontend/front-srv/assets/access.settings/res/js/AdminWorkspaces/editor/WsEditor.js +++ b/frontend/front-srv/assets/access.settings/res/js/AdminWorkspaces/editor/WsEditor.js @@ -111,6 +111,7 @@ class WsEditor extends Component { const ModernStyles = ThemedModernStyles(muiTheme) const m = id => pydio.MessageHash['ajxp_admin.' + id] || id; const mS = id => pydio.MessageHash['settings.' + id] || id; + const policiesMS = id => pydio.MessageHash['advanced_settings.' + id] || id; const readonly = !workspace.PoliciesContextEditable; let buttons = []; @@ -306,10 +307,10 @@ class WsEditor extends Component { {PoliciesBuilder && -
Workspace Visibility
+
{policiesMS('editor.visibility.workspace')}
- WARNING: this is a dangerous zone, modify only if you know what you are doing! - {!policiesEdit && this.setState({policiesEdit:true})}> - Edit Now} + {policiesMS('editor.visibility.warning')} + {!policiesEdit && this.setState({policiesEdit:true})}> - {policiesMS('editor.visibility.edit')}}
} advancedContainerStyle={policiesEdit?{paddingBottom: 300}:{}} - allowedActions={{'READ':'Read', 'WRITE':'Write'}} + allowedActions={{ + 'READ':policiesMS('policies.builder.action.read'), + 'WRITE':policiesMS('policies.builder.action.write') + }} />
}