Skip to content

Commit

Permalink
Optimise graphql for instance session members. Modify Instance filter…
Browse files Browse the repository at this point in the history
… to allow for multiple instance Ids.
  • Loading branch information
stuartcaunt committed Dec 3, 2024
1 parent fea1795 commit 5247ecc
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<clr-datagrid [clrDgLoading]="loading">
<clr-dg-column>ID</clr-dg-column>
<clr-dg-column *ngIf="!hiddenColumns.includes('instance.id')">Instance ID</clr-dg-column>
<clr-dg-column *ngIf="!hiddenColumns.includes('instance.name')">Instance Name</clr-dg-column>
<clr-dg-column>User</clr-dg-column>
<clr-dg-column>Role</clr-dg-column>
<clr-dg-column>Creation</clr-dg-column>
<clr-dg-column>Time connected</clr-dg-column>
<clr-dg-row *ngFor="let session of sessions">
<clr-dg-cell>{{ session.id }}</clr-dg-cell>
<clr-dg-cell *ngIf="!hiddenColumns.includes('instance.id')">{{ session.instanceSession.instance.id }}</clr-dg-cell>
<clr-dg-cell *ngIf="!hiddenColumns.includes('instance.name')">{{ session.instanceSession.instance.name }}</clr-dg-cell>
<clr-dg-cell>{{ session.user.fullName }}</clr-dg-cell>
<clr-dg-cell>{{ session.role | titlecase }}</clr-dg-cell>
<clr-dg-cell>{{ session.createdAt | date:'dd-MM-yyyy HH:mm:ss' }}</clr-dg-cell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export class InstanceSessionsComponent implements OnInit, OnDestroy {

private _refresh$: Subject<boolean> = new BehaviorSubject<boolean>(true);

private _hiddenColumns: string[] = [];

public get destroy$(): Subject<boolean> {
return this._destroy$;
}
Expand Down Expand Up @@ -57,15 +55,6 @@ export class InstanceSessionsComponent implements OnInit, OnDestroy {
this._loading = value;
}

get hiddenColumns(): string[] {
return this._hiddenColumns;
}

@Input('hiddenColumns')
set hiddenColumns(value: string[]) {
this._hiddenColumns = value;
}

@Input()
public get instance(): Instance {
return this._instance;
Expand Down Expand Up @@ -97,14 +86,6 @@ export class InstanceSessionsComponent implements OnInit, OnDestroy {
createdAt
role
duration
instanceSession {
connectionId
instance {
id
uid
name
}
}
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/app/admin/components/instance/instance.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@
<visa-tab id="sessions">
<visa-tab-title>Sessions</visa-tab-title>
<visa-tab-content>
<visa-admin-instance-sessions [instance]="instance"
[refresh]="refreshSession$"
[hiddenColumns]="['instance.id', 'instance.name']"></visa-admin-instance-sessions>
<visa-admin-instance-sessions [instance]="instance" [refresh]="refreshSession$"></visa-admin-instance-sessions>
</visa-tab-content>
<visa-tab-actions>
<button class="visa-tabs-btn" (click)="this.refreshSession$.next(true)">
Expand Down
10 changes: 1 addition & 9 deletions src/app/admin/components/instances/instances.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,6 @@ export class InstancesComponent implements OnInit, OnDestroy {
createdAt
role
duration
instanceSession {
connectionId
instance {
id
uid
name
}
}
}
cloudClient {
id
Expand Down Expand Up @@ -268,7 +260,7 @@ export class InstancesComponent implements OnInit, OnDestroy {
private processFilters(): InstanceFilterInput {
const {name, id, flavour, image, instrument, state, user} = this.filterState.filters;
return {
id,
ids: id ? [id] : null,
nameLike: name,
instrumentId: instrument,
imageId: image,
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/graphql/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export type Query = {


export type InstanceFilterInput = {
id: Maybe<Scalars['Int']>;
ids: Maybe<Array<Maybe<Scalars['Int']>>>;
nameLike: Maybe<Scalars['String']>;
instrumentId: Maybe<Scalars['Int']>;
imageId: Maybe<Scalars['Int']>;
Expand Down

0 comments on commit 5247ecc

Please sign in to comment.