Skip to content

Commit f964365

Browse files
Merge pull request #26 from strongbox/SB-1414
SB-1414 List repositories from all storages in group repository management
2 parents 4832acd + a3e526f commit f964365

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

src/app/modules/storage-management/pages/browse-storages/components/list-repositories/list-repositories.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<ng-container *ngFor="let column of repositoryColumns;">
44
<ng-container [matColumnDef]="column">
55
<th mat-header-cell *matHeaderCellDef>{{ column | titlecase }}</th>
6-
<td mat-cell *matCellDef="let repository" (click)="navigateToDirectoryListing(repository)" class="clickable">
6+
<td mat-cell *matCellDef="let repository" (click)="navigateToRepositoryUpdate(repository)" class="clickable">
77
{{repository[column]}}
88
</td>
99
</ng-container>

src/app/modules/storage-management/pages/manage-repository/manage-repository.component.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
import {ApiResponse, handleFormError} from '../../../core/core.model';
2424
import {ProxyConfiguration, ProxyConfigurationTypeEnum} from '../../proxyConfiguration.model';
2525
import {StorageEntity} from '../../storage.model';
26+
import {FormDataService} from 'src/app/shared/form/services/form-data.service';
2627

2728
@Component({
2829
selector: 'app-storage-manage',
@@ -48,7 +49,8 @@ export class ManageRepositoryComponent implements OnInit {
4849
private route: ActivatedRoute,
4950
private router: Router,
5051
private store: Store,
51-
private service: StorageManagerService) {
52+
private service: StorageManagerService,
53+
private formDataService: FormDataService) {
5254
}
5355

5456
generateCommonFormFields(type: RepositoryTypeEnum, repo: Repository) {
@@ -241,19 +243,20 @@ export class ManageRepositoryComponent implements OnInit {
241243
this.service
242244
.getRepository(storageId, repositoryId)
243245
.subscribe((repository: Repository) => {
246+
console.log(repository);
244247
this.type$.next(this.getRepositoryEnumType(repository));
245248
this.repository$.next(repository);
246249

247250
if (this.isGroupRepository()) {
248251
this.activeGroupRepositories = repository.groupRepositories;
249252

250-
this.service
251-
.getStorage(storageId)
252-
.subscribe((storage: StorageEntity) => {
253-
this.availableGroupRepositories = storage.repositories
254-
.map(r => r.id)
255-
.filter((id) => {
256-
return id !== repository.id && repository.groupRepositories.indexOf(id) === -1;
253+
this.formDataService
254+
.findRepositoryNames(null, null, true)
255+
.subscribe((storages: string[]) => {
256+
this.availableGroupRepositories = storages
257+
.filter((srId) => {
258+
return srId !== repository.getStorageIdAndRepositoryId() &&
259+
repository.groupRepositories.indexOf(srId) === -1;
257260
})
258261
.sort((a, b) => a.localeCompare(b));
259262

src/app/modules/storage-management/repository.model.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export class CustomRepositoryConfiguration {
6666
}
6767

6868
export class Repository {
69-
// this is used only internally to store the "owning" storage id - not actually received from the api.
7069
public storageId: string = null;
7170
public id: string = null;
7271
public basedir: string = null;
@@ -123,4 +122,8 @@ export class Repository {
123122
this.remoteRepository = new RemoteRepositoryConfiguration();
124123
}
125124
}
125+
126+
public getStorageIdAndRepositoryId() {
127+
return this.storageId + ':' + this.id;
128+
}
126129
}

src/app/shared/form/services/form-data.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class FormDataService {
8787
);
8888
}
8989

90-
findRepositoryNames(term = '', storageId = '', withStorageId = false, type = null): Observable<any> {
90+
findRepositoryNames(term = '', storageId = '', withStorageId = false, type = null): Observable<string[]> {
9191
term = this.sanitize(term);
9292
storageId = this.sanitize(storageId);
9393
type = this.sanitize(type);

0 commit comments

Comments
 (0)