Skip to content

Commit 9d90f17

Browse files
committed
Utilize only the provided project
getting rid of the idea of a default project
1 parent e6ae138 commit 9d90f17

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

webapp/src/app/components/projects/projects.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ export class ProjectsComponent implements OnInit {
1616
topicList2$: Observable<Topic[]> = EMPTY
1717
subscriptionList$: Observable<Subscription[]> = EMPTY
1818

19-
currentProject?: string
19+
currentProject: string = ""
2020
currentTopic?: Topic
2121
currentSubscription?: Subscription
2222

2323
constructor(private route: ActivatedRoute, private pubsub: PubsubService) { }
2424

2525
ngOnInit(): void {
2626
this.route.queryParamMap.subscribe(qpm => {
27-
this.currentProject = qpm.get("project") ?? undefined
27+
this.currentProject = qpm.get("project") ?? ""
2828

2929
console.log("loaded project: ", this.currentProject)
3030
this.pubsub.selectProject(this.currentProject!)

webapp/src/app/services/pubsub.service.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import { NewSubscriptionRequest } from '../components/subscription-list/new-subs
77
providedIn: 'root'
88
})
99
export class PubsubService {
10-
project_id = "test-project"
1110
public currentHost = "http://localhost:8681"
1211

13-
private _projectList = new BehaviorSubject<string[]>(["test-project"])
12+
private _projectList = new BehaviorSubject<string[]>([])
1413
private _currentProject = new ReplaySubject<string>()
1514
private _currentTopic = new ReplaySubject<Topic>()
1615
private _currentSubscription = new ReplaySubject<Subscription>()
@@ -39,14 +38,14 @@ export class PubsubService {
3938
this._projectList.next(newList)
4039
}
4140

42-
createTopic(projectId: string = this.project_id, topicId: string){
41+
createTopic(projectId: string, topicId: string){
4342
const url = `${this.currentHost}/v1/projects/${projectId}/topics/${topicId}`
4443

4544
return this.http.put<Topic>(url, {})
4645
}
4746

48-
listTopics(projectId: string = this.project_id) {
49-
return this.http.get<{ topics: Topic[] }>(`${this.currentHost}/v1/projects/${this.project_id}/topics`).pipe(map(incoming => incoming?.topics || []))
47+
listTopics(projectId: string) {
48+
return this.http.get<{ topics: Topic[] }>(`${this.currentHost}/v1/projects/${projectId}/topics`).pipe(map(incoming => incoming?.topics || []))
5049
}
5150

5251
createSubscription(projectId: string, request: NewSubscriptionRequest){
@@ -60,8 +59,8 @@ export class PubsubService {
6059
return this.http.delete(url)
6160
}
6261

63-
listSubscriptions(): Observable<Subscription[]> {
64-
return this.http.get<{ subscriptions?: string[] }>(`${this.currentHost}/v1/projects/${this.project_id}/subscriptions`)
62+
listSubscriptions(projectId: string): Observable<Subscription[]> {
63+
return this.http.get<{ subscriptions?: string[] }>(`${this.currentHost}/v1/projects/${projectId}/subscriptions`)
6564
.pipe(
6665
map(incoming => incoming.subscriptions), // first we pull out the subscriptions object
6766
map(subNames => subNames??[]),

0 commit comments

Comments
 (0)