Skip to content

Commit 1bebb1d

Browse files
Merge pull request #1344 from rocket-admin/saml
Saml
2 parents 6b3f0f4 + 76d65e4 commit 1bebb1d

34 files changed

Lines changed: 792 additions & 339 deletions

frontend/CLAUDE.md

Lines changed: 166 additions & 277 deletions
Large diffs are not rendered by default.

frontend/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
FROM public.ecr.aws/docker/library/node:18-alpine as builder
2+
ARG VERSION
23
WORKDIR /app
34
COPY package.json yarn.lock ./
45
RUN yarn global add @angular/cli && yarn install
56
COPY angular.json browserslist tsconfig.app.json tsconfig.json tslint.json ./
7+
COPY scripts ./scripts/
68
COPY src ./src/
9+
10+
# Update version if VERSION build arg is provided
11+
RUN if [ -n "$VERSION" ]; then \
12+
echo "Updating package.json version to $VERSION" && \
13+
npm version $VERSION --no-git-tag-version && \
14+
yarn update-version; \
15+
fi
16+
717
RUN ng build --configuration=production
818

919
FROM public.ecr.aws/docker/library/nginx:alpine

frontend/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"name": "dissendium-v0",
3-
"version": "0.0.0",
3+
"version": "1.0.0",
44
"scripts": {
55
"ng": "ng",
6-
"start": "ng serve",
7-
"build": "ng build",
6+
"start": "node scripts/update-version.js && ng serve",
7+
"build": "node scripts/update-version.js && ng build",
88
"test": "ng test",
99
"test:ci": "ng test --watch=false --browsers=ChromeHeadlessCustom",
1010
"lint": "ng lint",
1111
"e2e": "ng e2e",
1212
"analyze": "webpack-bundle-analyzer dist/dissendium-v0/stats.json",
13-
"build:stats": "ng build --stats-json"
13+
"build:stats": "node scripts/update-version.js && ng build --stats-json",
14+
"update-version": "node scripts/update-version.js"
1415
},
1516
"private": true,
1617
"dependencies": {

frontend/scripts/update-version.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
// Read package.json to get the version
5+
const packageJsonPath = path.join(__dirname, '..', 'package.json');
6+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
7+
const version = packageJson.version;
8+
9+
// Update the version.ts file
10+
const versionTsPath = path.join(__dirname, '..', 'src', 'app', 'version.ts');
11+
const versionTsContent = `// This file is auto-generated during build
12+
export const version = '${version}';
13+
`;
14+
15+
fs.writeFileSync(versionTsPath, versionTsContent);
16+
console.log(`Updated version.ts with version ${version}`);

frontend/src/app/app-routing.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { UserDeletedSuccessComponent } from './components/user-deleted-success/u
2929
import { UserSettingsComponent } from './components/user-settings/user-settings.component';
3030
import { UsersComponent } from './components/users/users.component';
3131
import { ZapierComponent } from './components/zapier/zapier.component';
32+
import { SsoComponent } from './components/sso/sso.component';
3233

3334
const routes: Routes = [
3435
{path: '', redirectTo: '/connections-list', pathMatch: 'full'},
@@ -46,6 +47,7 @@ const routes: Routes = [
4647
// company routes have to be in this specific order
4748
{path: 'company/:company-id/verify/:verification-token', pathMatch: 'full', component: CompanyMemberInvitationComponent, title: 'Invitation | Rocketadmin'},
4849
{path: 'company', pathMatch: 'full', component: CompanyComponent, canActivate: [AuthGuard]},
50+
{path: 'sso/:company-id', pathMatch: 'full', component: SsoComponent, canActivate: [AuthGuard]},
4951
{path: 'change-password', component: PasswordChangeComponent, canActivate: [AuthGuard]},
5052
{path: 'upgrade', component: UpgradeComponent, canActivate: [AuthGuard], title: 'Upgrade | Rocketadmin'},
5153
{path: 'upgrade/payment', component: PaymentFormComponent, canActivate: [AuthGuard], title: 'Payment | Rocketadmin'},

frontend/src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
</mat-tab-nav-panel>
221221

222222
<div *ngIf="!authBarTheme" class="footer">
223-
<span class="footer__text">&copy; 2025 Rocketadmin</span>
223+
<span class="footer__text">&copy; 2025 Rocketadmin • v{{appVersion}}</span>
224224
</div>
225225
<app-feature-notification *ngIf="isFeatureNotificationShown" (dismiss)="dismissFeatureNotification()"></app-feature-notification>
226226
</mat-sidenav-content>

frontend/src/app/app.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { UserService } from './services/user.service';
2929
import amplitude from 'amplitude-js';
3030
import { differenceInMilliseconds } from 'date-fns';
3131
import { environment } from '../environments/environment';
32+
import { version } from './version';
3233

3334
//@ts-ignore
3435
window.amplitude = amplitude;
@@ -58,6 +59,7 @@ amplitude.getInstance().init("9afd282be91f94da735c11418d5ff4f5");
5859
export class AppComponent {
5960

6061
public isSaas = (environment as any).saas;
62+
public appVersion = version;
6163
userActivity;
6264
userInactive: Subject<any> = new Subject();
6365
currentFeatureNotificationId: string = 'saved-filters';

frontend/src/app/components/company/company.component.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@
7777
}
7878
}
7979

80-
.tableHeader__button {
80+
.tableHeader__actions {
81+
display: flex;
82+
gap: 8px;
8183
margin-bottom: 16px;
8284
}
8385

frontend/src/app/components/company/company.component.html

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,35 @@ <h1 class="mat-h1 companyPageHeader">
5757

5858
<div class="tableHeader">
5959
<h2 class="heading-2 tableHeader__heading">Members <span *ngIf="currentPlan === 'free' && isSaas" data-testid="company-members-max-string">(max 3)</span></h2>
60-
<div data-testid="company-invitation-button-wrapper"
61-
[matTooltip]="currentPlan === 'free' && usersCount >= 3 && isSaas ? 'To add more members please upgrade your plan.' : null">
62-
<button *ngIf="currentUser && currentUser.role === 'ADMIN'"
63-
mat-flat-button type="button"
64-
data-testid="company-invitation-button"
65-
angulartics2On="click"
66-
angularticsAction="Company: invite member is clicked"
67-
class="tableHeader__button" color="primary"
68-
(click)="handleAddMemberDialogOpen()"
69-
[disabled]="currentPlan === 'free' && usersCount >= 3 && isSaas">
70-
Invite member
71-
<mat-icon *ngIf="currentPlan === 'free' && usersCount >= 3 && isSaas">
72-
info_outline
73-
</mat-icon>
74-
</button>
60+
<div class="tableHeader__actions">
61+
<div data-testid="sso-button-wrapper"
62+
[matTooltip]="currentPlan !== 'enterprise' && isSaas ? 'To turn on SAML SSO upgrade your plan to Enterprise.' : null">
63+
<a *ngIf="currentUser && (currentUser.role === 'ADMIN' || currentUser.role === 'DB_ADMIN')"
64+
mat-button
65+
routerLink="/sso/{{company.id}}"
66+
[disabled]="currentPlan !== 'enterprise' && isSaas"
67+
angulartics2On="click"
68+
angularticsAction="Dashboard: add row is clicked">
69+
Configure SAML
70+
</a>
71+
</div>
72+
<div data-testid="company-invitation-button-wrapper"
73+
[matTooltip]="currentPlan === 'free' && usersCount >= 3 && isSaas ? 'To add more members please upgrade your plan.' : null">
74+
<button *ngIf="currentUser && currentUser.role === 'ADMIN'"
75+
mat-flat-button type="button" color="primary"
76+
data-testid="company-invitation-button"
77+
angulartics2On="click"
78+
angularticsAction="Company: invite member is clicked"
79+
(click)="handleAddMemberDialogOpen()"
80+
[disabled]="currentPlan === 'free' && usersCount >= 3 && isSaas">
81+
Invite member
82+
<mat-icon *ngIf="currentPlan === 'free' && usersCount >= 3 && isSaas">
83+
info_outline
84+
</mat-icon>
85+
</button>
86+
</div>
7587
</div>
88+
7689
</div>
7790

7891
<app-placeholder-table-data *ngIf="submittingUsersChange"></app-placeholder-table-data>

frontend/src/app/components/company/company.component.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { SubscriptionPlans } from 'src/app/models/user';
1616
import { UserService } from 'src/app/services/user.service';
1717
import { of } from 'rxjs';
1818
import { provideHttpClient } from '@angular/common/http';
19+
import { provideRouter } from '@angular/router';
1920

2021
describe('CompanyComponent', () => {
2122
let component: CompanyComponent;
@@ -128,6 +129,7 @@ describe('CompanyComponent', () => {
128129
CompanyComponent
129130
],
130131
providers: [
132+
provideRouter([]),
131133
provideHttpClient(),
132134
{ provide: CompanyService, useValue: fakeCompanyService },
133135
{ provide: UserService, useValue: fakeUserService }

0 commit comments

Comments
 (0)