Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: main to develop #5

Merged
merged 15 commits into from
Apr 28, 2024
8 changes: 0 additions & 8 deletions at.PowerBIUnitTest.Portal/at.PowerBIUnitTest.Portal/Adds.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import { MsalGuard } from "@azure/msal-angular";
import { HomeComponent } from "./components/home/home.component";
import { ProfileComponent } from "./components/profile/profile.component";
import { UserComponent } from "./components/users/users.component";
import { utCreateComponent } from "./components/utCreate/utCreate.component";
import { utExecuteComponent } from "./components/utExecute/utExecute.component";
import { utTreeViewTestComponent } from "./components/utTreeViewTest/utTreeViewTest.component";
import { RoleGuard } from "./shared/guards/role.guard";
import { UnitTestsComponent } from "./components/unit-tests/unit-tests.component";

const routes: Routes = [
{ path: "", pathMatch: "full", redirectTo: "/unittests" },
{ path: "profile", component: ProfileComponent, canActivate: [MsalGuard] },
{ path: "unittests", component: utTreeViewTestComponent, canActivate: [MsalGuard] },
{ path: "unittests", component: UnitTestsComponent, canActivate: [MsalGuard] },
];

@NgModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,14 @@ import { LayoutService } from "./shared/services/layout.service";
import { DxTreeListModule } from "devextreme-angular";
import { RoleGuard } from "./shared/guards/role.guard";
import { Router } from "@angular/router";
import { utCreateComponent } from "./components/utCreate/utCreate.component";
import { utExecuteComponent } from "./components/utExecute/utExecute.component";
import { UnitTestService } from "./shared/services/UnitTest.service";
import { UserStoryService } from "./shared/services/UserStory.service";
import { utTreeViewTestComponent } from "./components/utTreeViewTest/utTreeViewTest.component";
import { UnitTestService } from "./shared/services/unit-test.service";
import { UserStoryService } from "./shared/services/user-story.service";
import { WorkspaceService } from "./shared/services/workspace.service";
import { TabularModelService } from "./shared/services/TabularModel.service";
import { StructurService } from "./shared/services/structur.service";
import { TabularModelService } from "./shared/services/tabular-model.service";
import { DxoHideEventModule } from "devextreme-angular/ui/nested";
import { HistoryService } from "./shared/services/history.service";
import { SideNavigationMenuComponent } from "./components/side-navigation-menu/side-navigation-menu.component";


import { UnitTestsComponent } from "./components/unit-tests/unit-tests.component";
import { GetFirstElementPipe } from "./shared/pipes/get-first-element.pipe";

export function initializeAppConfig(appConfig: AppConfig, router: Router) {
return () => appConfig.load();
Expand All @@ -88,10 +83,9 @@ export function initializeAppConfig(appConfig: AppConfig, router: Router) {
HomeComponent,
ProfileComponent,
UserComponent,
utCreateComponent,
utExecuteComponent,
utTreeViewTestComponent,
SideNavigationMenuComponent
UnitTestsComponent,
SideNavigationMenuComponent,
GetFirstElementPipe
],
imports: [
BrowserModule.withServerTransition({ appId: "ng-cli-universal" }),
Expand Down Expand Up @@ -162,8 +156,6 @@ export function initializeAppConfig(appConfig: AppConfig, router: Router) {
UserStoryService,
WorkspaceService,
TabularModelService,
StructurService,
HistoryService,
],
bootstrap: [AppComponent, MsalRedirectComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@

<div *ngIf="isLoggedIn">
<div *ngIf="user">
<p><strong>First Name: </strong> {{user?.Firstname}}</p>
<p><strong>Last Name: </strong> {{user?.Lastname}}</p>
<p><strong>Email: </strong> {{user?.Email}}</p>
<p><strong>Azure AD Id: </strong> {{user?.MsId}}</p>
<p><strong>Roles: </strong> {{roles}}</p>
<p><strong>First Name: </strong> {{ user?.Firstname }}</p>
<p><strong>Last Name: </strong> {{ user?.Lastname }}</p>
<p><strong>Email: </strong> {{ user?.Email }}</p>
<p><strong>Azure AD Id: </strong> {{ user?.MsId }}</p>
<p><strong>Roles: </strong> {{ roles }}</p>
<dx-button
width="100%"
text="Reset the settings of the grids"
type="success"
stylingMode="contained"
icon="clear"
(onClick)="onClickResetGridSettings($event)"
></dx-button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { Subject } from "rxjs";
import { filter, takeUntil } from "rxjs/operators";
import { User } from "src/app/shared/models/user.model";
import { LayoutService, NotificationType } from "src/app/shared/services/layout.service";
import { ODataService } from "src/app/shared/services/odata.service";
import { UserService } from "src/app/shared/services/user.service";

Expand All @@ -23,8 +24,9 @@ export class ProfileComponent implements OnInit {
roles: string;

constructor(
private userService: UserService
) {}
private userService: UserService,
private layoutService: LayoutService
) { }

ngOnInit(): void {
this.getUserInformation();
Expand All @@ -33,9 +35,9 @@ export class ProfileComponent implements OnInit {
});
}

private getUserInformation(){
private getUserInformation() {
this.isLoggedIn = this.userService.isLogggedIn;
if(this.isLoggedIn){
if (this.isLoggedIn) {
this.user = this.userService.currentDbUserWithTenant;
this.roles = this.userService.currentUserRoles?.join(", ");
}
Expand All @@ -48,4 +50,9 @@ export class ProfileComponent implements OnInit {
async logout() {
await this.userService.logout();
}

public onClickResetGridSettings(e): void {
localStorage.removeItem("atPowerBiUnitTestPortal_UnitTests_TreeListState");
this.layoutService.notify({ message: "The grid settings have been successfully reset.", type: NotificationType.Success });
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
::ng-deep .dx-treelist-search-panel {
margin: 0 !important;
}

::ng-deep .hide-checkbox .dx-select-checkbox{
display: none;
}

::ng-deep .hide-checkbox .dx-treelist-icon-container{
padding-right: 0px;
}

::ng-deep dx-select-box {
margin-bottom: 15px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<h1>Unit Tests</h1>

<dx-tree-list #treeList [dataSource]="dataSourceWorkspaces" dataStructure="tree" [showRowLines]="true"
[hoverStateEnabled]="true" [showBorders]="true" height="100%"
(onToolbarPreparing)="onToolbarPreparingTreeList($event)" (onCellPrepared)="onCellPreparedTreeList($event)"
(onRowDblClick)="onRowDbClickTreeList($event)" (onRowPrepared)="onRowPreparedTreeList($event)">
<dxo-search-panel [visible]="true" [width]="250"></dxo-search-panel>
<dxo-selection mode="multiple"></dxo-selection>
<dxo-sorting mode="single"></dxo-sorting>
<dxo-state-storing [enabled]="true" storageKey="atPowerBiUnitTestPortal_UnitTests_TreeListState"></dxo-state-storing>

<dxi-column dataField="type"></dxi-column>
<dxi-column dataField="Name" sortOrder="asc" [sortIndex]="0"></dxi-column>
<dxi-column dataField="TestRuns[0].TimeStamp" caption="Last Execution" format="dd.MM.yyyy HH:mm:ss"></dxi-column>
<dxi-column dataField="TestRuns[0].Result" caption="Last Result" cellTemplate="cellTemplateLastResult"></dxi-column>
<dxi-column dataField="ExpectedResult"></dxi-column>
<dxi-column dataField="DAX"></dxi-column>

<dxi-column type="buttons" caption="Actions" alignment="left" width="200">
<dxi-button icon="runner" text="Execute Unit Test(s)" type="default" [onClick]="onClickExecuteUnitTests">
</dxi-button>
<dxi-button [visible]="isTabularModelRow" icon="add" text="Add User Story" type="default"
[onClick]="onClickAddUserStory">
</dxi-button>
<dxi-button [visible]="isUserStoryRow" icon="add" text="Add Unit Test" type="default"
[onClick]="onClickAddUnitTest">
</dxi-button>
<dxi-button [visible]="isUserStoryRow" icon="edit" text="Edit User Story" type="default"
[onClick]="onClickEditUserStory">
</dxi-button>
<dxi-button [visible]="isUnitTestRow" icon="edit" text="Edit Unit Test" type="default"
[onClick]="onClickEditUnitTest">
</dxi-button>
<dxi-button [visible]="isUserStoryRow" icon="trash" text="Delete User Story" type="default"
[onClick]="onClickDeleteUserStory">
</dxi-button>
<dxi-button [visible]="isUnitTestRow" icon="trash" text="Delete Unit Test" type="default"
[onClick]="onClickDeleteUnitTest">
</dxi-button>
<dxi-button [visible]="isUserStoryRow" icon="copy" text="Copy User Story" type="default"
[onClick]="onClickCopyUserStory">
</dxi-button>
</dxi-column>

<div *dxTemplate="let data of 'cellTemplateLastResult'">
<div *ngIf="data.data?.TestRuns | getFirstElement as testRun">
<span *ngIf="testRun.ExecutedSuccessfully" [title]="testRun.JsonResponse ?? ''">{{ data.value }}</span>
<span *ngIf="!testRun.ExecutedSuccessfully" [title]="testRun.JsonResponse ?? ''"><i>error durring
execution</i></span>
</div>
</div>
</dx-tree-list>

<dx-popup *ngIf="isVisibleEditUserStory" [title]="popupTitle" [showTitle]="true" [width]="500" height="auto"
[(visible)]="isVisibleEditUserStory">
<dx-form [(formData)]="userStoryToEdit">
<dxi-item dataField="Name" [label]="{ text: 'Name' }" isRequired="true"></dxi-item>

<dxi-item itemType="button" horizontalAlignment="left" [buttonOptions]="{
icon: 'save',
text: 'Save',
type: 'success',
onClick: this.onClickSaveUserStory.bind(this),
width: '100%'
}"></dxi-item>
</dx-form>
</dx-popup>

<dx-popup *ngIf="isVisibleEditUnitTest" [title]="popupTitle" [showTitle]="true" [width]="750" height="auto"
[(visible)]="isVisibleEditUnitTest">
<dx-form [(formData)]="unitTestToEdit">
<dxi-item dataField="Name" [label]="{ text: 'Name' }" isRequired="true"></dxi-item>
<dxi-item dataField="ResultType" [label]="{ text: 'Result Type' }" editorType="dxSelectBox"
[editorOptions]="{ items: resultTypeItems }" isRequired="true"></dxi-item>
<dxi-item *ngIf="unitTestToEdit.ResultType == 'Float'" dataField="DecimalPlaces"
[label]="{ text: 'Decimal Places' }" editorType="dxSelectBox"
[editorOptions]="{ items: decimalPlacesItems }"></dxi-item>
<dxi-item *ngIf="unitTestToEdit.ResultType == 'Float'" dataField="FloatSeparators"
[label]="{ text: 'Float Separators' }" editorType="dxSelectBox"
[editorOptions]="{ items: floatSeparatorItems }"></dxi-item>
<dxi-item *ngIf="unitTestToEdit.ResultType == 'Date'" dataField="DateTimeFormat"
[label]="{ text: 'DateTime Format' }" editorType="dxSelectBox"
[editorOptions]="{ items: dateTimeFormatItems }"></dxi-item>
<dxi-item dataField="ExpectedResult" [label]="{ text: 'Expected Result' }" isRequired="true"></dxi-item>
<dxi-item dataField="DAX" [label]="{ text: 'DAX' }" editorType="dxTextArea" [editorOptions]="{ height: 250 }"
isRequired="true"></dxi-item>

<dxi-item itemType="button" horizontalAlignment="left" [buttonOptions]="{
icon: 'save',
text: 'Save',
type: 'success',
onClick: this.onClickSaveUnitTest.bind(this),
width: '100%'
}"></dxi-item>
</dx-form>
</dx-popup>

<dx-popup *ngIf="isVisibleCopyUserStory" [width]="700" height="auto" [showTitle]="true" title="Copy User Story"
[hideOnOutsideClick]="true" [(visible)]="isVisibleCopyUserStory">

<span>Workspace:</span>
<dx-select-box [dataSource]="dataSourceWorkspacesOdata" displayExpr="Name" (onValueChanged)="onValueChangeCopyUserStoryWorkspace($event)"
></dx-select-box>

<span>Tabular Model:</span>
<dx-select-box [disabled]="copyUserStoryConfig.workspaceId == null" [dataSource]="dataSourceTabularModels" displayExpr="Name" (onValueChanged)="onValueChangeCopyUserStoryTabularModel($event)"
></dx-select-box>

<dx-form>
<dxi-item itemType="button" horizontalAlignment="left" [buttonOptions]="{
icon: 'copy',
text: 'Copy',
type: 'success',
onClick: this.onClickSaveCopyUserStory.bind(this),
width: '100%'
}"></dxi-item></dx-form>
</dx-popup>
Loading
Loading