Skip to content

Commit

Permalink
Merge pull request #10 from meta-d/develop
Browse files Browse the repository at this point in the history
v1.6.14 beta.1
  • Loading branch information
tiven-w authored Oct 5, 2023
2 parents 5d121c1 + f903791 commit ff56de0
Show file tree
Hide file tree
Showing 587 changed files with 9,789 additions and 6,700 deletions.
18 changes: 15 additions & 3 deletions .deploy/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@ ARG PORT
FROM node:18-alpine AS build

LABEL maintainer="meta.digital.cloud@gmail.com"
LABEL org.opencontainers.image.source https://github.com/meta-d/ocap

ENV CI=true

RUN apk --update add bash && \
apk add --no-cache --virtual build-dependencies dos2unix gcc g++ git make python3 vips-dev && \
mkdir /srv/pangolin && chown -R node:node /srv/pangolin
# Set Python interpreter for `node-gyp` to use
ENV PYTHON /usr/bin/python

RUN apk --update add bash && npm i -g npm \
&& apk add --no-cache --virtual build-dependencies dos2unix gcc g++ git make python3 vips-dev

# Output Python3 version
RUN python3 --version

RUN npm install --quiet node-gyp@9.3.1 -g
RUN npm install yarn -g --force
RUN mkdir /srv/pangolin && chown -R node:node /srv/pangolin

USER node:node

WORKDIR /srv/pangolin

Expand Down
3 changes: 3 additions & 0 deletions .deploy/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"immer": "^10.0.1",
"js-yaml": "^4.1.0",
"json5": "^2.2.3",
"langchain": "^0.0.152",
"lato-font": "^3.0.0",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
Expand Down Expand Up @@ -94,6 +95,8 @@
"tslib": "^2.3.0",
"typeorm": "^0.2.37",
"xlsx": "^0.18.5",
"zod": "^3.22.2",
"zod-to-json-schema": "^3.21.4",
"zone.js": "0.13.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
- [ ] Have you followed the [contributing guidelines](https://github.com/meta-d/ocap/blob/master/.github/CONTRIBUTING.md)?
- [ ] Have you explained what your changes do, and why they add value?

**Please note: we will close your PR without comment if you do not check the boxes above and provide ALL requested information.**
**Please note: we will close your PR without comment if you do not check the boxes above and provide ALL requested information.**

---
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Main features:
* **AI Copilot**: assist users quickly design and implement story dashboards.

Basic feartures of the platform:

* Multi-tenant
* Multiple Organizations Management
* Home Dashboard
Expand Down
1 change: 1 addition & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
* **AI 副驾驶**: 帮助用户快速设计和实现故事仪表板。

平台的基本功能:

* 多租户
* 多组织管理
* 主页仪表盘
Expand Down
2 changes: 1 addition & 1 deletion apps/cloud/src/app/@shared/_components-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
}
}

nx-component-settings {
ngm-component-settings {
.metad-formly-array {
.metad-formly__array-row {
border: unset;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<header mat-dialog-title cdkDrag cdkDragRootElement=".cdk-overlay-pane" cdkDragHandle>
<div style="pointer-events: none;">
{{ 'PAC.MENU.AddUsers' | translate: {Default: 'Add Users'} }}
{{ 'PAC.MENU.AddCertifications' | translate: {Default: 'Add Certifications'} }}
</div>
</header>

<mat-dialog-content class="mat-typography flex flex-col">
<ngm-mat-select appearance="fill" displayBehaviour="descriptionOnly"
<ngm-select appearance="fill" color="accent" displayBehaviour="descriptionOnly"
[label]=" 'PAC.KEY_WORDS.Certification' | translate: { Default: 'Certification' } "
[selectOptions]="certifications$ | async"
searchable
[(ngModel)]="certificationId"
>
</ngm-mat-select>
</ngm-select>
</mat-dialog-content>

<mat-dialog-actions align="end">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CommonModule } from '@angular/common'
import { Component, inject } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { NgmMatSelectComponent } from '@metad/ocap-angular/common'
import { NgmSelectComponent } from '@metad/ocap-angular/common'
import { ButtonGroupDirective, DensityDirective } from '@metad/ocap-angular/core'
import { TranslateModule } from '@ngx-translate/core'
import { map } from 'rxjs/operators'
Expand All @@ -16,7 +16,7 @@ import { MaterialModule } from '../material.module'
ReactiveFormsModule,
MaterialModule,
TranslateModule,
NgmMatSelectComponent,
NgmSelectComponent,
ButtonGroupDirective,
DensityDirective
],
Expand Down
4 changes: 2 additions & 2 deletions apps/cloud/src/app/@shared/copilot/chat/chat.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
<div *ngIf="conversation.role === CopilotChatMessageRoleEnum.User" class="pl-4 flex">
<div class="flex-1 flex items-start justify-end overflow-auto">
<div class="flex flex-col justify-start items-end overflow-auto relative p-[10px] group">
<nx-table *ngIf="conversation.data; else messageContent" class="max-w-full rounded-lg border overflow-hidden bg-white"
<ngm-table *ngIf="conversation.data; else messageContent" class="max-w-full rounded-lg border overflow-hidden bg-white"
[columns]="conversation.data.columns"
[data]="conversation.data.content"
paging
[pageSizeOptions]="[10, 20, 50, 100]"
></nx-table>
></ngm-table>

<ng-template #messageContent>
<div class="pac-copilot__user-message rounded-lg py-2 px-4 w-full overflow-auto flex flex-col items-end">
Expand Down
8 changes: 4 additions & 4 deletions apps/cloud/src/app/@shared/copilot/chat/chat.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { RouterModule } from '@angular/router'
import { CopilotChatMessage, CopilotChatMessageRoleEnum, CopilotEngine } from '@metad/copilot'
import { DensityDirective } from '@metad/ocap-angular/core'
import { isString, pick } from '@metad/ocap-core'
import { UntilDestroy } from '@ngneat/until-destroy'
import { TranslateModule, TranslateService } from '@ngx-translate/core'
import { NxTableModule } from '@metad/components/table'
import { MarkdownModule } from 'ngx-markdown'
Expand All @@ -40,8 +39,9 @@ import { MaterialModule } from '../../material.module'
import { UserPipe } from '../../pipes'
import { UserAvatarComponent } from '../../user'
import { CopilotEnableComponent } from '../enable/enable.component'
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'


@UntilDestroy({ checkProperties: true })
@Component({
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down Expand Up @@ -179,7 +179,7 @@ export class CopilotMessageDirective implements OnChanges {
}
}

@UntilDestroy({ checkProperties: true })

@Component({
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down Expand Up @@ -400,7 +400,7 @@ export class CopilotChatComponent {
})

// Subscribers
private _copilotSub = this.copilotService.copilot$.pipe(delay(1000)).subscribe(() => {
private _copilotSub = this.copilotService.copilot$.pipe(delay(1000), takeUntilDestroyed()).subscribe(() => {
this._cdr.detectChanges()
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@
[disabled]="!enabledFeature(feature)">
<mat-expansion-panel-header>
<mat-panel-title>
{{ feature.name }}
{{ 'PAC.Feature.Features.' + feature.code + '.Name' | translate: {Default: feature.name } }}
</mat-panel-title>
<mat-panel-description class="flex justify-end items-center">
{{ feature.description }}
{{ 'PAC.Feature.Features.' + feature.code + '.Description' | translate: {Default: feature.description } }}
</mat-panel-description>
<mat-slide-toggle [checked]="enabledFeature(feature)" (change)="featureChanged($event.checked, feature)"></mat-slide-toggle>

<mat-slide-toggle class="inline-flex" [checked]="enabledFeature(feature)" (change)="featureChanged($event.checked, feature)"></mat-slide-toggle>
</mat-expansion-panel-header>

<mat-list *ngIf="feature?.children.length > 0" displayDensity="cosy">
<mat-list-item *ngFor="let child of feature.children">
<mat-checkbox [checked]="enabledFeature(child)" (change)="featureChanged($event.checked, child)">{{ child?.name }}</mat-checkbox>
<mat-checkbox [checked]="enabledFeature(child)" (change)="featureChanged($event.checked, child)">
<div class="flex items-center gap-4">
<span>{{ 'PAC.Feature.Features.' + child.code + '.Name' | translate: {Default: child.name } }}</span>
<span class="text-sm italic">{{ 'PAC.Feature.Features.' + child.code + '.Description' | translate: {Default: child.description } }}</span>
</div>
</mat-checkbox>
</mat-list-item>
</mat-list>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
:host {
@apply w-full;
}

.mat-mdc-slide-toggle {
@apply inline-flex;
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
import { Component, OnChanges, OnInit, SimpleChanges } from '@angular/core'
import { Component, OnInit, inject } from '@angular/core'
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'
import { MatDialog } from '@angular/material/dialog'
import { ActivatedRoute } from '@angular/router'
import { CountdownConfirmationComponent } from '@metad/components/confirm'
import { IFeature, IFeatureOrganization, IFeatureToggle } from '@metad/contracts'
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'
import { TranslateService } from '@ngx-translate/core'
import { CountdownConfirmationComponent } from '@metad/components/confirm'
import { combineLatest, firstValueFrom, of } from 'rxjs'
import {
distinctUntilChanged,
map,
shareReplay,
startWith,
switchMap,
tap,
withLatestFrom
} from 'rxjs/operators'
import { distinctUntilChanged, map, shareReplay, startWith, switchMap, tap, withLatestFrom } from 'rxjs/operators'
import { environment } from '../../../environments/environment'
import { FeatureService, FeatureStoreService, Store } from '../../@core/services'
import { TranslationBaseComponent } from '../language/translation-base.component'


@UntilDestroy({ checkProperties: true })
@Component({
selector: 'pac-feature-toggle',
templateUrl: './feature-toggle.component.html',
styleUrls: ['./feature-toggle.component.scss']
})
export class FeatureToggleComponent extends TranslationBaseComponent implements OnInit, OnChanges {
export class FeatureToggleComponent extends TranslationBaseComponent implements OnInit {
private readonly _activatedRoute = inject(ActivatedRoute)
private readonly _featureService = inject(FeatureService)
private readonly _featureStoreService = inject(FeatureStoreService)
private readonly _storeService = inject(Store)
private readonly _matDialog = inject(MatDialog)

loading = false
featureToggles = []
featureTogglesDefinitions: IFeatureToggle[] = []
Expand All @@ -34,7 +33,7 @@ export class FeatureToggleComponent extends TranslationBaseComponent implements
startWith(this._activatedRoute.snapshot.data),
map((data) => data?.isOrganization),
distinctUntilChanged(),
untilDestroyed(this),
takeUntilDestroyed(),
shareReplay(1)
)
public readonly organization$ = this._storeService.selectedOrganization$
Expand All @@ -52,21 +51,10 @@ export class FeatureToggleComponent extends TranslationBaseComponent implements
}
return this._featureStoreService.loadFeatureOrganizations(['feature'], request).pipe(map(({ items }) => items))
}),
untilDestroyed(this),
takeUntilDestroyed(),
shareReplay(1)
)

constructor(
private readonly _activatedRoute: ActivatedRoute,
private readonly _featureService: FeatureService,
private readonly _featureStoreService: FeatureStoreService,
private readonly _storeService: Store,
public readonly translationService: TranslateService,
private readonly _matDialog: MatDialog
) {
super()
}

ngOnInit(): void {
combineLatest([this.featureTenant$, this.featureOrganizations$])
.pipe(withLatestFrom(combineLatest([this.isOrganization$, this.organization$])), untilDestroyed(this))
Expand Down Expand Up @@ -99,45 +87,43 @@ export class FeatureToggleComponent extends TranslationBaseComponent implements
.subscribe()
}

ngOnChanges(change: SimpleChanges): void {}

getFeatures() {
this._featureStoreService.loadFeatures(['children']).pipe(untilDestroyed(this)).subscribe()
}

async featureChanged(event: boolean, feature: IFeature) {
async featureChanged(isEnabled: boolean, feature: IFeature) {
const result = await firstValueFrom(
this._matDialog
.open(CountdownConfirmationComponent, {
// context: {
// recordType: feature.description,
// isEnabled: isEnabled
// },
data: {
recordType: feature.description,
isEnabled: isEnabled
},
})
.afterClosed()
)

if (result) {
await this.emitFeatureToggle({ feature, isEnabled: !!event })
await this.emitFeatureToggle({ feature, isEnabled: !!isEnabled })
} else {
if (!environment.IS_ELECTRON) {
window.location.reload()
}
}
}

async emitFeatureToggle({feature, isEnabled}: { feature: IFeature; isEnabled: boolean }) {
async emitFeatureToggle({ feature, isEnabled }: { feature: IFeature; isEnabled: boolean }) {
const isOrganization = await firstValueFrom(this.isOrganization$)
const organization = await firstValueFrom(this.organization$)
const { id: featureId } = feature
const request = {
featureId,
isEnabled
}
if (organization && isOrganization) {
const { id: organizationId } = organization
request['organizationId'] = organizationId
}
const request = {
featureId,
isEnabled
}
if (organization && isOrganization) {
const { id: organizationId } = organization
request['organizationId'] = organizationId
}
await firstValueFrom(this._featureStoreService.changedFeature(request))
if (!environment.IS_ELECTRON) {
window.location.reload()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<span role="img" aria-label="search" class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<svg viewBox="64 64 896 896" focusable="false" class="" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg>
</span>
<input matInput class="rounded-md hover:bg-slate-500/10 dark:hover:bg-white/10 focus:bg-slate-500/20 dark:focus:bg-white/20 "
<input matInput class="rounded-md hover:bg-slate-500/10 dark:hover:bg-white/10 focus:bg-slate-500/20 dark:focus:bg-white/20 dark:bg-white/10"
placeholder="{{ 'PAC.KEY_WORDS.SEARCH' | translate: {Default: 'Search'} }}" type="text"
value="" [formControl]="searchControl"
>
6 changes: 3 additions & 3 deletions apps/cloud/src/app/@shared/model/formula.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="flex flex-1 max-w-full" cdkDropListGroup>
<div class="nx-theme-dark dark w-[400px] shrink-0 flex flex-col justify-start overflow-auto bg-bluegray-700 text-white p-4 group" >
<div class="ngm-theme-dark dark w-[400px] shrink-0 flex flex-col justify-start overflow-auto bg-bluegray-700 text-white p-4 group" >
<div class="w-full flex justify-start items-center my-2" cdkDrag cdkDragRootElement=".cdk-overlay-pane" cdkDragHandle>
<mat-icon displayDensity="cosy" class="-ml-2 opacity-0 group-hover:opacity-80">drag_indicator</mat-icon>
<span class="text-lg pointer-events-none">
Expand Down Expand Up @@ -52,12 +52,12 @@
[(ngModel)]="formula"
>
</ngm-formula-editor>
<nx-calculated-measure *ngIf="syntax === Syntax.MDX" class="flex w-full h-full"
<ngm-calculated-measure *ngIf="syntax === Syntax.MDX" class="flex w-full h-full"
[syntax]="Syntax.MDX"
[dataSettings]="dataSettings"
[entityType]="entityType"
[(ngModel)]="formula"
>
</nx-calculated-measure>
</ngm-calculated-measure>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="nx-theme-dark dark w-[300px] shrink-0 flex flex-col justify-start overflow-auto bg-bluegray-700 text-white p-4 group">
<div class="ngm-theme-dark dark w-[300px] shrink-0 flex flex-col justify-start overflow-auto bg-bluegray-700 text-white p-4 group">
<div class="w-full flex justify-start items-center mb-4" cdkDrag cdkDragRootElement=".cdk-overlay-pane" cdkDragHandle>
<mat-icon displayDensity="cosy" class="-ml-2 opacity-0 group-hover:opacity-80">drag_indicator</mat-icon>
<span class="text-lg pointer-events-none">
Expand Down
Loading

0 comments on commit ff56de0

Please sign in to comment.