@sync-in/server 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/environment/environment.dist.yaml +1 -1
- package/package.json +1 -1
- package/server/configuration/config.loader.js +1 -1
- package/server/configuration/config.loader.js.map +1 -1
- package/server/configuration/config.validation.js +2 -0
- package/server/configuration/config.validation.js.map +1 -1
- package/static/{chunk-UV4UIX6J.js → chunk-2CQOSX2Q.js} +1 -1
- package/static/{chunk-7WRQICEB.js → chunk-2QEYCCHN.js} +1 -1
- package/static/{chunk-QFRQQ4K3.js → chunk-2SX3MVH3.js} +1 -1
- package/static/{chunk-GWUCWOVK.js → chunk-2XXS272C.js} +1 -1
- package/static/{chunk-ZVPX26RB.js → chunk-3RLZPQMJ.js} +1 -1
- package/static/{chunk-3V7XYPSJ.js → chunk-5JDPARJT.js} +1 -1
- package/static/{chunk-2EBPSJJT.js → chunk-5OIPLRAE.js} +1 -1
- package/static/{chunk-7PCJMNDR.js → chunk-7U66TR6P.js} +1 -1
- package/static/{chunk-IFJD2ISM.js → chunk-AA6ZTGRW.js} +1 -1
- package/static/{chunk-WTPZUBNX.js → chunk-AXITQYVN.js} +1 -1
- package/static/{chunk-OWGR4BYT.js → chunk-AYEOHGUD.js} +1 -1
- package/static/{chunk-NPLV4M2H.js → chunk-CTWOQLAR.js} +1 -1
- package/static/{chunk-O4CXCITB.js → chunk-EWY4ALVF.js} +1 -1
- package/static/{chunk-5RFOYHL3.js → chunk-FBG4NUDE.js} +1 -1
- package/static/{chunk-ATFX6EIO.js → chunk-GI2LXVWQ.js} +1 -1
- package/static/{chunk-NU3TPXFY.js → chunk-HDDBV3QQ.js} +1 -1
- package/static/{chunk-I644MKAO.js → chunk-HQC3W7BS.js} +1 -1
- package/static/{chunk-4IYQWOGR.js → chunk-LHKO5Y4A.js} +1 -1
- package/static/{chunk-MQZEETHL.js → chunk-NCIAR3N4.js} +1 -1
- package/static/{chunk-VBD7QTEP.js → chunk-R4USKWW6.js} +1 -1
- package/static/{chunk-XI72YZ2M.js → chunk-RGONEEJE.js} +1 -1
- package/static/{chunk-AKM2LQUU.js → chunk-TFBTBTPR.js} +1 -1
- package/static/{chunk-RUNMEQOV.js → chunk-VIL6L67B.js} +1 -1
- package/static/{chunk-Z6IHRUVL.js → chunk-WA3LPP4G.js} +1 -1
- package/static/{chunk-MEKYVWV4.js → chunk-WQPVP63E.js} +1 -1
- package/static/{chunk-ATLT5DK5.js → chunk-Y6IYSEKU.js} +1 -1
- package/static/{chunk-IUUTIYHF.js → chunk-ZS5YIDNI.js} +1 -1
- package/static/{chunk-VQRN7HFP.js → chunk-ZSMTUPAP.js} +1 -1
- package/static/{chunk-RAVRSB6R.js → chunk-ZZGFGD5E.js} +1 -1
- package/static/index.html +1 -1
- package/static/{main-ILCPT3IK.js → main-7IVUWYWM.js} +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
## [1.3.1](https://github.com/Sync-in/server/compare/v1.3.0...v1.3.1) (2025-08-08)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **backend:conf:** handle undefined logger.stdout in some environments ([08087ba](https://github.com/Sync-in/server/commit/08087bab675860d4c35041f9cd1752840df3cc7f))
|
|
8
|
+
* **backend:test:** log path ([eabf3d7](https://github.com/Sync-in/server/commit/eabf3d734721fbfd821489ac2bc83913c9afaf2e))
|
|
9
|
+
* **backend:validation:** log file path ([0e8c695](https://github.com/Sync-in/server/commit/0e8c695437dae0e6000e213382e1f4c7d91aef93))
|
|
10
|
+
|
|
2
11
|
## [1.3.0](https://github.com/Sync-in/server/compare/v1.2.2...v1.3.0) (2025-08-08)
|
|
3
12
|
|
|
4
13
|
|
package/package.json
CHANGED
|
@@ -73,7 +73,7 @@ function configLoader() {
|
|
|
73
73
|
if (Object.keys(config).length === 0) {
|
|
74
74
|
throw new Error(`Missing configuration: "${_configconstants.ENVIRONMENT_FILE_NAME}" not found, or no variables beginning with "${_configconstants.ENVIRONMENT_PREFIX}" are set.`);
|
|
75
75
|
}
|
|
76
|
-
if (config.logger
|
|
76
|
+
if (config.logger?.stdout === false) {
|
|
77
77
|
// ensure log directory exists
|
|
78
78
|
const logFilePath = config.logger.filePath || _configconstants.DEFAULT_LOG_FILE_PATH;
|
|
79
79
|
const dirLogPath = _nodepath.default.dirname(logFilePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../backend/src/configuration/config.loader.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport deepmerge from 'deepmerge'\nimport * as yaml from 'js-yaml'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport {\n DEFAULT_LOG_FILE_PATH,\n ENVIRONMENT_DIST_FILE_NAME,\n ENVIRONMENT_DIST_PATH,\n ENVIRONMENT_FILE_NAME,\n ENVIRONMENT_PATH,\n ENVIRONMENT_PREFIX\n} from './config.constants'\nimport type { Configuration } from './config.validation'\n\nexport function configLoader(): any {\n let config: Partial<Configuration> = loadEnvFile(ENVIRONMENT_PATH, ENVIRONMENT_FILE_NAME)\n\n if (hasEnvConfig()) {\n // If any environment vars are found, parse the config model and apply those settings\n const envConfig = getEnvOverrides(loadEnvFile(ENVIRONMENT_DIST_PATH, ENVIRONMENT_DIST_FILE_NAME, true))\n config = deepmerge(config, envConfig)\n }\n\n if (Object.keys(config).length === 0) {\n throw new Error(`Missing configuration: \"${ENVIRONMENT_FILE_NAME}\" not found, or no variables beginning with \"${ENVIRONMENT_PREFIX}\" are set.`)\n }\n\n if (config.logger
|
|
1
|
+
{"version":3,"sources":["../../../backend/src/configuration/config.loader.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport deepmerge from 'deepmerge'\nimport * as yaml from 'js-yaml'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport {\n DEFAULT_LOG_FILE_PATH,\n ENVIRONMENT_DIST_FILE_NAME,\n ENVIRONMENT_DIST_PATH,\n ENVIRONMENT_FILE_NAME,\n ENVIRONMENT_PATH,\n ENVIRONMENT_PREFIX\n} from './config.constants'\nimport type { Configuration } from './config.validation'\n\nexport function configLoader(): any {\n let config: Partial<Configuration> = loadEnvFile(ENVIRONMENT_PATH, ENVIRONMENT_FILE_NAME)\n\n if (hasEnvConfig()) {\n // If any environment vars are found, parse the config model and apply those settings\n const envConfig = getEnvOverrides(loadEnvFile(ENVIRONMENT_DIST_PATH, ENVIRONMENT_DIST_FILE_NAME, true))\n config = deepmerge(config, envConfig)\n }\n\n if (Object.keys(config).length === 0) {\n throw new Error(`Missing configuration: \"${ENVIRONMENT_FILE_NAME}\" not found, or no variables beginning with \"${ENVIRONMENT_PREFIX}\" are set.`)\n }\n\n if (config.logger?.stdout === false) {\n // ensure log directory exists\n const logFilePath = config.logger.filePath || DEFAULT_LOG_FILE_PATH\n const dirLogPath = path.dirname(logFilePath)\n if (!fs.existsSync(dirLogPath)) {\n fs.mkdirSync(dirLogPath, { recursive: true })\n }\n console.log(`Logging to file → ${logFilePath}`)\n }\n\n return config\n}\n\nfunction buildPathsUp(basePath: string, fileName: string, levels = 4): string[] {\n // Generates candidate file paths, optionally walking up from __dirname to a given depth.\n return Array.from({ length: levels + 1 }, (_, i) => path.resolve(basePath, ...Array(i).fill('..'), fileName))\n}\n\nfunction loadEnvFile(envPath: string, envFileName: string, throwIfMissing = false): any {\n const candidates = [envPath, envFileName, ...buildPathsUp(__dirname, envPath), ...buildPathsUp(__dirname, envFileName)]\n for (const envFilePath of candidates) {\n if (fs.existsSync(envFilePath) && fs.lstatSync(envFilePath).isFile()) {\n if (envFileName === ENVIRONMENT_FILE_NAME) {\n console.log(`Load configuration → ${envFilePath}`)\n }\n return yaml.load(fs.readFileSync(envFilePath, 'utf8'))\n }\n }\n if (throwIfMissing) {\n throw new Error(`${envFileName} not found`)\n }\n return {}\n}\n\nfunction hasEnvConfig(): boolean {\n return Object.keys(process.env).some((key) => key.startsWith(ENVIRONMENT_PREFIX))\n}\n\n/**\n * Parse a raw env-string into boolean, number or leave as string.\n */\nfunction parseEnvValue(value: string): any {\n // remove quotes & convert to lowercase\n value = value.replace(/^\"+|\"+$/g, '').toLowerCase()\n if (value === 'true') return true\n if (value === 'false') return false\n if (!isNaN(Number(value))) return Number(value)\n return value\n}\n\n/**\n * Assigns a nested property into obj, creating sub-objects as needed.\n */\nfunction setObjectPropertyFromString(obj: any, property: string, value: any): void {\n const segments = property.split('.')\n let cursor = obj\n for (let i = 0; i < segments.length - 1; i++) {\n const seg = segments[i]\n if (!(seg in cursor) || typeof cursor[seg] !== 'object') {\n cursor[seg] = {}\n }\n cursor = cursor[seg]\n }\n cursor[segments[segments.length - 1]] = value\n}\n\n/**\n * Returns a new object containing only the env-var overrides\n * that match existing keys in `config`, nested and cased properly.\n */\nfunction getEnvOverrides(config: Record<string, any>): Record<string, any> {\n const result: Record<string, any> = {}\n\n for (const [envKey, rawValue] of Object.entries(process.env)) {\n if (!envKey.startsWith(ENVIRONMENT_PREFIX) || rawValue === undefined) {\n continue\n }\n\n // [\"APPLICATIONS\",\"FILES\",\"DATAPATH\"] etc.\n const segments = envKey.slice(ENVIRONMENT_PREFIX.length).split('_')\n const secretFromFile = segments[segments.length - 1] === 'FILE'\n if (secretFromFile) {\n // remove FILE attribute\n segments.pop()\n }\n\n // Walk through config to validate path & capture real key names\n let cursorConfig: any = config\n const realSegments: string[] = []\n let pathExists = true\n\n for (const seg of segments) {\n if (cursorConfig == null || typeof cursorConfig !== 'object') {\n pathExists = false\n break\n }\n // Find the actual key (preserving camelCase) whose uppercase matches seg\n const match = Object.keys(cursorConfig).find((k) => k.toUpperCase() === seg)\n if (!match) {\n pathExists = false\n break\n }\n realSegments.push(match)\n cursorConfig = cursorConfig[match]\n }\n\n if (!pathExists) {\n console.warn(`Ignoring unknown environment variable: \"${envKey}\".`)\n continue\n }\n\n // Build the nested override in `result`\n const path = realSegments.join('.')\n if (secretFromFile) {\n try {\n setObjectPropertyFromString(result, path, fs.readFileSync(rawValue, 'utf-8').trim())\n } catch (e) {\n console.error(`Unable to store secret from file ${rawValue} : ${e}`)\n }\n } else {\n setObjectPropertyFromString(result, path, parseEnvValue(rawValue))\n }\n }\n\n return result\n}\n"],"names":["configLoader","config","loadEnvFile","ENVIRONMENT_PATH","ENVIRONMENT_FILE_NAME","hasEnvConfig","envConfig","getEnvOverrides","ENVIRONMENT_DIST_PATH","ENVIRONMENT_DIST_FILE_NAME","deepmerge","Object","keys","length","Error","ENVIRONMENT_PREFIX","logger","stdout","logFilePath","filePath","DEFAULT_LOG_FILE_PATH","dirLogPath","path","dirname","fs","existsSync","mkdirSync","recursive","console","log","buildPathsUp","basePath","fileName","levels","Array","from","_","i","resolve","fill","envPath","envFileName","throwIfMissing","candidates","__dirname","envFilePath","lstatSync","isFile","yaml","load","readFileSync","process","env","some","key","startsWith","parseEnvValue","value","replace","toLowerCase","isNaN","Number","setObjectPropertyFromString","obj","property","segments","split","cursor","seg","result","envKey","rawValue","entries","undefined","slice","secretFromFile","pop","cursorConfig","realSegments","pathExists","match","find","k","toUpperCase","push","warn","join","trim","e","error"],"mappings":"AAAA;;;;CAIC;;;;+BAgBeA;;;eAAAA;;;kEAdM;gEACA;+DACP;iEACE;iCAQV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAASA;IACd,IAAIC,SAAiCC,YAAYC,iCAAgB,EAAEC,sCAAqB;IAExF,IAAIC,gBAAgB;QAClB,qFAAqF;QACrF,MAAMC,YAAYC,gBAAgBL,YAAYM,sCAAqB,EAAEC,2CAA0B,EAAE;QACjGR,SAASS,IAAAA,kBAAS,EAACT,QAAQK;IAC7B;IAEA,IAAIK,OAAOC,IAAI,CAACX,QAAQY,MAAM,KAAK,GAAG;QACpC,MAAM,IAAIC,MAAM,CAAC,wBAAwB,EAAEV,sCAAqB,CAAC,6CAA6C,EAAEW,mCAAkB,CAAC,UAAU,CAAC;IAChJ;IAEA,IAAId,OAAOe,MAAM,EAAEC,WAAW,OAAO;QACnC,8BAA8B;QAC9B,MAAMC,cAAcjB,OAAOe,MAAM,CAACG,QAAQ,IAAIC,sCAAqB;QACnE,MAAMC,aAAaC,iBAAI,CAACC,OAAO,CAACL;QAChC,IAAI,CAACM,eAAE,CAACC,UAAU,CAACJ,aAAa;YAC9BG,eAAE,CAACE,SAAS,CAACL,YAAY;gBAAEM,WAAW;YAAK;QAC7C;QACAC,QAAQC,GAAG,CAAC,CAAC,kBAAkB,EAAEX,aAAa;IAChD;IAEA,OAAOjB;AACT;AAEA,SAAS6B,aAAaC,QAAgB,EAAEC,QAAgB,EAAEC,SAAS,CAAC;IAClE,yFAAyF;IACzF,OAAOC,MAAMC,IAAI,CAAC;QAAEtB,QAAQoB,SAAS;IAAE,GAAG,CAACG,GAAGC,IAAMf,iBAAI,CAACgB,OAAO,CAACP,aAAaG,MAAMG,GAAGE,IAAI,CAAC,OAAOP;AACrG;AAEA,SAAS9B,YAAYsC,OAAe,EAAEC,WAAmB,EAAEC,iBAAiB,KAAK;IAC/E,MAAMC,aAAa;QAACH;QAASC;WAAgBX,aAAac,WAAWJ;WAAaV,aAAac,WAAWH;KAAa;IACvH,KAAK,MAAMI,eAAeF,WAAY;QACpC,IAAInB,eAAE,CAACC,UAAU,CAACoB,gBAAgBrB,eAAE,CAACsB,SAAS,CAACD,aAAaE,MAAM,IAAI;YACpE,IAAIN,gBAAgBrC,sCAAqB,EAAE;gBACzCwB,QAAQC,GAAG,CAAC,CAAC,qBAAqB,EAAEgB,aAAa;YACnD;YACA,OAAOG,QAAKC,IAAI,CAACzB,eAAE,CAAC0B,YAAY,CAACL,aAAa;QAChD;IACF;IACA,IAAIH,gBAAgB;QAClB,MAAM,IAAI5B,MAAM,GAAG2B,YAAY,UAAU,CAAC;IAC5C;IACA,OAAO,CAAC;AACV;AAEA,SAASpC;IACP,OAAOM,OAAOC,IAAI,CAACuC,QAAQC,GAAG,EAAEC,IAAI,CAAC,CAACC,MAAQA,IAAIC,UAAU,CAACxC,mCAAkB;AACjF;AAEA;;CAEC,GACD,SAASyC,cAAcC,KAAa;IAClC,uCAAuC;IACvCA,QAAQA,MAAMC,OAAO,CAAC,YAAY,IAAIC,WAAW;IACjD,IAAIF,UAAU,QAAQ,OAAO;IAC7B,IAAIA,UAAU,SAAS,OAAO;IAC9B,IAAI,CAACG,MAAMC,OAAOJ,SAAS,OAAOI,OAAOJ;IACzC,OAAOA;AACT;AAEA;;CAEC,GACD,SAASK,4BAA4BC,GAAQ,EAAEC,QAAgB,EAAEP,KAAU;IACzE,MAAMQ,WAAWD,SAASE,KAAK,CAAC;IAChC,IAAIC,SAASJ;IACb,IAAK,IAAI1B,IAAI,GAAGA,IAAI4B,SAASpD,MAAM,GAAG,GAAGwB,IAAK;QAC5C,MAAM+B,MAAMH,QAAQ,CAAC5B,EAAE;QACvB,IAAI,CAAE+B,CAAAA,OAAOD,MAAK,KAAM,OAAOA,MAAM,CAACC,IAAI,KAAK,UAAU;YACvDD,MAAM,CAACC,IAAI,GAAG,CAAC;QACjB;QACAD,SAASA,MAAM,CAACC,IAAI;IACtB;IACAD,MAAM,CAACF,QAAQ,CAACA,SAASpD,MAAM,GAAG,EAAE,CAAC,GAAG4C;AAC1C;AAEA;;;CAGC,GACD,SAASlD,gBAAgBN,MAA2B;IAClD,MAAMoE,SAA8B,CAAC;IAErC,KAAK,MAAM,CAACC,QAAQC,SAAS,IAAI5D,OAAO6D,OAAO,CAACrB,QAAQC,GAAG,EAAG;QAC5D,IAAI,CAACkB,OAAOf,UAAU,CAACxC,mCAAkB,KAAKwD,aAAaE,WAAW;YACpE;QACF;QAEA,2CAA2C;QAC3C,MAAMR,WAAWK,OAAOI,KAAK,CAAC3D,mCAAkB,CAACF,MAAM,EAAEqD,KAAK,CAAC;QAC/D,MAAMS,iBAAiBV,QAAQ,CAACA,SAASpD,MAAM,GAAG,EAAE,KAAK;QACzD,IAAI8D,gBAAgB;YAClB,wBAAwB;YACxBV,SAASW,GAAG;QACd;QAEA,gEAAgE;QAChE,IAAIC,eAAoB5E;QACxB,MAAM6E,eAAyB,EAAE;QACjC,IAAIC,aAAa;QAEjB,KAAK,MAAMX,OAAOH,SAAU;YAC1B,IAAIY,gBAAgB,QAAQ,OAAOA,iBAAiB,UAAU;gBAC5DE,aAAa;gBACb;YACF;YACA,yEAAyE;YACzE,MAAMC,QAAQrE,OAAOC,IAAI,CAACiE,cAAcI,IAAI,CAAC,CAACC,IAAMA,EAAEC,WAAW,OAAOf;YACxE,IAAI,CAACY,OAAO;gBACVD,aAAa;gBACb;YACF;YACAD,aAAaM,IAAI,CAACJ;YAClBH,eAAeA,YAAY,CAACG,MAAM;QACpC;QAEA,IAAI,CAACD,YAAY;YACfnD,QAAQyD,IAAI,CAAC,CAAC,wCAAwC,EAAEf,OAAO,EAAE,CAAC;YAClE;QACF;QAEA,wCAAwC;QACxC,MAAMhD,OAAOwD,aAAaQ,IAAI,CAAC;QAC/B,IAAIX,gBAAgB;YAClB,IAAI;gBACFb,4BAA4BO,QAAQ/C,MAAME,eAAE,CAAC0B,YAAY,CAACqB,UAAU,SAASgB,IAAI;YACnF,EAAE,OAAOC,GAAG;gBACV5D,QAAQ6D,KAAK,CAAC,CAAC,iCAAiC,EAAElB,SAAS,GAAG,EAAEiB,GAAG;YACrE;QACF,OAAO;YACL1B,4BAA4BO,QAAQ/C,MAAMkC,cAAce;QAC1D;IACF;IAEA,OAAOF;AACT"}
|
|
@@ -97,7 +97,9 @@ _ts_decorate([
|
|
|
97
97
|
_ts_metadata("design:type", Boolean)
|
|
98
98
|
], LoggerConfig.prototype, "colorize", void 0);
|
|
99
99
|
_ts_decorate([
|
|
100
|
+
(0, _classvalidator.IsOptional)(),
|
|
100
101
|
(0, _classvalidator.IsString)(),
|
|
102
|
+
(0, _classtransformer.Transform)(({ value })=>value || _configconstants.DEFAULT_LOG_FILE_PATH),
|
|
101
103
|
_ts_metadata("design:type", String)
|
|
102
104
|
], LoggerConfig.prototype, "filePath", void 0);
|
|
103
105
|
let Configuration = class Configuration {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../backend/src/configuration/config.validation.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { Transform, Type } from 'class-transformer'\nimport { IsBoolean, IsDefined, IsInt, IsIP, IsNotEmptyObject, IsObject, IsOptional, IsString, Max, Min, ValidateNested } from 'class-validator'\nimport { cpus } from 'node:os'\nimport type { Level } from 'pino'\nimport { ApplicationsConfig } from '../applications/applications.config'\nimport { AuthConfig } from '../authentication/auth.config'\nimport { CacheConfig } from '../infrastructure/cache/cache.config'\nimport { MySQLConfig } from '../infrastructure/database/database.config'\nimport { MailerConfig } from '../infrastructure/mailer/mailer.config'\nimport { WebSocketConfig } from '../infrastructure/websocket/web-socket.config'\nimport { DEFAULT_LOG_FILE_PATH } from './config.constants'\n\nexport class ServerConfig {\n @IsIP()\n host: string = '0.0.0.0'\n\n @IsInt()\n @Min(1024)\n @Max(65535)\n port: number = 8080\n\n @Transform(({ value }) => (value === 0 || value === 'auto' ? cpus().length : Math.max(Number(value), 2)))\n @IsInt()\n @Min(2)\n workers: number = 2\n\n @IsOptional()\n trustProxy: boolean | string = false\n\n @IsBoolean()\n restartOnFailure: boolean = true\n}\n\nexport class LoggerConfig {\n @IsDefined()\n @IsString()\n level: Level = 'info'\n\n @IsBoolean()\n stdout: boolean = true\n\n @IsBoolean()\n colorize: boolean = true\n\n @IsString()\n filePath: string = DEFAULT_LOG_FILE_PATH\n}\n\nexport class Configuration {\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => ServerConfig)\n server: ServerConfig = new ServerConfig()\n\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => LoggerConfig)\n logger: LoggerConfig = new LoggerConfig()\n\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => MySQLConfig)\n mysql: MySQLConfig\n\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => CacheConfig)\n cache: CacheConfig = new CacheConfig()\n\n @IsOptional()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => WebSocketConfig)\n websocket: WebSocketConfig = new WebSocketConfig()\n\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => AuthConfig)\n auth: AuthConfig\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => MailerConfig)\n mail?: MailerConfig\n\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => ApplicationsConfig)\n applications: ApplicationsConfig\n}\n"],"names":["Configuration","LoggerConfig","ServerConfig","host","port","workers","trustProxy","restartOnFailure","value","cpus","length","Math","max","Number","level","stdout","colorize","filePath","DEFAULT_LOG_FILE_PATH","server","logger","cache","CacheConfig","websocket","WebSocketConfig","MySQLConfig","AuthConfig","MailerConfig","ApplicationsConfig"],"mappings":"AAAA;;;;CAIC;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../backend/src/configuration/config.validation.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { Transform, Type } from 'class-transformer'\nimport { IsBoolean, IsDefined, IsInt, IsIP, IsNotEmptyObject, IsObject, IsOptional, IsString, Max, Min, ValidateNested } from 'class-validator'\nimport { cpus } from 'node:os'\nimport type { Level } from 'pino'\nimport { ApplicationsConfig } from '../applications/applications.config'\nimport { AuthConfig } from '../authentication/auth.config'\nimport { CacheConfig } from '../infrastructure/cache/cache.config'\nimport { MySQLConfig } from '../infrastructure/database/database.config'\nimport { MailerConfig } from '../infrastructure/mailer/mailer.config'\nimport { WebSocketConfig } from '../infrastructure/websocket/web-socket.config'\nimport { DEFAULT_LOG_FILE_PATH } from './config.constants'\n\nexport class ServerConfig {\n @IsIP()\n host: string = '0.0.0.0'\n\n @IsInt()\n @Min(1024)\n @Max(65535)\n port: number = 8080\n\n @Transform(({ value }) => (value === 0 || value === 'auto' ? cpus().length : Math.max(Number(value), 2)))\n @IsInt()\n @Min(2)\n workers: number = 2\n\n @IsOptional()\n trustProxy: boolean | string = false\n\n @IsBoolean()\n restartOnFailure: boolean = true\n}\n\nexport class LoggerConfig {\n @IsDefined()\n @IsString()\n level: Level = 'info'\n\n @IsBoolean()\n stdout: boolean = true\n\n @IsBoolean()\n colorize: boolean = true\n\n @IsOptional()\n @IsString()\n @Transform(({ value }) => value || DEFAULT_LOG_FILE_PATH)\n filePath: string = DEFAULT_LOG_FILE_PATH\n}\n\nexport class Configuration {\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => ServerConfig)\n server: ServerConfig = new ServerConfig()\n\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => LoggerConfig)\n logger: LoggerConfig = new LoggerConfig()\n\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => MySQLConfig)\n mysql: MySQLConfig\n\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => CacheConfig)\n cache: CacheConfig = new CacheConfig()\n\n @IsOptional()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => WebSocketConfig)\n websocket: WebSocketConfig = new WebSocketConfig()\n\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => AuthConfig)\n auth: AuthConfig\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => MailerConfig)\n mail?: MailerConfig\n\n @IsDefined()\n @IsObject()\n @IsNotEmptyObject()\n @ValidateNested()\n @Type(() => ApplicationsConfig)\n applications: ApplicationsConfig\n}\n"],"names":["Configuration","LoggerConfig","ServerConfig","host","port","workers","trustProxy","restartOnFailure","value","cpus","length","Math","max","Number","level","stdout","colorize","filePath","DEFAULT_LOG_FILE_PATH","server","logger","cache","CacheConfig","websocket","WebSocketConfig","MySQLConfig","AuthConfig","MailerConfig","ApplicationsConfig"],"mappings":"AAAA;;;;CAIC;;;;;;;;;;;QAoDYA;eAAAA;;QAjBAC;eAAAA;;QArBAC;eAAAA;;;kCAZmB;gCAC8F;wBACzG;oCAEc;4BACR;6BACC;gCACA;8BACC;iCACG;iCACM;;;;;;;;;;AAE/B,IAAA,AAAMA,eAAN,MAAMA;;aAEXC,OAAe;aAKfC,OAAe;aAKfC,UAAkB;aAGlBC,aAA+B;aAG/BC,mBAA4B;;AAC9B;;;;;;;;;;;;sCAVc,EAAEC,KAAK,EAAE,GAAMA,UAAU,KAAKA,UAAU,SAASC,IAAAA,YAAI,IAAGC,MAAM,GAAGC,KAAKC,GAAG,CAACC,OAAOL,QAAQ;;;;;;;;;;;;;AAYhG,IAAA,AAAMP,eAAN,MAAMA;;aAGXa,QAAe;aAGfC,SAAkB;aAGlBC,WAAoB;aAKpBC,WAAmBC,sCAAqB;;AAC1C;;;;;;;;;;;;;;;;;sCAFc,EAAEV,KAAK,EAAE,GAAKA,SAASU,sCAAqB;;;AAInD,IAAA,AAAMlB,gBAAN,MAAMA;;aAMXmB,SAAuB,IAAIjB;aAO3BkB,SAAuB,IAAInB;aAc3BoB,QAAqB,IAAIC,wBAAW;aAOpCC,YAA6B,IAAIC,gCAAe;;AAqBlD;;;;;;oCAlDctB;;;;;;;;oCAOAD;;;;;;;;oCAOAwB,2BAAW;;;;;;;;oCAOXH,wBAAW;;;;;;;;oCAOXE,gCAAe;;;;;;;;oCAOfE,sBAAU;;;;;;;oCAMVC,0BAAY;;;;;;;;oCAOZC,sCAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ya as J,ab as K}from"./chunk-
|
|
1
|
+
import{Ya as J,ab as K}from"./chunk-HDDBV3QQ.js";import{$d as H,Ad as W,Bb as y,Bd as j,Dd as z,Eb as f,Fb as b,Le as U,Mb as L,Nb as S,Ob as T,Pb as P,Qb as I,Sa as n,Tf as Z,Ub as V,Vb as D,Wb as F,Xa as E,Yc as B,ab as g,ad as O,bc as R,dc as q,fb as _,fd as N,lb as w,mb as d,nb as k,oa as v,pa as c,pd as A,qa as u,rb as C,sd as G,td as x,ud as Q,vb as r,wa as M,wb as l,xb as m}from"./chunk-FPEGN42P.js";var ie=["Password"];function ne(i,X){i&1&&(r(0,"label",1),I(1,"Password"),l())}function se(i,X){if(i&1){let o=y();r(0,"div",5),f("click",function(){c(o);let t=b();return u(t.randomPassword())}),r(1,"span"),m(2,"fa-icon",6),l()()}if(i&2){let o=b();n(2),w("icon",o.icons.faDice)}}var Ce=(()=>{class i{constructor(o){this.locale=o,this.passwordChange=new M,this.passwordMinLength=8,this.showGenerator=!1,this.showLabel=!1,this.disabled=!1,this.isRequired=!1,this.focus=!1,this.toggleVisiblePassword=K,this.icons={faEye:U,faEyeSlash:H,faDice:Z}}ngOnInit(){this.focus&&setTimeout(()=>{this.passwordElement.nativeElement.focus(),this.passwordElement.nativeElement.select()},0)}randomPassword(){this.disabled||this.passwordChange.emit(J(this.passwordMinLength+2))}static{this.\u0275fac=function(e){return new(e||i)(E(Q))}}static{this.\u0275cmp=g({type:i,selectors:[["app-input-password"]],viewQuery:function(e,t){if(e&1&&L(ie,7),e&2){let s;S(s=T())&&(t.passwordElement=s.first)}},inputs:{password:"password",passwordMinLength:"passwordMinLength",placeholder:"placeholder",showGenerator:"showGenerator",showLabel:"showLabel",disabled:"disabled",isRequired:"isRequired",focus:"focus"},outputs:{passwordChange:"passwordChange"},decls:9,vars:12,consts:[["Password",""],["for","password","l10nTranslate",""],["id","password",1,"input-group","input-group-sm",2,"min-width","150px"],["autocomplete","off","type","password",1,"form-control","form-control-sm",3,"ngModelChange","keyup","ngModel","disabled","placeholder","required"],[1,"input-group-text","cursor-pointer"],[1,"input-group-text","cursor-pointer",3,"click"],[3,"icon"]],template:function(e,t){if(e&1){let s=y();_(0,ne,2,0,"label",1),r(1,"div",2)(2,"input",3,0),R(4,"translate"),F("ngModelChange",function(a){return c(s),D(t.password,a)||(t.password=a),u(a)}),f("keyup",function(){return c(s),u(t.passwordChange.emit(t.password))}),l(),_(5,se,3,1,"div",4),r(6,"div",5),f("click",function(){c(s);let a=P(3);return u(t.toggleVisiblePassword(a))}),r(7,"span"),m(8,"fa-icon",6),l()()()}if(e&2){let s=P(3);C(t.showLabel?0:-1),n(2),k("is-invalid",t.isRequired&&(t.password==null?null:t.password.length)<t.passwordMinLength),V("ngModel",t.password),w("disabled",t.disabled)("placeholder",q(4,9,t.placeholder,t.locale.language))("required",t.isRequired),n(3),C(t.showGenerator?5:-1),n(3),w("icon",s.type==="text"?t.icons.faEye:t.icons.faEyeSlash)}},dependencies:[G,B,O,A,N,x,W,z,j],encapsulation:2})}}return i})();var be=(()=>{class i{constructor(){this.passwordToCheck="",this.bar0="",this.bar1="",this.bar2="",this.bar3="",this.bar4="",this.colors=["#F00","#F90","#FF0","#7ACC00","#06854B"]}static measureStrength(o){let e=0,t=/[$-/:-?{-~!"^_`[\]]/g,s=/[a-z]+/.test(o),h=/[A-Z]+/.test(o),a=/[0-9]+/.test(o),Y=t.test(o),$=[s,h,a,Y],p=0;for(let ee of $)p+=ee===!0?1:0;return e+=2*o.length+(o.length>=10?1:0),e+=p*10,e=o.length<=6?Math.min(e,10):e,e=p===1?Math.min(e,10):e,e=p===2?Math.min(e,20):e,e=p===3?Math.min(e,40):e,e}ngOnChanges(o){let e=o.passwordToCheck.currentValue;if(this.setBarColors(5,"#DDD"),e){let t=this.getColor(i.measureStrength(e));this.setBarColors(t.idx,t.col)}}getColor(o){let e=Math.min(Math.floor((o-1)/10),4);return{idx:e+1,col:this.colors[e]}}setBarColors(o,e){for(let t=0;t<o;t++)this[`bar${t}`]=e}static{this.\u0275fac=function(e){return new(e||i)}}static{this.\u0275cmp=g({type:i,selectors:[["app-password-strength-bar"]],inputs:{passwordToCheck:"passwordToCheck"},features:[v],decls:8,vars:10,consts:[["strength",""],["id","strength"],["id","strengthBar"],[1,"point"]],template:function(e,t){e&1&&(r(0,"div",1,0)(2,"ul",2),m(3,"li",3)(4,"li",3)(5,"li",3)(6,"li",3)(7,"li",3),l()()),e&2&&(n(3),d("background-color",t.bar0),n(),d("background-color",t.bar1),n(),d("background-color",t.bar2),n(),d("background-color",t.bar3),n(),d("background-color",t.bar4))},styles:["ul#strengthBar[_ngcontent-%COMP%]{display:flex;list-style:none;padding:0;align-self:center;margin-bottom:-2px}.point[_ngcontent-%COMP%]:last-child{margin:0!important}.point[_ngcontent-%COMP%]{background:#ddd;border-radius:2px;height:6px;margin-right:1px;width:20px}"],changeDetection:0})}}return i})();export{Ce as a,be as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as fe,b as he,c as _e,d as ve,f as xe,i as Se}from"./chunk-3V7XYPSJ.js";import{a as Ce,b as be}from"./chunk-UV4UIX6J.js";import{f as ge}from"./chunk-RAVRSB6R.js";import{J as re,K as le,Q as E,Sb as pe,ub as me,xb as ce,yb as ue,zb as de}from"./chunk-NU3TPXFY.js";import{Ad as Q,Bb as L,Bd as Y,Bf as ae,Dc as R,Dd as Z,Eb as h,Fb as u,Gf as oe,Me as ne,Qb as s,Rb as b,Sa as o,Sb as T,Tb as N,Xa as S,Xc as V,Yc as M,_c as p,_d as ee,_f as se,ab as P,ad as j,bc as v,bd as B,cc as x,cd as q,dc as O,ed as g,fb as d,jd as H,kd as X,lb as l,ld as $,md as z,nb as C,nd as W,pa as A,pb as w,qa as I,rb as f,sb as y,tb as G,td as J,ub as F,ud as K,vb as n,ve as te,wa as k,wb as a,xb as c,xe as ie}from"./chunk-FPEGN42P.js";import{a as U}from"./chunk-GAL4ENT6.js";function Te(i,m){if(i&1&&(c(0,"fa-icon",42),n(1,"span"),s(2),a()),i&2){let e=u();l("icon",e.icons.faPen),o(2),b(e.guest.fullName)}}function Ee(i,m){if(i&1&&(c(0,"fa-icon",42),n(1,"span",43),s(2,"New guest"),a()),i&2){let e=u();l("icon",e.icons.faPlus)}}function De(i,m){if(i&1&&c(0,"fa-icon",2),i&2){let e=u();l("icon",e.icons.faSpinner)}}function we(i,m){i&1&&(n(0,"h4",3)(1,"span",43),s(2,"Edit guest"),a()())}function ye(i,m){if(i&1&&(c(0,"fa-icon",44),n(1,"span",45),s(2,"Account"),a()),i&2){let e=u();l("icon",e.icons.faAddressCard)}}function Ge(i,m){if(i&1&&c(0,"app-password-strength-bar",22),i&2){let e=u();l("passwordToCheck",e.guestForm.value.password)}}function Fe(i,m){if(i&1&&(n(0,"option",26),s(1),a()),i&2){let e=m.$implicit;l("ngValue",e),o(),b(e)}}function Ne(i,m){if(i&1&&(n(0,"option",34),s(1),a()),i&2){let e=m.$implicit,r=u();l("ngValue",r.allNotifications.indexOf(e)),o(),b(e)}}function Ue(i,m){if(i&1&&(n(0,"div"),s(1),v(2,"amDateFormat"),a(),n(3,"div"),s(4),v(5,"amDateFormat"),a()),i&2){let e=u(2);o(),N("",x(2,4,e.guest.currentAccess)," - ",e.guest.currentIp,""),o(3),N("",x(5,6,e.guest.lastAccess)," - ",e.guest.lastIp,"")}}function Ae(i,m){i&1&&(n(0,"span",37),s(1,"never"),a())}function Ie(i,m){if(i&1&&(n(0,"div",11)(1,"div",12)(2,"label",46),s(3,"Creation date"),a(),n(4,"div",47),s(5),v(6,"amDateFormat"),a()(),n(7,"div",48)(8,"label",49),s(9,"Last accesses"),a(),n(10,"div",50),d(11,Ue,6,8)(12,Ae,2,0,"span",37),a()()()),i&2){let e=u();o(5),b(x(6,2,e.guest.createdAt)),o(6),f(e.guest.lastAccess?11:12)}}function ke(i,m){if(i&1&&(c(0,"fa-icon",44),n(1,"span",51),s(2,"Managers"),a(),n(3,"span"),s(4),a()),i&2){let e=u();l("icon",e.icons.faUsersGear),o(4),T("(",e.guestForm.value.managers.length||0,")")}}function Pe(i,m){i&1&&(n(0,"small",37),s(1,"At least one manager is required"),a())}function Le(i,m){if(i&1){let e=L();n(0,"button",52),h("click",function(){A(e);let t=u();return I(t.confirmDeletion=!0)}),s(1," Remove "),a()}if(i&2){let e=u();l("disabled",e.confirmDeletion)}}var st=(()=>{class i{constructor(e,r,t){this.locale=e,this.layout=r,this.userService=t,this.guest=null,this.guestChange=new k,this.user=this.userService.user,this.icons={GROUPS:ce.GROUPS,faPlus:ae,faPen:ne,faUsersGear:se,faSpinner:oe,faAddressCard:te,faUsers:ee,faShieldHalved:ie},this.allNotifications=Object.values(E),this.defaultPassword=this.layout.translateString(ue),this.languages=this.layout.getLanguages(!0),this.submitted=!1,this.loading=!1,this.confirmDeletion=!1}ngOnInit(){this.guestForm=new q({login:new g(this.guest?.login||"",[p.required,p.pattern(re)]),email:new g(this.guest?.email||"",[p.required,p.maxLength(255),p.email]),firstName:new g(this.guest?.firstName||"",[p.required,p.maxLength(255)]),lastName:new g(this.guest?.lastName||"",p.maxLength(255)),password:new g(this.guest?this.defaultPassword:"",p.maxLength(255)),language:new g(this.guest?.language||null),notification:new g(this.guest?.notification||Object.values(E).indexOf(E.APPLICATION_EMAIL)),isActive:new g(this.guest?this.guest.isActive:!0),managers:new g(this.guest?.managers||[me(this.user)])})}updatePassword(e){this.guestForm.controls.password.setValue(e),this.guestForm.controls.password.markAsDirty()}updateManagers(e){this.guestForm.controls.managers.setValue(e),this.guestForm.controls.managers.markAsDirty(),this.guestForm.controls.managers.setErrors(e.length?null:{incorrect:!0})}searchMembers(e){let r={search:e,ignoreUserIds:this.guestForm.value.managers.map(t=>t.id),usersRole:le.USER,onlyUsers:!0};return this.userService.searchMembers(r)}onCancel(){this.confirmDeletion?this.confirmDeletion=!1:this.layout.closeDialog()}onSubmit(){if(this.submitted=!0,this.confirmDeletion)this.userService.deleteGuest(this.guest.id).subscribe({next:()=>{this.guestChange.emit(["delete",this.guest]),this.layout.sendNotification("success","Guest deleted",this.guest.login),this.layout.closeDialog()},error:e=>this.onError(e)});else if(!this.guest)this.userService.createGuest(this.makeDto(!0)).subscribe({next:e=>{this.guestChange.emit(["add",e]),this.layout.sendNotification("success","Guest created",this.guestForm.value.login),this.layout.closeDialog()},error:e=>this.onError(e)});else{let e=this.makeDto();if(!Object.keys(e).length){this.loading=!1,this.submitted=!1;return}this.userService.updateGuest(this.guest.id,e).subscribe({next:r=>{r?this.guestChange.emit(["update",r]):this.guestChange.emit(["delete",this.guest]),this.layout.sendNotification("success","Guest updated",this.guestForm.value.login),this.layout.closeDialog()},error:r=>this.onError(r)})}}makeDto(e=!1){let r={};if(e)r=U({},this.guestForm.value);else for(let t in this.guestForm.controls)this.guestForm.controls[t].dirty&&(r[t]=this.guestForm.controls[t].value);for(let t in r)switch(t){case"language":r[t]=r[t]===de?null:r[t];break;case"managers":r[t]=r[t].map(_=>_.id);break}return r}onError(e){this.layout.sendNotification("error","Guest error",this.guestForm.value.login,e),this.submitted=!1,this.confirmDeletion=!1}static{this.\u0275fac=function(r){return new(r||i)(S(K),S(pe),S(ge))}}static{this.\u0275cmp=P({type:i,selectors:[["app-user-guest-dialog"]],inputs:{guest:"guest"},outputs:{guestChange:"guestChange"},decls:70,vars:40,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],["animation","spin","size","sm",1,"ms-2",3,"icon"],[1,"modal-title","ms-auto"],["aria-label","Close","type","button",3,"click"],[1,"modal-body",3,"formGroup"],["type","pills",3,"justified"],[1,"my-3"],["customClass","tab-dialog form-validation",3,"selectTab"],["tabHeading",""],[1,"d-flex","flex-column"],[1,"d-flex","col-12","pb-3"],[1,"flex-fill","col-6","pe-4"],["for","login","l10nTranslate",""],["id","login","appAutofocus","","formControlName","login","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"autoSelect"],[1,"flex-fill","col-6","ps-4"],["for","email","l10nTranslate",""],["id","email","formControlName","email","autocomplete","off","type","email",1,"form-control","form-control-sm"],["for","firstName","l10nTranslate",""],["id","firstName","formControlName","firstName","autocomplete","off","type","text",1,"form-control","form-control-sm"],["for","lastName","l10nTranslate",""],["id","lastName","formControlName","lastName","autocomplete","off","type","text",1,"form-control","form-control-sm"],[1,"position-absolute","pe-4",2,"right","50%","padding-top","6px",3,"passwordToCheck"],["id","password","placeholder","Set a password",3,"passwordChange","password","showGenerator","showLabel","isRequired"],["for","language","l10nTranslate",""],["id","language","formControlName","language",1,"form-control","form-select","form-select-sm"],[3,"ngValue"],[1,"d-flex","flex-column","col-6","pe-4"],["for","account","l10nTranslate",""],["id","account",1,"form-check","form-switch","form-check-inline"],["for","isActive",1,"form-check-label"],["formControlName","isActive","id","isActive","type","checkbox",1,"form-check-input"],["for","notification","l10nTranslate",""],["id","notification","formControlName","notification",1,"form-control","form-select","form-select-sm"],["l10nTranslate","",3,"ngValue"],["customClass","tab-dialog",3,"selectTab"],[3,"membersChange","members","withPermissions","customPlaceholder","searchFunction"],["l10nTranslate","",1,"text-danger"],[1,"modal-footer"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"disabled"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",3,"click","disabled"],[1,"me-2",3,"icon"],["l10nTranslate",""],[3,"icon"],["l10nTranslate","",1,"ms-2"],["for","created","l10nTranslate",""],["id","created"],[1,"d-flex","flex-column","align-items-end","col-6","ps-4"],["for","access","l10nTranslate",""],["id","access",1,"text-align-end"],["l10nTranslate","",1,"ms-2","me-1"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"click","disabled"]],template:function(r,t){r&1&&(n(0,"div",0)(1,"h4",1),d(2,Te,3,2)(3,Ee,3,1)(4,De,1,1,"fa-icon",2),a(),d(5,we,3,0,"h4",3),n(6,"button",4),h("click",function(){return t.layout.closeDialog()}),a()(),n(7,"div",5)(8,"tabset",6),c(9,"hr",7),n(10,"tab",8),h("selectTab",function(){return t.tabView=null}),d(11,ye,3,1,"ng-template",9),n(12,"div",10)(13,"div",11)(14,"div",12)(15,"label",13),s(16,"Login"),a(),c(17,"input",14),a(),n(18,"div",15)(19,"label",16),s(20,"Email"),a(),c(21,"input",17),a()(),n(22,"div",11)(23,"div",12)(24,"label",18),s(25,"First name"),a(),c(26,"input",19),a(),n(27,"div",15)(28,"label",20),s(29,"Last name"),a(),c(30,"input",21),a()(),n(31,"div",11)(32,"div",12),d(33,Ge,1,1,"app-password-strength-bar",22),n(34,"app-input-password",23),h("passwordChange",function(D){return t.updatePassword(D)}),a()(),n(35,"div",15)(36,"label",24),s(37,"Language"),a(),n(38,"select",25),G(39,Fe,2,2,"option",26,y),a()()(),n(41,"div",11)(42,"div",27)(43,"label",28),s(44,"Account status"),a(),n(45,"div",29)(46,"label",30),c(47,"input",31),n(48,"span"),s(49),v(50,"translate"),v(51,"titlecase"),a()()()(),n(52,"div",15)(53,"label",32),s(54,"Notification"),a(),n(55,"select",33),G(56,Ne,2,2,"option",34,y),a()()(),d(58,Ie,13,4,"div",11),a()(),n(59,"tab",35),h("selectTab",function(){return t.tabView="managers"}),d(60,ke,5,2,"ng-template",9),n(61,"div",7)(62,"app-user-search",36),h("membersChange",function(D){return t.updateManagers(D)}),a(),d(63,Pe,2,0,"small",37),a()()()(),n(64,"div",38),d(65,Le,2,1,"button",39),n(66,"button",40),h("click",function(){return t.onCancel()}),s(67,"Cancel"),a(),n(68,"button",41),h("click",function(){return t.onSubmit()}),s(69),a()()),r&2&&(o(2),f(t.guest?2:3),o(2),f(t.loading?4:-1),o(),f(t.guest?5:-1),o(),w("btn-close btn-close-white ",t.guest?"ms-2":"ms-auto"," ms-2"),o(),l("formGroup",t.guestForm),o(),l("justified",!0),o(9),C("is-invalid",t.guestForm.controls.login.invalid),l("autoSelect",!1),o(4),C("is-invalid",t.guestForm.controls.email.invalid),o(5),C("is-invalid",t.guestForm.controls.firstName.invalid),o(7),f(t.guestForm.value.password!==t.defaultPassword?33:-1),o(),l("password",t.guestForm.value.password)("showGenerator",!0)("showLabel",!0)("isRequired",!0),o(5),F(t.languages),o(9),C("text-danger",!t.guestForm.value.isActive),o(),T(" ",x(51,38,O(50,35,t.guestForm.value.isActive?"active":"suspended",t.locale.language))," "),o(7),F(t.allNotifications),o(2),f(t.guest?58:-1),o(4),l("members",t.guestForm.value.managers)("withPermissions",!1)("customPlaceholder","Type to search for managers to add")("searchFunction",t.searchMembers.bind(t)),o(),f(t.guestForm.value.managers.length?-1:63),o(2),f(t.guest!=null&&t.guest.id?65:-1),o(3),w("btn btn-sm ",t.confirmDeletion?"btn-danger":"btn-primary",""),l("disabled",t.guestForm.invalid||t.submitted),o(),T(" ",t.confirmDeletion?"Confirm deletion":"Confirm"," "))},dependencies:[Z,Y,fe,J,z,W,M,V,$,j,B,H,X,Ce,be,xe,Q,R,Se,he,_e,ve],encapsulation:2})}}return i})();export{st as a};
|
|
1
|
+
import{a as fe,b as he,c as _e,d as ve,f as xe,i as Se}from"./chunk-5JDPARJT.js";import{a as Ce,b as be}from"./chunk-2CQOSX2Q.js";import{f as ge}from"./chunk-ZZGFGD5E.js";import{J as re,K as le,Q as E,Sb as pe,ub as me,xb as ce,yb as ue,zb as de}from"./chunk-HDDBV3QQ.js";import{Ad as Q,Bb as L,Bd as Y,Bf as ae,Dc as R,Dd as Z,Eb as h,Fb as u,Gf as oe,Me as ne,Qb as s,Rb as b,Sa as o,Sb as T,Tb as N,Xa as S,Xc as V,Yc as M,_c as p,_d as ee,_f as se,ab as P,ad as j,bc as v,bd as B,cc as x,cd as q,dc as O,ed as g,fb as d,jd as H,kd as X,lb as l,ld as $,md as z,nb as C,nd as W,pa as A,pb as w,qa as I,rb as f,sb as y,tb as G,td as J,ub as F,ud as K,vb as n,ve as te,wa as k,wb as a,xb as c,xe as ie}from"./chunk-FPEGN42P.js";import{a as U}from"./chunk-GAL4ENT6.js";function Te(i,m){if(i&1&&(c(0,"fa-icon",42),n(1,"span"),s(2),a()),i&2){let e=u();l("icon",e.icons.faPen),o(2),b(e.guest.fullName)}}function Ee(i,m){if(i&1&&(c(0,"fa-icon",42),n(1,"span",43),s(2,"New guest"),a()),i&2){let e=u();l("icon",e.icons.faPlus)}}function De(i,m){if(i&1&&c(0,"fa-icon",2),i&2){let e=u();l("icon",e.icons.faSpinner)}}function we(i,m){i&1&&(n(0,"h4",3)(1,"span",43),s(2,"Edit guest"),a()())}function ye(i,m){if(i&1&&(c(0,"fa-icon",44),n(1,"span",45),s(2,"Account"),a()),i&2){let e=u();l("icon",e.icons.faAddressCard)}}function Ge(i,m){if(i&1&&c(0,"app-password-strength-bar",22),i&2){let e=u();l("passwordToCheck",e.guestForm.value.password)}}function Fe(i,m){if(i&1&&(n(0,"option",26),s(1),a()),i&2){let e=m.$implicit;l("ngValue",e),o(),b(e)}}function Ne(i,m){if(i&1&&(n(0,"option",34),s(1),a()),i&2){let e=m.$implicit,r=u();l("ngValue",r.allNotifications.indexOf(e)),o(),b(e)}}function Ue(i,m){if(i&1&&(n(0,"div"),s(1),v(2,"amDateFormat"),a(),n(3,"div"),s(4),v(5,"amDateFormat"),a()),i&2){let e=u(2);o(),N("",x(2,4,e.guest.currentAccess)," - ",e.guest.currentIp,""),o(3),N("",x(5,6,e.guest.lastAccess)," - ",e.guest.lastIp,"")}}function Ae(i,m){i&1&&(n(0,"span",37),s(1,"never"),a())}function Ie(i,m){if(i&1&&(n(0,"div",11)(1,"div",12)(2,"label",46),s(3,"Creation date"),a(),n(4,"div",47),s(5),v(6,"amDateFormat"),a()(),n(7,"div",48)(8,"label",49),s(9,"Last accesses"),a(),n(10,"div",50),d(11,Ue,6,8)(12,Ae,2,0,"span",37),a()()()),i&2){let e=u();o(5),b(x(6,2,e.guest.createdAt)),o(6),f(e.guest.lastAccess?11:12)}}function ke(i,m){if(i&1&&(c(0,"fa-icon",44),n(1,"span",51),s(2,"Managers"),a(),n(3,"span"),s(4),a()),i&2){let e=u();l("icon",e.icons.faUsersGear),o(4),T("(",e.guestForm.value.managers.length||0,")")}}function Pe(i,m){i&1&&(n(0,"small",37),s(1,"At least one manager is required"),a())}function Le(i,m){if(i&1){let e=L();n(0,"button",52),h("click",function(){A(e);let t=u();return I(t.confirmDeletion=!0)}),s(1," Remove "),a()}if(i&2){let e=u();l("disabled",e.confirmDeletion)}}var st=(()=>{class i{constructor(e,r,t){this.locale=e,this.layout=r,this.userService=t,this.guest=null,this.guestChange=new k,this.user=this.userService.user,this.icons={GROUPS:ce.GROUPS,faPlus:ae,faPen:ne,faUsersGear:se,faSpinner:oe,faAddressCard:te,faUsers:ee,faShieldHalved:ie},this.allNotifications=Object.values(E),this.defaultPassword=this.layout.translateString(ue),this.languages=this.layout.getLanguages(!0),this.submitted=!1,this.loading=!1,this.confirmDeletion=!1}ngOnInit(){this.guestForm=new q({login:new g(this.guest?.login||"",[p.required,p.pattern(re)]),email:new g(this.guest?.email||"",[p.required,p.maxLength(255),p.email]),firstName:new g(this.guest?.firstName||"",[p.required,p.maxLength(255)]),lastName:new g(this.guest?.lastName||"",p.maxLength(255)),password:new g(this.guest?this.defaultPassword:"",p.maxLength(255)),language:new g(this.guest?.language||null),notification:new g(this.guest?.notification||Object.values(E).indexOf(E.APPLICATION_EMAIL)),isActive:new g(this.guest?this.guest.isActive:!0),managers:new g(this.guest?.managers||[me(this.user)])})}updatePassword(e){this.guestForm.controls.password.setValue(e),this.guestForm.controls.password.markAsDirty()}updateManagers(e){this.guestForm.controls.managers.setValue(e),this.guestForm.controls.managers.markAsDirty(),this.guestForm.controls.managers.setErrors(e.length?null:{incorrect:!0})}searchMembers(e){let r={search:e,ignoreUserIds:this.guestForm.value.managers.map(t=>t.id),usersRole:le.USER,onlyUsers:!0};return this.userService.searchMembers(r)}onCancel(){this.confirmDeletion?this.confirmDeletion=!1:this.layout.closeDialog()}onSubmit(){if(this.submitted=!0,this.confirmDeletion)this.userService.deleteGuest(this.guest.id).subscribe({next:()=>{this.guestChange.emit(["delete",this.guest]),this.layout.sendNotification("success","Guest deleted",this.guest.login),this.layout.closeDialog()},error:e=>this.onError(e)});else if(!this.guest)this.userService.createGuest(this.makeDto(!0)).subscribe({next:e=>{this.guestChange.emit(["add",e]),this.layout.sendNotification("success","Guest created",this.guestForm.value.login),this.layout.closeDialog()},error:e=>this.onError(e)});else{let e=this.makeDto();if(!Object.keys(e).length){this.loading=!1,this.submitted=!1;return}this.userService.updateGuest(this.guest.id,e).subscribe({next:r=>{r?this.guestChange.emit(["update",r]):this.guestChange.emit(["delete",this.guest]),this.layout.sendNotification("success","Guest updated",this.guestForm.value.login),this.layout.closeDialog()},error:r=>this.onError(r)})}}makeDto(e=!1){let r={};if(e)r=U({},this.guestForm.value);else for(let t in this.guestForm.controls)this.guestForm.controls[t].dirty&&(r[t]=this.guestForm.controls[t].value);for(let t in r)switch(t){case"language":r[t]=r[t]===de?null:r[t];break;case"managers":r[t]=r[t].map(_=>_.id);break}return r}onError(e){this.layout.sendNotification("error","Guest error",this.guestForm.value.login,e),this.submitted=!1,this.confirmDeletion=!1}static{this.\u0275fac=function(r){return new(r||i)(S(K),S(pe),S(ge))}}static{this.\u0275cmp=P({type:i,selectors:[["app-user-guest-dialog"]],inputs:{guest:"guest"},outputs:{guestChange:"guestChange"},decls:70,vars:40,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],["animation","spin","size","sm",1,"ms-2",3,"icon"],[1,"modal-title","ms-auto"],["aria-label","Close","type","button",3,"click"],[1,"modal-body",3,"formGroup"],["type","pills",3,"justified"],[1,"my-3"],["customClass","tab-dialog form-validation",3,"selectTab"],["tabHeading",""],[1,"d-flex","flex-column"],[1,"d-flex","col-12","pb-3"],[1,"flex-fill","col-6","pe-4"],["for","login","l10nTranslate",""],["id","login","appAutofocus","","formControlName","login","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"autoSelect"],[1,"flex-fill","col-6","ps-4"],["for","email","l10nTranslate",""],["id","email","formControlName","email","autocomplete","off","type","email",1,"form-control","form-control-sm"],["for","firstName","l10nTranslate",""],["id","firstName","formControlName","firstName","autocomplete","off","type","text",1,"form-control","form-control-sm"],["for","lastName","l10nTranslate",""],["id","lastName","formControlName","lastName","autocomplete","off","type","text",1,"form-control","form-control-sm"],[1,"position-absolute","pe-4",2,"right","50%","padding-top","6px",3,"passwordToCheck"],["id","password","placeholder","Set a password",3,"passwordChange","password","showGenerator","showLabel","isRequired"],["for","language","l10nTranslate",""],["id","language","formControlName","language",1,"form-control","form-select","form-select-sm"],[3,"ngValue"],[1,"d-flex","flex-column","col-6","pe-4"],["for","account","l10nTranslate",""],["id","account",1,"form-check","form-switch","form-check-inline"],["for","isActive",1,"form-check-label"],["formControlName","isActive","id","isActive","type","checkbox",1,"form-check-input"],["for","notification","l10nTranslate",""],["id","notification","formControlName","notification",1,"form-control","form-select","form-select-sm"],["l10nTranslate","",3,"ngValue"],["customClass","tab-dialog",3,"selectTab"],[3,"membersChange","members","withPermissions","customPlaceholder","searchFunction"],["l10nTranslate","",1,"text-danger"],[1,"modal-footer"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"disabled"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",3,"click","disabled"],[1,"me-2",3,"icon"],["l10nTranslate",""],[3,"icon"],["l10nTranslate","",1,"ms-2"],["for","created","l10nTranslate",""],["id","created"],[1,"d-flex","flex-column","align-items-end","col-6","ps-4"],["for","access","l10nTranslate",""],["id","access",1,"text-align-end"],["l10nTranslate","",1,"ms-2","me-1"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"click","disabled"]],template:function(r,t){r&1&&(n(0,"div",0)(1,"h4",1),d(2,Te,3,2)(3,Ee,3,1)(4,De,1,1,"fa-icon",2),a(),d(5,we,3,0,"h4",3),n(6,"button",4),h("click",function(){return t.layout.closeDialog()}),a()(),n(7,"div",5)(8,"tabset",6),c(9,"hr",7),n(10,"tab",8),h("selectTab",function(){return t.tabView=null}),d(11,ye,3,1,"ng-template",9),n(12,"div",10)(13,"div",11)(14,"div",12)(15,"label",13),s(16,"Login"),a(),c(17,"input",14),a(),n(18,"div",15)(19,"label",16),s(20,"Email"),a(),c(21,"input",17),a()(),n(22,"div",11)(23,"div",12)(24,"label",18),s(25,"First name"),a(),c(26,"input",19),a(),n(27,"div",15)(28,"label",20),s(29,"Last name"),a(),c(30,"input",21),a()(),n(31,"div",11)(32,"div",12),d(33,Ge,1,1,"app-password-strength-bar",22),n(34,"app-input-password",23),h("passwordChange",function(D){return t.updatePassword(D)}),a()(),n(35,"div",15)(36,"label",24),s(37,"Language"),a(),n(38,"select",25),G(39,Fe,2,2,"option",26,y),a()()(),n(41,"div",11)(42,"div",27)(43,"label",28),s(44,"Account status"),a(),n(45,"div",29)(46,"label",30),c(47,"input",31),n(48,"span"),s(49),v(50,"translate"),v(51,"titlecase"),a()()()(),n(52,"div",15)(53,"label",32),s(54,"Notification"),a(),n(55,"select",33),G(56,Ne,2,2,"option",34,y),a()()(),d(58,Ie,13,4,"div",11),a()(),n(59,"tab",35),h("selectTab",function(){return t.tabView="managers"}),d(60,ke,5,2,"ng-template",9),n(61,"div",7)(62,"app-user-search",36),h("membersChange",function(D){return t.updateManagers(D)}),a(),d(63,Pe,2,0,"small",37),a()()()(),n(64,"div",38),d(65,Le,2,1,"button",39),n(66,"button",40),h("click",function(){return t.onCancel()}),s(67,"Cancel"),a(),n(68,"button",41),h("click",function(){return t.onSubmit()}),s(69),a()()),r&2&&(o(2),f(t.guest?2:3),o(2),f(t.loading?4:-1),o(),f(t.guest?5:-1),o(),w("btn-close btn-close-white ",t.guest?"ms-2":"ms-auto"," ms-2"),o(),l("formGroup",t.guestForm),o(),l("justified",!0),o(9),C("is-invalid",t.guestForm.controls.login.invalid),l("autoSelect",!1),o(4),C("is-invalid",t.guestForm.controls.email.invalid),o(5),C("is-invalid",t.guestForm.controls.firstName.invalid),o(7),f(t.guestForm.value.password!==t.defaultPassword?33:-1),o(),l("password",t.guestForm.value.password)("showGenerator",!0)("showLabel",!0)("isRequired",!0),o(5),F(t.languages),o(9),C("text-danger",!t.guestForm.value.isActive),o(),T(" ",x(51,38,O(50,35,t.guestForm.value.isActive?"active":"suspended",t.locale.language))," "),o(7),F(t.allNotifications),o(2),f(t.guest?58:-1),o(4),l("members",t.guestForm.value.managers)("withPermissions",!1)("customPlaceholder","Type to search for managers to add")("searchFunction",t.searchMembers.bind(t)),o(),f(t.guestForm.value.managers.length?-1:63),o(2),f(t.guest!=null&&t.guest.id?65:-1),o(3),w("btn btn-sm ",t.confirmDeletion?"btn-danger":"btn-primary",""),l("disabled",t.guestForm.invalid||t.submitted),o(),T(" ",t.confirmDeletion?"Confirm deletion":"Confirm"," "))},dependencies:[Z,Y,fe,J,z,W,M,V,$,j,B,H,X,Ce,be,xe,Q,R,Se,he,_e,ve],encapsulation:2})}}return i})();export{st as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$a as d,Fa as p,Pa as c,Ub as u,f as l,nb as C,oa as S,pa as o,pb as h,rb as k,sa as M,ta as w,tb as A,ua as r,xa as x,ya as b,za as N}from"./chunk-
|
|
1
|
+
import{$a as d,Fa as p,Pa as c,Ub as u,f as l,nb as C,oa as S,pa as o,pb as h,rb as k,sa as M,ta as w,tb as A,ua as r,xa as x,ya as b,za as N}from"./chunk-HDDBV3QQ.js";import{c as a,d as O,h as E,m as $}from"./chunk-ZZ3LHYOY.js";import{Mc as T,ca as I,ha as _,v as n}from"./chunk-FPEGN42P.js";function R(i){i.file?.id?(i.file.isDir&&(i.file.mime=i.parent?.alias?O:a),i.mimeUrl=E(i.file.mime)):i.mimeUrl=E(i.parent?.alias?O:a)}function H(i){let e,t=i.file.path?i.file.path.split("/").filter(m=>m&&m!=="."):[];if(i.parent?.id){if(!t.length)return[p.SPACES_SHARES,i.parent.alias];e=`${p.SPACES_SHARES}/${i.parent.alias}`}else i.file.space?.alias?i.file.inTrash?e=`${p.SPACES_TRASH}/${i.file.space.alias}`:(e=`${p.SPACES_FILES}/${i.file.space.alias}`,i.file.space?.root?.alias&&(t.length?e=`${e}/${i.file.space.root.alias}`:t.push(i.file.space.root.name))):i.file?.ownerId?e=`${i.file.inTrash?p.PERSONAL_TRASH:p.PERSONAL_FILES}`:console.warn("unable to find the right file path",i);let s=t.pop();return e&&t.length&&(e=`${e}/${t.join("/")}`),[e,s]}var g=class{constructor(e){this.hTimeExpirationAgo=0,this.hPerms={},this.newly=0,Object.assign(this,e),R(this),this.updatePermission(),this.updateTimes()}fallBackMimeUrl(){this.mimeUrl=$}updatePermission(){this.hPerms=h(this.link.permissions)}updateTimes(){if(this.hTimeAccessAgo=(0,l.default)(this.link.currentAccess).fromNow(!0),this.newly=d(this.link.currentAccess),this.link.expiresAt){this.link.expiresAt=new Date((0,l.default)(this.link.expiresAt).local().format("YYYY-MM-DD"));let e=Math.max(0,(0,l.default)(this.link.expiresAt).diff((0,l.default)(),"hours"));e===0?this.hTimeExpirationAgo=0:e<=24?this.hTimeExpirationAgo=1:this.hTimeExpirationAgo=Math.round(e/24)+1}else this.hTimeExpirationAgo=0}};var D=function(i){return i[i.COMMON=0]="COMMON",i[i.LINK=1]="LINK",i}(D||{}),U=Object.values(o).filter(i=>i!==o.SHARE_INSIDE).sort().join(S);var P=class{constructor(e){this.members=[],this.links=[],this.hPerms={},this.setMembers(c("members",e),e.externalPath||e.file?.isDir?[o.SHARE_INSIDE]:[]),Object.assign(this,e),R(this),this.checkFile(),this.setPermissions()}fallBackMimeUrl(){this.mimeUrl=$}setMembers(e,t){if(e)for(let s of e)s.linkId?this.links.push(new A(s,[...t,o.SHARE_OUTSIDE])):this.members.push(new A(s,t))}checkFile(){this.file&&(!this.file.path&&this.file.space.root?.name&&(this.file.path=this.file.space.root.name,this.file.name=this.file.space.root.name),this.file.permissions&&(this.file.permissions=this.file.permissions.split(S).filter(e=>e===o.SHARE_INSIDE||e===o.ADD&&this.file.id&&!this.file.isDir?!1:!(e===o.DELETE&&this.file.id&&!this.file.isDir)).join(S)))}setPermissions(){typeof this.file?.permissions=="string"?this.hPerms=h(this.file.permissions):this.externalPath&&(this.hPerms=h(U))}};var f=class{constructor(e){this.roots=[],this.managers=[],this.members=[],this.links=[],this.hPerms={},this.newly=0,this.hPerms=h(e.permissions),this.setMembers(c("members",e)),this.setRoots(c("roots",e)),Object.assign(this,e),this.hTimeAgo=(0,l.default)(this.modifiedAt).fromNow(!0),this.newly=d(this.modifiedAt),this.sort()}addRoot(e,t=!1){e.hPerms=C(e.permissions,[o.SHARE_INSIDE]),e.owner?.login&&(e.owner.avatarUrl=k(e.owner.login)),e.file.mimeUrl=E(e.file?.mime?e.file.mime:a),t?this.roots.unshift(e):this.roots.push(e),e.isDir=e.file.mime===a||!!e.externalPath}havePermission(e){return this.permissions.indexOf(e)>-1}setMembers(e){if(e)for(let t of e){let s=new A(t);s.isLink?this.links.push(s):s.spaceRole===M.IS_MANAGER?this.managers.push(s):this.members.push(s)}}setRoots(e){if(e)for(let t of e)this.addRoot(t)}sort(){u(this.roots,"createdAt",!1),u(this.managers,"createdAt",!1),u(this.members,"createdAt",!1),u(this.links,"createdAt",!1)}};var $e=(()=>{class i{constructor(t){this.http=t}listSpaces(){return this.http.get(x).pipe(n(t=>t.map(s=>new f(s))))}getSpace(t){return this.http.get(`${r.BASE}/${t}`).pipe(n(s=>new f(s)))}getUserSpaceRoots(t){return this.http.get(`${r.BASE}/${t}/${r.ROOTS}`)}createUserSpaceRoots(t,s){return this.http.post(`${r.BASE}/${t}/${r.ROOTS}`,s)}updateUserSpaceRoots(t,s){return this.http.put(`${r.BASE}/${t}/${r.ROOTS}`,s)}updateSpace(t){return this.http.put(`${r.BASE}/${t.id}`,t).pipe(n(s=>s?new f(s):null))}createSpace(t){return this.http.post(r.BASE,t).pipe(n(s=>(s.permissions=w,new f(s))))}deleteSpace(t,s){return this.http.request("delete",`${r.BASE}/${t}`,{body:s})}searchSpaces(t){return this.http.request("search",r.BASE,{body:t})}listSpaceShares(t){return this.http.get(`${r.BASE}/${t}/${r.SHARES}`)}getSpaceShare(t,s){return this.http.get(`${r.BASE}/${t}/${r.SHARES}/${s}`).pipe(n(m=>new P(m)))}updateSpaceShare(t,s){return this.http.put(`${r.BASE}/${t}/${r.SHARES}/${s.id}`,s).pipe(n(m=>new P(m)))}deleteSpaceShare(t,s){return this.http.delete(`${r.BASE}/${t}/${r.SHARES}/${s}`)}getSpaceShareLink(t,s){return this.http.get(`${r.BASE}/${t}/${r.LINKS}/${s}`).pipe(n(m=>new g(m)))}listTrashBins(){return this.http.get(b)}checkSpaceRootPath(t){return this.http.post(N,{path:t})}static{this.\u0275fac=function(s){return new(s||i)(_(T))}}static{this.\u0275prov=I({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();export{D as a,R as b,H as c,P as d,g as e,f,$e as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as pe,b as q,c as we,d as Ct}from"./chunk-MQZEETHL.js";import{b as V,c as _t}from"./chunk-NPLV4M2H.js";import{a as G,b as W,c as tt,e as dt}from"./chunk-ATFX6EIO.js";import{a as bt}from"./chunk-VBWPPICY.js";import{a as ft,b as ht,c as gt}from"./chunk-I644MKAO.js";import{a as ue,b as st,c as mt,d as pt,f as ct,i as ut}from"./chunk-3V7XYPSJ.js";import{a as Ge,b as Se,c as at,d as lt}from"./chunk-Z6IHRUVL.js";import"./chunk-ATLT5DK5.js";import{g as rt}from"./chunk-RAVRSB6R.js";import{Cb as it,Db as nt,Eb as ot,Ia as ve,K as Ze,L as $,M as et,Sb as P,cb as xe,gb as ce,tb as ye,v as je,xb as L}from"./chunk-NU3TPXFY.js";import{b as Me,d as Pe}from"./chunk-UGSGMP2I.js";import{Ad as ne,Bb as A,Bd as D,Bf as se,Dd as M,E as be,Eb as d,Ec as Z,Fb as c,Ff as Xe,L as R,Ma as z,Mb as K,Me as ae,Nb as H,Nf as me,Ob as Q,Oe as We,Qb as l,Qd as Ke,Rb as b,Sa as a,Sb as O,Tb as De,Ub as Y,Vb as J,Wb as X,Xa as y,Xc as Ve,Yc as Ue,Ye as le,_c as Re,_e as ze,ab as T,ad as B,bc as C,bd as Fe,cc as E,cd as ke,dc as S,ed as N,fb as f,fd as ee,fe as oe,jd as Ie,kd as Oe,lb as p,ld as Be,mb as Ce,md as Ne,nb as U,nd as $e,ne as He,ob as j,oe as re,pa as v,pb as Ae,pf as Ye,qa as x,qb as Ee,rb as g,re as Qe,sd as te,tb as k,td as Le,ub as I,ud as ie,vb as o,wa as F,wb as r,wf as Je,xb as u,xe as qe}from"./chunk-FPEGN42P.js";import{a as he,b as ge}from"./chunk-GAL4ENT6.js";var vt=(()=>{class i{constructor(e,n){this.layout=e,this.adminService=n,this.currentMemberIds=[],this.hasChanges=new F,this.newMembers=[],this.submitted=!1,this.icons={faUserPlus:me}}searchMembers(e){let n={search:e,onlyUsers:!0,usersRole:this.parentGroup.type===pe.USER?Ze.USER:void 0,ignoreUserIds:[...this.currentMemberIds,...this.newMembers.map(t=>t.id)]};return this.adminService.searchMembers(n)}onSubmit(){this.submitted=!0,this.adminService.addUsersToGroup(this.parentGroup.id,this.newMembers.map(e=>e.id)).subscribe({next:()=>{this.hasChanges.emit(!0),this.layout.sendNotification("success","Add members",this.newMembers.map(e=>e.name).join("<br>"),null,{enableHtml:!0}),this.layout.closeDialog()},error:e=>{this.submitted=!1,this.layout.sendNotification("error","Add members",this.newMembers.map(n=>n.name).join("<br>"),e,{enableHtml:!0})}})}static{this.\u0275fac=function(n){return new(n||i)(y(P),y(V))}}static{this.\u0275cmp=T({type:i,selectors:[["app-admin-group-add-users-dialog"]],inputs:{parentGroup:"parentGroup",currentMemberIds:"currentMemberIds"},outputs:{hasChanges:"hasChanges"},decls:16,vars:7,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],[1,"modal-title","ms-auto"],["l10nTranslate",""],["aria-label","Close","type","button",1,"btn-close","btn-close-white","ms-2",3,"click"],[1,"modal-body"],[3,"membersChange","members","withPermissions","customPlaceholder","searchFunction"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(n,t){n&1&&(o(0,"div",0)(1,"h4",1),u(2,"fa-icon",2),o(3,"span"),l(4),r()(),o(5,"h4",3)(6,"span",4),l(7,"Add members"),r()(),o(8,"button",5),d("click",function(){return t.layout.closeDialog()}),r()(),o(9,"div",6)(10,"app-user-search",7),X("membersChange",function(_){return J(t.newMembers,_)||(t.newMembers=_),_}),r()(),o(11,"div",8)(12,"button",9),d("click",function(){return t.layout.closeDialog()}),l(13,"Cancel"),r(),o(14,"button",10),d("click",function(){return t.onSubmit()}),l(15," Confirm "),r()()),n&2&&(a(2),p("icon",t.icons.faUserPlus),a(2),b(t.parentGroup.name),a(6),Y("members",t.newMembers),p("withPermissions",!1)("customPlaceholder","Type to search for users to add")("searchFunction",t.searchMembers.bind(t)),a(4),p("disabled",t.submitted||!t.newMembers.length))},dependencies:[M,D,ut],encapsulation:2})}}return i})();function Tt(i,m){if(i&1&&u(0,"img",9),i&2){let e=c();p("src",e.member.avatarUrl,z)}}function At(i,m){if(i&1&&u(0,"fa-icon",15),i&2){let e=c();j(e.member.isPersonalGroup?"circle-purple-icon":"circle-primary-icon"),p("icon",e.icons.GROUPS)}}function Et(i,m){if(i&1&&(o(0,"div",7)(1,"span",16),l(2,"from the group"),r(),o(3,"span",11),l(4),C(5,"capitalize"),r()()),i&2){let e=c();a(4),b(E(5,1,e.parentGroup.name))}}function Dt(i,m){i&1&&(o(0,"small",4),l(1,"Only the group will be deleted, the members will no longer be part of it."),r())}var xt=(()=>{class i{constructor(e,n){this.layout=e,this.adminService=n,this.wasDeleted=new F,this.submitted=!1,this.icons={GROUPS:L.GROUPS,faMinus:le,faUserMinus:re}}onSubmit(){this.submitted=!0;let e=this.member.isUser?"Remove from group":"Delete group";(this.member.isUser?this.adminService.removeUserFromGroup(this.parentGroup.id,this.member.id):this.adminService.deleteGroup(this.member.id)).subscribe({next:()=>{this.wasDeleted.emit(!0),this.layout.sendNotification("success",e,this.member.name),this.onClose()},error:t=>{this.submitted=!1,this.layout.sendNotification("error",e,this.member.name,t)}})}onClose(){this.wasDeleted.emit(!1),this.layout.closeDialog()}static{this.\u0275fac=function(n){return new(n||i)(y(P),y(V))}}static{this.\u0275cmp=T({type:i,selectors:[["app-admin-group-delete-dialog"]],inputs:{parentGroup:"parentGroup",member:"member"},outputs:{wasDeleted:"wasDeleted"},decls:26,vars:10,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],[1,"modal-title","ms-auto"],["l10nTranslate",""],["aria-label","Close","type","button",1,"btn-close","btn-close-white","ms-2",3,"click"],[1,"modal-body"],[1,"d-flex","align-items-center"],[1,"d-flex","align-items-center","avatar","me-2"],["alt","",1,"avatar-img",3,"src"],[3,"icon","class"],[1,"fw-bold","me-1"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"click","disabled"],[3,"icon"],["l10nTranslate","",1,"mx-1"]],template:function(n,t){n&1&&(o(0,"div",0)(1,"h4",1),u(2,"fa-icon",2),o(3,"span"),l(4),r()(),o(5,"h4",3)(6,"span",4),l(7),r()(),o(8,"button",5),d("click",function(){return t.onClose()}),r()(),o(9,"div",6)(10,"div",7)(11,"div",8),f(12,Tt,1,1,"img",9)(13,At,1,4,"fa-icon",10),r(),o(14,"span",11),l(15),C(16,"capitalize"),r(),o(17,"span",4),l(18,"will be removed"),r(),f(19,Et,6,3,"div",7),r(),f(20,Dt,2,0,"small",4),r(),o(21,"div",12)(22,"button",13),d("click",function(){return t.onClose()}),l(23,"Cancel"),r(),o(24,"button",14),d("click",function(){return t.onSubmit()}),l(25," Remove "),r()()),n&2&&(a(2),p("icon",t.member.isUser?t.icons.faUserMinus:t.icons.faMinus),a(2),b(t.member.name),a(3),b(t.member.isUser?"Remove from group":"Delete group"),a(5),g(t.member.isUser?12:13),a(3),b(E(16,8,t.member.name)),a(4),g(t.member.isUser?19:-1),a(),g(t.member.isGroup?20:-1),a(4),p("disabled",t.submitted))},dependencies:[M,D,dt],encapsulation:2})}}return i})();var Mt=(i,m)=>m.value;function Pt(i,m){if(i&1&&(u(0,"fa-icon",31),o(1,"span"),l(2),r()),i&2){let e=c();p("icon",e.icons.faPen),a(2),b(e.group.name)}}function Vt(i,m){if(i&1&&(u(0,"fa-icon",31),o(1,"span",23),l(2,"New group"),r()),i&2){let e=c();p("icon",e.icons.faPlus)}}function Ut(i,m){i&1&&(o(0,"h4",2)(1,"span",23),l(2,"Edit group"),r()())}function Rt(i,m){if(i&1&&(u(0,"fa-icon",32),o(1,"span",33),l(2,"Settings"),r()),i&2){let e=c();p("icon",e.icons.faCog)}}function Ft(i,m){if(i&1&&(o(0,"option",21),l(1),r()),i&2){let e=m.$implicit;p("ngValue",e.value),a(),b(e.key)}}function kt(i,m){i&1&&(o(0,"span",23),l(1,"All users can see this group."),r())}function It(i,m){i&1&&(o(0,"span",23),l(1,"Users who are not members of this group cannot see it."),r())}function Ot(i,m){i&1&&(o(0,"span",23),l(1,"The group is not visible, its members cannot see it and cannot see each other."),r())}function Bt(i,m){if(i&1&&(o(0,"div",24)(1,"div",18)(2,"label",34),l(3,"Creation date"),r(),o(4,"div",35),l(5),C(6,"amDateFormat"),r()(),o(7,"div",36)(8,"label",37),l(9,"Modification date"),r(),o(10,"div",38),l(11),C(12,"amDateFormat"),r()()()),i&2){let e=c();a(5),b(E(6,2,e.group.createdAt)),a(6),b(E(12,4,e.group.modifiedAt))}}function Nt(i,m){if(i&1&&(u(0,"fa-icon",32),o(1,"span",33),l(2,"Permissions"),r()),i&2){let e=c();p("icon",e.icons.faShieldHalved)}}var Te=(()=>{class i{constructor(e,n,t){this.locale=e,this.layout=n,this.adminService=t,this.group=null,this.parentGroup=null,this.groupChange=new F,this.icons={GROUPS:L.GROUPS,faPen:ae,faPlus:se,faCog:ze,faShieldHalved:qe},this.submitted=!1,this.originalOrderKeyValue=ce,this.allVisibilities={Visible:q.VISIBLE,Private:q.PRIVATE,Isolated:q.ISOLATED}}ngOnInit(){this.groupForm=new ke({name:new N(this.group?.name||"",Re.required),description:new N(this.group?.description||""),visibility:new N(this.group?.visibility||q.VISIBLE),applications:new N(this.group?.applications||[]),parent:new N(this.parentGroup)})}updateApplications(e){this.groupForm.controls.applications.setValue(e),this.groupForm.controls.applications.markAsDirty()}onSetParent(e){this.groupForm.controls.parent.setValue(e?{id:e.id,name:e.name}:null),this.groupForm.controls.parent.markAsDirty()}searchGroups(e){let n={search:e,onlyGroups:!0,excludePersonalGroups:!0,ignoreGroupIds:this.groupForm.value.parent?[this.groupForm.value.parent.id]:[]};return this.adminService.searchMembers(n,!0)}onSubmit(){if(this.submitted=!0,this.group?.id){let e=this.makeDto();this.adminService.updateGroup(this.group.id,e).subscribe({next:n=>{this.groupChange.emit(["update",n]),this.layout.sendNotification("success","Group updated",this.groupForm.value.name),this.layout.closeDialog()},error:n=>this.onError(n)})}else{let e=this.makeDto(!0);this.adminService.createGroup(e).subscribe({next:n=>{this.groupChange.emit(["add",n]),this.layout.sendNotification("success","Group created",this.groupForm.value.name),this.layout.closeDialog()},error:n=>this.onError(n)})}}makeDto(e=!1){let n;e?n=Object.fromEntries(Object.keys(this.groupForm.controls).map(t=>[t,this.groupForm.controls[t].value])):n=Object.fromEntries(Object.keys(this.groupForm.controls).filter(t=>this.groupForm.controls[t].dirty).map(t=>[t,this.groupForm.controls[t].value]));for(let t in n)switch(t){case"applications":n.permissions=n[t].join(et),delete n.applications;break;case"parent":n.parentId=n[t]?n[t].id:null,delete n.parent;break}return n}onError(e){this.layout.sendNotification("error","Group error",this.groupForm.value.name,e),this.submitted=!1}static{this.\u0275fac=function(n){return new(n||i)(y(ie),y(P),y(V))}}static{this.\u0275cmp=T({type:i,selectors:[["app-admin-group-dialog"]],inputs:{group:"group",parentGroup:"parentGroup"},outputs:{groupChange:"groupChange"},decls:50,vars:24,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"modal-title","ms-auto"],["aria-label","Close","type","button",3,"click"],[1,"modal-body","form-validation",3,"formGroup"],["type","pills",3,"justified"],[1,"my-3"],["customClass","tab-dialog form-validation",3,"selectTab"],["tabHeading",""],[1,"d-flex","flex-column"],[1,"d-flex","col-12","pb-3"],[1,"flex-fill","col-6","pe-4"],["for","name","l10nTranslate",""],["id","name","appAutofocus","","formControlName","name","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"autoSelect"],[1,"flex-fill","col-6","ps-4"],["for","description","l10nTranslate",""],["id","description","formControlName","description","autocomplete","off","type","text",1,"form-control","form-control-sm"],[1,"d-flex","flex-column","align-items-start","col-12","pb-3"],[1,"col-6","pe-4"],["for","visibility","l10nTranslate",""],["id","visibility","formControlName","visibility",1,"form-control","form-select","form-select-sm"],["l10nTranslate","",3,"ngValue"],[1,"d-none","d-sm-block","fst-italic","fs-xxs"],["l10nTranslate",""],[1,"d-flex","align-items-start","col-12","pb-3"],["for","parent","translate",""],["id","parent",3,"data","searchFunction","active","itemIcon","placeholder"],[3,"permissionsChange","permissions"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"],[1,"me-2",3,"icon"],[3,"icon"],["l10nTranslate","",1,"ms-2"],["for","created","l10nTranslate",""],["id","created"],[1,"d-flex","flex-column","align-items-end","col-6","ps-4"],["for","modified","l10nTranslate",""],["id","modified"]],template:function(n,t){if(n&1&&(o(0,"div",0)(1,"h4",1),f(2,Pt,3,2)(3,Vt,3,1),r(),f(4,Ut,3,0,"h4",2),o(5,"button",3),d("click",function(){return t.layout.closeDialog()}),r()(),o(6,"div",4)(7,"tabset",5),u(8,"hr",6),o(9,"tab",7),d("selectTab",function(){return t.tabView=null}),f(10,Rt,3,1,"ng-template",8),o(11,"div",9)(12,"div",10)(13,"div",11)(14,"label",12),l(15,"Name"),r(),u(16,"input",13),r(),o(17,"div",14)(18,"label",15),l(19,"Description"),r(),u(20,"input",16),r()(),o(21,"div",17)(22,"div",18)(23,"label",19),l(24,"Visibility"),r(),o(25,"select",20),k(26,Ft,2,2,"option",21,Mt),C(28,"keyvalue"),r()(),o(29,"div",22),f(30,kt,2,0,"span",23)(31,It,2,0,"span",23)(32,Ot,2,0,"span",23),r()(),o(33,"div",24)(34,"div",18)(35,"label",25),l(36,"Parent group"),r(),o(37,"app-select",26),C(38,"translate"),d("data",function(_){return t.onSetParent(_)}),r()()(),f(39,Bt,13,6,"div",24),r()(),o(40,"tab",7),d("selectTab",function(){return t.tabView="permissions"}),f(41,Nt,3,1,"ng-template",8),o(42,"div",9)(43,"div",10)(44,"app-admin-permissions",27),d("permissionsChange",function(_){return t.updateApplications(_)}),r()()()()()(),o(45,"div",28)(46,"button",29),d("click",function(){return t.layout.closeDialog()}),l(47,"Cancel"),r(),o(48,"button",30),d("click",function(){return t.onSubmit()}),l(49," Confirm "),r()()),n&2){let s;a(2),g(t.group?2:3),a(2),g(t.group?4:-1),a(),Ae("btn-close btn-close-white ",t.group?"ms-2":"ms-auto"," ms-2"),a(),p("formGroup",t.groupForm),a(),p("justified",!0),a(9),U("is-invalid",t.groupForm.controls.name.invalid),p("autoSelect",!1),a(10),I(S(28,18,t.allVisibilities,t.originalOrderKeyValue)),a(4),g((s=t.groupForm.value.visibility)===t.allVisibilities.Visible?30:s===t.allVisibilities.Private?31:s===t.allVisibilities.Isolated?32:-1),a(7),p("searchFunction",t.searchGroups.bind(t))("active",t.groupForm.value.parent)("itemIcon",t.icons.GROUPS)("placeholder",S(38,21,"Select the parent group",t.locale.language)),a(2),g(t.group?39:-1),a(5),p("permissions",t.groupForm.value.applications),a(4),p("disabled",t.submitted||t.groupForm.invalid)}},dependencies:[M,D,Le,Ne,$e,Ue,Be,B,Fe,Ie,Oe,ct,_t,Z,Ct,ne,ue,mt,pt,st],encapsulation:2})}}return i})();var Gt=(()=>{class i{constructor(e,n){this.layout=e,this.adminService=n,this.submitted=!1,this.isManager=!1,this.USER_GROUP_ROLE=$,this.icons={faUserPen:Qe,faKey:oe}}ngOnInit(){this.isManager=this.user.isGroupManager}onSubmit(){if(this.submitted=!0,this.user.isGroupManager===this.isManager){this.layout.closeDialog();return}let e=this.isManager?$.MANAGER:$.MEMBER;this.adminService.updateUserFromGroup(this.parentGroup.id,this.user.id,{role:e}).subscribe({next:()=>{this.user.setGroupRole(e),this.layout.sendNotification("success","Edit user",this.user.name),this.layout.closeDialog()},error:n=>{this.submitted=!1,this.layout.sendNotification("error","Edit user",this.user.name,n)}})}static{this.\u0275fac=function(n){return new(n||i)(y(P),y(V))}}static{this.\u0275cmp=T({type:i,selectors:[["app-admin-group-edit-user-dialog"]],inputs:{parentGroup:"parentGroup",user:"user"},decls:25,vars:5,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],[1,"modal-title","ms-auto"],["l10nTranslate",""],["aria-label","Close","type","button",1,"btn-close","btn-close-white","ms-2",3,"click"],[1,"modal-body"],[1,"d-flex","align-items-center"],[1,"form-check","form-switch","form-check-inline"],[1,"d-flex"],[1,"form-check-label"],["type","checkbox",1,"form-check-input",3,"ngModelChange","ngModel"],[1,"ms-1",3,"icon"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(n,t){n&1&&(o(0,"div",0)(1,"h4",1),u(2,"fa-icon",2),o(3,"span"),l(4),r()(),o(5,"h4",3)(6,"span",4),l(7,"Edit user"),r()(),o(8,"button",5),d("click",function(){return t.layout.closeDialog()}),r()(),o(9,"div",6)(10,"div",7)(11,"div",8)(12,"div",9)(13,"label",10)(14,"input",11),X("ngModelChange",function(_){return J(t.isManager,_)||(t.isManager=_),_}),r(),o(15,"span",4),l(16,"Set as group manager"),r(),u(17,"fa-icon",12),r()()()(),o(18,"small",4),l(19,"As a manager, the user will be able to manage group members but not group properties."),r()(),o(20,"div",13)(21,"button",14),d("click",function(){return t.layout.closeDialog()}),l(22,"Cancel"),r(),o(23,"button",15),d("click",function(){return t.onSubmit()}),l(24," Confirm "),r()()),n&2&&(a(2),p("icon",t.icons.faUserPen),a(2),b(t.user.name),a(10),Y("ngModel",t.isManager),a(3),p("icon",t.icons.faKey),a(6),p("disabled",t.submitted))},dependencies:[M,D,te,Ve,B,ee],encapsulation:2})}}return i})();var $t=["MainContextMenu"],Lt=["TargetContextMenu"],St=(i,m)=>m.key,jt=(i,m)=>m.mid;function Kt(i,m){if(i&1){let e=A();o(0,"ul",26)(1,"li",27)(2,"a",28),d("click",function(){v(e);let t=c();return x(t.openDialog(!0))}),o(3,"span",14),u(4,"fa-icon",7),l(5),r()()(),o(6,"li",27)(7,"a",28),d("click",function(){v(e);let t=c();return x(t.addUserToGroupDialog())}),o(8,"span",14),u(9,"fa-icon",7),l(10,"Add members"),r()()()()}if(i&2){let e=c();a(2),U("disabled",!!e.currentGroup&&e.personalGroupsView),a(2),p("icon",e.icons.GROUPS),a(),O(" ",e.personalGroupsView?"Personal group":"Group",""),a(2),U("disabled",!e.currentGroup),a(2),p("icon",e.icons.faUserPlus)}}function Ht(i,m){if(i&1&&u(0,"fa-icon",31),i&2){let e=c(3);p("icon",e.sortTable.sortParam.asc?e.icons.faArrowDown:e.icons.faArrowUp)("fixedWidth",!1)}}function Qt(i,m){if(i&1){let e=A();o(0,"th",30),d("click",function(){v(e);let t=c().$implicit,s=c();return x(s.sortBy(t.key))}),l(1),f(2,Ht,1,2,"fa-icon",31),r()}if(i&2){let e=c().$implicit,n=c();j(e.value.class),Ce("width",e.value.width,"%"),U("text-align-center",e.value.textCenter)("cursor-pointer",e.value.sortable),a(),O(" ",e.value.label," "),a(),g(n.sortTable.sortParam.column===e.key?2:-1)}}function qt(i,m){if(i&1&&f(0,Qt,3,11,"th",29),i&2){let e=m.$implicit;g(e.value.show?0:-1)}}function Wt(i,m){if(i&1&&u(0,"img",36),i&2){let e=c(4).$implicit;p("src",e.avatarUrl,z)}}function zt(i,m){if(i&1&&u(0,"fa-icon",7),i&2){let e=c(4).$implicit,n=c();j(e.isPersonalGroup?"circle-purple-icon":"circle-primary-icon"),p("icon",n.icons.GROUPS)}}function Yt(i,m){if(i&1&&u(0,"fa-icon",39),i&2){let e=c(5);p("icon",e.icons.faKey)}}function Jt(i,m){if(i&1&&(o(0,"div",34),f(1,Wt,1,1,"img",36)(2,zt,1,4,"fa-icon",37),o(3,"div",35)(4,"span",38),l(5),f(6,Yt,1,1,"fa-icon",39),r(),o(7,"span",40),l(8),r()()()),i&2){let e=c(3).$implicit;a(),g(e.isUser?1:2),a(4),O(" ",e.name," "),a(),g(e.isUser&&e.isGroupManager?6:-1),a(2),b(e.description)}}function Xt(i,m){if(i&1&&(o(0,"span"),l(1),C(2,"joinCounts"),r()),i&2){let e=c(4).$implicit;a(),b(E(2,1,e.counts))}}function Zt(i,m){if(i&1&&f(0,Xt,3,3,"span"),i&2){let e=c(3).$implicit;g(e.isGroup?0:-1)}}function ei(i,m){i&1&&(o(0,"span",14),l(1,"manager"),r())}function ti(i,m){if(i&1&&(o(0,"span",14),l(1),r()),i&2){let e=c(4).$implicit;a(),b(e.type)}}function ii(i,m){if(i&1&&f(0,ei,2,0,"span",14)(1,ti,2,1,"span",14),i&2){let e=c(3).$implicit;g(e.isUser&&e.isGroupManager?0:1)}}function ni(i,m){if(i&1&&(o(0,"div"),l(1),C(2,"amDateFormat"),r()),i&2){let e=c(4).$implicit;a(),b(E(2,1,e.modifiedAt))}}function oi(i,m){if(i&1&&(o(0,"div",35)(1,"div"),l(2),C(3,"amDateFormat"),r(),f(4,ni,3,3,"div"),r()),i&2){let e=c(3).$implicit;a(2),b(E(3,2,e.createdAt)),a(2),g(e.modifiedAt?4:-1)}}function ri(i,m){if(i&1&&(o(0,"td"),f(1,Jt,9,4,"div",34)(2,Zt,1,1)(3,ii,2,1)(4,oi,5,4,"div",35),r()),i&2){let e,n=c().$implicit,t=c().$implicit;Ee("",n.value.class," ",n.value.newly?"prop-newly-"+t[n.value.newly]:"",""),Ce("width",n.value.width,"%"),U("text-align-center",n.value.textCenter),a(),g((e=n.key)==="name"?1:e==="members"?2:e==="type"?3:e==="createdAndModified"?4:-1)}}function ai(i,m){if(i&1&&f(0,ri,5,9,"td",33),i&2){let e=m.$implicit;g(e.value.show?0:-1)}}function li(i,m){if(i&1){let e=A();o(0,"tr",32),d("click",function(){let t=v(e).$implicit,s=c();return x(s.onSelect(t))})("contextmenu",function(t){let s=v(e).$implicit,_=c();return x(_.onTargetContextMenu(t,s))})("pressup",function(t){let s=v(e).$implicit,_=c();return x(_.onTargetContextMenu(t,s))})("tap",function(){let t=v(e).$implicit,s=c();return x(s.browse(t))}),k(1,ai,1,1,null,null,St),C(3,"keyvalue"),r()}if(i&2){let e=m.$implicit,n=c();U("selected",e.mid===(n.selected==null?null:n.selected.mid)),a(),I(S(3,2,n.tableHeaders,n.originalOrderKeyValue))}}function si(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2),r()),i&2){let e=c(2);a(),p("icon",e.icons.faPlus),a(),O(" ",e.personalGroupsView?"Personal group":"Group","")}}function mi(i,m){if(i&1){let e=A();f(0,si,3,2,"ng-template",25),d("execute",function(){v(e);let t=c();return x(t.openDialog(!0))})}}function pi(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2,"Add members"),r()),i&2){let e=c(2);a(),p("icon",e.icons.faUserPlus)}}function ci(i,m){if(i&1){let e=A();f(0,pi,3,1,"ng-template",25),d("execute",function(){v(e);let t=c();return x(t.addUserToGroupDialog())})}}function ui(i,m){}function di(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2,"Refresh"),r()),i&2){let e=c();a(),p("icon",e.icons.faArrowRotateRight)}}function _i(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2),r()),i&2){let e=c(2);a(),p("icon",e.icons.faPen),a(),O(" ",e.selected.isGroup?"Edit group":"Edit user","")}}function fi(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2,"Delete group"),r()),i&2){let e=c(3);a(),p("icon",e.icons.faMinus)}}function hi(i,m){if(i&1){let e=A();f(0,fi,3,1,"ng-template",25),d("execute",function(){v(e);let t=c(2);return x(t.openDialog(!1,!0))})}}function gi(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2,"Remove from group"),r()),i&2){let e=c(3);a(),p("icon",e.icons.faUserMinus)}}function bi(i,m){if(i&1){let e=A();f(0,gi,3,1,"ng-template",25),d("execute",function(){v(e);let t=c(2);return x(t.openDialog(!1,!0))})}}function Ci(i,m){if(i&1){let e=A();f(0,_i,3,2,"ng-template",25),d("execute",function(){v(e);let t=c();return x(t.openDialog())}),f(1,hi,1,0,null,23)(2,bi,1,0,null,23)}if(i&2){let e=c();a(),g(e.selected.isGroup?1:2)}}var Kn=(()=>{class i{constructor(e,n,t,s,_){this.locale=e,this.router=n,this.activatedRoute=t,this.layout=s,this.adminService=_,this.originalOrderKeyValue=ce,this.icons={GROUPS:L.GROUPS,faRotate:Xe,faPlus:se,faMinus:le,faPen:ae,faArrowDown:Ye,faArrowUp:Je,faKey:oe,faUserPlus:me,faUserMinus:re,faArrowRotateRight:We,faToggleOn:He,faToggleOff:Ke},this.tableHeaders={name:{label:"Name",width:30,textCenter:!1,class:"",show:!0,sortable:!0},type:{label:"Type",width:10,textCenter:!0,class:"",show:!0,sortable:!0},members:{label:"Members",width:10,class:"",textCenter:!0,show:!0},createdAndModified:{label:"Created & Modified",width:12,textCenter:!0,class:"d-none d-lg-table-cell",newly:"newly",show:!0,sortable:!0}},this.sortSettings={default:[{prop:"name",type:"string"}],name:[{prop:"name",type:"string"}],type:[{prop:"type",type:"string"}],createdAndModified:[{prop:"modifiedAt",type:"date"},{prop:"createdAt",type:"date"}]},this.sortTable=new lt(this.constructor.name,this.sortSettings),this.personalGroupsView=!1,this.loading=!1,this.selected=null,this.members=[],this.activatedRoute.data.subscribe(h=>{this.personalGroupsView=h.type===pe.PERSONAL,this.setEnv(h.routes)}),this.activatedRoute.queryParams.subscribe(h=>this.focusOnSelect=h.select),this.layout.setBreadcrumbIcon(tt.GROUPS)}setEnv(e){let n;e.length?(n=e[e.length-1].path,this.layout.setBreadcrumbNav({url:this.personalGroupsView?`/${G.BASE}/${G.PGROUPS}${xe(e)}`:`/${G.BASE}/${G.GROUPS}${xe(e)}`,firstLink:`/${G.BASE}/${G.GROUPS}`,splicing:1,translating:!0,sameLink:!1,mutateLevel:{0:{setTitle:this.personalGroupsView?W.PGROUPS:W.GROUPS,translateTitle:!0}}})):this.layout.setBreadcrumbNav({url:this.personalGroupsView?`/${G.BASE}/${G.PGROUPS}/${W.PGROUPS}`:`/${G.BASE}/${G.GROUPS}/${W.GROUPS}`,splicing:2,translating:!0,sameLink:!0}),this.loadGroups(n)}onPersonalGroupsView(e){this.personalGroupsView=e,this.router.navigate([G.BASE,e?G.PGROUPS:G.GROUPS]).catch(n=>console.error(n))}refresh(){this.loadGroups(this.currentGroup?.name)}loadGroups(e){this.loading=!0,this.onSelect(),this.adminService.browseGroup(e,this.personalGroupsView).subscribe({next:n=>{this.currentGroup=n.parentGroup,this.sortBy(this.sortTable.sortParam.column,!1,n.members),this.focusOnSelect?this.focusOn(this.focusOnSelect):this.scrollView.scrollInto(-1),this.loading=!1},error:n=>{this.members=[],this.layout.sendNotification("error","Groups",n.error.message),this.onSelect(),this.loading=!1}})}browse(e){e.isGroup&&this.router.navigate([e.name],{relativeTo:this.activatedRoute}).catch(n=>console.error(n))}onSelect(e=null){this.selected=e}onContextMenu(e){e.preventDefault(),e.stopPropagation(),this.layout.openContextMenu(e,this.mainContextMenu)}onTargetContextMenu(e,n){e.preventDefault(),e.type==="contextmenu"&&e.stopPropagation(),this.onSelect(n),this.layout.openContextMenu(e,this.targetContextMenu)}sortBy(e,n=!0,t){this.members=this.sortTable.sortBy(e,n,t||this.members)}addUserToGroupDialog(){this.layout.openDialog(vt,"md",{initialState:{parentGroup:this.currentGroup,currentMemberIds:this.members.filter(n=>n.isUser).map(n=>n.id)}}).content.hasChanges.pipe(be(n=>n),R(1)).subscribe(()=>this.refresh())}openDialog(e=!1,n=!1){e?this.personalGroupsView?this.layout.openDialog(we,"md").content.groupChange.pipe(R(1)).subscribe(s=>{let[_,h]=s;_==="add"&&(h.setGroupRole($.MANAGER),h.counts={users:1},this.sortBy(this.sortTable.sortParam.column,!1,this.members.concat(h)),this.onSelect(h))}):this.layout.openDialog(Te,"md",{initialState:{parentGroup:this.currentGroup}}).content.groupChange.pipe(R(1)).subscribe(s=>{let[_,h]=s;if(_==="add")if(!this.currentGroup&&!h?.parent||h.parent.id===this.currentGroup.id){let w=new ye(ge(he({},h),{type:ve.GROUP}));this.sortBy(this.sortTable.sortParam.column,!1,this.members.concat(new ye(ge(he({},h),{type:ve.GROUP})))),this.onSelect(w)}else this.router.navigate([`${G.BASE}/${G.GROUPS}`,h.parent?.id?h.parent.name:""],{queryParams:{select:h.name}}).catch(w=>console.error(w))}):n?this.layout.openDialog(xt,"md",{initialState:{parentGroup:this.currentGroup,member:this.selected}}).content.wasDeleted.pipe(be(s=>s),R(1)).subscribe(()=>{this.currentGroup?this.selected.counts?.groups?this.loadGroups(this.currentGroup.name):(this.sortBy(this.sortTable.sortParam.column,!1,this.members.filter(s=>this.selected.mid!==s.mid)),this.onSelect()):this.loadGroups()}):this.selected.isGroup?this.personalGroupsView?this.layout.openDialog(we,"md",{initialState:{originalGroup:this.selected}}).content.groupChange.pipe(R(1)).subscribe(s=>{let[_,h]=s;_==="update"&&(this.selected=Object.assign(this.selected,{name:h.name,description:h.description,modifiedAt:h.modifiedAt}))}):this.adminService.getGroup(this.selected.id).subscribe({next:t=>{this.layout.openDialog(Te,"md",{initialState:{group:t,parentGroup:this.currentGroup}}).content.groupChange.pipe(R(1)).subscribe(_=>{let[h,w]=_;h==="update"&&(!this.currentGroup&&!w?.parent||w.parent.id===this.currentGroup.id?this.selected=Object.assign(this.selected,w):this.router.navigate([`${G.BASE}/${G.GROUPS}`,w.parent?.id?w.parent.name:""],{queryParams:{select:w.name}}).catch(wt=>console.error(wt)))})},error:t=>this.layout.sendNotification("error","Edit group",this.selected.name,t)}):this.layout.openDialog(Gt,"md",{initialState:{user:this.selected,parentGroup:this.currentGroup}})}focusOn(e){let n=this.members.find(t=>t.name===e);n&&(setTimeout(()=>this.scrollView.scrollInto(n),100),this.onSelect(n))}static{this.\u0275fac=function(n){return new(n||i)(y(ie),y(Pe),y(Me),y(P),y(V))}}static{this.\u0275cmp=T({type:i,selectors:[["app-admin-groups"]],viewQuery:function(n,t){if(n&1&&(K(Se,5),K(Ge,7),K($t,7),K(Lt,7)),n&2){let s;H(s=Q())&&(t.scrollView=s.first),H(s=Q())&&(t.inputFilter=s.first),H(s=Q())&&(t.mainContextMenu=s.first),H(s=Q())&&(t.targetContextMenu=s.first)}},decls:48,vars:42,consts:[["MainContextMenu",""],["TargetContextMenu",""],[1,"app-top-menu"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","tooltip"],[3,"icon","animation"],["dropdown","",1,"btn-group","btn-group-sm","me-1"],["dropdownToggle","","container","body","type","button",1,"btn","btn-sm","btn-secondary","dropdown-toggle",3,"tooltip"],[3,"icon"],["class","dropdown-menu","role","menu",4,"dropdownMenu"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","disabled","tooltip"],[1,"ms-auto"],["btnCheckbox","","type","button",1,"btn","btn-sm","btn-custom","me-1",3,"ngModelChange","ngModel"],[1,"d-flex","align-items-center"],[1,"me-2",3,"icon"],["l10nTranslate",""],[1,"btn-group","btn-group-sm"],[1,"d-none","d-sm-block"],[1,"app-table"],[3,"contextmenu","bufferAmount","items"],["tabindex","-1"],[3,"selected"],[1,"app-foot-menu"],[1,"mx-auto"],["contextMenuItem",""],["contextMenuItem","",3,"divider"],["contextMenuItem","",3,"execute"],["role","menu",1,"dropdown-menu"],["role","menuitem"],[1,"dropdown-item",3,"click"],["l10nTranslate","",3,"width","text-align-center","cursor-pointer","class"],["l10nTranslate","",3,"click"],[3,"icon","fixedWidth"],[3,"click","contextmenu","pressup","tap"],[3,"width","text-align-center","class"],[1,"d-flex","align-items-center","avatar"],[1,"d-flex","flex-column"],["alt","",1,"avatar-img",3,"src"],[3,"icon","class"],["draggable","false",1,"no-pointer-events"],[1,"m-0",3,"icon"],["draggable","false",1,"no-pointer-events","text-muted","fs-xxxs"]],template:function(n,t){if(n&1){let s=A();o(0,"div",2)(1,"button",3),C(2,"translate"),d("click",function(){return v(s),x(t.refresh())}),u(3,"fa-icon",4),r(),o(4,"div",5)(5,"button",6),C(6,"translate"),u(7,"fa-icon",7),r(),f(8,Kt,11,7,"ul",8),r(),o(9,"button",9),C(10,"translate"),d("click",function(){return v(s),x(t.openDialog(!1,!0))}),u(11,"fa-icon",7),r(),o(12,"button",9),C(13,"translate"),d("click",function(){return v(s),x(t.openDialog())}),u(14,"fa-icon",7),r(),o(15,"div",10)(16,"button",11),d("ngModelChange",function(h){return v(s),x(t.onPersonalGroupsView(h))}),o(17,"div",12),u(18,"fa-icon",13),o(19,"span",14),l(20,"Personal groups"),r()()(),o(21,"div",15),u(22,"app-input-filter",16),r()()(),o(23,"table",17)(24,"thead")(25,"tr"),k(26,qt,1,1,null,null,St),C(28,"keyvalue"),r()()(),o(29,"app-virtual-scroll",18),C(30,"searchFilter"),d("contextmenu",function(h){return v(s),x(t.onContextMenu(h))}),o(31,"table",17)(32,"tbody",19),k(33,li,4,5,"tr",20,jt),r()()(),o(35,"div",21)(36,"span",22),l(37),C(38,"translate"),r()(),o(39,"context-menu",null,0),f(41,mi,1,0,null,23)(42,ci,1,0,null,23)(43,ui,0,0,"ng-template",24)(44,di,3,1,"ng-template",25),d("execute",function(){return v(s),x(t.refresh())}),r(),o(45,"context-menu",null,1),f(47,Ci,3,1),r()}n&2&&(a(),p("tooltip",S(2,21,"Refresh",t.locale.language)),a(2),p("icon",t.icons.faRotate)("animation",t.loading?"spin":null),a(2),p("tooltip",S(6,24,"New",t.locale.language)),a(2),p("icon",t.icons.faPlus),a(2),p("disabled",!t.selected)("tooltip",S(10,27,t.selected!=null&&t.selected.isUser?"Remove from group":"Delete group",t.locale.language)),a(2),p("icon",t.icons.faMinus),a(),p("disabled",!t.selected)("tooltip",S(13,30,t.selected!=null&&t.selected.isGroup?"Edit group":"Edit user",t.locale.language)),a(2),p("icon",t.icons.faPen),a(2),p("ngModel",t.personalGroupsView),a(2),p("icon",t.personalGroupsView?t.icons.faToggleOn:t.icons.faToggleOff),a(8),I(S(28,33,t.tableHeaders,t.originalOrderKeyValue)),a(3),p("bufferAmount",5)("items",S(30,36,t.members,t.inputFilter.search())),a(4),I(t.scrollView==null?null:t.scrollView.viewPortItems),a(4),De("",t.members.length," ",S(38,39,"groups",t.locale.language),""),a(4),g(t.currentGroup&&!t.personalGroupsView||!t.currentGroup&&t.personalGroupsView?41:-1),a(),g(t.currentGroup?42:-1),a(),p("divider",!0),a(4),g(t.selected?47:-1))},dependencies:[ot,nt,it,M,Z,D,ne,Ge,at,Se,je,bt,ue,ft,gt,ht,rt,te,B,ee],encapsulation:2})}}return i})();export{Kn as AdminGroupsComponent};
|
|
1
|
+
import{a as pe,b as q,c as we,d as Ct}from"./chunk-NCIAR3N4.js";import{b as V,c as _t}from"./chunk-CTWOQLAR.js";import{a as G,b as W,c as tt,e as dt}from"./chunk-GI2LXVWQ.js";import{a as bt}from"./chunk-VBWPPICY.js";import{a as ft,b as ht,c as gt}from"./chunk-HQC3W7BS.js";import{a as ue,b as st,c as mt,d as pt,f as ct,i as ut}from"./chunk-5JDPARJT.js";import{a as Ge,b as Se,c as at,d as lt}from"./chunk-WA3LPP4G.js";import"./chunk-Y6IYSEKU.js";import{g as rt}from"./chunk-ZZGFGD5E.js";import{Cb as it,Db as nt,Eb as ot,Ia as ve,K as Ze,L as $,M as et,Sb as P,cb as xe,gb as ce,tb as ye,v as je,xb as L}from"./chunk-HDDBV3QQ.js";import{b as Me,d as Pe}from"./chunk-UGSGMP2I.js";import{Ad as ne,Bb as A,Bd as D,Bf as se,Dd as M,E as be,Eb as d,Ec as Z,Fb as c,Ff as Xe,L as R,Ma as z,Mb as K,Me as ae,Nb as H,Nf as me,Ob as Q,Oe as We,Qb as l,Qd as Ke,Rb as b,Sa as a,Sb as O,Tb as De,Ub as Y,Vb as J,Wb as X,Xa as y,Xc as Ve,Yc as Ue,Ye as le,_c as Re,_e as ze,ab as T,ad as B,bc as C,bd as Fe,cc as E,cd as ke,dc as S,ed as N,fb as f,fd as ee,fe as oe,jd as Ie,kd as Oe,lb as p,ld as Be,mb as Ce,md as Ne,nb as U,nd as $e,ne as He,ob as j,oe as re,pa as v,pb as Ae,pf as Ye,qa as x,qb as Ee,rb as g,re as Qe,sd as te,tb as k,td as Le,ub as I,ud as ie,vb as o,wa as F,wb as r,wf as Je,xb as u,xe as qe}from"./chunk-FPEGN42P.js";import{a as he,b as ge}from"./chunk-GAL4ENT6.js";var vt=(()=>{class i{constructor(e,n){this.layout=e,this.adminService=n,this.currentMemberIds=[],this.hasChanges=new F,this.newMembers=[],this.submitted=!1,this.icons={faUserPlus:me}}searchMembers(e){let n={search:e,onlyUsers:!0,usersRole:this.parentGroup.type===pe.USER?Ze.USER:void 0,ignoreUserIds:[...this.currentMemberIds,...this.newMembers.map(t=>t.id)]};return this.adminService.searchMembers(n)}onSubmit(){this.submitted=!0,this.adminService.addUsersToGroup(this.parentGroup.id,this.newMembers.map(e=>e.id)).subscribe({next:()=>{this.hasChanges.emit(!0),this.layout.sendNotification("success","Add members",this.newMembers.map(e=>e.name).join("<br>"),null,{enableHtml:!0}),this.layout.closeDialog()},error:e=>{this.submitted=!1,this.layout.sendNotification("error","Add members",this.newMembers.map(n=>n.name).join("<br>"),e,{enableHtml:!0})}})}static{this.\u0275fac=function(n){return new(n||i)(y(P),y(V))}}static{this.\u0275cmp=T({type:i,selectors:[["app-admin-group-add-users-dialog"]],inputs:{parentGroup:"parentGroup",currentMemberIds:"currentMemberIds"},outputs:{hasChanges:"hasChanges"},decls:16,vars:7,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],[1,"modal-title","ms-auto"],["l10nTranslate",""],["aria-label","Close","type","button",1,"btn-close","btn-close-white","ms-2",3,"click"],[1,"modal-body"],[3,"membersChange","members","withPermissions","customPlaceholder","searchFunction"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(n,t){n&1&&(o(0,"div",0)(1,"h4",1),u(2,"fa-icon",2),o(3,"span"),l(4),r()(),o(5,"h4",3)(6,"span",4),l(7,"Add members"),r()(),o(8,"button",5),d("click",function(){return t.layout.closeDialog()}),r()(),o(9,"div",6)(10,"app-user-search",7),X("membersChange",function(_){return J(t.newMembers,_)||(t.newMembers=_),_}),r()(),o(11,"div",8)(12,"button",9),d("click",function(){return t.layout.closeDialog()}),l(13,"Cancel"),r(),o(14,"button",10),d("click",function(){return t.onSubmit()}),l(15," Confirm "),r()()),n&2&&(a(2),p("icon",t.icons.faUserPlus),a(2),b(t.parentGroup.name),a(6),Y("members",t.newMembers),p("withPermissions",!1)("customPlaceholder","Type to search for users to add")("searchFunction",t.searchMembers.bind(t)),a(4),p("disabled",t.submitted||!t.newMembers.length))},dependencies:[M,D,ut],encapsulation:2})}}return i})();function Tt(i,m){if(i&1&&u(0,"img",9),i&2){let e=c();p("src",e.member.avatarUrl,z)}}function At(i,m){if(i&1&&u(0,"fa-icon",15),i&2){let e=c();j(e.member.isPersonalGroup?"circle-purple-icon":"circle-primary-icon"),p("icon",e.icons.GROUPS)}}function Et(i,m){if(i&1&&(o(0,"div",7)(1,"span",16),l(2,"from the group"),r(),o(3,"span",11),l(4),C(5,"capitalize"),r()()),i&2){let e=c();a(4),b(E(5,1,e.parentGroup.name))}}function Dt(i,m){i&1&&(o(0,"small",4),l(1,"Only the group will be deleted, the members will no longer be part of it."),r())}var xt=(()=>{class i{constructor(e,n){this.layout=e,this.adminService=n,this.wasDeleted=new F,this.submitted=!1,this.icons={GROUPS:L.GROUPS,faMinus:le,faUserMinus:re}}onSubmit(){this.submitted=!0;let e=this.member.isUser?"Remove from group":"Delete group";(this.member.isUser?this.adminService.removeUserFromGroup(this.parentGroup.id,this.member.id):this.adminService.deleteGroup(this.member.id)).subscribe({next:()=>{this.wasDeleted.emit(!0),this.layout.sendNotification("success",e,this.member.name),this.onClose()},error:t=>{this.submitted=!1,this.layout.sendNotification("error",e,this.member.name,t)}})}onClose(){this.wasDeleted.emit(!1),this.layout.closeDialog()}static{this.\u0275fac=function(n){return new(n||i)(y(P),y(V))}}static{this.\u0275cmp=T({type:i,selectors:[["app-admin-group-delete-dialog"]],inputs:{parentGroup:"parentGroup",member:"member"},outputs:{wasDeleted:"wasDeleted"},decls:26,vars:10,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],[1,"modal-title","ms-auto"],["l10nTranslate",""],["aria-label","Close","type","button",1,"btn-close","btn-close-white","ms-2",3,"click"],[1,"modal-body"],[1,"d-flex","align-items-center"],[1,"d-flex","align-items-center","avatar","me-2"],["alt","",1,"avatar-img",3,"src"],[3,"icon","class"],[1,"fw-bold","me-1"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"click","disabled"],[3,"icon"],["l10nTranslate","",1,"mx-1"]],template:function(n,t){n&1&&(o(0,"div",0)(1,"h4",1),u(2,"fa-icon",2),o(3,"span"),l(4),r()(),o(5,"h4",3)(6,"span",4),l(7),r()(),o(8,"button",5),d("click",function(){return t.onClose()}),r()(),o(9,"div",6)(10,"div",7)(11,"div",8),f(12,Tt,1,1,"img",9)(13,At,1,4,"fa-icon",10),r(),o(14,"span",11),l(15),C(16,"capitalize"),r(),o(17,"span",4),l(18,"will be removed"),r(),f(19,Et,6,3,"div",7),r(),f(20,Dt,2,0,"small",4),r(),o(21,"div",12)(22,"button",13),d("click",function(){return t.onClose()}),l(23,"Cancel"),r(),o(24,"button",14),d("click",function(){return t.onSubmit()}),l(25," Remove "),r()()),n&2&&(a(2),p("icon",t.member.isUser?t.icons.faUserMinus:t.icons.faMinus),a(2),b(t.member.name),a(3),b(t.member.isUser?"Remove from group":"Delete group"),a(5),g(t.member.isUser?12:13),a(3),b(E(16,8,t.member.name)),a(4),g(t.member.isUser?19:-1),a(),g(t.member.isGroup?20:-1),a(4),p("disabled",t.submitted))},dependencies:[M,D,dt],encapsulation:2})}}return i})();var Mt=(i,m)=>m.value;function Pt(i,m){if(i&1&&(u(0,"fa-icon",31),o(1,"span"),l(2),r()),i&2){let e=c();p("icon",e.icons.faPen),a(2),b(e.group.name)}}function Vt(i,m){if(i&1&&(u(0,"fa-icon",31),o(1,"span",23),l(2,"New group"),r()),i&2){let e=c();p("icon",e.icons.faPlus)}}function Ut(i,m){i&1&&(o(0,"h4",2)(1,"span",23),l(2,"Edit group"),r()())}function Rt(i,m){if(i&1&&(u(0,"fa-icon",32),o(1,"span",33),l(2,"Settings"),r()),i&2){let e=c();p("icon",e.icons.faCog)}}function Ft(i,m){if(i&1&&(o(0,"option",21),l(1),r()),i&2){let e=m.$implicit;p("ngValue",e.value),a(),b(e.key)}}function kt(i,m){i&1&&(o(0,"span",23),l(1,"All users can see this group."),r())}function It(i,m){i&1&&(o(0,"span",23),l(1,"Users who are not members of this group cannot see it."),r())}function Ot(i,m){i&1&&(o(0,"span",23),l(1,"The group is not visible, its members cannot see it and cannot see each other."),r())}function Bt(i,m){if(i&1&&(o(0,"div",24)(1,"div",18)(2,"label",34),l(3,"Creation date"),r(),o(4,"div",35),l(5),C(6,"amDateFormat"),r()(),o(7,"div",36)(8,"label",37),l(9,"Modification date"),r(),o(10,"div",38),l(11),C(12,"amDateFormat"),r()()()),i&2){let e=c();a(5),b(E(6,2,e.group.createdAt)),a(6),b(E(12,4,e.group.modifiedAt))}}function Nt(i,m){if(i&1&&(u(0,"fa-icon",32),o(1,"span",33),l(2,"Permissions"),r()),i&2){let e=c();p("icon",e.icons.faShieldHalved)}}var Te=(()=>{class i{constructor(e,n,t){this.locale=e,this.layout=n,this.adminService=t,this.group=null,this.parentGroup=null,this.groupChange=new F,this.icons={GROUPS:L.GROUPS,faPen:ae,faPlus:se,faCog:ze,faShieldHalved:qe},this.submitted=!1,this.originalOrderKeyValue=ce,this.allVisibilities={Visible:q.VISIBLE,Private:q.PRIVATE,Isolated:q.ISOLATED}}ngOnInit(){this.groupForm=new ke({name:new N(this.group?.name||"",Re.required),description:new N(this.group?.description||""),visibility:new N(this.group?.visibility||q.VISIBLE),applications:new N(this.group?.applications||[]),parent:new N(this.parentGroup)})}updateApplications(e){this.groupForm.controls.applications.setValue(e),this.groupForm.controls.applications.markAsDirty()}onSetParent(e){this.groupForm.controls.parent.setValue(e?{id:e.id,name:e.name}:null),this.groupForm.controls.parent.markAsDirty()}searchGroups(e){let n={search:e,onlyGroups:!0,excludePersonalGroups:!0,ignoreGroupIds:this.groupForm.value.parent?[this.groupForm.value.parent.id]:[]};return this.adminService.searchMembers(n,!0)}onSubmit(){if(this.submitted=!0,this.group?.id){let e=this.makeDto();this.adminService.updateGroup(this.group.id,e).subscribe({next:n=>{this.groupChange.emit(["update",n]),this.layout.sendNotification("success","Group updated",this.groupForm.value.name),this.layout.closeDialog()},error:n=>this.onError(n)})}else{let e=this.makeDto(!0);this.adminService.createGroup(e).subscribe({next:n=>{this.groupChange.emit(["add",n]),this.layout.sendNotification("success","Group created",this.groupForm.value.name),this.layout.closeDialog()},error:n=>this.onError(n)})}}makeDto(e=!1){let n;e?n=Object.fromEntries(Object.keys(this.groupForm.controls).map(t=>[t,this.groupForm.controls[t].value])):n=Object.fromEntries(Object.keys(this.groupForm.controls).filter(t=>this.groupForm.controls[t].dirty).map(t=>[t,this.groupForm.controls[t].value]));for(let t in n)switch(t){case"applications":n.permissions=n[t].join(et),delete n.applications;break;case"parent":n.parentId=n[t]?n[t].id:null,delete n.parent;break}return n}onError(e){this.layout.sendNotification("error","Group error",this.groupForm.value.name,e),this.submitted=!1}static{this.\u0275fac=function(n){return new(n||i)(y(ie),y(P),y(V))}}static{this.\u0275cmp=T({type:i,selectors:[["app-admin-group-dialog"]],inputs:{group:"group",parentGroup:"parentGroup"},outputs:{groupChange:"groupChange"},decls:50,vars:24,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"modal-title","ms-auto"],["aria-label","Close","type","button",3,"click"],[1,"modal-body","form-validation",3,"formGroup"],["type","pills",3,"justified"],[1,"my-3"],["customClass","tab-dialog form-validation",3,"selectTab"],["tabHeading",""],[1,"d-flex","flex-column"],[1,"d-flex","col-12","pb-3"],[1,"flex-fill","col-6","pe-4"],["for","name","l10nTranslate",""],["id","name","appAutofocus","","formControlName","name","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"autoSelect"],[1,"flex-fill","col-6","ps-4"],["for","description","l10nTranslate",""],["id","description","formControlName","description","autocomplete","off","type","text",1,"form-control","form-control-sm"],[1,"d-flex","flex-column","align-items-start","col-12","pb-3"],[1,"col-6","pe-4"],["for","visibility","l10nTranslate",""],["id","visibility","formControlName","visibility",1,"form-control","form-select","form-select-sm"],["l10nTranslate","",3,"ngValue"],[1,"d-none","d-sm-block","fst-italic","fs-xxs"],["l10nTranslate",""],[1,"d-flex","align-items-start","col-12","pb-3"],["for","parent","translate",""],["id","parent",3,"data","searchFunction","active","itemIcon","placeholder"],[3,"permissionsChange","permissions"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"],[1,"me-2",3,"icon"],[3,"icon"],["l10nTranslate","",1,"ms-2"],["for","created","l10nTranslate",""],["id","created"],[1,"d-flex","flex-column","align-items-end","col-6","ps-4"],["for","modified","l10nTranslate",""],["id","modified"]],template:function(n,t){if(n&1&&(o(0,"div",0)(1,"h4",1),f(2,Pt,3,2)(3,Vt,3,1),r(),f(4,Ut,3,0,"h4",2),o(5,"button",3),d("click",function(){return t.layout.closeDialog()}),r()(),o(6,"div",4)(7,"tabset",5),u(8,"hr",6),o(9,"tab",7),d("selectTab",function(){return t.tabView=null}),f(10,Rt,3,1,"ng-template",8),o(11,"div",9)(12,"div",10)(13,"div",11)(14,"label",12),l(15,"Name"),r(),u(16,"input",13),r(),o(17,"div",14)(18,"label",15),l(19,"Description"),r(),u(20,"input",16),r()(),o(21,"div",17)(22,"div",18)(23,"label",19),l(24,"Visibility"),r(),o(25,"select",20),k(26,Ft,2,2,"option",21,Mt),C(28,"keyvalue"),r()(),o(29,"div",22),f(30,kt,2,0,"span",23)(31,It,2,0,"span",23)(32,Ot,2,0,"span",23),r()(),o(33,"div",24)(34,"div",18)(35,"label",25),l(36,"Parent group"),r(),o(37,"app-select",26),C(38,"translate"),d("data",function(_){return t.onSetParent(_)}),r()()(),f(39,Bt,13,6,"div",24),r()(),o(40,"tab",7),d("selectTab",function(){return t.tabView="permissions"}),f(41,Nt,3,1,"ng-template",8),o(42,"div",9)(43,"div",10)(44,"app-admin-permissions",27),d("permissionsChange",function(_){return t.updateApplications(_)}),r()()()()()(),o(45,"div",28)(46,"button",29),d("click",function(){return t.layout.closeDialog()}),l(47,"Cancel"),r(),o(48,"button",30),d("click",function(){return t.onSubmit()}),l(49," Confirm "),r()()),n&2){let s;a(2),g(t.group?2:3),a(2),g(t.group?4:-1),a(),Ae("btn-close btn-close-white ",t.group?"ms-2":"ms-auto"," ms-2"),a(),p("formGroup",t.groupForm),a(),p("justified",!0),a(9),U("is-invalid",t.groupForm.controls.name.invalid),p("autoSelect",!1),a(10),I(S(28,18,t.allVisibilities,t.originalOrderKeyValue)),a(4),g((s=t.groupForm.value.visibility)===t.allVisibilities.Visible?30:s===t.allVisibilities.Private?31:s===t.allVisibilities.Isolated?32:-1),a(7),p("searchFunction",t.searchGroups.bind(t))("active",t.groupForm.value.parent)("itemIcon",t.icons.GROUPS)("placeholder",S(38,21,"Select the parent group",t.locale.language)),a(2),g(t.group?39:-1),a(5),p("permissions",t.groupForm.value.applications),a(4),p("disabled",t.submitted||t.groupForm.invalid)}},dependencies:[M,D,Le,Ne,$e,Ue,Be,B,Fe,Ie,Oe,ct,_t,Z,Ct,ne,ue,mt,pt,st],encapsulation:2})}}return i})();var Gt=(()=>{class i{constructor(e,n){this.layout=e,this.adminService=n,this.submitted=!1,this.isManager=!1,this.USER_GROUP_ROLE=$,this.icons={faUserPen:Qe,faKey:oe}}ngOnInit(){this.isManager=this.user.isGroupManager}onSubmit(){if(this.submitted=!0,this.user.isGroupManager===this.isManager){this.layout.closeDialog();return}let e=this.isManager?$.MANAGER:$.MEMBER;this.adminService.updateUserFromGroup(this.parentGroup.id,this.user.id,{role:e}).subscribe({next:()=>{this.user.setGroupRole(e),this.layout.sendNotification("success","Edit user",this.user.name),this.layout.closeDialog()},error:n=>{this.submitted=!1,this.layout.sendNotification("error","Edit user",this.user.name,n)}})}static{this.\u0275fac=function(n){return new(n||i)(y(P),y(V))}}static{this.\u0275cmp=T({type:i,selectors:[["app-admin-group-edit-user-dialog"]],inputs:{parentGroup:"parentGroup",user:"user"},decls:25,vars:5,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],[1,"modal-title","ms-auto"],["l10nTranslate",""],["aria-label","Close","type","button",1,"btn-close","btn-close-white","ms-2",3,"click"],[1,"modal-body"],[1,"d-flex","align-items-center"],[1,"form-check","form-switch","form-check-inline"],[1,"d-flex"],[1,"form-check-label"],["type","checkbox",1,"form-check-input",3,"ngModelChange","ngModel"],[1,"ms-1",3,"icon"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(n,t){n&1&&(o(0,"div",0)(1,"h4",1),u(2,"fa-icon",2),o(3,"span"),l(4),r()(),o(5,"h4",3)(6,"span",4),l(7,"Edit user"),r()(),o(8,"button",5),d("click",function(){return t.layout.closeDialog()}),r()(),o(9,"div",6)(10,"div",7)(11,"div",8)(12,"div",9)(13,"label",10)(14,"input",11),X("ngModelChange",function(_){return J(t.isManager,_)||(t.isManager=_),_}),r(),o(15,"span",4),l(16,"Set as group manager"),r(),u(17,"fa-icon",12),r()()()(),o(18,"small",4),l(19,"As a manager, the user will be able to manage group members but not group properties."),r()(),o(20,"div",13)(21,"button",14),d("click",function(){return t.layout.closeDialog()}),l(22,"Cancel"),r(),o(23,"button",15),d("click",function(){return t.onSubmit()}),l(24," Confirm "),r()()),n&2&&(a(2),p("icon",t.icons.faUserPen),a(2),b(t.user.name),a(10),Y("ngModel",t.isManager),a(3),p("icon",t.icons.faKey),a(6),p("disabled",t.submitted))},dependencies:[M,D,te,Ve,B,ee],encapsulation:2})}}return i})();var $t=["MainContextMenu"],Lt=["TargetContextMenu"],St=(i,m)=>m.key,jt=(i,m)=>m.mid;function Kt(i,m){if(i&1){let e=A();o(0,"ul",26)(1,"li",27)(2,"a",28),d("click",function(){v(e);let t=c();return x(t.openDialog(!0))}),o(3,"span",14),u(4,"fa-icon",7),l(5),r()()(),o(6,"li",27)(7,"a",28),d("click",function(){v(e);let t=c();return x(t.addUserToGroupDialog())}),o(8,"span",14),u(9,"fa-icon",7),l(10,"Add members"),r()()()()}if(i&2){let e=c();a(2),U("disabled",!!e.currentGroup&&e.personalGroupsView),a(2),p("icon",e.icons.GROUPS),a(),O(" ",e.personalGroupsView?"Personal group":"Group",""),a(2),U("disabled",!e.currentGroup),a(2),p("icon",e.icons.faUserPlus)}}function Ht(i,m){if(i&1&&u(0,"fa-icon",31),i&2){let e=c(3);p("icon",e.sortTable.sortParam.asc?e.icons.faArrowDown:e.icons.faArrowUp)("fixedWidth",!1)}}function Qt(i,m){if(i&1){let e=A();o(0,"th",30),d("click",function(){v(e);let t=c().$implicit,s=c();return x(s.sortBy(t.key))}),l(1),f(2,Ht,1,2,"fa-icon",31),r()}if(i&2){let e=c().$implicit,n=c();j(e.value.class),Ce("width",e.value.width,"%"),U("text-align-center",e.value.textCenter)("cursor-pointer",e.value.sortable),a(),O(" ",e.value.label," "),a(),g(n.sortTable.sortParam.column===e.key?2:-1)}}function qt(i,m){if(i&1&&f(0,Qt,3,11,"th",29),i&2){let e=m.$implicit;g(e.value.show?0:-1)}}function Wt(i,m){if(i&1&&u(0,"img",36),i&2){let e=c(4).$implicit;p("src",e.avatarUrl,z)}}function zt(i,m){if(i&1&&u(0,"fa-icon",7),i&2){let e=c(4).$implicit,n=c();j(e.isPersonalGroup?"circle-purple-icon":"circle-primary-icon"),p("icon",n.icons.GROUPS)}}function Yt(i,m){if(i&1&&u(0,"fa-icon",39),i&2){let e=c(5);p("icon",e.icons.faKey)}}function Jt(i,m){if(i&1&&(o(0,"div",34),f(1,Wt,1,1,"img",36)(2,zt,1,4,"fa-icon",37),o(3,"div",35)(4,"span",38),l(5),f(6,Yt,1,1,"fa-icon",39),r(),o(7,"span",40),l(8),r()()()),i&2){let e=c(3).$implicit;a(),g(e.isUser?1:2),a(4),O(" ",e.name," "),a(),g(e.isUser&&e.isGroupManager?6:-1),a(2),b(e.description)}}function Xt(i,m){if(i&1&&(o(0,"span"),l(1),C(2,"joinCounts"),r()),i&2){let e=c(4).$implicit;a(),b(E(2,1,e.counts))}}function Zt(i,m){if(i&1&&f(0,Xt,3,3,"span"),i&2){let e=c(3).$implicit;g(e.isGroup?0:-1)}}function ei(i,m){i&1&&(o(0,"span",14),l(1,"manager"),r())}function ti(i,m){if(i&1&&(o(0,"span",14),l(1),r()),i&2){let e=c(4).$implicit;a(),b(e.type)}}function ii(i,m){if(i&1&&f(0,ei,2,0,"span",14)(1,ti,2,1,"span",14),i&2){let e=c(3).$implicit;g(e.isUser&&e.isGroupManager?0:1)}}function ni(i,m){if(i&1&&(o(0,"div"),l(1),C(2,"amDateFormat"),r()),i&2){let e=c(4).$implicit;a(),b(E(2,1,e.modifiedAt))}}function oi(i,m){if(i&1&&(o(0,"div",35)(1,"div"),l(2),C(3,"amDateFormat"),r(),f(4,ni,3,3,"div"),r()),i&2){let e=c(3).$implicit;a(2),b(E(3,2,e.createdAt)),a(2),g(e.modifiedAt?4:-1)}}function ri(i,m){if(i&1&&(o(0,"td"),f(1,Jt,9,4,"div",34)(2,Zt,1,1)(3,ii,2,1)(4,oi,5,4,"div",35),r()),i&2){let e,n=c().$implicit,t=c().$implicit;Ee("",n.value.class," ",n.value.newly?"prop-newly-"+t[n.value.newly]:"",""),Ce("width",n.value.width,"%"),U("text-align-center",n.value.textCenter),a(),g((e=n.key)==="name"?1:e==="members"?2:e==="type"?3:e==="createdAndModified"?4:-1)}}function ai(i,m){if(i&1&&f(0,ri,5,9,"td",33),i&2){let e=m.$implicit;g(e.value.show?0:-1)}}function li(i,m){if(i&1){let e=A();o(0,"tr",32),d("click",function(){let t=v(e).$implicit,s=c();return x(s.onSelect(t))})("contextmenu",function(t){let s=v(e).$implicit,_=c();return x(_.onTargetContextMenu(t,s))})("pressup",function(t){let s=v(e).$implicit,_=c();return x(_.onTargetContextMenu(t,s))})("tap",function(){let t=v(e).$implicit,s=c();return x(s.browse(t))}),k(1,ai,1,1,null,null,St),C(3,"keyvalue"),r()}if(i&2){let e=m.$implicit,n=c();U("selected",e.mid===(n.selected==null?null:n.selected.mid)),a(),I(S(3,2,n.tableHeaders,n.originalOrderKeyValue))}}function si(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2),r()),i&2){let e=c(2);a(),p("icon",e.icons.faPlus),a(),O(" ",e.personalGroupsView?"Personal group":"Group","")}}function mi(i,m){if(i&1){let e=A();f(0,si,3,2,"ng-template",25),d("execute",function(){v(e);let t=c();return x(t.openDialog(!0))})}}function pi(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2,"Add members"),r()),i&2){let e=c(2);a(),p("icon",e.icons.faUserPlus)}}function ci(i,m){if(i&1){let e=A();f(0,pi,3,1,"ng-template",25),d("execute",function(){v(e);let t=c();return x(t.addUserToGroupDialog())})}}function ui(i,m){}function di(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2,"Refresh"),r()),i&2){let e=c();a(),p("icon",e.icons.faArrowRotateRight)}}function _i(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2),r()),i&2){let e=c(2);a(),p("icon",e.icons.faPen),a(),O(" ",e.selected.isGroup?"Edit group":"Edit user","")}}function fi(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2,"Delete group"),r()),i&2){let e=c(3);a(),p("icon",e.icons.faMinus)}}function hi(i,m){if(i&1){let e=A();f(0,fi,3,1,"ng-template",25),d("execute",function(){v(e);let t=c(2);return x(t.openDialog(!1,!0))})}}function gi(i,m){if(i&1&&(o(0,"span",14),u(1,"fa-icon",7),l(2,"Remove from group"),r()),i&2){let e=c(3);a(),p("icon",e.icons.faUserMinus)}}function bi(i,m){if(i&1){let e=A();f(0,gi,3,1,"ng-template",25),d("execute",function(){v(e);let t=c(2);return x(t.openDialog(!1,!0))})}}function Ci(i,m){if(i&1){let e=A();f(0,_i,3,2,"ng-template",25),d("execute",function(){v(e);let t=c();return x(t.openDialog())}),f(1,hi,1,0,null,23)(2,bi,1,0,null,23)}if(i&2){let e=c();a(),g(e.selected.isGroup?1:2)}}var Kn=(()=>{class i{constructor(e,n,t,s,_){this.locale=e,this.router=n,this.activatedRoute=t,this.layout=s,this.adminService=_,this.originalOrderKeyValue=ce,this.icons={GROUPS:L.GROUPS,faRotate:Xe,faPlus:se,faMinus:le,faPen:ae,faArrowDown:Ye,faArrowUp:Je,faKey:oe,faUserPlus:me,faUserMinus:re,faArrowRotateRight:We,faToggleOn:He,faToggleOff:Ke},this.tableHeaders={name:{label:"Name",width:30,textCenter:!1,class:"",show:!0,sortable:!0},type:{label:"Type",width:10,textCenter:!0,class:"",show:!0,sortable:!0},members:{label:"Members",width:10,class:"",textCenter:!0,show:!0},createdAndModified:{label:"Created & Modified",width:12,textCenter:!0,class:"d-none d-lg-table-cell",newly:"newly",show:!0,sortable:!0}},this.sortSettings={default:[{prop:"name",type:"string"}],name:[{prop:"name",type:"string"}],type:[{prop:"type",type:"string"}],createdAndModified:[{prop:"modifiedAt",type:"date"},{prop:"createdAt",type:"date"}]},this.sortTable=new lt(this.constructor.name,this.sortSettings),this.personalGroupsView=!1,this.loading=!1,this.selected=null,this.members=[],this.activatedRoute.data.subscribe(h=>{this.personalGroupsView=h.type===pe.PERSONAL,this.setEnv(h.routes)}),this.activatedRoute.queryParams.subscribe(h=>this.focusOnSelect=h.select),this.layout.setBreadcrumbIcon(tt.GROUPS)}setEnv(e){let n;e.length?(n=e[e.length-1].path,this.layout.setBreadcrumbNav({url:this.personalGroupsView?`/${G.BASE}/${G.PGROUPS}${xe(e)}`:`/${G.BASE}/${G.GROUPS}${xe(e)}`,firstLink:`/${G.BASE}/${G.GROUPS}`,splicing:1,translating:!0,sameLink:!1,mutateLevel:{0:{setTitle:this.personalGroupsView?W.PGROUPS:W.GROUPS,translateTitle:!0}}})):this.layout.setBreadcrumbNav({url:this.personalGroupsView?`/${G.BASE}/${G.PGROUPS}/${W.PGROUPS}`:`/${G.BASE}/${G.GROUPS}/${W.GROUPS}`,splicing:2,translating:!0,sameLink:!0}),this.loadGroups(n)}onPersonalGroupsView(e){this.personalGroupsView=e,this.router.navigate([G.BASE,e?G.PGROUPS:G.GROUPS]).catch(n=>console.error(n))}refresh(){this.loadGroups(this.currentGroup?.name)}loadGroups(e){this.loading=!0,this.onSelect(),this.adminService.browseGroup(e,this.personalGroupsView).subscribe({next:n=>{this.currentGroup=n.parentGroup,this.sortBy(this.sortTable.sortParam.column,!1,n.members),this.focusOnSelect?this.focusOn(this.focusOnSelect):this.scrollView.scrollInto(-1),this.loading=!1},error:n=>{this.members=[],this.layout.sendNotification("error","Groups",n.error.message),this.onSelect(),this.loading=!1}})}browse(e){e.isGroup&&this.router.navigate([e.name],{relativeTo:this.activatedRoute}).catch(n=>console.error(n))}onSelect(e=null){this.selected=e}onContextMenu(e){e.preventDefault(),e.stopPropagation(),this.layout.openContextMenu(e,this.mainContextMenu)}onTargetContextMenu(e,n){e.preventDefault(),e.type==="contextmenu"&&e.stopPropagation(),this.onSelect(n),this.layout.openContextMenu(e,this.targetContextMenu)}sortBy(e,n=!0,t){this.members=this.sortTable.sortBy(e,n,t||this.members)}addUserToGroupDialog(){this.layout.openDialog(vt,"md",{initialState:{parentGroup:this.currentGroup,currentMemberIds:this.members.filter(n=>n.isUser).map(n=>n.id)}}).content.hasChanges.pipe(be(n=>n),R(1)).subscribe(()=>this.refresh())}openDialog(e=!1,n=!1){e?this.personalGroupsView?this.layout.openDialog(we,"md").content.groupChange.pipe(R(1)).subscribe(s=>{let[_,h]=s;_==="add"&&(h.setGroupRole($.MANAGER),h.counts={users:1},this.sortBy(this.sortTable.sortParam.column,!1,this.members.concat(h)),this.onSelect(h))}):this.layout.openDialog(Te,"md",{initialState:{parentGroup:this.currentGroup}}).content.groupChange.pipe(R(1)).subscribe(s=>{let[_,h]=s;if(_==="add")if(!this.currentGroup&&!h?.parent||h.parent.id===this.currentGroup.id){let w=new ye(ge(he({},h),{type:ve.GROUP}));this.sortBy(this.sortTable.sortParam.column,!1,this.members.concat(new ye(ge(he({},h),{type:ve.GROUP})))),this.onSelect(w)}else this.router.navigate([`${G.BASE}/${G.GROUPS}`,h.parent?.id?h.parent.name:""],{queryParams:{select:h.name}}).catch(w=>console.error(w))}):n?this.layout.openDialog(xt,"md",{initialState:{parentGroup:this.currentGroup,member:this.selected}}).content.wasDeleted.pipe(be(s=>s),R(1)).subscribe(()=>{this.currentGroup?this.selected.counts?.groups?this.loadGroups(this.currentGroup.name):(this.sortBy(this.sortTable.sortParam.column,!1,this.members.filter(s=>this.selected.mid!==s.mid)),this.onSelect()):this.loadGroups()}):this.selected.isGroup?this.personalGroupsView?this.layout.openDialog(we,"md",{initialState:{originalGroup:this.selected}}).content.groupChange.pipe(R(1)).subscribe(s=>{let[_,h]=s;_==="update"&&(this.selected=Object.assign(this.selected,{name:h.name,description:h.description,modifiedAt:h.modifiedAt}))}):this.adminService.getGroup(this.selected.id).subscribe({next:t=>{this.layout.openDialog(Te,"md",{initialState:{group:t,parentGroup:this.currentGroup}}).content.groupChange.pipe(R(1)).subscribe(_=>{let[h,w]=_;h==="update"&&(!this.currentGroup&&!w?.parent||w.parent.id===this.currentGroup.id?this.selected=Object.assign(this.selected,w):this.router.navigate([`${G.BASE}/${G.GROUPS}`,w.parent?.id?w.parent.name:""],{queryParams:{select:w.name}}).catch(wt=>console.error(wt)))})},error:t=>this.layout.sendNotification("error","Edit group",this.selected.name,t)}):this.layout.openDialog(Gt,"md",{initialState:{user:this.selected,parentGroup:this.currentGroup}})}focusOn(e){let n=this.members.find(t=>t.name===e);n&&(setTimeout(()=>this.scrollView.scrollInto(n),100),this.onSelect(n))}static{this.\u0275fac=function(n){return new(n||i)(y(ie),y(Pe),y(Me),y(P),y(V))}}static{this.\u0275cmp=T({type:i,selectors:[["app-admin-groups"]],viewQuery:function(n,t){if(n&1&&(K(Se,5),K(Ge,7),K($t,7),K(Lt,7)),n&2){let s;H(s=Q())&&(t.scrollView=s.first),H(s=Q())&&(t.inputFilter=s.first),H(s=Q())&&(t.mainContextMenu=s.first),H(s=Q())&&(t.targetContextMenu=s.first)}},decls:48,vars:42,consts:[["MainContextMenu",""],["TargetContextMenu",""],[1,"app-top-menu"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","tooltip"],[3,"icon","animation"],["dropdown","",1,"btn-group","btn-group-sm","me-1"],["dropdownToggle","","container","body","type","button",1,"btn","btn-sm","btn-secondary","dropdown-toggle",3,"tooltip"],[3,"icon"],["class","dropdown-menu","role","menu",4,"dropdownMenu"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","disabled","tooltip"],[1,"ms-auto"],["btnCheckbox","","type","button",1,"btn","btn-sm","btn-custom","me-1",3,"ngModelChange","ngModel"],[1,"d-flex","align-items-center"],[1,"me-2",3,"icon"],["l10nTranslate",""],[1,"btn-group","btn-group-sm"],[1,"d-none","d-sm-block"],[1,"app-table"],[3,"contextmenu","bufferAmount","items"],["tabindex","-1"],[3,"selected"],[1,"app-foot-menu"],[1,"mx-auto"],["contextMenuItem",""],["contextMenuItem","",3,"divider"],["contextMenuItem","",3,"execute"],["role","menu",1,"dropdown-menu"],["role","menuitem"],[1,"dropdown-item",3,"click"],["l10nTranslate","",3,"width","text-align-center","cursor-pointer","class"],["l10nTranslate","",3,"click"],[3,"icon","fixedWidth"],[3,"click","contextmenu","pressup","tap"],[3,"width","text-align-center","class"],[1,"d-flex","align-items-center","avatar"],[1,"d-flex","flex-column"],["alt","",1,"avatar-img",3,"src"],[3,"icon","class"],["draggable","false",1,"no-pointer-events"],[1,"m-0",3,"icon"],["draggable","false",1,"no-pointer-events","text-muted","fs-xxxs"]],template:function(n,t){if(n&1){let s=A();o(0,"div",2)(1,"button",3),C(2,"translate"),d("click",function(){return v(s),x(t.refresh())}),u(3,"fa-icon",4),r(),o(4,"div",5)(5,"button",6),C(6,"translate"),u(7,"fa-icon",7),r(),f(8,Kt,11,7,"ul",8),r(),o(9,"button",9),C(10,"translate"),d("click",function(){return v(s),x(t.openDialog(!1,!0))}),u(11,"fa-icon",7),r(),o(12,"button",9),C(13,"translate"),d("click",function(){return v(s),x(t.openDialog())}),u(14,"fa-icon",7),r(),o(15,"div",10)(16,"button",11),d("ngModelChange",function(h){return v(s),x(t.onPersonalGroupsView(h))}),o(17,"div",12),u(18,"fa-icon",13),o(19,"span",14),l(20,"Personal groups"),r()()(),o(21,"div",15),u(22,"app-input-filter",16),r()()(),o(23,"table",17)(24,"thead")(25,"tr"),k(26,qt,1,1,null,null,St),C(28,"keyvalue"),r()()(),o(29,"app-virtual-scroll",18),C(30,"searchFilter"),d("contextmenu",function(h){return v(s),x(t.onContextMenu(h))}),o(31,"table",17)(32,"tbody",19),k(33,li,4,5,"tr",20,jt),r()()(),o(35,"div",21)(36,"span",22),l(37),C(38,"translate"),r()(),o(39,"context-menu",null,0),f(41,mi,1,0,null,23)(42,ci,1,0,null,23)(43,ui,0,0,"ng-template",24)(44,di,3,1,"ng-template",25),d("execute",function(){return v(s),x(t.refresh())}),r(),o(45,"context-menu",null,1),f(47,Ci,3,1),r()}n&2&&(a(),p("tooltip",S(2,21,"Refresh",t.locale.language)),a(2),p("icon",t.icons.faRotate)("animation",t.loading?"spin":null),a(2),p("tooltip",S(6,24,"New",t.locale.language)),a(2),p("icon",t.icons.faPlus),a(2),p("disabled",!t.selected)("tooltip",S(10,27,t.selected!=null&&t.selected.isUser?"Remove from group":"Delete group",t.locale.language)),a(2),p("icon",t.icons.faMinus),a(),p("disabled",!t.selected)("tooltip",S(13,30,t.selected!=null&&t.selected.isGroup?"Edit group":"Edit user",t.locale.language)),a(2),p("icon",t.icons.faPen),a(2),p("ngModel",t.personalGroupsView),a(2),p("icon",t.personalGroupsView?t.icons.faToggleOn:t.icons.faToggleOff),a(8),I(S(28,33,t.tableHeaders,t.originalOrderKeyValue)),a(3),p("bufferAmount",5)("items",S(30,36,t.members,t.inputFilter.search())),a(4),I(t.scrollView==null?null:t.scrollView.viewPortItems),a(4),De("",t.members.length," ",S(38,39,"groups",t.locale.language),""),a(4),g(t.currentGroup&&!t.personalGroupsView||!t.currentGroup&&t.personalGroupsView?41:-1),a(),g(t.currentGroup?42:-1),a(),p("divider",!0),a(4),g(t.selected?47:-1))},dependencies:[ot,nt,it,M,Z,D,ne,Ge,at,Se,je,bt,ue,ft,gt,ht,rt,te,B,ee],encapsulation:2})}}return i})();export{Kn as AdminGroupsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{gb as L,v as F,w as O}from"./chunk-
|
|
1
|
+
import{gb as L,v as F,w as O}from"./chunk-HDDBV3QQ.js";import{Ad as v,Bd as T,Dd as E,Ec as g,Fb as o,Qb as y,Xa as l,ab as m,bc as s,dc as r,fb as c,lb as f,oa as a,rb as u,tb as d,ub as P,ud as x,vb as C,wb as h,xb as _}from"./chunk-FPEGN42P.js";var k=(e,n)=>n.key;function D(e,n){e&1&&(C(0,"span",0),y(1,"No permissions"),h())}function I(e,n){if(e&1&&(_(0,"fa-icon",1),s(1,"translate")),e&2){let i=n.$implicit,t=o(2);f("icon",i.value.icon)("tooltip",r(1,3,i.value.text,t.locale.language))("placement",t.tooltipPlacement)}}function K(e,n){if(e&1&&(d(0,I,2,6,"fa-icon",1,k),s(2,"keyvalue")),e&2){let i=o();P(r(2,0,i.permissions,i.originalOrderKeyValue))}}var w=(()=>{class e{constructor(i){this.locale=i,this.permissions={},this.tooltipPlacement="top",this.replaceEmptyPermissions=!1,this.hasPermissions=!1,this.originalOrderKeyValue=L}ngOnChanges(){this.hasPermissions=!!Object.keys(this.permissions).length}static{this.\u0275fac=function(t){return new(t||e)(l(x))}}static{this.\u0275cmp=m({type:e,selectors:[["app-file-permissions"]],inputs:{permissions:"permissions",tooltipPlacement:"tooltipPlacement",replaceEmptyPermissions:"replaceEmptyPermissions"},features:[a],decls:2,vars:1,consts:[["l10nTranslate",""],[1,"cursor-pointer","fs-md",3,"icon","tooltip","placement"]],template:function(t,p){t&1&&c(0,D,2,0,"span",0)(1,K,3,3),t&2&&u(p.replaceEmptyPermissions&&!p.hasPermissions?0:1)},dependencies:[O,F,T,E,g,v],encapsulation:2})}}return e})();export{w as a};
|