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

fixed intermittent issues with moving applications on a team #632

Merged
merged 3 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
[ngClass]="moveUp.disabled ? 'disabled-button' : null"
mat-icon-button
title="Move Up"
(click)="swapDisplayOrders(app, applications[i - 1])"
(click)="moveAppUp(app.id)"
>
<mat-icon
svgIcon="ic_expand_more_black_24px"
Expand All @@ -76,7 +76,7 @@
[ngClass]="moveDown.disabled ? 'disabled-button' : null"
title="Move Down"
mat-icon-button
(click)="swapDisplayOrders(app, applications[i + 1])"
(click)="moveAppDown(app.id)"
>
<mat-icon svgIcon="ic_expand_more_black_24px"></mat-icon>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ export class TeamApplicationsSelectComponent implements OnInit {
});
}

public moveAppUp(id: string) {
this.applicationService
.moveUpApplicationInstance(id)
.subscribe((x) => (this.applications = x));
}

public moveAppDown(id: string) {
this.applicationService
.moveDownApplicationInstance(id)
.subscribe((x) => (this.applications = x));
}

/**
* Swaps the display orders of two teams in the application
* @param app1
Expand Down
114 changes: 114 additions & 0 deletions src/app/generated/player-api/api/application.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,120 @@ export class ApplicationService {
);
}

/**
* Moves an Application Instance down
* Moves an Application Instance down one spot in the list &lt;para /&gt; Accessible only to a SuperUser or a User on an Admin Team in the Application Instances\&#39;s Team\&#39;s View
* @param id The id of the Application Instance
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public moveDownApplicationInstance(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable<Array<ApplicationInstance>>;
public moveDownApplicationInstance(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable<HttpResponse<Array<ApplicationInstance>>>;
public moveDownApplicationInstance(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable<HttpEvent<Array<ApplicationInstance>>>;
public moveDownApplicationInstance(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable<any> {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling moveDownApplicationInstance.');
}

let headers = this.defaultHeaders;

// authentication (oauth2) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}

let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
if (httpHeaderAcceptSelected === undefined) {
// to determine the Accept header
const httpHeaderAccepts: string[] = [
'text/plain',
'application/json',
'text/json'
];
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
}
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}


let responseType: 'text' | 'json' = 'json';
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
responseType = 'text';
}

return this.httpClient.post<Array<ApplicationInstance>>(`${this.configuration.basePath}/api/application-instances/${encodeURIComponent(String(id))}/move-down`,
null,
{
responseType: <any>responseType,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}

/**
* Moves an Application Instance up
* Moves an Application Instance up one spot in the list &lt;para /&gt; Accessible only to a SuperUser or a User on an Admin Team in the Application Instances\&#39;s Team\&#39;s View
* @param id The id of the Application Instance
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public moveUpApplicationInstance(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable<Array<ApplicationInstance>>;
public moveUpApplicationInstance(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable<HttpResponse<Array<ApplicationInstance>>>;
public moveUpApplicationInstance(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable<HttpEvent<Array<ApplicationInstance>>>;
public moveUpApplicationInstance(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable<any> {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling moveUpApplicationInstance.');
}

let headers = this.defaultHeaders;

// authentication (oauth2) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}

let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
if (httpHeaderAcceptSelected === undefined) {
// to determine the Accept header
const httpHeaderAccepts: string[] = [
'text/plain',
'application/json',
'text/json'
];
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
}
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}


let responseType: 'text' | 'json' = 'json';
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
responseType = 'text';
}

return this.httpClient.post<Array<ApplicationInstance>>(`${this.configuration.basePath}/api/application-instances/${encodeURIComponent(String(id))}/move-up`,
null,
{
responseType: <any>responseType,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}

/**
* Updates an Application
* Updates an Application with the attributes specified &lt;para /&gt; Accessible only to a SuperUser or a User on an Admin Team in the Application\&#39;s assigned View
Expand Down