Skip to content

Commit

Permalink
Merge pull request #15 from MTerance/users/sho/dev/fixAddAssets
Browse files Browse the repository at this point in the history
Users/sho/dev/fix add assets
  • Loading branch information
MTerance authored Oct 3, 2024
2 parents f816eb8 + 3fe7eb9 commit a0d4d44
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { AzureContainerService } from 'src/app/services/azure-container.service';
import assetsJson from './../../models/fakeDataAssets.json';
import { asset, fileHandle, typeAsset } from 'src/app/models/asset';
import { ApiService } from 'src/app/services/api.service';
import { AzureContainerService } from 'src/app/services/azure-container.service';

@Component({
selector: 'app-add-assets',
templateUrl: './add-assets.component.html',
Expand Down Expand Up @@ -34,6 +35,7 @@ export class AddAssetsComponent implements OnInit {
pathFile: "",
};
this.getAssetType();
this.getAssets();
}

ngOnInit(): void {
Expand All @@ -48,12 +50,15 @@ export class AddAssetsComponent implements OnInit {
console.log(this.files.length);
}

getAssets() : void {
this.apiAssetService.getAll(this.apiAsset).subscribe(data => {
this.assets = data;
});
}

getAssetType() : void {
this.apiAssetTypeService.getAll(this.apiTypeAsset).subscribe(data => {
this.typeAssets = data;
this.assetApiService.getAll(this.apiAsset).subscribe(data=> {
this.assets = data;
});
});
}

Expand Down
2 changes: 1 addition & 1 deletion F1-backoffice/src/app/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';


const API_URL = 'https://localhost:7279/api';
const API_URL = process.env['API_ADRESS'] as string;

@Injectable({
providedIn: 'root'
Expand Down
12 changes: 8 additions & 4 deletions F1-backoffice/src/app/services/azure-container.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { Injectable } from '@angular/core';
import { BlobServiceClient } from '@azure/storage-blob';
import { DefaultAzureCredential } from '@azure/identity';
import { DefaultAzureCredential, InteractiveBrowserCredential } from '@azure/identity';


const accountName = process.env['AZURE_STORAGE_ACCOUNT_NAME'] as string;

const credentials= new InteractiveBrowserCredential({
tenantId: 'common',
clientId: '04b07795-8ddb-461a-bbee-02f9e1bf7b46'
});

@Injectable({
providedIn: 'root'
})
Expand All @@ -14,10 +19,9 @@ export class AzureContainerService {
private blobServiceClient: BlobServiceClient;

constructor() {
this.blobServiceClient = new BlobServiceClient(
this.blobServiceClient = new BlobServiceClient(
`https://${accountName}.blob.core.windows.net`,
new DefaultAzureCredential()
);
credentials);
}

async CreateFile(file: File, containerName: string, blobName: string) {
Expand Down
3 changes: 3 additions & 0 deletions F1-backoffice/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export const environment = {
production: true,
AZURE_STORAGE_ACCOUNT_NAME: 'f1backoffice',
API_ADRESS: 'https://localhost:7279/api',
BLOB_STORAGE: 'https://f1backoffice.blob.core.windows.net',
AZURE_STORAGE_ACCOUNT_KEY: 'Default',
};
1 change: 1 addition & 0 deletions F1-backoffice/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
export const environment = {
production: false,
AZURE_STORAGE_ACCOUNT_NAME: 'f1backoffice',
API_ADRESS: 'https://localhost:7279/api'
};

/*
Expand Down
1 change: 1 addition & 0 deletions F1-backoffice/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"dom"
],
"types": [
"node",
"babylonjs",
"babylonjs-gui"
],
Expand Down

0 comments on commit a0d4d44

Please sign in to comment.