Skip to content

Commit e4ffb4d

Browse files
committed
Merge branch 'bugfix/fix_defects' into 'develop'
bugfix/fix_defects See merge request upm-inesdata/inesdata-connector-interface!38
2 parents f856418 + 37dcc7d commit e4ffb4d

File tree

15 files changed

+160
-53
lines changed

15 files changed

+160
-53
lines changed

package-lock.json

Lines changed: 32 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/pages/assets/asset-create/asset-create.component.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Vocabulary } from "../../../shared/models/vocabulary";
88
import { NotificationService } from 'src/app/shared/services/notification.service';
99
import { DATA_ADDRESS_TYPES, ASSET_TYPES } from 'src/app/shared/utils/app.constants';
1010
import { CKEDITOR_CONFIG } from 'src/app/shared/utils/ckeditor.utils';
11-
11+
import { LoadingService } from 'src/app/shared/services/loading.service';
1212
import { createAjv } from '@jsonforms/core';
1313
import { angularMaterialRenderers } from '@jsonforms/angular-material';
1414
import * as jsonld from 'jsonld';
@@ -150,13 +150,16 @@ export class AssetCreateComponent implements OnInit {
150150
private vocabularyService: VocabularyService,
151151
private notificationService: NotificationService,
152152
@Inject('STORAGE_TYPES') public storageTypes: StorageType[],
153-
private router: Router) {
153+
private router: Router,
154+
private loadingService: LoadingService) {
154155
}
155156

156157
async onSave() {
158+
this.loadingService.showLoading();
157159
// Check whether the asset is valid
158160
if (!this.checkVocabularyData() || !this.checkRequiredFields()) {
159161
this.notificationService.showError("Review the form fields");
162+
this.loadingService.hideLoading();
160163
return;
161164
}
162165

@@ -198,6 +201,7 @@ export class AssetCreateComponent implements OnInit {
198201
dataAddress = this.inesDataStoreAddress;
199202
} else {
200203
this.notificationService.showError("Incorrect destination value");
204+
this.loadingService.hideLoading();
201205
return;
202206
}
203207

@@ -208,9 +212,21 @@ export class AssetCreateComponent implements OnInit {
208212
dataAddress: dataAddress
209213
};
210214

211-
if (this.storageTypeId === DATA_ADDRESS_TYPES.inesDataStore) {
212-
assetInput.file = this.inesDataStoreAddress?.file
213-
assetInput.blob = new Blob([await assetInput?.file.arrayBuffer()])
215+
if (this.storageTypeId === DATA_ADDRESS_TYPES.inesDataStore && this.inesDataStoreAddress?.file) {
216+
const file = this.inesDataStoreAddress?.file;
217+
218+
const chunkSize = 1024 * 1024;
219+
let offset = 0;
220+
const chunks: Blob[] = [];
221+
222+
while (offset < file.size) {
223+
const slice = file.slice(offset, offset + chunkSize);
224+
const arrayBuffer = await slice.arrayBuffer();
225+
chunks.push(new Blob([arrayBuffer]));
226+
offset += chunkSize;
227+
}
228+
229+
assetInput.blob = new Blob(chunks);
214230
}
215231

216232
this.createAsset(assetInput)
@@ -363,6 +379,7 @@ private createAsset(asset: AssetInput){
363379
complete: () => {
364380
this.navigateToAsset()
365381
this.notificationService.showInfo("Successfully created");
382+
this.loadingService.hideLoading();
366383
}
367384
})
368385
} else {
@@ -372,6 +389,7 @@ private createAsset(asset: AssetInput){
372389
complete: () => {
373390
this.navigateToAsset()
374391
this.notificationService.showInfo("Successfully created");
392+
this.loadingService.hideLoading();
375393
}
376394
})
377395
}
@@ -384,6 +402,7 @@ private createAsset(asset: AssetInput){
384402
private showError(error: string, errorMessage: string) {
385403
this.notificationService.showError(errorMessage);
386404
console.error(error);
405+
this.loadingService.hideLoading();
387406
}
388407

389408
navigateToAsset(){

src/app/pages/contract-definitions/contract-definition-viewer/contract-definition-viewer.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
<mat-list dense>
1919
<mat-list-item>
2020
<mat-icon matListItemIcon>policy</mat-icon>
21-
<div class="policy-name" matListItemTitle>Access policy</div>
21+
<div class="bold-text" matListItemTitle>Access policy</div>
2222
<div matListItemLine>{{contractDefinition.accessPolicyId}}</div>
2323
</mat-list-item>
2424
<mat-list-item>
2525
<mat-icon matListItemIcon>policy</mat-icon>
26-
<div class="policy-name" matListItemTitle>Contract policy</div>
26+
<div class="bold-text" matListItemTitle>Contract policy</div>
2727
<div matListItemLine>{{contractDefinition.contractPolicyId}}</div>
2828
</mat-list-item>
29-
<mat-list-item>
30-
<div class="policy-assets" matListItemTitle>Assets</div>
29+
<mat-list-item class="contract-assets">
30+
<div class="bold-text" matListItemTitle>Assets</div>
3131
<mat-icon matListItemIcon>policy</mat-icon>
3232

3333
<div matListItemLine *ngIf="contractDefinition.assetsSelector.length == 0; else elseBlock">All assets</div>

src/app/pages/contract-definitions/contract-definition-viewer/contract-definition-viewer.component.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
margin-left: 0;
2020
}
2121

22-
.policy-name,
23-
#policy-assets {
22+
.bold-text {
2423
font-weight: bold !important;
2524
}
2625

@@ -34,3 +33,7 @@ mat-paginator {
3433
align-items: center;
3534
gap: 10px;
3635
}
36+
37+
.contract-assets .mdc-list-item__secondary-text{
38+
white-space: break-spaces;
39+
}

src/app/pages/policies/new-policy/new-policy.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<mat-label>ID</mat-label>
1010
<input matInput autocomplete="newvalue" [formControl]="ctrl" />
1111
<mat-error *ngIf="ctrl.invalid && ctrl.errors?.pattern">{{
12-
validationMessages.invalidWhitespacesOrColonsMessage
12+
validationMessages.invalidSpecialCharactersMessage
1313
}}</mat-error>
1414
</mat-form-field>
1515

src/app/pages/policies/new-policy/policy-definition-create-page-form.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
PolicyDefinitionCreatePageFormValue,
66
} from './policy-definition-create-page-form-model';
77
import { ExpressionFormControls } from '../policy-editor/editor/expression-form-controls';
8-
import { noWhitespacesOrColonsValidator } from 'src/app/shared/validators/no-whitespaces-or-colons-validator';
8+
import { noSpecialCharactersValidator } from 'src/app/shared/validators/no-special-characters-validator';
99

1010
/**
1111
* Handles AngularForms for NewPolicyDialog
@@ -28,7 +28,7 @@ export class PolicyDefinitionCreatePageForm {
2828

2929
buildFormGroup(): FormGroup<PolicyDefinitionCreatePageFormModel> {
3030
return this.formBuilder.nonNullable.group({
31-
id: ['', [Validators.required, noWhitespacesOrColonsValidator]],
31+
id: ['', [Validators.required, noSpecialCharactersValidator]],
3232
treeControls: this.expressionFormControls.formGroup,
3333
});
3434
}

src/app/pages/policies/policy-editor/editor/recipes/timespan-restriction-dialog/timespan-restriction-expression.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ export const buildTimespanRestriction = (
1919
return multi(
2020
'AND',
2121
evaluationTimeConstraint('GEQ', firstDay),
22-
evaluationTimeConstraint('LT', addDays(lastDay, 1)),
22+
evaluationTimeConstraint('LEQ', lastDay),
2323
);
2424
};

src/app/pages/policies/policy-view/policy-view.component.scss

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#wrapper {
2-
}
3-
41
:host ::ng-deep div.mat-expansion-panel-body {
52
padding-left: 0 !important;
63
}
@@ -31,6 +28,7 @@ button {
3128

3229
mat-card {
3330
font-family: "Open Sans";
31+
place-self: normal;
3432
}
3533

3634
:host ::ng-deep policy-expression {
@@ -45,6 +43,14 @@ mat-card {
4543
height: 100%;
4644
}
4745

48-
mat-card {
49-
place-self: normal;
46+
.code {
47+
word-wrap: break-word;
48+
}
49+
50+
.mat-mdc-card-title {
51+
padding-right: 30px !important;
52+
}
53+
54+
:host ::ng-deep .mat-mdc-card-header-text{
55+
width: 100%;
5056
}

src/app/shared/components/navigation/navigation.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@
4747
</div>
4848
</mat-sidenav-content>
4949
</mat-sidenav-container>
50+
<app-spinner></app-spinner>
5051
</div>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.overlay {
2+
position: fixed;
3+
top: 0;
4+
left: 0;
5+
width: 100%;
6+
height: 100%;
7+
background: rgba(25, 25, 25, 0.8);
8+
display: flex;
9+
justify-content: center;
10+
align-items: center;
11+
z-index: 1000;
12+
}
13+
14+
.spinner {
15+
border: 8px solid #f3f3f3;
16+
border-top: 8px solid #03a9f4;
17+
border-radius: 50%;
18+
width: 60px;
19+
height: 60px;
20+
animation: spin 1s linear infinite;
21+
}
22+
23+
@keyframes spin {
24+
0% { transform: rotate(0deg); }
25+
100% { transform: rotate(360deg); }
26+
}

0 commit comments

Comments
 (0)