????
Current Path : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/ |
Current File : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/core-administration-08557f995fab40cf6908.js |
/*! For license information please see ../license.txt */ "use strict";(self.webpackChunk_cloudbeaver_product_default=self.webpackChunk_cloudbeaver_product_default||[]).push([[88273],{62586:(e,t,i)=>{i.r(t),i.d(t,{AdministrationItemService:()=>d,filterHiddenAdministrationItem:()=>filterHiddenAdministrationItem,filterOnlyActive:()=>filterOnlyActive});var n=i(1118),s=i(94866),r=i(5576),a=i(29606),o=i(51121),c=i(10220),u=i(79130);let d=class AdministrationItemService{constructor(){this.items=[],this.activateHandler=async({screen:e,configurationWizard:t,outside:i,outsideAdminPage:n})=>{let s=0;for(;;){const e=this.getActiveItems(t);if(s===e.length)break;await(e[s]?.onLoad?.(t,i,n)),s++}if(t){let e=0;for(;;){const i=this.getActiveItems(t);if(e===i.length)break;await(i[e].configurationWizardOptions?.onLoad?.()),e++}}const r=this.getItem(e.item,t);r&&(await(r.onActivate?.(t,i,n)),e.sub&&await(this.getItemSub(r,e.sub)?.onActivate?.(e.param,t,i)))},this.deActivateHandler=async({screen:e,configurationWizard:t,outside:i,outsideAdminPage:n})=>{const s=this.getItem(e.item,t);s&&(await(s.onDeActivate?.(t,i,n)),e.sub&&await(this.getItemSub(s,e.sub)?.onDeActivate?.(e.param,t,i)))},this.itemActivating=!1,this.itemDeactivating=!1,this.activationTask=new a.Q,this.deActivationTask=new a.Q,(0,s.Gn)(this,{items:s.sH,itemActivating:s.sH,itemDeactivating:s.sH}),this.activationTask.addHandler((()=>{this.itemActivating=!0})).addHandler(this.activateHandler).addPostHandler((()=>{this.itemActivating=!1})),this.deActivationTask.addHandler((()=>{this.itemDeactivating=!0})).addHandler(this.deActivateHandler).addPostHandler((()=>{this.itemDeactivating=!1}))}getUniqueItems(e){const t=[],i=this.items.slice().sort(((e,t)=>e.name!==t.name?e.name.localeCompare(t.name):e.replace&&t.replace?(t.replace.priority??Number.MIN_SAFE_INTEGER)-(e.replace.priority??Number.MIN_SAFE_INTEGER):0)).filter((t=>!t.replace?.condition||t.replace.condition(e)));let n=null;for(const e of i)n?.name!==e.name&&(t.push(e),n=e);return t}getActiveItems(e){return this.getUniqueItems(e).filter((t=>filterHiddenAdministrationItem(e)(t)&&(0,o.M)(e)(t))).sort((0,u.p)(e))}getDefaultItem(e){const t=this.getActiveItems(e);if(0===t.length)return null;const i=t.find(filterOnlyActive(e));return i?i.name:t[0].name}getAdministrationItemRoute(e,t=!1){return{item:e.params.item||this.getDefaultItem(t),sub:e.params.sub||null,param:e.params.param||null}}getItem(e,t){const i=this.getActiveItems(t).find((t=>t.name===e));return i||null}getItemSub(e,t){const i=e.sub.find((e=>e.name===t));return i||null}create(e){const t=e.type??c._.Administration,i=this.items.findIndex((i=>i.name===e.name&&(i.type===t||i.type===c._.Default||t===c._.Default)));if(!e.replace&&-1!==i)throw new Error(`Administration item "${e.name}" already exists in the same visibility scope`);const n={...e,type:t,sub:e.sub??[],order:e.order??Number.MAX_SAFE_INTEGER};this.items.push(n)}async activate(e,t,i,n){await this.activationTask.execute({screen:e,configurationWizard:t,outside:i,outsideAdminPage:n})}async deActivate(e,t,i,n){await this.deActivationTask.execute({screen:e,configurationWizard:t,outside:i,outsideAdminPage:n})}async canDeActivate(e,t,i,n){const s=this.getItem(e.item,i);let r=null;if(t&&(r=this.getItem(t.item,i)),!s)return!0;if(s.canDeActivate&&!await s.canDeActivate(i,n,r))return!1;if(e.sub){const t=this.getItemSub(s,e.sub);if(t?.canDeActivate&&!await t.canDeActivate(e.param,i))return!1}return!0}async canActivate(e,t,i){const n=this.getItem(e.item,t);if(!n)return!1;if(n.canActivate&&!await n.canActivate(t,i))return!1;if(e.sub){const i=this.getItemSub(n,e.sub);if(i?.canActivate&&!await i.canActivate(e.param,t))return!1}return!0}};function filterHiddenAdministrationItem(e){return function filterHiddenAdministrationItem(t){return"function"==typeof t.isHidden?!t.isHidden(e):!t.isHidden}}function filterOnlyActive(e){return function filterOnlyActive(t){return"function"==typeof t.isOnlyActive?t.isOnlyActive(e):!0===t.isOnlyActive}}d=(0,n.Cg)([(0,r._)(),(0,n.Sn)("design:paramtypes",[])],d)},10220:(e,t,i)=>{var n;i.d(t,{_:()=>n}),function(e){e[e.Default=0]="Default",e[e.Administration=1]="Administration",e[e.ConfigurationWizard=2]="ConfigurationWizard"}(n||(n={}))},51121:(e,t,i)=>{i.d(t,{M:()=>filterConfigurationWizard});var n=i(10220);function filterConfigurationWizard(e){return t=>e?t.type!==n._.Administration:t.type!==n._.ConfigurationWizard}},79130:(e,t,i)=>{function orderAdministrationItems(e){return(t,i)=>e?(t.configurationWizardOptions?.order??t.order)-(i.configurationWizardOptions?.order??i.order):t.order-i.order}i.d(t,{p:()=>orderAdministrationItems})},87461:(e,t,i)=>{i.r(t),i.d(t,{AdministrationLocaleService:()=>o});var n=i(1118),s=i(82103),r=i(5576),a=i(34227);let o=class AdministrationLocaleService extends s.j{constructor(e){super(),this.localizationService=e}register(){this.localizationService.addProvider(this.provider.bind(this))}load(){}async provider(e){switch(e){case"ru":return(await Promise.all([i.e(92436),i.e(47763)]).then(i.bind(i,26581))).default;case"it":return(await Promise.all([i.e(32756),i.e(70144)]).then(i.bind(i,18745))).default;case"zh":return(await Promise.all([i.e(52041),i.e(30288)]).then(i.bind(i,6362))).default;case"fr":return(await Promise.all([i.e(29671),i.e(7907)]).then(i.bind(i,60516))).default;default:return(await Promise.all([i.e(41114),i.e(85526)]).then(i.bind(i,18659))).default}}};o=(0,n.Cg)([(0,r._)(),(0,n.Sn)("design:paramtypes",[a.LocalizationService])],o)},21428:(e,t,i)=>{i.r(t),i.d(t,{AdministrationScreenService:()=>I});var n=i(1118),s=i(94866),r=i(5576),a=i(14452),o=i(29606),c=i(72755),u=i(19462),d=i(68061),m=i(40601),h=i(71086),v=i(1513),f=i(31324),g=i(56191),S=i(62586),l=i(3065);const p=l.Ik({workspaceId:l.Yj(),version:l.Yj(),serverVersion:l.Yj(),configurationMode:l.zM(),itemsState:l.YO(l.PV([l.Yj(),l.bz()]))});var A;let I=class AdministrationScreenService{static{A=this}static{this.screenName="administration"}static{this.itemRouteName="administration.item"}static{this.itemSubRouteName="administration.item.sub"}static{this.itemSubParamRouteName="administration.item.sub.param"}static{this.setupName="setup"}static{this.setupItemRouteName="setup.item"}static{this.setupItemSubRouteName="setup.item.sub"}static{this.setupItemSubParamRouteName="setup.item.sub.param"}get isAdministrationPageActive(){return this.isAdministrationRouteActive(this.screenService.routerService.state.name)}get activeScreen(){return this.getScreen(this.screenService.routerService.state)}get isConfigurationMode(){return this.serverConfigResource.configurationMode}get publicDisabled(){return this.serverConfigResource.publicDisabled}constructor(e,t,i,n,r,a,c){this.permissionsResource=e,this.permissionsService=t,this.screenService=i,this.administrationItemService=n,this.storageService=r,this.serverConfigResource=a,this.notificationService=c,this.info=getDefaultAdministrationScreenInfo(),this.itemState=new f.C,this.activationEvent=new o.Q,this.ensurePermissions=new o.Q,this.itemsStateSync=[],(0,s.Gn)(this,{info:s.sH,itemsStateSync:s.sH,activeScreen:s.EW}),this.storageService.registerSettings("administration_info",this.info,getDefaultAdministrationScreenInfo,(e=>{const t=p.safeParse(e);return t.success&&t.data.workspaceId===this.serverConfigResource.workspaceId&&t.data.configurationMode===this.isConfigurationMode&&t.data.serverVersion===this.serverConfigResource.serverVersion&&t.data.version===g.b.version?{...t.data,itemsState:(0,s.sH)(t.data.itemsState,{deep:!0})}:{workspaceId:this.serverConfigResource.workspaceId,configurationMode:this.isConfigurationMode,serverVersion:this.serverConfigResource.serverVersion,version:g.b.version||"",itemsState:(0,s.sH)([],{deep:!0})}}),(()=>{this.itemState.sync(this.itemsStateSync)})),this.permissionsResource.onDataUpdate.addPostHandler((()=>{this.checkPermissions(this.screenService.routerService.state)}))}getRouteName(e,t,i){return this.isConfigurationMode?e?t?i?A.setupItemSubParamRouteName:A.setupItemSubRouteName:A.setupItemRouteName:A.setupName:e?t?i?A.itemSubParamRouteName:A.itemSubRouteName:A.itemRouteName:A.screenName}getScreen(e){return e&&this.isAdministrationRouteActive(e.name)?this.administrationItemService.getAdministrationItemRoute(e,this.isConfigurationMode):null}navigateToRoot(){this.screenService.navigateToScreen(this.getRouteName())}navigateTo(e,t){t?this.navigateToItemSub(e,t.sub,t.param):this.navigateToItem(e)}navigateToItem(e){const t=this.administrationItemService.getItem(e,this.isConfigurationMode);this.screenService.navigateToScreen(this.getRouteName(e,t?.defaultSub,t?.defaultParam),e,t?.defaultSub,t?.defaultParam)}navigateToItemSub(e,t,i){this.screenService.navigateToScreen(this.getRouteName(e,t,i),e,t,i)}getItemState(e,t,i){if(!this.serverConfigResource.isLoaded())throw new Error("Administration screen getItemState can be used only after server configuration loaded");return this.itemState.get(e,t,i)}clearItemsState(){this.itemState.clear()}isAdministrationRouteActive(e){return this.screenService.isActive(e,A.screenName)||this.screenService.isActive(e,A.setupName)}async handleDeactivate(e,t){t&&!this.isAdministrationRouteActive(t.name)&&await this.activationEvent.execute(!1);const i=this.getScreen(t),n=this.getScreen(e);n&&await this.administrationItemService.deActivate(n,this.isConfigurationMode,n.item!==i?.item,null===i),this.isConfigurationMode&&!this.screenService.isActive(t.name,A.setupName)&&this.navigateToRoot()}async handleCanDeActivate(e,t){if(!e.params.item)return!0;const i=this.getScreen(t),n=this.getScreen(e);return!n||this.administrationItemService.canDeActivate(n,i,this.isConfigurationMode,n.item!==i?.item)}async handleCanActivate(e,t){if(!e.params.item)return!1;const i=this.getScreen(t),n=this.getScreen(e);return!!n&&this.administrationItemService.canActivate(n,this.isConfigurationMode,n.item!==i?.item)}async handleActivate(e,t){if(!await this.checkPermissions(e))return;await this.activationEvent.execute(!0);const i=this.getScreen(e),n=this.getScreen(t);i&&await this.administrationItemService.activate(i,this.isConfigurationMode,i.item!==n?.item,null===n)}async checkPermissions(e){if(!this.isAdministrationRouteActive(e.name))return!1;return!!await this.isAccessProvided(e)||(this.screenService.navigateToRoot(),this.notificationService.logInfo({title:"root_permission_no_permission",uuid:"no_permission"}),!1)}async isAccessProvided(e){if(await this.serverConfigResource.load(),await this.permissionsResource.load(),this.isConfigurationMode)return!0;if(this.screenService.isActive(e.name,A.setupName))return!1;await this.ensurePermissions.execute();return!!await this.permissionsService.hasAsync(c.y.admin)}};function getDefaultAdministrationScreenInfo(){return{workspaceId:"",version:g.b.version||"",serverVersion:"",configurationMode:!1,itemsState:[]}}I=A=(0,n.Cg)([(0,r._)(),(0,n.Sn)("design:paramtypes",[u.SessionPermissionsResource,d.PermissionsService,h.ScreenService,S.AdministrationItemService,v.StorageService,m.ServerConfigResource,a.NotificationService])],I)},66403:(e,t,i)=>{i.r(t),i.d(t,{ConfigurationWizardService:()=>m});var n=i(1118),s=i(94866),r=i(5576),a=i(14452),o=i(62586),c=i(51121),u=i(79130),d=i(21428);let m=class ConfigurationWizardService{get steps(){return this.administrationItemService.getUniqueItems(!0).filter((e=>(0,c.M)(!0)(e)&&(0,o.filterHiddenAdministrationItem)(!0)(e))).sort((0,u.p)(!0))}get stepsToFinish(){return this.steps.filter((e=>e.configurationWizardOptions?.isDone))}get finishedSteps(){return this.steps.filter((e=>e.configurationWizardOptions?.isDone&&e.configurationWizardOptions.isDone()))}get currentStepIndex(){return this.currentStep&&this.steps.indexOf(this.currentStep)||0}get canFinish(){return this.steps.every((e=>!(e.configurationWizardOptions?.isDone&&!e.configurationWizardOptions?.isDone())))}get nextStep(){return this.steps.find(((e,t)=>!(t<=this.currentStepIndex)&&(!e.configurationWizardOptions?.isDisabled||!e.configurationWizardOptions.isDisabled())))}get currentStep(){return this.steps.find((e=>e.name===this.administrationScreenService.activeScreen?.item))}constructor(e,t,i){this.administrationItemService=e,this.administrationScreenService=t,this.notificationService=i,(0,s.Gn)(this,{steps:s.EW,stepsToFinish:s.EW,finishedSteps:s.EW,currentStepIndex:s.EW,canFinish:s.EW,nextStep:s.EW,currentStep:s.EW})}isStepAvailable(e){if(this.currentStep?.name===e)return!0;for(const t of this.steps){if(t.name===e)return!0;if(this.stepsToFinish.includes(t)&&!this.finishedSteps.includes(t))return!1}return!1}async finishStep(e){const t=this.getStep(e);if(!t)return!1;if(t.configurationWizardOptions?.onFinish){if(!await t.configurationWizardOptions.onFinish())return!1}if(t.configurationWizardOptions?.isDone){if(!t.configurationWizardOptions.isDone())return!1}return!0}async next(){this.currentStep&&await this.finishStep(this.currentStep.name)&&(this.currentStepIndex+1<this.steps.length?this.nextStep&&this.administrationScreenService.navigateTo(this.nextStep.name,this.nextStep.configurationWizardOptions?.defaultRoute):await this.finish())}back(){if(this.currentStep&&this.currentStepIndex-1>=0){const e=this.steps[this.currentStepIndex-1];this.administrationScreenService.navigateTo(e.name,e.configurationWizardOptions?.defaultRoute)}}getStep(e){return this.administrationItemService.getUniqueItems(!0).find((t=>(0,c.M)(!0)(t)&&t.name===e))}async finish(){for(const e of this.steps)e?.configurationWizardOptions?.onConfigurationFinish&&await e.configurationWizardOptions.onConfigurationFinish();this.administrationScreenService.clearItemsState(),this.administrationScreenService.navigateToRoot(),this.notificationService.logSuccess({title:"administration_configuration_wizard_finish_success_title",message:"administration_configuration_wizard_finish_success_message"})}};m=(0,n.Cg)([(0,r._)(),(0,n.Sn)("design:paramtypes",[o.AdministrationItemService,d.AdministrationScreenService,a.NotificationService])],m)},89917:(e,t,i)=>{i.d(t,{O:()=>n});const n=(0,i(44745).M)("AdministrationItemRoute")},18050:(e,t,i)=>{i.r(t),i.d(t,{PermissionsResource:()=>u});var n=i(1118),s=i(5576),r=i(40813),a=i(7278),o=i(98076),c=i(83336);let u=class PermissionsResource extends r.nG{constructor(e,t){super(),this.graphQLService=e,this.sync(t,(()=>{}),(()=>r.fZ))}async loader(){const{permissions:e}=await this.graphQLService.sdk.getPermissionsList();return this.replace((0,a.OU)(e.map((e=>e.id))),e),this.data}validateKey(e){return"string"==typeof e}};u=(0,n.Cg)([(0,s._)(),(0,n.Sn)("design:paramtypes",[c.GraphQLService,o.SessionDataResource])],u)}}]);