UNPKG

corporate-frontend-mithril

Version:

Corporate frontend MithrilJS modules

1 lines 20.1 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{10:function(e,t,n){(function(t){var r=n(38),a=n(4),i=n(68),l=n(69),c=n(15),o=r(i.apiRootPath),u={ams:{},updatedBundles:[],currentServerKey:"",currentInstanceKey:"",state:{isWatchingProdBundles:!1},watchingProdBundlesRemaining:0},s=l({data:u});Object.assign(s,{handleUpdatedBundles:function(e){var n;u.updatedBundles.length=0,Object.assign(u.updatedBundles,e),n=e,a.each(u.ams,function(e,t){var r=a.filter(n,function(e){return e.server===t});Object.is(r,void 0)||a.each(r,function(t){var n=a.find(e.bundleGroups,function(e){return e[0]===t.name}),r=a.find(n[1],function(e){return e.instance===t.instance});Object.assign(r,t)})}),s.broadcastDataChanges("updatedBundles"),t.redraw()},fetchAllBundles:function(){return new Promise(function(e,t){Promise.all(i.ams.map(function(e){return s.fetchBundles(e.server,e.instance)})).then(function(t){var n=c.groupByServers(t);n=c.groupByBundles(n),Object.assign(u.ams,n),e(n)}).catch(t)})},fetchBundles:function(e,n){return new Promise(function(r,a){t.request({method:"GET",url:"".concat(i.apiRootPath,"/aem-bundles?server=").concat(e,"&instance=").concat(n)}).then(function(t){r({server:e,instance:n,data:t})}).catch(function(e){console.warn("fetchBundles error",e),a(e)})})},listResults:function(){return u.ams},set currentServerKey(e){u.currentServerKey=e},set currentInstanceKey(e){u.currentInstanceKey=e},get currentServerKey(){return u.currentServerKey},get currentInstanceKey(){return u.currentInstanceKey},get state(){return u.state}}),o.on("connect",function(){console.log("socket connected")}),o.emit("join","aem-board client"),o.on("updated_bundles",s.handleUpdatedBundles),e.exports=s}).call(this,n(0))},15:function(e,t,n){var r=n(4);e.exports={groupByServers:function(e){return r.groupBy(e,"server")},groupByBundles:function(e){var t={};return r.each(e,function(e,n){t[n]={};var a=[];r.each(e,function(e){r.each(e.data,function(e){a.push(e)})}),t[n].bundleGroups=Object.entries(r.groupBy(r.sortBy(a,"name"),"name"))}),t},insertServerToBundles:function(e,t,n){return r.each(e,function(e){e.splice(n,0,t)}),e},findInstanceBundle:function(e,t){return r.find(e,function(e){return Object.is(e.instance,t)})},getBundleStateText:function(e){return"Active"==e.state?"":" ("+e.state+")"},getBundleStateClass:function(e){return Object.is(e,void 0)||r.isEmpty(e)?"":"Active"===e.state?"":"Resolved"===e.state?".b-box--padding-left-xxs.fas.fa-cloud":".b-box--padding-left-xxs.fas.fa-cloud-rain"}}},28:function(e,t,n){n(29),e.exports=n(33)},29:function(e,t,n){n(30),n(31),n(32)},32:function(e,t){},33:function(e,t,n){(function(e){var t=n(36);e.route(document.body.querySelector("#root"),"/",{"/":t})}).call(this,n(0))},36:function(e,t,n){(function(t){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=n(37),i=n(72),l=n(74),c=n(76),o=n(78);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,u,s;return n=e,(u=[{key:"oninit",value:function(e){a.initState().then(function(n){e.state.title=n,t.redraw()})}},{key:"view",value:function(){return a.isReady()?t(".b-page.b-page--bg-dark",[t(i),t(".b-container.b-container--section",[t(".b-container".concat(a.isCurrentKey("dev")?"":".b-hidden--fixed"),[t(l,a.getServerData("dev"))]),t(".b-container".concat(a.isCurrentKey("test")?"":".b-hidden--fixed"),[t(l,a.getServerData("test"))]),t(".b-container".concat(a.isCurrentKey("compareTrain")?"":".b-hidden--fixed"),[t(c,a.getComparedData("test","train"))]),t(".b-container".concat(a.isCurrentKey("train")?"":".b-hidden--fixed"),[t(l,a.getServerData("train"))]),t(".b-container".concat(a.isCurrentKey("compareProd")?"":".b-hidden--fixed"),[t(c,a.getComparedData("train","prod"))]),t(".b-container".concat(a.isCurrentKey("prod")?"":".b-hidden--fixed"),[t(l,a.getServerData("prod"))])])]):t(o)}}])&&r(n.prototype,u),s&&r(n,s),e}()}).call(this,n(0))},37:function(e,t,n){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=n(10),i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._isReady=!1}var t,n,i;return t=e,(n=[{key:"initState",value:function(){var e=this;return new Promise(function(t,n){a.fetchAllBundles().then(function(n){e._isReady=!0,a.currentServerKey="compareTrain",t(n)}).catch(n)})}},{key:"isReady",value:function(){return this._isReady}},{key:"getServerData",value:function(e){return a.listResults()[e]}},{key:"isCurrentKey",value:function(e){return Object.is(a.currentServerKey,e)}},{key:"getComparedData",value:function(e,t){return{source:{server:e,bundleGroups:a.listResults()[e].bundleGroups},destination:{server:t,bundleGroups:a.listResults()[t].bundleGroups}}}}])&&r(t.prototype,n),i&&r(t,i),e}();e.exports=new i},64:function(e,t){},68:function(e,t){var n=window.location.href,r=window.location.hostname,a=n.includes("aem-board")?"".concat(r,"/rpa-server"):"".concat(r,":7071"),i=n.includes("aem-board")?"".concat(r,"/rpa-bucket"):"".concat(r,":7080");e.exports={env:"production",apiRootPath:"".concat(window.location.protocol,"//").concat(a),outputPath:"".concat(window.location.protocol,"//").concat(i),ams:[{server:"dev",instance:"author1"},{server:"dev",instance:"publish1"},{server:"test",instance:"author1"},{server:"test",instance:"publish1"},{server:"test",instance:"publish2"},{server:"train",instance:"author1"},{server:"train",instance:"publish1"},{server:"train",instance:"publish2"},{server:"train",instance:"publish3"},{server:"prod",instance:"author1"},{server:"prod",instance:"publish1"},{server:"prod",instance:"publish2"},{server:"prod",instance:"publish3"}]}},69:function(e,t,n){var r=n(70),a=n(71);e.exports=function(e){var t=e.data||{},n=new Map,i=new Set,l=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;return n.has(e)||n.set(e,a.create(t[e],!0,function(t){r(t,e)})),n.get(e)},c=function(e,t){return u(t),!0},o=function(){i.clear()},u=function(e,n){var r=t[e],a=!0,l=!1,c=void 0;try{for(var o,u=i[Symbol.iterator]();!(a=(o=u.next()).done);a=!0){var s=o.value;if(Object.is(s,void 0))return;Object.is(s.keyPath,e)&&!Object.is(n,s)&&s.handler(e,r)}}catch(e){l=!0,c=e}finally{try{a||null==u.return||u.return()}finally{if(l)throw c}}};return{subscribe:function(e,t,n){if(Object.is(e,void 0))throw new Error("keyPath is required to subscribe data service");if(Object.is(t,void 0))throw new Error("fn is required to subscribe data service");var a={instance:n,id:r.random(6),keyPath:e,handler:t,proxy:l(e)};return i.add(a),a},unsubscribe:function(e){i.delete(e)},unsubscribeAll:o,broadcastDataChanges:u,destroy:function(){for(var e in o(),this)hasOwnProperty(e)&&delete this[e]}}}},70:function(e,t){e.exports={random:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=e&&e<=12?e:12,n="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=r.length,i=0;i<t;i++)n+=r.charAt(Math.floor(Math.random()*a));return n},truncate:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=e.length>t,a=r?e.substr(0,t-1):e;return a=n&&r?a.substr(0,a.lastIndexOf(" ")):a,r?a+"...":a},removeEmptyHtmlTags:function(e,t){return e.replace(t,"").replace(/(<(?!\/)[^>]+>)+(<\/[^>]+>)/gm,"")},removeLineBreaks:function(e){return e.replace(/\r?\n|\r|&lt;br&gt;|<br>|<br\/>/g,"")},getMediaTimeStringFromSeconds:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=parseInt(e),n=Math.floor(e/3600);t-=3600*n;var r=Math.floor(t/60),a="";return n>0&&(a=a+n+" hour "),r>0&&(a=a+r+" min "),a=a+(t-=60*r)+" sec"},upperCaseFirstChar:function(e){return e.substring(0,1).toUpperCase()+e.substring(1)}}},72:function(e,t,n){(function(t){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=n(73);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,i,l;return n=e,(i=[{key:"view",value:function(){return t(".b-aem-board-header.b-box.b-box--padding-base.b-box--margin-bottom-base",[t(".b-container.b-container--section",[t(".grid.grid--flush",[t(".1/12.grid__cell",[t("a.b-aem-board-header__button.b-link.b-link--block\n ".concat(a.getSelectedStateClass("dev"),"[href=javascript:void(0);]"),{onclick:function(){a.setCurrentServerKey("dev")}},"dev")]),t(".1/12.grid__cell",[t("a.b-aem-board-header__button.b-link.b-link--block\n ".concat(a.getSelectedStateClass("test"),"[href=javascript:void(0);]"),{onclick:function(){a.setCurrentServerKey("test")}},"test")]),t(".3/28.grid__cell",[t("a.b-aem-board-header__button.b-link.b-link--block\n ".concat(a.getSelectedStateClass("compareTrain"),"[href=javascript:void(0);]"),{onclick:function(){a.setCurrentServerKey("compareTrain")}},"compare")]),t(".1/12.grid__cell",[t("a.b-aem-board-header__button.b-link.b-link--block\n ".concat(a.getSelectedStateClass("train"),"[href=javascript:void(0);]"),{onclick:function(){a.setCurrentServerKey("train")}},"train")]),t(".3/28.grid__cell",[t("a.b-aem-board-header__button.b-link.b-link--block\n ".concat(a.getSelectedStateClass("compareProd"),"[href=javascript:void(0);]"),{onclick:function(){a.setCurrentServerKey("compareProd")}},"compare")]),t(".1/12.grid__cell",[t("a.b-aem-board-header__button.b-link.b-link--block\n ".concat(a.getSelectedStateClass("prod"),"[href=javascript:void(0);]"),{onclick:function(){a.setCurrentServerKey("prod")}},"prod")])])])])}}])&&r(n.prototype,i),l&&r(n,l),e}()}).call(this,n(0))},73:function(e,t,n){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=n(10),i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,i;return t=e,(n=[{key:"listResults",value:function(){return a.listResults()}},{key:"setCurrentServerKey",value:function(e){a.currentServerKey=e}},{key:"getSelectedStateClass",value:function(e){return a.currentServerKey===e?"":".b-link--hover-underline"}}])&&r(t.prototype,n),i&&r(t,i),e}();e.exports=new i},74:function(e,t,n){(function(t){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=n(4),i=n(75);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,l,c;return n=e,(l=[{key:"view",value:function(e){return t(".b-bundles-panel.b-component",[t(".b-title.b-title--h2.b-text--upper.b-text--align-center.b-component--tight",i.getCurrentServerKey()),t(".b-bundles-panel__content-container.b-component",[t(".b-featured-table",[t(".b-featured-table__row",[t(".2/7.b-featured-table__cell.b-featured-table__cell--head","Bundle Name"),t(".1/7.b-featured-table__cell.b-featured-table__cell--head","Author1"),t(".1/7.b-featured-table__cell.b-featured-table__cell--head","Publish1"),t(".1/7.b-featured-table__cell.b-featured-table__cell--head","Publish2"),t(".1/7.b-featured-table__cell.b-featured-table__cell--head","Publish3")]),a.map(e.attrs.bundleGroups,function(e){return t(".b-featured-table__row",[t(".2/7.grid_cell.b-featured-table__cell","".concat(e[0])),a.map(i.generateStandardBundleList(e[1]),function(e){return t(".1/7.grid_cell.b-featured-table__cell",[t("span.b-text","".concat(e.version?e.version:"")),t("span.b-text","".concat(e.version?i.getBundleStateText(e):""))])})])})])]),t("div",[t("span","Synchronise bundle status every 5 seconds for DEV, TEST, TRAIN and PROD.")])])}}])&&r(n.prototype,l),c&&r(n,c),e}()}).call(this,n(0))},75:function(e,t,n){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=n(4),i=n(10),l=n(15),c={author1:{},publish1:{},publish2:{},publish3:{}},o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._data={updatedBundles:[]}}var t,n,o;return t=e,(n=[{key:"generateStandardBundleList",value:function(e){var t=Object.assign({},c);return a.each(e,function(e){t[e.instance]=e}),t}},{key:"getBundleStateText",value:function(e){return l.getBundleStateText(e)}},{key:"getBundleStateClass",value:function(e){return l.getBundleStateClass(e)}},{key:"getCurrentServerKey",value:function(){return i.currentServerKey}}])&&r(t.prototype,n),o&&r(t,o),e}();e.exports=new o},76:function(e,t,n){(function(t){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=n(4),i=n(77);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,l,c;return n=e,(l=[{key:"view",value:function(e){return t(".b-bundles-panel.b-component",[t("h2.b-title--first.b-title.b-title--h2.b-text--upper.b-text--align-center.b-component--tight","Compare ".concat(e.attrs.source.server," and ").concat(e.attrs.destination.server)),t(".b-bundles-panel__content-container.b-component",[t(".b-featured-table",[t(".b-featured-table__row",[t(".4/12.b-featured-table__cell.b-featured-table__cell--head"," "),t(".5/24.b-featured-table__cell.b-featured-table__cell--head","AUTHORS"),t(".8/24.b-featured-table__cell.b-featured-table__cell--head.b-featured-table__cell--no-border-right","PUBLISHES"),t(".3/24.b-featured-table__cell.b-featured-table__cell--head"," ")]),t(".b-featured-table__row",[t(".4/12.b-featured-table__cell.b-featured-table__cell--head"," "),t(".1/12.b-featured-table__cell.b-featured-table__cell--head.b-featured-table__cell--white.b-text--upper","".concat(e.attrs.source.server)),t(".3/24.b-featured-table__cell.b-featured-table__cell--head.b-text--upper","".concat(e.attrs.destination.server)),t(".1/12.b-featured-table__cell.b-featured-table__cell--head.b-featured-table__cell--white.b-text--upper","".concat(e.attrs.source.server)),t(".6/24.b-featured-table__cell.b-featured-table__cell--head.b-featured-table__cell--no-border-right.b-text--upper","".concat(e.attrs.destination.server)),t(".3/24.b-featured-table__cell.b-featured-table__cell--head"," ")]),t(".b-featured-table__row",[t(".4/12.b-featured-table__cell.b-featured-table__cell--head","Bundle Name"),t(".1/12.b-featured-table__cell.b-featured-table__cell--head.b-featured-table__cell--white","Author1"),t(".3/24.b-featured-table__cell.b-featured-table__cell--head","Author1"),t(".1/12.b-featured-table__cell.b-featured-table__cell--head.b-featured-table__cell--white","Publish1"),t(".3/24.b-featured-table__cell.b-featured-table__cell--head","Publish1"),t(".3/24.b-featured-table__cell.b-featured-table__cell--head","Publish2"),t(".3/24.b-featured-table__cell.b-featured-table__cell--head","Publish3")]),a.map(i.getDisplayList(e.attrs.source,e.attrs.destination),function(e){return t(".b-featured-table__row",[t(".4/12.grid_cell.b-featured-table__cell\n ".concat(i.getBundleNameClass(e)),"".concat(e.name)),t(".1/12.grid_cell.b-featured-table__cell.b-featured-table__cell--white",e.source.author1?[t("span.b-text","".concat(e.source.author1.version)),t("span.b-text","".concat(i.getBundleStateText(e.source.author1)))]:"-"),t(".3/24.grid_cell.b-featured-table__cell\n ".concat(i.getDestinationBundleClass(e,"author1")),e.destination.author1?[t("span.b-text","".concat(e.destination.author1.version)),t("span.b-text","".concat(i.getBundleStateText(e.destination.author1)))]:"-"),t(".1/12.grid_cell.b-featured-table__cell.b-featured-table__cell--white",e.source.publish1?[t("span.b-text","".concat(e.source.publish1.version)),t("span.b-text","".concat(i.getBundleStateText(e.source.publish1)))]:"-"),t(".3/24.grid_cell.b-featured-table__cell\n ".concat(i.getDestinationBundleClass(e,"publish1")),e.destination.publish1?[t("span.b-text","".concat(e.destination.publish1.version)),t("span.b-text","".concat(i.getBundleStateText(e.destination.publish1)))]:"-"),t(".3/24.grid_cell.b-featured-table__cell\n ".concat(i.getDestinationBundleClass(e,"publish2")),e.destination.publish2?[t("span.b-text","".concat(e.destination.publish2.version)),t("span.b-text","".concat(i.getBundleStateText(e.destination.publish2)))]:"-"),t(".3/24.grid_cell.b-featured-table__cell\n ".concat(i.getDestinationBundleClass(e,"publish3")),e.destination.publish3?[t("span.b-text","".concat(e.destination.publish3.version)),t("span.b-text","".concat(i.getBundleStateText(e.destination.publish3)))]:"-")])})])]),t("div",[t("span","Synchronise bundle status every 5 seconds for DEV, TEST, TRAIN and PROD.")])])}}])&&r(n.prototype,l),c&&r(n,c),e}()}).call(this,n(0))},77:function(e,t,n){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=n(4),i=n(15),l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,l;return t=e,(n=[{key:"getDisplayList",value:function(e,t){e=JSON.parse(JSON.stringify(e)),i.insertServerToBundles(e.bundleGroups,e.server,1),t=JSON.parse(JSON.stringify(t)),i.insertServerToBundles(t.bundleGroups,t.server,1);var n=a.sortBy(a.concat(e.bundleGroups,t.bundleGroups));return this._generateComparedList(n,e.server,t.server)}},{key:"getBundleStateClass",value:function(e){return i.getBundleStateClass(e)}},{key:"getBundleStateText",value:function(e){return i.getBundleStateText(e)}},{key:"getBundleNameClass",value:function(e){return Object.is(this.getDestinationBundleClass(e,"author1"),"")&&Object.is(this.getDestinationBundleClass(e,"publish1"),"")&&Object.is(this.getDestinationBundleClass(e,"publish2"),"")&&Object.is(this.getDestinationBundleClass(e,"publish3"),"")?"":".b-featured-table__cell--dark"}},{key:"getDestinationBundleClass",value:function(e,t){var n=t.includes("publish")?"publish1":t.includes("author")?"author1":t;return Object.is(!Object.is(e.source[n],void 0),!Object.is(e.destination[t],void 0))&&Object.is(e.source[n]&&e.source[n].version,e.destination[t]&&e.destination[t].version)?"":".b-featured-table__cell--dark"}},{key:"_generateComparedList",value:function(e,t,n){var r={};return a.each(e,function(e){Object.is(r[e[0]],void 0)&&(r[e[0]]={}),r[e[0]].name=e[0],e[1]===t&&(r[e[0]].source={server:t,author1:i.findInstanceBundle(e[2],"author1"),publish1:i.findInstanceBundle(e[2],"publish1")}),e[1]===n&&(r[e[0]].destination={server:n,author1:i.findInstanceBundle(e[2],"author1"),publish1:i.findInstanceBundle(e[2],"publish1"),publish2:i.findInstanceBundle(e[2],"publish2"),publish3:i.findInstanceBundle(e[2],"publish3")})}),r}}])&&r(t.prototype,n),l&&r(t,l),e}();e.exports=new l},78:function(e,t,n){(function(t){var r=n(79);e.exports={view:function(){return t(".b-page.b-page--bg-dark.b-page--position-fixed",[t(".b-container.b-container--center.b-container--size-full",[t(r)])])}}}).call(this,n(0))},79:function(e,t,n){(function(t){e.exports={view:function(){return t(".b-spinner",[t(".b-spinner__child.b-spinner__child--1"),t(".b-spinner__child.b-spinner__child--2"),t(".b-spinner__child.b-spinner__child--3"),t(".b-spinner__child.b-spinner__child--4"),t(".b-spinner__child.b-spinner__child--5"),t(".b-spinner__child.b-spinner__child--6")])}}}).call(this,n(0))}},[[28,1,2]]]);