mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-2948] Add process services extension in settings page (#1374)
* [ACA-2948] Add toggle in settings page for process services extension * [ACA-2948] Remove console log * [ACA-2948] Fix import
This commit is contained in:
@@ -30,6 +30,7 @@ import * as repository from './repository.rules';
|
|||||||
export interface AcaRuleContext extends RuleContext {
|
export interface AcaRuleContext extends RuleContext {
|
||||||
languagePicker: boolean;
|
languagePicker: boolean;
|
||||||
withCredentials: boolean;
|
withCredentials: boolean;
|
||||||
|
processServices: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -546,3 +547,12 @@ export function canShowLanguagePicker(context: AcaRuleContext): boolean {
|
|||||||
export function canShowLogout(context: AcaRuleContext): boolean {
|
export function canShowLogout(context: AcaRuleContext): boolean {
|
||||||
return !context.withCredentials;
|
return !context.withCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if application should render process services extension.
|
||||||
|
* JSON ref: `canShowProcessServices`
|
||||||
|
* @param context Rule execution context
|
||||||
|
*/
|
||||||
|
export function canShowProcessServices(context: AcaRuleContext): boolean {
|
||||||
|
return context.processServices;
|
||||||
|
}
|
||||||
|
@@ -41,7 +41,8 @@ export enum AppActionTypes {
|
|||||||
ResetSelection = 'RESET_SELECTION',
|
ResetSelection = 'RESET_SELECTION',
|
||||||
SetInfoDrawerState = 'SET_INFO_DRAWER_STATE',
|
SetInfoDrawerState = 'SET_INFO_DRAWER_STATE',
|
||||||
SetInfoDrawerMetadataAspect = 'SET_INFO_DRAWER_METADATA_ASPECT',
|
SetInfoDrawerMetadataAspect = 'SET_INFO_DRAWER_METADATA_ASPECT',
|
||||||
CloseModalDialogs = 'CLOSE_MODAL_DIALOGS'
|
CloseModalDialogs = 'CLOSE_MODAL_DIALOGS',
|
||||||
|
ToggleProcessServices = 'TOGGLE_PROCESS_SERVICES'
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SetInitialStateAction implements Action {
|
export class SetInitialStateAction implements Action {
|
||||||
@@ -113,3 +114,9 @@ export class SetRepositoryInfoAction implements Action {
|
|||||||
|
|
||||||
constructor(public payload: RepositoryInfo) {}
|
constructor(public payload: RepositoryInfo) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class ToggleProcessServicesAction implements Action {
|
||||||
|
readonly type = AppActionTypes.ToggleProcessServices;
|
||||||
|
|
||||||
|
constructor(public payload: boolean) {}
|
||||||
|
}
|
||||||
|
@@ -133,3 +133,8 @@ export const infoDrawerMetadataAspect = createSelector(
|
|||||||
selectApp,
|
selectApp,
|
||||||
state => state.infoDrawerMetadataAspect
|
state => state.infoDrawerMetadataAspect
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const getProcessServicesState = createSelector(
|
||||||
|
selectApp,
|
||||||
|
state => state.processServices
|
||||||
|
);
|
||||||
|
@@ -44,6 +44,7 @@ export interface AppState {
|
|||||||
showFacetFilter: boolean;
|
showFacetFilter: boolean;
|
||||||
documentDisplayMode: string;
|
documentDisplayMode: string;
|
||||||
repository: RepositoryInfo;
|
repository: RepositoryInfo;
|
||||||
|
processServices: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AppStore {
|
export interface AppStore {
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
"sharedLinkDateTimePickerType": "date",
|
"sharedLinkDateTimePickerType": "date",
|
||||||
"headerColor": "#1565c0",
|
"headerColor": "#1565c0",
|
||||||
"languagePicker": true,
|
"languagePicker": true,
|
||||||
|
"processServices": true,
|
||||||
"pagination": {
|
"pagination": {
|
||||||
"size": 25,
|
"size": 25,
|
||||||
"supportedPageSizes": [25, 50, 100]
|
"supportedPageSizes": [25, 50, 100]
|
||||||
|
@@ -179,6 +179,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
const state: AppState = {
|
const state: AppState = {
|
||||||
...INITIAL_APP_STATE,
|
...INITIAL_APP_STATE,
|
||||||
languagePicker: this.config.get<boolean>('languagePicker'),
|
languagePicker: this.config.get<boolean>('languagePicker'),
|
||||||
|
processServices: this.config.get<boolean>('processServices'),
|
||||||
appName: this.config.get<string>('application.name'),
|
appName: this.config.get<string>('application.name'),
|
||||||
headerColor: this.config.get<string>('headerColor'),
|
headerColor: this.config.get<string>('headerColor'),
|
||||||
logoPath: this.config.get<string>('application.logo'),
|
logoPath: this.config.get<string>('application.logo'),
|
||||||
|
@@ -87,11 +87,20 @@
|
|||||||
<mat-panel-title>Extensions</mat-panel-title>
|
<mat-panel-title>Extensions</mat-panel-title>
|
||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
|
|
||||||
|
<div class="aca-settings-extensions-list">
|
||||||
<mat-checkbox
|
<mat-checkbox
|
||||||
[ngModel]="aiExtensions$ | async"
|
[ngModel]="aiExtensions$ | async"
|
||||||
(change)="onToggleAiExtensions($event)"
|
(change)="onToggleAiExtensions($event)"
|
||||||
>
|
>
|
||||||
Enable AI Extensions
|
Enable AI Extensions
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
|
|
||||||
|
<mat-checkbox
|
||||||
|
[ngModel]="psExtensions$ | async"
|
||||||
|
(change)="onTogglePsExtensions($event)"
|
||||||
|
>
|
||||||
|
Enable Process Services Extensions
|
||||||
|
</mat-checkbox>
|
||||||
|
</div>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
</mat-accordion>
|
</mat-accordion>
|
||||||
|
@@ -3,6 +3,11 @@
|
|||||||
$app-menu-height: 64px;
|
$app-menu-height: 64px;
|
||||||
|
|
||||||
.aca-settings {
|
.aca-settings {
|
||||||
|
&-extensions-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
.settings-input {
|
.settings-input {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,8 @@ import {
|
|||||||
getHeaderColor,
|
getHeaderColor,
|
||||||
getAppName,
|
getAppName,
|
||||||
getUserProfile,
|
getUserProfile,
|
||||||
getLanguagePickerState
|
getLanguagePickerState,
|
||||||
|
ToggleProcessServicesAction
|
||||||
} from '@alfresco/aca-shared/store';
|
} from '@alfresco/aca-shared/store';
|
||||||
import { ProfileState } from '@alfresco/adf-extensions';
|
import { ProfileState } from '@alfresco/adf-extensions';
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ export class SettingsComponent implements OnInit {
|
|||||||
headerColor$: Observable<string>;
|
headerColor$: Observable<string>;
|
||||||
languagePicker$: Observable<boolean>;
|
languagePicker$: Observable<boolean>;
|
||||||
aiExtensions$: Observable<boolean>;
|
aiExtensions$: Observable<boolean>;
|
||||||
|
psExtensions$: Observable<boolean>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<AppStore>,
|
private store: Store<AppStore>,
|
||||||
@@ -87,6 +89,10 @@ export class SettingsComponent implements OnInit {
|
|||||||
this.storage.getItem('ai') === 'true'
|
this.storage.getItem('ai') === 'true'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.psExtensions$ = new BehaviorSubject(
|
||||||
|
this.storage.getItem('processServices') === 'true'
|
||||||
|
);
|
||||||
|
|
||||||
this.form = this.fb.group({
|
this.form = this.fb.group({
|
||||||
ecmHost: [
|
ecmHost: [
|
||||||
'',
|
'',
|
||||||
@@ -141,4 +147,9 @@ export class SettingsComponent implements OnInit {
|
|||||||
onToggleAiExtensions(event: MatCheckboxChange) {
|
onToggleAiExtensions(event: MatCheckboxChange) {
|
||||||
this.storage.setItem('ai', event.checked.toString());
|
this.storage.setItem('ai', event.checked.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onTogglePsExtensions(event: MatCheckboxChange) {
|
||||||
|
this.storage.setItem('processServices', event.checked.toString());
|
||||||
|
this.store.dispatch(new ToggleProcessServicesAction(event.checked));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -172,7 +172,8 @@ export class CoreExtensionsModule {
|
|||||||
'repository.isQuickShareEnabled': rules.hasQuickShareEnabled,
|
'repository.isQuickShareEnabled': rules.hasQuickShareEnabled,
|
||||||
'user.isAdmin': rules.isAdmin,
|
'user.isAdmin': rules.isAdmin,
|
||||||
'app.canShowLanguagePicker': rules.canShowLanguagePicker,
|
'app.canShowLanguagePicker': rules.canShowLanguagePicker,
|
||||||
'app.canShowLogout': rules.canShowLogout
|
'app.canShowLogout': rules.canShowLogout,
|
||||||
|
'app.canShowProcessServices': rules.canShowProcessServices
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,8 @@ import { DomSanitizer } from '@angular/platform-browser';
|
|||||||
import {
|
import {
|
||||||
AppStore,
|
AppStore,
|
||||||
getRuleContext,
|
getRuleContext,
|
||||||
getLanguagePickerState
|
getLanguagePickerState,
|
||||||
|
getProcessServicesState
|
||||||
} from '@alfresco/aca-shared/store';
|
} from '@alfresco/aca-shared/store';
|
||||||
import { NodePermissionService } from '@alfresco/aca-shared';
|
import { NodePermissionService } from '@alfresco/aca-shared';
|
||||||
import {
|
import {
|
||||||
@@ -110,6 +111,7 @@ export class AppExtensionService implements RuleContext {
|
|||||||
repository: RepositoryInfo;
|
repository: RepositoryInfo;
|
||||||
withCredentials: boolean;
|
withCredentials: boolean;
|
||||||
languagePicker: boolean;
|
languagePicker: boolean;
|
||||||
|
processServices: boolean;
|
||||||
|
|
||||||
references$: Observable<ExtensionRef[]>;
|
references$: Observable<ExtensionRef[]>;
|
||||||
|
|
||||||
@@ -135,6 +137,10 @@ export class AppExtensionService implements RuleContext {
|
|||||||
this.store.select(getLanguagePickerState).subscribe(result => {
|
this.store.select(getLanguagePickerState).subscribe(result => {
|
||||||
this.languagePicker = result;
|
this.languagePicker = result;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.store.select(getProcessServicesState).subscribe(result => {
|
||||||
|
this.processServices = result;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
|
@@ -54,7 +54,8 @@ export const INITIAL_APP_STATE: AppState = {
|
|||||||
status: <any>{
|
status: <any>{
|
||||||
isQuickShareEnabled: true
|
isQuickShareEnabled: true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
processServices: false
|
||||||
};
|
};
|
||||||
|
|
||||||
export const INITIAL_STATE: AppStore = {
|
export const INITIAL_STATE: AppStore = {
|
||||||
|
@@ -37,7 +37,8 @@ import {
|
|||||||
SetSelectedNodesAction,
|
SetSelectedNodesAction,
|
||||||
SetRepositoryInfoAction,
|
SetRepositoryInfoAction,
|
||||||
SetInfoDrawerStateAction,
|
SetInfoDrawerStateAction,
|
||||||
SetInfoDrawerMetadataAspectAction
|
SetInfoDrawerMetadataAspectAction,
|
||||||
|
ToggleProcessServicesAction
|
||||||
} from '@alfresco/aca-shared/store';
|
} from '@alfresco/aca-shared/store';
|
||||||
import { INITIAL_APP_STATE } from '../initial-state';
|
import { INITIAL_APP_STATE } from '../initial-state';
|
||||||
|
|
||||||
@@ -92,6 +93,11 @@ export function appReducer(
|
|||||||
case SearchActionTypes.HideFilter:
|
case SearchActionTypes.HideFilter:
|
||||||
newState = hideSearchFilter(state);
|
newState = hideSearchFilter(state);
|
||||||
break;
|
break;
|
||||||
|
case AppActionTypes.ToggleProcessServices:
|
||||||
|
newState = updateProcessServices(state, <ToggleProcessServicesAction>(
|
||||||
|
action
|
||||||
|
));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
newState = Object.assign({}, state);
|
newState = Object.assign({}, state);
|
||||||
}
|
}
|
||||||
@@ -268,3 +274,12 @@ function updateRepositoryStatus(
|
|||||||
newState.repository = action.payload;
|
newState.repository = action.payload;
|
||||||
return newState;
|
return newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateProcessServices(
|
||||||
|
state: AppState,
|
||||||
|
action: ToggleProcessServicesAction
|
||||||
|
) {
|
||||||
|
const newState = Object.assign({}, state);
|
||||||
|
newState.processServices = action.payload;
|
||||||
|
return newState;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user