Skip to content
Merged
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
347 changes: 182 additions & 165 deletions npm-shrinkwrap.json

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
"license": "MIT",
"private": true,
"dependencies": {
"@angular/animations": "~20.2.4",
"@angular/cdk": "~20.2.2",
"@angular/common": "~20.2.4",
"@angular/compiler": "~20.2.4",
"@angular/core": "~20.2.4",
"@angular/forms": "~20.2.4",
"@angular/material": "~20.2.2",
"@angular/platform-browser": "~20.2.4",
"@angular/platform-browser-dynamic": "~20.2.4",
"@angular/router": "~20.2.4",
"@angular/service-worker": "~20.2.4",
"@angular/animations": "~20.3.0",
"@angular/cdk": "~20.2.3",
"@angular/common": "~20.3.0",
"@angular/compiler": "~20.3.0",
"@angular/core": "~20.3.0",
"@angular/forms": "~20.3.0",
"@angular/material": "~20.2.3",
"@angular/platform-browser": "~20.3.0",
"@angular/platform-browser-dynamic": "~20.3.0",
"@angular/router": "~20.3.0",
"@angular/service-worker": "~20.3.0",
"@apollo/client": "^3.14.0",
"@ng-bootstrap/ng-bootstrap": "~19.0.1",
"@types/grecaptcha": "^3.0.9",
Expand All @@ -48,10 +48,10 @@
"tslib": "^2.8.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^20.2.2",
"@angular/cli": "^20.2.2",
"@angular/compiler-cli": "~20.2.4",
"@angular/language-service": "20.2.4",
"@angular-devkit/build-angular": "^20.3.1",
"@angular/cli": "^20.3.1",
"@angular/compiler-cli": "~20.3.0",
"@angular/language-service": "20.3.0",
"@types/node": "^24.3.1",
"@types/react": "^19.1.12",
"angular-eslint": "20.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ export class ChangelogComponent implements OnInit, OnDestroy {
this.domainRouteService.updatePath(this.groupId, data.name, Types.GROUP_TYPE,
`/dashboard/domain/${this.domainName}/${this.domainId}/groups/${this.groupId}`);
});
} else {
this.domainRouteService.refreshPath();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ export class ComponentsComponent extends BasicComponent implements OnInit, OnDes
if (this.fetch) {
this.domainRouteService.updatePath(this.domainId, this.domainName, Types.DOMAIN_TYPE,
`/dashboard/domain/${this.domainName}/${this.domainId}`);
} else {
this.domainRouteService.refreshPath();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
<button mat-button class="btn-element create" (click)="createEnvironment()" [disabled]="inputEnvironmentName.value.length < 2 || !creatable">
@if (creating) {
<mat-icon><mat-spinner [diameter]="20"></mat-spinner></mat-icon>
}
@if (!creating) {
} @else {
<mat-icon style="font-size: large;">create</mat-icon>
}
Create
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ export class EnvironmentsComponent implements OnInit, OnDestroy {
if (this.fetch) {
this.domainRouteService.updatePath(this.domainId, this.domainName, Types.DOMAIN_TYPE,
`/dashboard/domain/${this.domainName}/${this.domainId}`);
} else {
this.domainRouteService.refreshPath();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ export class ExtGitOpsComponent implements OnInit, OnDestroy {
if (this.fetch) {
this.domainRouteService.updatePath(this.domainId, this.domainName, Types.DOMAIN_TYPE,
`/dashboard/domain/${this.domainName}/${this.domainId}`);
} else {
this.domainRouteService.refreshPath();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ export class ExtSlackComponent implements OnInit, OnDestroy {
if (this.fetch) {
this.domainRouteService.updatePath(this.domainId, this.domainName, Types.DOMAIN_TYPE,
`/dashboard/domain/${this.domainName}/${this.domainId}`);
} else {
this.domainRouteService.refreshPath();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ export class MetricComponent implements OnInit, OnDestroy {
if (this.fetch) {
this.domainRouteService.updatePath(this.domainId, this.domainName, Types.DOMAIN_TYPE,
`/dashboard/domain/${this.domainName}/${this.domainId}`);
} else {
this.domainRouteService.refreshPath();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
<button mat-button class="btn-element create" (click)="createTeam()" [disabled]="inputTeamName.value.length < 2 || !creatable">
@if (creating) {
<mat-icon><mat-spinner [diameter]="20"></mat-spinner></mat-icon>
}
@if (!creating) {
} @else {
<mat-icon style="font-size: large;">create</mat-icon>
}
Create
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ export class TeamComponent implements OnInit, OnDestroy {
if (this.fetch) {
this.domainRouteService.updatePath(this.domainId, this.domainName, Types.DOMAIN_TYPE,
`/dashboard/domain/${this.domainName}/${this.domainId}`);
} else {
this.domainRouteService.refreshPath();
}
}

Expand Down
24 changes: 15 additions & 9 deletions src/app/services/domain-route.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ export class DomainRouteService {
@Output() pathChange = new EventEmitter<PathRoute>();
@Output() viewHeaderEvent = new EventEmitter<ViewHeader>();

private pathRoute: PathRoute;

updatePath(id: string, name: string, type: string, path: string, forceFetch = false): void {
const pathRoute = new PathRoute();
pathRoute.id = id;
pathRoute.name = name;
pathRoute.type = type;
pathRoute.path = path;
pathRoute.forceFetch = forceFetch;

localStorage.setItem(Types.CURRENT_ROUTE, JSON.stringify(pathRoute));
this.pathChange.next(pathRoute);
this.pathRoute = new PathRoute();
this.pathRoute.id = id;
this.pathRoute.name = name;
this.pathRoute.type = type;
this.pathRoute.path = path;
this.pathRoute.forceFetch = forceFetch;

localStorage.setItem(Types.CURRENT_ROUTE, JSON.stringify(this.pathRoute));
this.pathChange.next(this.pathRoute);
}

refreshPath(): void {
this.pathChange.next(this.pathRoute);
}

getStoredPath(): PathRoute {
Expand Down
45 changes: 41 additions & 4 deletions src/assets/documentation/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,43 @@ Switching fast. Adapt everywhere.
2. Add .env-cmdrc file into the project directory (use '.env-cmdrc-template')
3. Replace values such as secret keys and URLs

### Auth Providers

Switcher API supports multiple auth providers to sign up and sign in such as email/password, GitHub, and Bitbucket.

Follow the steps below to set up your OAuth App in GitHub and Bitbucket.

#### GitHub OAuth App setup

1. Open your GitHub account or organization settings
2. Go to Developer settings > OAuth Apps
3. Click on "New OAuth App"
4. Fill in the application details:
- Application name: Switcher API
- Homepage URL: https://switcher-management-url (or your deployed URL)
- Authorization callback URL: https://switcher-management-url/login?platform=github
5. Click on "Register application"
6. Copy the Client ID and Client Secret
7. Update your .env-cmdrc file or ConfigMap/Secret in Kubernetes with the following variables:
- GIT_OAUTH_CLIENT_ID=your_client_id
- GIT_OAUTH_CLIENT_SECRET=your_client_secret
8. Update Switcher Management GITHUB_CLIENTID environment variable with your_client_id

#### Bitbucket OAuth App setup

1. Open your Bitbucket account or workspace settings
2. Go to Apps and features > OAuth consumers
3. Fill in the application details:
- Name: Switcher API
- Callback URL: https://switcher-management-url/login?platform=bitbucket
4. Add permissions -> Account: Read
5. Click on "Save"
6. Copy the Key and Secret
7. Update your .env-cmdrc file or ConfigMap/Secret in Kubernetes with the following variables:
- BIT_OAUTH_CLIENT_ID=your_client_id
- BIT_OAUTH_CLIENT_SECRET=your_client_secret
8. Update Switcher Management BITBUCKET_CLIENTID environment variable with your_client_id

### Running Switcher API from Docker Composer manifest file

This option leverages Switcher API and Switcher Management with minimum settings required.
Expand Down Expand Up @@ -56,8 +93,8 @@ It is equivalent to an organization that can manage multiple projects, users, an
- **New domain** - Domain: /domain/create [POST]

##### Component
Components are applications that are using Switcher API.<br>
Each component has its own access token and needs to be linked to Switchers.
Components are applications that will use Switcher API.<br>
Each component has its own access API key to interact with Switcher API.

- **Create a component** - Component: /component/create [POST]
- **Generating a new API Key** - Component: /component/generateApiKey [GET]
Expand All @@ -68,12 +105,12 @@ Groups are used to organize Switchers that share the same feature scope.
- **New Group** - GroupConfig: /groupconfig/create [POST]

##### Switcher
Switchers are the main entities to control features.
Switchers are the entry point to control features in your application.<br>

- **New Switcher** - Config: /config/create [POST]

##### Strategy
Customize the behavior of the Switcher by including strategy rules to your Switchers.
Customize the Switcher behavior by including strategy rules to your Switchers.

- **New Strategy** - ConfigStrategy: /configstrategy/create [POST]

Expand Down
2 changes: 1 addition & 1 deletion src/environments/environment.global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const environment_global = {
allowInternalAuth: true,
allowHomeView: false,
githubApiClientId: '5745650fe81a1f1f3486',
bitbucketApiClientId: 'JNfFteJqcjcDytFAh5',
bitbucketApiClientId: 'My5KxNyU3vNxYdP68G',
timeout: 5000,
teamInviteLink: 'http://localhost:4200/collab/join',
domainTransferLink: 'http://localhost:4200/domain/transfer',
Expand Down