-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial iteration on building out a UI
- Loading branch information
Showing
21 changed files
with
758 additions
and
343 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<div class="overlay"> | ||
<fd-dynamic-page size="large" ariaLabel="Example Dynamic Page" [autoResponsive]="false"> | ||
<fd-dynamic-page-header title="Account List" | ||
subtitle="This page displays the created Accounts on in your Environment"> | ||
<!-- breadcrumb content --> | ||
<fd-dynamic-page-breadcrumb> | ||
<fd-breadcrumb> | ||
<fd-breadcrumb-item> | ||
<a fd-link href="#">Accounts</a> | ||
</fd-breadcrumb-item> | ||
</fd-breadcrumb> | ||
</fd-dynamic-page-breadcrumb> | ||
<fd-dynamic-page-global-actions> | ||
<fd-toolbar fdType="transparent" [clearBorder]="true"> | ||
<button fd-toolbar-item fd-button fdCompact fdType="emphasized" label="Create Account" title="Create"></button> | ||
<fd-toolbar-separator></fd-toolbar-separator> | ||
</fd-toolbar> | ||
</fd-dynamic-page-global-actions> | ||
</fd-dynamic-page-header> | ||
<fd-dynamic-page-content cdkScrollable> | ||
<div *ngIf="(accounts | async) as accountList"> | ||
<table fd-table aria-label="Default" *ngIf="accountList.length > 0"> | ||
<thead fd-table-header> | ||
<tr fd-table-row> | ||
<th fd-table-cell>Name</th> | ||
</tr> | ||
</thead> | ||
<tbody fd-table-body > | ||
|
||
<tr fd-table-row *ngFor="let row of accountList;"> | ||
<td fd-table-cell> | ||
<a fd-link href="#">{{ row.metadata.name }}</a> | ||
</td> | ||
<!-- <td fd-table-cell> | ||
<p fd-table-text maxWidth="250px" [noWrap]="true"> | ||
{{ row.column2 }} | ||
</p> | ||
</td> | ||
<td fd-table-cell> | ||
<p fd-table-text maxWidth="250px"> | ||
{{ row.column3 }} | ||
</p> | ||
</td> | ||
<td fd-table-cell>{{ row.date }}</td> | ||
<td fd-table-cell><fd-icon [glyph]="row.type"></fd-icon></td> --> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<div [style.width.%]="100" [style.display]="'flex'" [style.justify-content]="'center'" *ngIf="accountList.length == 0"> | ||
<figure fd-illustrated-message [svgConfig]="sceneConfig" svgAriaLabel="Illustration label"> | ||
<figcaption fd-illustrated-message-figcaption> | ||
<h3 fd-illustrated-message-title>No Accounts so far</h3> | ||
<p fd-illustrated-message-text>Create your first Account!</p> | ||
</figcaption> | ||
<fd-illustrated-message-actions> | ||
<button fd-button label="Create"></button> | ||
</fd-illustrated-message-actions> | ||
</figure> | ||
</div> | ||
</div> | ||
</fd-dynamic-page-content> | ||
</fd-dynamic-page> | ||
</div> |
Empty file.
23 changes: 23 additions & 0 deletions
23
frontend/src/app/account-list/account-list.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { AccountListComponent } from './account-list.component'; | ||
|
||
describe('AccountListComponent', () => { | ||
let component: AccountListComponent; | ||
let fixture: ComponentFixture<AccountListComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [AccountListComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(AccountListComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Component, OnInit } from "@angular/core"; | ||
import { FundamentalNgxCoreModule, IllustratedMessageModule } from "@fundamental-ngx/core"; | ||
import { AccountService } from "../services/account-service.service"; | ||
import { BehaviorSubject, Observable } from "rxjs"; | ||
import { Account } from "../models/account"; | ||
import { CommonModule } from "@angular/common"; | ||
|
||
@Component({ | ||
selector: "app-account-list", | ||
standalone: true, | ||
imports: [FundamentalNgxCoreModule, CommonModule,IllustratedMessageModule], | ||
templateUrl: "./account-list.component.html", | ||
styleUrl: "./account-list.component.scss", | ||
}) | ||
export class AccountListComponent implements OnInit { | ||
constructor(private accountService: AccountService){} | ||
|
||
sceneConfig = { | ||
scene: { url: 'assets/images/sapIllus-Scene-NoSearchResults.svg', id: 'sapIllus-Scene-NoSearchResults' }, | ||
dialog: { url: 'assets/images/sapIllus-Dialog-NoSearchResults.svg', id: 'sapIllus-Dialog-NoSearchResults' } | ||
}; | ||
|
||
|
||
accounts: Observable<Account[]> = new BehaviorSubject([]); | ||
|
||
ngOnInit(): void { | ||
this.accounts = this.accountService.getAccounts() | ||
this.accounts.subscribe(res => console.log(res)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Injectable } from "@angular/core"; | ||
import { ApolloLink, InMemoryCache } from "@apollo/client"; | ||
import { setContext } from "@apollo/client/link/context"; | ||
import { apiurl } from "./graphql.config"; | ||
import { PortalLuigiContextService } from "./services/luigi-context.service"; | ||
import { HttpLink } from 'apollo-angular/http'; | ||
import { first } from "rxjs"; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ApolloFactory { | ||
constructor(private luigiContextService:PortalLuigiContextService){} | ||
|
||
|
||
createApollo(httpLink: HttpLink) { | ||
const basic = setContext((operation, context) => ({ | ||
headers: { | ||
Accept: 'charset=utf-8', | ||
}, | ||
})); | ||
|
||
const auth = setContext((operation, context) => { | ||
let ctx = this.luigiContextService.getContext() | ||
if (ctx.token === null) { | ||
return {}; | ||
} else { | ||
return { | ||
headers: { | ||
Authorization: `Bearer ${ctx.token}`, | ||
}, | ||
}; | ||
} | ||
}); | ||
|
||
const link = ApolloLink.from([basic, auth, httpLink.create({ uri: apiurl })]); | ||
const cache = new InMemoryCache(); | ||
|
||
return { | ||
link, | ||
cache, | ||
}; | ||
} | ||
} |
Oops, something went wrong.