@lowcodeunit/applications-flow-common 1.33.101-lets-get-social-ish → 1.33.102-lets-get-social-ish

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.
@@ -4220,7 +4220,8 @@ SourceControlFormComponent.propDecorators = {
4220
4220
  };
4221
4221
 
4222
4222
  class BuildPipelineFormComponent {
4223
- constructor(formBuilder, appsFlowSvc) {
4223
+ constructor(eacSvc, formBuilder, appsFlowSvc) {
4224
+ this.eacSvc = eacSvc;
4224
4225
  this.formBuilder = formBuilder;
4225
4226
  this.appsFlowSvc = appsFlowSvc;
4226
4227
  this.HostingDetails = new ProjectHostingDetails();
@@ -4255,6 +4256,9 @@ class BuildPipelineFormComponent {
4255
4256
  get DevOpsActions() {
4256
4257
  return this.Environment.DevOpsActions || {};
4257
4258
  }
4259
+ get DevOpsActionNameFormControl() {
4260
+ return this.BuildPipelineFormGroup.get('devOpsActionName');
4261
+ }
4258
4262
  get EditingSourceControl() {
4259
4263
  var _a, _b;
4260
4264
  let sc = ((_a = this.Environment) === null || _a === void 0 ? void 0 : _a.Sources) ? (_b = this.Environment) === null || _b === void 0 ? void 0 : _b.Sources[this.EditingSourceControlLookup] : null;
@@ -4263,11 +4267,22 @@ class BuildPipelineFormComponent {
4263
4267
  }
4264
4268
  return sc;
4265
4269
  }
4270
+ get NPMTokenFormControl() {
4271
+ return this.BuildPipelineFormGroup.get('npmToken');
4272
+ }
4266
4273
  // (ho) => ho.Lookup === this.BuildPipeline
4267
4274
  get SelectedHostingOption() {
4268
4275
  var _a, _b;
4269
4276
  return (_b = (_a = this.HostingDetails) === null || _a === void 0 ? void 0 : _a.HostingOptions) === null || _b === void 0 ? void 0 : _b.find((ho) => ho.Lookup === this.BuildPipeline);
4270
4277
  }
4278
+ get SelectedHostingOptionInputControlValues() {
4279
+ var _a, _b;
4280
+ return (_b = (_a = this.SelectedHostingOption) === null || _a === void 0 ? void 0 : _a.Inputs) === null || _b === void 0 ? void 0 : _b.reduce((prev, cur) => {
4281
+ const res = Object.assign({}, prev);
4282
+ res[cur.Lookup] = this.BuildPipelineFormGroup.controls[cur.Lookup].value;
4283
+ return res;
4284
+ }, {});
4285
+ }
4271
4286
  get SourceControlLookups() {
4272
4287
  return Object.keys(this.SourceControls || {});
4273
4288
  }
@@ -4275,22 +4290,18 @@ class BuildPipelineFormComponent {
4275
4290
  return this.Environment.Sources || {};
4276
4291
  }
4277
4292
  ngOnInit() {
4278
- var _a, _b, _c;
4279
4293
  this.BuildPipelineFormGroup = this.formBuilder.group({});
4280
- this.loadProjectHostingDetails();
4281
4294
  console.log("ARTIFACT: ", this.Artifact);
4282
4295
  // this.BuildPipeline ||
4283
4296
  // github-artifacts-release is this.HostingDetails?.HostingOptions[0]?.Lookup
4284
- this.BuildPipeline =
4285
- ((_a = this.HostingDetails) === null || _a === void 0 ? void 0 : _a.HostingOptions) ? (_c = (_b = this.HostingDetails) === null || _b === void 0 ? void 0 : _b.HostingOptions[0]) === null || _c === void 0 ? void 0 : _c.Lookup : '';
4286
- console.log("Build Pipeline HERE= ", this.BuildPipeline);
4287
4297
  if (this.BuildPipelineFormGroup != null) {
4288
4298
  this.BuildPipelineFormGroup.removeControl('hostingDetails');
4289
4299
  }
4290
4300
  this.BuildPipelineFormGroup.addControl('hostingDetails', this.formBuilder.group({
4291
4301
  buildPipeline: [this.BuildPipeline, [Validators.required]],
4292
4302
  }));
4293
- this.setupControlsForForm();
4303
+ this.loadProjectHostingDetails();
4304
+ // this.setupControlsForForm();
4294
4305
  }
4295
4306
  //API METHODS
4296
4307
  BuildPipelineChanged() {
@@ -4299,17 +4310,80 @@ class BuildPipelineFormComponent {
4299
4310
  this.BuildPipeline = (_b = this.BuildPipelineFormControl) === null || _b === void 0 ? void 0 : _b.value;
4300
4311
  this.setupControlsForForm();
4301
4312
  }
4313
+ SubmitBuildPipeline() {
4314
+ }
4315
+ SaveEnvironment() {
4316
+ var _a;
4317
+ const saveEnvReq = {
4318
+ Environment: Object.assign(Object.assign({}, this.Environment), { Artifacts: this.Environment.Artifacts || {}, DevOpsActions: this.Environment.DevOpsActions || {}, Secrets: this.Environment.Secrets || {}, Sources: this.Environment.Sources || {} }),
4319
+ EnvironmentLookup: this.EnvironmentLookup,
4320
+ EnterpriseDataTokens: {},
4321
+ };
4322
+ let artifactLookup;
4323
+ let artifact = Object.assign(Object.assign({}, this.Artifact), this.SelectedHostingOptionInputControlValues);
4324
+ if (!this.ArtifactLookup) {
4325
+ artifactLookup = Guid.CreateRaw();
4326
+ artifact = Object.assign(Object.assign({}, artifact), { Type: this.SelectedHostingOption
4327
+ .ArtifactType, Name: this.SelectedHostingOption.Name, NPMRegistry: 'https://registry.npmjs.org/' });
4328
+ }
4329
+ else {
4330
+ artifactLookup = this.ArtifactLookup;
4331
+ }
4332
+ saveEnvReq.Environment.Artifacts[artifactLookup] = artifact;
4333
+ let devOpsActionLookup;
4334
+ if (!this.DevOpsActionLookup) {
4335
+ devOpsActionLookup = Guid.CreateRaw();
4336
+ const doa = Object.assign(Object.assign({}, this.DevOpsAction), { ArtifactLookups: [artifactLookup], Name: this.DevOpsActionNameFormControl.value, Path: this.SelectedHostingOption.Path, Templates: this.SelectedHostingOption.Templates });
4337
+ if ((_a = this.NPMTokenFormControl) === null || _a === void 0 ? void 0 : _a.value) {
4338
+ const secretLookup = 'npm-access-token';
4339
+ doa.SecretLookups = [secretLookup];
4340
+ saveEnvReq.Environment.Secrets[secretLookup] = {
4341
+ Name: 'NPM Access Token',
4342
+ DataTokenLookup: secretLookup,
4343
+ KnownAs: 'NPM_TOKEN',
4344
+ };
4345
+ saveEnvReq.EnterpriseDataTokens[secretLookup] = {
4346
+ Name: saveEnvReq.Environment.Secrets[secretLookup].Name,
4347
+ Description: saveEnvReq.Environment.Secrets[secretLookup].Name,
4348
+ Value: this.NPMTokenFormControl.value,
4349
+ };
4350
+ }
4351
+ saveEnvReq.Environment.DevOpsActions[devOpsActionLookup] = doa;
4352
+ }
4353
+ else {
4354
+ devOpsActionLookup = this.DevOpsActionLookup;
4355
+ const doa = Object.assign(Object.assign({}, this.DevOpsAction), { Name: this.DevOpsActionNameFormControl.value });
4356
+ saveEnvReq.Environment.DevOpsActions[devOpsActionLookup] = doa;
4357
+ }
4358
+ // let source: EaCSourceControl = {
4359
+ // ...this.EditingSourceControl,
4360
+ // Branches: this.SourceControlFormControls.SelectedBranches,
4361
+ // MainBranch: this.SourceControlFormControls.MainBranchFormControl.value,
4362
+ // };
4363
+ // source = {
4364
+ // ...source,
4365
+ // Type: 'GitHub',
4366
+ // Name: this.EditingSourceControlLookup,
4367
+ // DevOpsActionTriggerLookups: [devOpsActionLookup],
4368
+ // Organization:
4369
+ // this.SourceControlFormControls.OrganizationFormControl.value,
4370
+ // Repository: this.SourceControlFormControls.RepositoryFormControl.value,
4371
+ // };
4372
+ // const scLookup = `github://${source.Organization}/${source.Repository}`;
4373
+ // saveEnvReq.Environment.Sources[scLookup] = source;
4374
+ this.eacSvc.SaveEnvironmentAsCode(saveEnvReq);
4375
+ }
4302
4376
  // Helpers
4303
4377
  setupControlsForForm() {
4304
- //for (const ctrlName in this.BuildPipelineFormGroup.controls) {
4305
- //devOpsAction doesn't exist
4306
- //removes hosting details
4307
- // if (ctrlName !== 'buildPipeline' && ctrlName !== 'devOpsAction') {
4308
- // console.log("removing control: ", ctrlName)
4309
- // this.BuildPipelineFormGroup.removeControl(ctrlName);
4310
- // }
4311
- //}
4312
4378
  var _a, _b, _c, _d, _e, _f;
4379
+ for (const ctrlName in this.BuildPipelineFormGroup.controls) {
4380
+ //devOpsAction doesn't exist
4381
+ //removes hosting details
4382
+ if (ctrlName !== 'buildPipeline' && ctrlName !== 'devOpsAction') {
4383
+ console.log("removing control: ", ctrlName);
4384
+ this.BuildPipelineFormGroup.removeControl(ctrlName);
4385
+ }
4386
+ }
4313
4387
  this.BuildPipelineFormGroup.addControl('devOpsActionName', this.formBuilder.control(((_a = this.DevOpsAction) === null || _a === void 0 ? void 0 : _a.Name) || ((_b = this.SelectedHostingOption) === null || _b === void 0 ? void 0 : _b.Name) || '', [Validators.required]));
4314
4388
  (_d = (_c = this.SelectedHostingOption) === null || _c === void 0 ? void 0 : _c.Inputs) === null || _d === void 0 ? void 0 : _d.forEach((input) => {
4315
4389
  const validators = input.Required ? [Validators.required] : [];
@@ -4318,9 +4392,7 @@ class BuildPipelineFormComponent {
4318
4392
  // this.FormGroup.controls[input.Lookup].disable();
4319
4393
  // }
4320
4394
  });
4321
- debugger;
4322
4395
  if (((_e = this.BuildPipelineFormControl) === null || _e === void 0 ? void 0 : _e.value) === 'npm-release') {
4323
- debugger;
4324
4396
  if (!this.BuildPipelineFormGroup.controls.npmToken) {
4325
4397
  this.BuildPipelineFormGroup.addControl('npmToken', this.formBuilder.control('', this.Disabled ? [] : [Validators.required]));
4326
4398
  if (this.Disabled) {
@@ -4335,23 +4407,28 @@ class BuildPipelineFormComponent {
4335
4407
  }
4336
4408
  }
4337
4409
  loadProjectHostingDetails() {
4338
- // this.HostingDetails.Loading = true;
4410
+ this.HostingDetails.Loading = true;
4339
4411
  // this.Organization,
4340
4412
  // this.Repository,
4341
4413
  // this.MainBranch
4342
- // "powhound4",
4343
- // "RedwoodCrystals",
4344
- // "master"
4414
+ // "powhound4",
4415
+ // "RedwoodCrystals",
4416
+ // "master"
4345
4417
  this.appsFlowSvc
4346
4418
  .NewLoadProjectHostingDetails()
4347
4419
  .subscribe((response) => {
4420
+ var _a, _b, _c;
4348
4421
  this.HostingDetails = response.Model;
4349
4422
  console.log("response: ", response);
4350
4423
  this.HostingDetails.Loading = false;
4424
+ this.BuildPipeline =
4425
+ ((_a = this.HostingDetails) === null || _a === void 0 ? void 0 : _a.HostingOptions) ? (_c = (_b = this.HostingDetails) === null || _b === void 0 ? void 0 : _b.HostingOptions[0]) === null || _c === void 0 ? void 0 : _c.Lookup : '';
4426
+ console.log("Build Pipeline HERE= ", this.BuildPipeline);
4427
+ this.setupControlsForForm();
4351
4428
  }, (err) => {
4352
- this.HostingDetails.Loading = false;
4353
4429
  console.log("hosting details LOADING EERR: ", this.HostingDetails);
4354
4430
  console.log("ERR: ", err);
4431
+ this.HostingDetails.Loading = false;
4355
4432
  });
4356
4433
  console.log("HOSTING DETAILS: ", this.HostingDetails);
4357
4434
  }
@@ -4359,11 +4436,12 @@ class BuildPipelineFormComponent {
4359
4436
  BuildPipelineFormComponent.decorators = [
4360
4437
  { type: Component, args: [{
4361
4438
  selector: 'lcu-build-pipeline-form',
4362
- template: "<form class=\"form-card\" [formGroup]=\"BuildPipelineFormGroup\">\n <!-- *ngIf=\"EditingSourceControl?.Branches?.length > 0\" -->\n <mat-card\n class=\"spread\" \n >\n <mat-card-header>\n <mat-card-title> Build Pipeline </mat-card-title>\n\n <mat-hint>\n Changes made here are reflected for all sources using this\n DevOpsAction\n </mat-hint>\n </mat-card-header>\n\n <mat-card-content>\n\n <ng-container>\n\n <div *ngIf=\"!HostingDetails?.Loading\">\n <mat-form-field class=\"mat-full-width\">\n <mat-select\n formControlName=\"buildPipeline\"\n placeholder=\"Build Pipeline\"\n [disabled]=\"Disabled\"\n (selectionChange)=\"BuildPipelineChanged()\"\n required\n >\n <ng-container\n *ngFor=\"let hostOption of HostingDetails?.HostingOptions; let i = index\"\n >\n <mat-option [value]=\"hostOption?.Lookup\">\n {{ hostOption.Name }}\n </mat-option>\n </ng-container>\n </mat-select>\n \n <mat-hint>\n <ng-container *ngFor=\"let hostOption of HostingDetails?.HostingOptions\">\n <span *ngIf=\"BuildPipeline == hostOption?.Lookup\">\n {{ hostOption.Description }}\n </span>\n </ng-container>\n </mat-hint>\n </mat-form-field>\n \n <mat-form-field class=\"mat-full-width\">\n <input\n matInput\n formControlName=\"devOpsActionName\"\n placeholder=\"Name of DevOps Action\"\n required=\"true\"\n />\n </mat-form-field>\n \n <ng-container *ngFor=\"let input of SelectedHostingOption?.Inputs\">\n <mat-form-field class=\"mat-full-width\">\n <input\n matInput\n [formControlName]=\"input.Lookup\"\n [placeholder]=\"input.Placeholder\"\n [required]=\"input.Required\"\n />\n \n <mat-hint>{{ input.Hint }}</mat-hint>\n </mat-form-field>\n </ng-container>\n \n <div *ngIf=\"BuildPipeline == 'npm-release'\">\n <mat-form-field class=\"mat-full-width with-hint padding-bottom-4\">\n <mat-icon matPrefix>security</mat-icon>\n \n <input\n id=\"npm-token\"\n matInput\n type=\"text\"\n formControlName=\"npmToken\"\n placeholder=\"NPM token\"\n [required]=\"!Disabled\"\n style=\"-webkit-text-security: disc;\"\n />\n <mat-hint>\n Securely publish to NPM, provide an NPM Personal Access Token (PAT) with publish access to the organization used for your NPM packages. \n Learn how to create and view access tokens \n <a\n href=\"https://docs.npmjs.com/creating-and-viewing-access-tokens\"\n target=\"_blank\"\n >\n here.\n </a>\n </mat-hint>\n </mat-form-field>\n </div>\n </div>\n \n <div *ngIf=\"HostingDetails?.Loading\">\n <div class=\"spread\">\n <lcu-loader style=\"margin: auto\" [loading]=\"true\"></lcu-loader>\n \n <div class=\"margin-3\">\n <h4 class=\"mat-title\">Loading hosting details</h4>\n </div>\n </div>\n </div>\n </ng-container>\n </mat-card-content>\n </mat-card>\n</form>\n",
4439
+ template: "<form class=\"form-card\" [formGroup]=\"BuildPipelineFormGroup\" (ngSubmit)=\"SubmitBuildPipeline()\">\n <!-- *ngIf=\"EditingSourceControl?.Branches?.length > 0\" -->\n <mat-card\n class=\"spread\" \n >\n <mat-card-header>\n <mat-card-title> Build Pipeline </mat-card-title>\n\n <mat-hint>\n Changes made here are reflected for all sources using this\n DevOpsAction\n </mat-hint>\n </mat-card-header>\n\n <mat-card-content>\n\n <ng-container>\n\n <div *ngIf=\"!HostingDetails?.Loading\">\n <mat-form-field class=\"mat-full-width\">\n <mat-select\n formControlName=\"buildPipeline\"\n placeholder=\"Build Pipeline\"\n [disabled]=\"Disabled\"\n (selectionChange)=\"BuildPipelineChanged()\"\n required\n >\n <ng-container\n *ngFor=\"let hostOption of HostingDetails?.HostingOptions; let i = index\"\n >\n <mat-option [value]=\"hostOption?.Lookup\">\n {{ hostOption.Name }}\n </mat-option>\n </ng-container>\n </mat-select>\n \n <mat-hint>\n <ng-container *ngFor=\"let hostOption of HostingDetails?.HostingOptions\">\n <span *ngIf=\"BuildPipeline == hostOption?.Lookup\">\n {{ hostOption.Description }}\n </span>\n </ng-container>\n </mat-hint>\n </mat-form-field>\n \n <mat-form-field class=\"mat-full-width\">\n <input\n matInput\n formControlName=\"devOpsActionName\"\n placeholder=\"Name of DevOps Action\"\n required=\"true\"\n />\n </mat-form-field>\n \n <ng-container *ngFor=\"let input of SelectedHostingOption?.Inputs\">\n <mat-form-field class=\"mat-full-width\">\n <input\n matInput\n [formControlName]=\"input.Lookup\"\n [placeholder]=\"input.Placeholder\"\n [required]=\"input.Required\"\n />\n \n <mat-hint>{{ input.Hint }}</mat-hint>\n </mat-form-field>\n </ng-container>\n \n <div *ngIf=\"BuildPipeline == 'npm-release'\">\n <mat-form-field class=\"mat-full-width with-hint padding-bottom-4\">\n <mat-icon matPrefix>security</mat-icon>\n \n <input\n id=\"npm-token\"\n matInput\n type=\"text\"\n formControlName=\"npmToken\"\n placeholder=\"NPM token\"\n [required]=\"!Disabled\"\n style=\"-webkit-text-security: disc;\"\n />\n <mat-hint>\n Securely publish to NPM, provide an NPM Personal Access Token (PAT) with publish access to the organization used for your NPM packages. \n Learn how to create and view access tokens \n <a\n href=\"https://docs.npmjs.com/creating-and-viewing-access-tokens\"\n target=\"_blank\"\n >\n here.\n </a>\n </mat-hint>\n </mat-form-field>\n </div>\n </div>\n \n <div *ngIf=\"HostingDetails?.Loading\">\n <div class=\"spread\">\n <lcu-loader style=\"margin: auto\" [loading]=\"true\"></lcu-loader>\n \n <div class=\"margin-3\">\n <h4 class=\"mat-title\">Loading hosting details</h4>\n </div>\n </div>\n </div>\n </ng-container>\n </mat-card-content>\n <mat-card-actions fxLayoutAlign=\"center center\">\n <!-- [disabled]=\"!SecurityFormGroup.valid || !SecurityFormGroup.dirty\" -->\n <button mat-raised-button type=\"submit\">Save</button>\n </mat-card-actions>\n </mat-card>\n</form>\n",
4363
4440
  styles: [""]
4364
4441
  },] }
4365
4442
  ];
4366
4443
  BuildPipelineFormComponent.ctorParameters = () => [
4444
+ { type: EaCService },
4367
4445
  { type: FormBuilder },
4368
4446
  { type: ApplicationsFlowService }
4369
4447
  ];
@@ -4371,7 +4449,8 @@ BuildPipelineFormComponent.propDecorators = {
4371
4449
  BuildPipeline: [{ type: Input, args: ['build-pipeline',] }],
4372
4450
  DevOpsActionLookup: [{ type: Input, args: ['devops-action-lookup',] }],
4373
4451
  Disabled: [{ type: Input, args: ['disabled',] }],
4374
- Environment: [{ type: Input, args: ['environment',] }]
4452
+ Environment: [{ type: Input, args: ['environment',] }],
4453
+ EnvironmentLookup: [{ type: Input, args: ['environment-lookup',] }]
4375
4454
  };
4376
4455
 
4377
4456
  class DevopsSourceControlFormComponent {
@@ -4555,23 +4634,23 @@ class DevopsSourceControlFormComponent {
4555
4634
  // EnterpriseDataTokens: {},
4556
4635
  // };
4557
4636
  // let artifactLookup: string;
4558
- // // let artifact: EaCArtifact = {
4559
- // // ...this.Artifact,
4560
- // // ...this.HostingDetailsFormControls
4561
- // // .SelectedHostingOptionInputControlValues,
4562
- // // };
4563
- // if (!this.ArtifactLookup) {
4564
- // artifactLookup = Guid.CreateRaw();
4565
- // artifact = {
4566
- // ...artifact,
4567
- // Type: this.HostingDetailsFormControls.SelectedHostingOption
4568
- // .ArtifactType,
4569
- // Name: this.HostingDetailsFormControls.SelectedHostingOption.Name,
4570
- // NPMRegistry: 'https://registry.npmjs.org/',
4571
- // };
4572
- // } else {
4573
- // artifactLookup = this.ArtifactLookup;
4574
- // }
4637
+ // let artifact: EaCArtifact = {
4638
+ // ...this.Artifact,
4639
+ // ...this.HostingDetailsFormControls
4640
+ // .SelectedHostingOptionInputControlValues,
4641
+ // };
4642
+ // // if (!this.ArtifactLookup) {
4643
+ // // artifactLookup = Guid.CreateRaw();
4644
+ // // artifact = {
4645
+ // // ...artifact,
4646
+ // // Type: this.HostingDetailsFormControls.SelectedHostingOption
4647
+ // // .ArtifactType,
4648
+ // // Name: this.HostingDetailsFormControls.SelectedHostingOption.Name,
4649
+ // // NPMRegistry: 'https://registry.npmjs.org/',
4650
+ // // };
4651
+ // // } else {
4652
+ // // artifactLookup = this.ArtifactLookup;
4653
+ // // }
4575
4654
  // saveEnvReq.Environment.Artifacts[artifactLookup] = artifact;
4576
4655
  // let devOpsActionLookup: string;
4577
4656
  // if (!this.DevOpsActionLookup) {
@@ -4816,7 +4895,7 @@ class BuildPipelineDialogComponent {
4816
4895
  BuildPipelineDialogComponent.decorators = [
4817
4896
  { type: Component, args: [{
4818
4897
  selector: 'lcu-build-pipeline-dialog',
4819
- template: "<lcu-build-pipeline-form\n[build-pipeline]=\"data.buildPipeline\"\n[devops-action-lookup]=\"data.devopsActionLookup\"\n[environment]=\"data.environment\"\n>\n\n</lcu-build-pipeline-form>\n",
4898
+ template: "<lcu-build-pipeline-form\n[build-pipeline]=\"data.buildPipeline\"\n[devops-action-lookup]=\"data.devopsActionLookup\"\n[environment]=\"data.environment\"\n[environment-lookup]=\"data.environmentLookup\"\n>\n\n</lcu-build-pipeline-form>\n",
4820
4899
  styles: [""]
4821
4900
  },] }
4822
4901
  ];