Skip to content

Commit

Permalink
to remove: craps for UA update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Regzox committed Feb 23, 2024
1 parent 33103e5 commit d1a7c71
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
>
<i class="material-icons">chevron_right</i>
</button>
<div class="btn-group d-flex">
<button (click)="updateUnits()" class="btn secondary">Test update by archive unit list</button>
<button (click)="updateUnitByCommands()" class="btn secondary">Test update by single-command set</button>
<button (click)="updateUnitsByCommands()" class="btn secondary">Test update by multi-command sets</button>
</div>
</div>
<app-archive-search
(archiveUnitClick)="showPreviewArchiveUnit($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ import {
import { ArchiveSharedDataService } from '../core/archive-shared-data.service';
import { ManagementRulesSharedDataService } from '../core/management-rules-shared-data.service';
import { ArchiveService } from './archive.service';
import { JsonPatchDto, MultiJsonPatchDto } from 'ui-frontend-common/app/modules/archive/models/json-patch';
import { ArchiveUnit } from 'ui-frontend-common/app/modules/archive/models/archive-unit';

@Component({
selector: 'app-archive',
Expand Down Expand Up @@ -182,4 +184,89 @@ export class ArchiveComponent extends SidenavPage<any> implements OnInit, OnDest
backToNormalLateralPanel() {
this.isLPExtended = false;
}

updateUnits() {
const archiveUnits: ArchiveUnit[] = [
{
'#id': 'aeaqaaaaaeecjacaabikwamny6s377qaaaaq',
Description: 'Description inserted by bulk update archive units test',
},
];
const subscription: Subscription = this.archiveService.asyncPartialUpdateArchiveUnits(archiveUnits).subscribe(({ operationId }) => {
console.log({ operationId });
subscription.unsubscribe();
});
}

updateUnitByCommands() {
const jsonPatchDto: JsonPatchDto = {
id: 'aeaqaaaaaeecjacaabikwamny6s377qaaaaq',
jsonPatch: [
{ op: 'remove', path: 'Description', value: null },
{ op: 'replace', path: 'Description', value: 'Description inserted by bulk update archive unit by command test SINGLE' },
// {
// op: 'replace',
// path: 'Description',
// value:
// "Début du texte [Bonjour à tous,\n\nJ'ai vu un documentaire ce week end résumant bien la problématique de\nl'archivage numérique (par moment on aurait dit une pub pour Vitam...]\nFin du texte [ine.jablasy@culture.gouv.fr>\nSuivez-nous sur Twitter @ProgVitam <https://twitter.com/progvitam>\n/Le programme est hébergé par les moyens informatiques du MCC/]",
// },
{
op: 'add',
path: 'Agent',
value: [
{
FirstName: '"catherine',
BirthName: 'JABLASY-Telem@c"',
Identifier: ['catherine.jablasy@culture.gouv.fr'],
Function: ['Standardiste'],
Role: ['Standardiste'],
},
{
FirstName: 'John',
BirthName: 'Doe',
Identifier: ['john.doe@culture.gouv.fr'],
Function: ['Guitariste'],
Role: ['Guitariste'],
},
],
},
{ op: 'remove', path: 'Agent', value: null },
],
};
const subscription: Subscription = this.archiveService
.asyncPartialUpdateArchiveUnitByCommands(jsonPatchDto)
.subscribe(({ operationId }) => {
console.log({ operationId });
subscription.unsubscribe();
});
}

updateUnitsByCommands() {
const multiJsonPatchDto: MultiJsonPatchDto = [
{
id: 'aeaqaaaaaeecjacaabikwamny6tzigaaaada',
jsonPatch: [
{ op: 'replace', path: 'Description', value: 'Description inserted by bulk update archive units by command test MULTI-A' },
],
},
{
id: 'aeaqaaaaaeecjacaabikwamny6tzigiaaaaq',
jsonPatch: [
{ op: 'replace', path: 'Description', value: 'Description inserted by bulk update archive units by command test MULTI-B' },
],
},
{
id: 'aeaqaaaaaeecjacaabikwamny6tzigiaaabq',
jsonPatch: [
{ op: 'replace', path: 'Description', value: 'Description inserted by bulk update archive units by command test MULTI-C' },
],
},
];
const subscription: Subscription = this.archiveService
.asyncPartialUpdateArchiveUnitsByCommands(multiJsonPatchDto)
.subscribe(({ operationId }) => {
console.log({ operationId });
subscription.unsubscribe();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ import {
SecurityService,
Unit,
} from 'ui-frontend-common';
import { ArchiveUnit } from 'ui-frontend-common/app/modules/archive/models/archive-unit';
import { JsonPatchDto, MultiJsonPatchDto } from 'ui-frontend-common/app/modules/archive/models/json-patch';
import { ArchiveApiService } from '../core/api/archive-api.service';
import { ArchiveUnit } from './models/archive-unit';
import { ExportDIPRequestDto, TransferRequestDto } from './models/dip.interface';
import { JsonPatchDto, MultiJsonPatchDto } from './models/json-patch';
import { ReclassificationCriteriaDto } from './models/reclassification-request.interface';
import { RuleSearchCriteriaDto } from './models/ruleAction.interface';
import { UnitDescriptiveMetadataDto } from './models/unitDescriptiveMetadata.interface';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ import {
SearchResponse,
Unit,
} from 'ui-frontend-common';
import { ArchiveUnit } from '../../archive/models/archive-unit';
import { ArchiveUnit } from 'ui-frontend-common/app/modules/archive/models/archive-unit';
import { JsonPatchDto, MultiJsonPatchDto } from 'ui-frontend-common/app/modules/archive/models/json-patch';
import { ExportDIPRequestDto, TransferRequestDto } from '../../archive/models/dip.interface';
import { JsonPatchDto, MultiJsonPatchDto } from '../../archive/models/json-patch';
import { ReclassificationCriteriaDto } from '../../archive/models/reclassification-request.interface';
import { RuleSearchCriteriaDto } from '../../archive/models/ruleAction.interface';
import { UnitDescriptiveMetadataDto } from '../../archive/models/unitDescriptiveMetadata.interface';
Expand Down

0 comments on commit d1a7c71

Please sign in to comment.