You do not have any starred entries or organizations.
diff --git a/src/app/home-page/widget/starred-box/starred-box.component.ts b/src/app/home-page/widget/starred-box/starred-box.component.ts
index 6851baa608..eb9da780f7 100644
--- a/src/app/home-page/widget/starred-box/starred-box.component.ts
+++ b/src/app/home-page/widget/starred-box/starred-box.component.ts
@@ -1,10 +1,7 @@
-import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
-import { AlertService } from 'app/shared/alert/state/alert.service';
import { Base } from 'app/shared/base';
import { Dockstore } from 'app/shared/dockstore.model';
-import { Event, UsersService, EventsService } from 'app/shared/openapi';
-import { finalize, takeUntil } from 'rxjs/operators';
+import { UsersService } from 'app/shared/openapi';
@Component({
selector: 'app-starred-box',
@@ -12,32 +9,20 @@ import { finalize, takeUntil } from 'rxjs/operators';
styleUrls: ['./starred-box.component.scss', '../../../shared/styles/dashboard-boxes.scss'],
})
export class StarredBoxComponent extends Base implements OnInit {
- Dockstore = Dockstore;
- totalStarredWorkflows: number = 0;
- totalStarredTools: number = 0;
- totalStarredServices: number = 0;
- totalStarredOrganizations: number = 0;
- events: Array = [];
- public isLoading = true;
- EventType = Event.TypeEnum;
- private readonly supportedEventTypes = [
- Event.TypeEnum.ADDVERSIONTOENTRY,
- Event.TypeEnum.CREATECOLLECTION,
- Event.TypeEnum.ADDTOCOLLECTION,
- Event.TypeEnum.PUBLISHENTRY,
- Event.TypeEnum.UNPUBLISHENTRY,
- Event.TypeEnum.MODIFYCOLLECTION,
- Event.TypeEnum.ADDUSERTOORG,
- ];
+ public Dockstore = Dockstore;
+ public totalStarredWorkflows: number = 0;
+ public totalStarredTools: number = 0;
+ public totalStarredServices: number = 0;
+ public totalStarredOrganizations: number = 0;
+
// Hides starred services, remove when implemented
- serviceImplemented: boolean = false;
+ public serviceImplemented: boolean = false;
- constructor(private usersService: UsersService, private eventsService: EventsService, private alertService: AlertService) {
+ constructor(private usersService: UsersService) {
super();
}
ngOnInit(): void {
- this.getMyEvents();
this.usersService.getStarredServices().subscribe((starredServices) => {
this.totalStarredServices = starredServices.length;
});
@@ -51,21 +36,4 @@ export class StarredBoxComponent extends Base implements OnInit {
this.totalStarredOrganizations = starredOrganizations.length;
});
}
-
- private getMyEvents() {
- this.eventsService
- .getEvents('ALL_STARRED')
- .pipe(
- finalize(() => (this.isLoading = false)),
- takeUntil(this.ngUnsubscribe)
- )
- .subscribe(
- (events) => {
- this.events = events.filter((event) => this.supportedEventTypes.includes(event.type)).slice(0, 4);
- },
- (error: HttpErrorResponse) => {
- this.alertService.detailedError(error);
- }
- );
- }
}
diff --git a/src/app/shared/entry-to-display-name.pipe.ts b/src/app/shared/entry-to-display-name.pipe.ts
index 0648b3ba88..6d6a59f69b 100644
--- a/src/app/shared/entry-to-display-name.pipe.ts
+++ b/src/app/shared/entry-to-display-name.pipe.ts
@@ -1,5 +1,5 @@
import { Pipe, PipeTransform } from '@angular/core';
-import { DockstoreTool, Workflow } from './swagger';
+import { DockstoreTool, Workflow } from './openapi';
/**
* This pipe converts and entry (DockstoreTool or Workflow) to a name that is missing the registry or source control
diff --git a/src/app/shared/entry/recent-events.pipe.ts b/src/app/shared/entry/recent-events.pipe.ts
new file mode 100644
index 0000000000..443ad36363
--- /dev/null
+++ b/src/app/shared/entry/recent-events.pipe.ts
@@ -0,0 +1,58 @@
+import { Inject, Pipe, PipeTransform } from '@angular/core';
+import { Event } from 'app/shared/openapi';
+import { EntryToDisplayNamePipe } from '../entry-to-display-name.pipe';
+import { EntryType } from '../../shared/enum/entry-type';
+
+@Pipe({
+ name: 'recentEvents',
+})
+// TO DO: Accommodate for notebooks and services when we can retrieve those events
+export class RecentEventsPipe implements PipeTransform {
+ private EntryType = EntryType;
+ constructor(@Inject(EntryToDisplayNamePipe) private entryToDisplayNamePipe: EntryToDisplayNamePipe) {}
+
+ /**
+ * Takes in an event object and extracts details used in the RecentEventsComponent
+ *
+ * @param {Event} event
+ * @param {string} type 'displayName' | 'entryLink' | 'entryType' | 'orgLink' | 'collectionLink'
+ * @returns String | null
+ */
+ transform(event: Event, type: 'displayName' | 'entryLink' | 'entryType' | 'orgLink' | 'collectionLink'): string | null {
+ if (!event || !type) {
+ return null;
+ }
+
+ switch (type) {
+ case 'displayName': {
+ if (event.workflow) {
+ return this.entryToDisplayNamePipe.transform(event.workflow);
+ } else if (event.tool) {
+ return this.entryToDisplayNamePipe.transform(event.tool);
+ } else if (event.apptool) {
+ return this.entryToDisplayNamePipe.transform(event.apptool);
+ }
+ break;
+ }
+ case 'entryLink': {
+ if (event.workflow) {
+ return '/workflows/' + event.workflow.full_workflow_path;
+ } else if (event.tool) {
+ return '/tools/' + event.tool.tool_path;
+ } else if (event.apptool) {
+ return '/tools/' + event.apptool.full_workflow_path;
+ }
+ break;
+ }
+ case 'entryType': {
+ return event.tool || event.apptool ? this.EntryType.Tool : this.EntryType.BioWorkflow;
+ }
+ case 'orgLink': {
+ return '/organizations/' + event.organization.name;
+ }
+ case 'collectionLink': {
+ return '/organizations/' + event.organization.name + '/collections/' + event.collection.name;
+ }
+ }
+ }
+}
diff --git a/src/app/shared/pipe/pipe.module.ts b/src/app/shared/pipe/pipe.module.ts
index 5eb3cc4d75..199a876c77 100644
--- a/src/app/shared/pipe/pipe.module.ts
+++ b/src/app/shared/pipe/pipe.module.ts
@@ -12,6 +12,8 @@ import { SelectTabPipe } from '../entry/select-tab.pipe';
import { BaseUrlPipe } from '../entry/base-url.pipe';
import { DescriptorLanguageVersionsPipe } from '../entry/descriptor-language-versions.pipe';
import { DescriptorLanguagePipe } from '../entry/descriptor-language.pipe';
+import { RecentEventsPipe } from '../entry/recent-events.pipe';
+import { EntryToDisplayNamePipe } from '../entry-to-display-name.pipe';
const DECLARATIONS: any[] = [
FilePathPipe,
@@ -26,10 +28,12 @@ const DECLARATIONS: any[] = [
BaseUrlPipe,
DescriptorLanguageVersionsPipe,
DescriptorLanguagePipe,
+ RecentEventsPipe,
];
@NgModule({
imports: [CommonModule],
declarations: DECLARATIONS,
exports: DECLARATIONS,
+ providers: [EntryToDisplayNamePipe],
})
export class PipeModule {}
diff --git a/src/app/shared/styles/dashboard-boxes.scss b/src/app/shared/styles/dashboard-boxes.scss
index ad39b7a59c..47b787af74 100644
--- a/src/app/shared/styles/dashboard-boxes.scss
+++ b/src/app/shared/styles/dashboard-boxes.scss
@@ -9,7 +9,7 @@ img[alt='User avatar'] {
margin: 0.8rem;
}
-img[alt='Org avatar'] {
+img.entry-img {
width: 6rem;
max-height: 6rem;
object-fit: scale-down;
@@ -29,6 +29,11 @@ button[mat-icon-button] {
border-bottom: 0.1rem solid mat.get-color-from-palette($dockstore-app-gray, 3);
}
+// Ensure recent activity events are uniform
+.event {
+ min-height: 8rem;
+}
+
// Overide mat-card padding to extend mat-divider to edges
mat-divider {
margin: 0 -16px;
diff --git a/src/materialColorScheme.scss b/src/materialColorScheme.scss
index f426638e92..dc085477b9 100644
--- a/src/materialColorScheme.scss
+++ b/src/materialColorScheme.scss
@@ -197,6 +197,8 @@ $workflow-selection-color: #d2fbf0;
$service-color: #ff6c44;
$service-selection-color: #ffdbcf;
+$org-selection-color: #dde1f2;
+
// Color used to indicate success in general (of an operation, verified badge, etc).
$accent-3-dark: #00bfa5 !important;
diff --git a/src/styles.scss b/src/styles.scss
index 3b66037870..ea1b9f4853 100644
--- a/src/styles.scss
+++ b/src/styles.scss
@@ -904,6 +904,12 @@ app-workflow-sidebar-accordion
background: $service-selection-color !important;
}
+// Set the background to the color associated with organizations (purple).
+// Used to set the background color in bubbles.
+.org-background {
+ background: $org-selection-color !important;
+}
+
// Styles an element as a "bubble", which is a small very-rounded rectangular element that typically contains a word or short phrase.
// Bubbles always render in a 12px font, are 28px tall, and default to gray background.
.bubble {