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

Fix base URL usage in frontend #85

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion frontend/src/app/database/database.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Router } from '@angular/router';
import { finalize, takeWhile, timer } from 'rxjs';
import { InstallationsService, statusResponse } from '../services/api/installations.service';
import { SetupService } from '../services/api/setup.service';
import { BASE_URL } from '../services/server.service';

@Component({
selector: 'app-database',
Expand Down Expand Up @@ -63,7 +64,7 @@ export class DatabaseComponent implements AfterViewInit {
return !this.status || !this.status.isSetup;
}),
finalize(async () => {
await this.router.navigate(['/copilot'], {
await this.router.navigate([`${BASE_URL}/copilot`], {
queryParams: { celebrate: true }
})
})
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/install/dialog-create-app.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ <h1 mat-dialog-title>{{ existingApp ? 'Add Existing Github App' : 'Register GitH
</p>
<mat-form-field class="example-full-width" appearance="outline">
<mat-label>Webhook URL</mat-label>
<input matInput #webhookInput [value]="manifest?.hook_attributes?.url" readonly>
<mat-icon matSuffix [cdkCopyToClipboard]="manifest?.hook_attributes?.url || ''" (click)="webhookInput.select()">content_copy</mat-icon>
<input matInput #webhookInput [value]="`${BASE_URL}/webhook`" readonly>
<mat-icon matSuffix [cdkCopyToClipboard]="`${BASE_URL}/webhook` || ''" (click)="webhookInput.select()">content_copy</mat-icon>
</mat-form-field>
<div>
<a mat-raised-button href="https://github.com/settings/organizations" target="_blank">
Expand Down Expand Up @@ -80,4 +80,4 @@ <h1 mat-dialog-title>{{ existingApp ? 'Add Existing Github App' : 'Register GitH
<ng-template #registerAppActions>
<button type="submit" [disabled]="false" (click)="registerNewApp()" mat-button cdkFocusInitial>Create</button>
</ng-template>
</div>
</div>
4 changes: 2 additions & 2 deletions frontend/src/app/install/install.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { CommonModule } from '@angular/common';
import { ClipboardModule } from '@angular/cdk/clipboard';
import { ThemeService } from '../services/theme.service';

import { BASE_URL } from '../services/server.service';

Check failure

Code scanning / ESLint

Disallow unused variables Error

'BASE_URL' is defined but never used.

Copilot Autofix AI about 1 month ago

To fix the problem, we need to remove the unused BASE_URL import from the file frontend/src/app/install/install.component.ts. This will resolve the ESLint error and clean up the code by removing unnecessary imports.

  • Locate the import statement for BASE_URL on line 9.
  • Remove the BASE_URL import from the import statement.
Suggested changeset 1
frontend/src/app/install/install.component.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/install/install.component.ts b/frontend/src/app/install/install.component.ts
--- a/frontend/src/app/install/install.component.ts
+++ b/frontend/src/app/install/install.component.ts
@@ -8,3 +8,3 @@
 import { ThemeService } from '../services/theme.service';
-import { BASE_URL } from '../services/server.service';
+
 
EOF
@@ -8,3 +8,3 @@
import { ThemeService } from '../services/theme.service';
import { BASE_URL } from '../services/server.service';


Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options

@Component({
selector: 'app-install',
Expand Down Expand Up @@ -129,4 +129,4 @@
this.existingAppForm.controls.privateKey.setValue(text);
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { ActiveUsersChartComponent } from './dashboard-card/active-users-chart/active-users-chart.component';
import { InstallationsService } from '../../../services/api/installations.service';
import { StatusComponent } from './status/status.component';
import { BASE_URL } from '../../../services/server.service';

Check failure

Code scanning / ESLint

Disallow unused variables Error

'BASE_URL' is defined but never used.

Copilot Autofix AI about 1 month ago

The best way to fix the problem is to remove the unused BASE_URL import from the file. This will resolve the ESLint error and clean up the code by removing unnecessary imports.

To implement this fix, we need to:

  1. Remove the import statement for BASE_URL on line 19.
Suggested changeset 1
frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts b/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
--- a/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
+++ b/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
@@ -18,3 +18,3 @@
 import { StatusComponent } from './status/status.component';
-import { BASE_URL } from '../../../services/server.service';
+
 
EOF
@@ -18,3 +18,3 @@
import { StatusComponent } from './status/status.component';
import { BASE_URL } from '../../../services/server.service';


Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options

@Component({
selector: 'app-dashboard',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/main/main.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { InstallationsService } from '../services/api/installations.service';
import { BASE_URL } from '../services/server.service';

Check failure

Code scanning / ESLint

Disallow unused variables Error

'BASE_URL' is defined but never used.

Copilot Autofix AI about 1 month ago

The best way to fix the problem is to remove the unused import of BASE_URL from the file. This will resolve the ESLint error and clean up the code by removing unnecessary imports.

  • Locate the import statement for BASE_URL on line 21.
  • Remove the import statement entirely since BASE_URL is not used anywhere in the MainComponent class.
Suggested changeset 1
frontend/src/app/main/main.component.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/main/main.component.ts b/frontend/src/app/main/main.component.ts
--- a/frontend/src/app/main/main.component.ts
+++ b/frontend/src/app/main/main.component.ts
@@ -20,3 +20,3 @@
 import { InstallationsService } from '../services/api/installations.service';
-import { BASE_URL } from '../services/server.service';
+
 
EOF
@@ -20,3 +20,3 @@
import { InstallationsService } from '../services/api/installations.service';
import { BASE_URL } from '../services/server.service';


Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options

@Component({
selector: 'app-main',
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/app/services/server.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { isDevMode } from '@angular/core';

export const BASE_URL = 'http://localhost:32000';

export const serverUrl = (() => {
if (isDevMode()) {
return 'http://localhost';
return BASE_URL;
} else {
return '';
}
})();

Loading