Skip to content

Commit

Permalink
Add commit info to the about panel (spring-cloud#1971)
Browse files Browse the repository at this point in the history
* adding the `commit` info to the about panel

* adding the `commit` link to the about panel

* fixing the `commit` in the about panel. The backend if configured with mode=simple

* Fixed minor linting

---------

Co-authored-by: Claudia Bressi <[email protected]>
  • Loading branch information
felipeg48 and claudiahub authored Nov 9, 2023
1 parent fcca794 commit 230e060
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 289 deletions.
418 changes: 139 additions & 279 deletions ui/package-lock.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions ui/src/app/about/info/info.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ <h3 style="padding-top: 0">{{ 'about.info.serverImpTitle' | translate }}</h3>
<strong>{{ 'about.info.version' | translate }}</strong
>: {{ about.versions.implementation.version || 'n/a' }}
</li>
<li>
<strong>{{ 'about.info.commit' | translate }}</strong
>:
<a
target="_blank"
href="https://github.com/spring-cloud/spring-cloud-dataflow/commit/{{ about.git.commit || 'main' }}"
>
{{ about.git.commit || 'main' }}
</a>
</li>
</ul>
<h3>{{ 'about.info.features' | translate }}</h3>
<ul id="enabledFeaturesTable">
Expand Down
6 changes: 6 additions & 0 deletions ui/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ describe('app.component.ts', () => {
},
security: {
isAuthentication: true
},
git: {
commit: 'fakecommit'
}
}
};
Expand Down Expand Up @@ -98,6 +101,9 @@ describe('app.component.ts', () => {
},
security: {
isAuthentication: true
},
git: {
commit: 'fakecommit'
}
}
};
Expand Down
24 changes: 17 additions & 7 deletions ui/src/app/shared/store/about.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export interface AboutState {
username: string;
roles: Array<string>;
};
git: {
commit?: string;
};
}

export interface State extends fromRoot.State {
Expand Down Expand Up @@ -100,16 +103,23 @@ export const initialState: AboutState = {
isAuthenticated: false,
username: '',
roles: []
},
git: {
commit: ''
}
};

export const reducer = createReducer(
initialState,
on(AboutActions.loaded, (state, {versions, features, runtimeEnvironment, monitoringDashboardInfo, security}) => ({
versions,
features,
runtimeEnvironment,
monitoringDashboardInfo,
security
}))
on(
AboutActions.loaded,
(state, {versions, features, runtimeEnvironment, monitoringDashboardInfo, security, git}) => ({
versions,
features,
runtimeEnvironment,
monitoringDashboardInfo,
security,
git
})
)
);
3 changes: 3 additions & 0 deletions ui/src/app/shared/store/about.support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,8 @@ export const parse = (input: any): AboutState => ({
isAuthenticated: input.securityInfo.authenticated,
username: input.securityInfo.username,
roles: input.securityInfo.roles as string[]
},
git: {
commit: input.gitAndBuildInfo.git?.commit?.id || ''
}
});
7 changes: 7 additions & 0 deletions ui/src/app/tests/data/about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,12 @@ export const LOAD = {
dashboardType: 'WAVEFRONT',
source: 'tzolov-08-09'
},
gitAndBuildInfo: {
git: {
commit: {
id: '0ca477f'
}
}
},
_links: {self: {href: 'http://localhost:9393/about'}}
};
3 changes: 2 additions & 1 deletion ui/src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@
"copy": "Kopiere Details in die Zwischenablage",
"message": {
"copyContent": "Kopiere Über-Details in die Zwischenablage(Als JSON)."
}
},
"commit": "Commit"
}
},
"auditRecords": {
Expand Down
3 changes: 2 additions & 1 deletion ui/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@
"copy": "Copy Details to Clipboard",
"message": {
"copyContent": "Copied About Details to Clipboard (As JSON)."
}
},
"commit": "Commit"
}
},
"auditRecords": {
Expand Down
3 changes: 2 additions & 1 deletion ui/src/assets/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@
"copy": "Скопировать данные в буфер обмена",
"message": {
"copyContent": "Информация о деталях скопирована в буфер обмена (как JSON)."
}
},
"commit": "Commit"
}
},
"auditRecords": {
Expand Down

0 comments on commit 230e060

Please sign in to comment.