-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
351 additions
and
3 deletions.
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
...io/cds-dashboard/cds-canvas/actions/list/cds-action-qapla/cds-action-qapla.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<div *ngIf="previewMode" class="cds-action-content cds-action-preview" style="position: relative;"> | ||
|
||
<div class="action-row"> | ||
<div class="action-row-left"> | ||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="none"> | ||
<path d="M0 0h24v24H0z" fill="none"/> | ||
<path d="M20 8h-3V4H3c-1.1 0-2 .9-2 2v11h2c0 1.66 1.34 3 3 3s3-1.34 3-3h6c0 1.66 1.34 3 3 3s3-1.34 3-3h2v-5l-3-4zM6 18.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm13.5-9l1.96 2.5H17V9.5h2.5zm-1.5 9c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"/> | ||
</svg> | ||
</div> | ||
<div *ngIf="action?.trackingNumber" class="action-row-right"> | ||
{{action?.trackingNumber}} | ||
</div> | ||
<div *ngIf="!action?.trackingNumber" class="action-row-right empty"> | ||
Enter the tracking number | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
<div *ngIf="!previewMode && action_locked == false" class="content-panel-intent-detail no-footer"> | ||
|
||
<div class="field-box"> | ||
<label class="title-label">Tracking Number</label> | ||
<cds-textarea id="assignTo" | ||
[textLimitBtn]="false" | ||
[emojiPikerBtn]="false" | ||
[setAttributeBtn]="true" | ||
[minRow]="1" [maxRow]="1" | ||
[readonly]="false" | ||
[text]="action.trackingNumber" | ||
[placeholder]="'Tracking number to search'" | ||
(changeTextarea)="changeTextarea($event, 'trackingNumber')"> | ||
</cds-textarea> | ||
</div> | ||
|
||
<div class="field-box"> | ||
<label class="title-label">Qapla Api Key</label> | ||
<cds-textarea id="assignTo" | ||
[textLimitBtn]="false" | ||
[emojiPikerBtn]="false" | ||
[setAttributeBtn]="false" | ||
[minRow]="1" [maxRow]="1" | ||
[readonly]="false" | ||
[text]="action.apiKey" | ||
[placeholder]="'Your Api Key'" | ||
(changeTextarea)="changeTextarea($event, 'apiKey')"> | ||
</cds-textarea> | ||
</div> | ||
|
||
<hr class="custom-divider"> | ||
|
||
<div class="field-box"> | ||
<label class="title-label">Status</label> | ||
<cds-textarea id="assignTo" | ||
[textLimitBtn]="false" | ||
[emojiPikerBtn]="false" | ||
[setAttributeBtn]="true" | ||
[minRow]="1" [maxRow]="1" | ||
[readonly]="true" | ||
[text]="action.assignStatusTo" | ||
(selectedAttribute)="onSelectedAttribute($event, 'assignStatusTo')" | ||
(clearSelectedAttribute)="onSelectedAttribute($event, 'assignStatusTo')"> | ||
</cds-textarea> | ||
</div> | ||
|
||
<div class="field-box"> | ||
<label class="title-label">Result</label> | ||
<cds-textarea id="assignTo" | ||
[textLimitBtn]="false" | ||
[emojiPikerBtn]="false" | ||
[setAttributeBtn]="true" | ||
[minRow]="1" [maxRow]="1" | ||
[readonly]="true" | ||
[text]="action.assignResultTo" | ||
(selectedAttribute)="onSelectedAttribute($event, 'assignResultTo')" | ||
(clearSelectedAttribute)="onSelectedAttribute($event, 'assignResultTo')"> | ||
</cds-textarea> | ||
</div> | ||
|
||
<div class="field-box"> | ||
<label class="title-label">Error</label> | ||
<cds-textarea id="assignTo" | ||
[textLimitBtn]="false" | ||
[emojiPikerBtn]="false" | ||
[setAttributeBtn]="true" | ||
[minRow]="1" [maxRow]="1" | ||
[readonly]="true" | ||
[text]="action.assignErrorTo" | ||
(selectedAttribute)="onSelectedAttribute($event, 'assignErrorTo')" | ||
(clearSelectedAttribute)="onSelectedAttribute($event, 'assignErrorTo')"> | ||
</cds-textarea> | ||
</div> | ||
|
||
</div> | ||
|
||
<div *ngIf="!previewMode && action_locked == true" class="content-panel-intent-detail no-footer"> | ||
|
||
<div class="block-overlay"> | ||
<span class="material-icons lock-icon">lock</span> | ||
<p>Feature available from <b>Scale</b> plan</p> | ||
|
||
<button id="cds-publish-btn" class="btn btn-primary cds-blue-button" type="button" (click)="goToPricing()"> | ||
<span class="material-icons">bolt</span> | ||
Upgrade now! | ||
</button> | ||
</div> | ||
|
||
</div> |
15 changes: 15 additions & 0 deletions
15
...io/cds-dashboard/cds-canvas/actions/list/cds-action-qapla/cds-action-qapla.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
.block-overlay { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
padding-top: 60px; | ||
|
||
|
||
.lock-icon { | ||
font-size: 40px; | ||
margin-bottom: 16px; | ||
color: #506493b0; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...cds-dashboard/cds-canvas/actions/list/cds-action-qapla/cds-action-qapla.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { CdsActionQaplaComponent } from './cds-action-qapla.component'; | ||
|
||
describe('CdsActionQaplaComponent', () => { | ||
let component: CdsActionQaplaComponent; | ||
let fixture: ComponentFixture<CdsActionQaplaComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ CdsActionQaplaComponent ] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(CdsActionQaplaComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
86 changes: 86 additions & 0 deletions
86
...udio/cds-dashboard/cds-canvas/actions/list/cds-action-qapla/cds-action-qapla.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | ||
import { ActionQapla } from 'src/app/models/action-model'; | ||
import { Intent } from 'src/app/models/intent-model'; | ||
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service'; | ||
import { variableList } from '../../../../../utils'; | ||
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'; | ||
import { Project } from 'src/app/models/project-model'; | ||
import { DashboardService } from 'src/app/services/dashboard.service'; | ||
import { AppConfigService } from 'src/app/services/app-config'; | ||
|
||
@Component({ | ||
selector: 'cds-action-qapla', | ||
templateUrl: './cds-action-qapla.component.html', | ||
styleUrls: ['./cds-action-qapla.component.scss'] | ||
}) | ||
export class CdsActionQaplaComponent implements OnInit { | ||
|
||
@Input() intentSelected: Intent; | ||
@Input() action: ActionQapla; | ||
@Input() previewMode: boolean = true; | ||
@Output() updateAndSaveAction = new EventEmitter; | ||
|
||
project: Project; | ||
action_locked: boolean = false; | ||
|
||
private logger: LoggerService = LoggerInstance.getInstance(); | ||
|
||
constructor( | ||
private dashboardService: DashboardService, | ||
private appConfigService: AppConfigService, | ||
) { } | ||
|
||
ngOnInit(): void { | ||
console.log("[ACTION QAPLA] action:", this.action); | ||
this.initializeAttributes(); | ||
this.project = this.dashboardService.project; | ||
console.log("this.project: ", this.project); | ||
this.availabilityCheck(); | ||
} | ||
|
||
availabilityCheck() { | ||
console.log("availabilityCheck profile plan: ", this.project.profile.name) | ||
if (this.project.profile.name !== 'Scale' && this.project.profile.name !== 'Plus') { | ||
console.log("availabilityCheck BLOCK ACTION!!"); | ||
this.action_locked = true; | ||
} | ||
} | ||
|
||
private initializeAttributes() { | ||
let new_attributes = []; | ||
if (!variableList.userDefined.some(v => v.name === 'qapla_status')) { | ||
new_attributes.push({ name: "qapla_status", value: "qapla_status" }); | ||
} | ||
if (!variableList.userDefined.some(v => v.name === 'qapla_result')) { | ||
new_attributes.push({ name: "qapla_result", value: "qapla_result" }); | ||
} | ||
if (!variableList.userDefined.some(v => v.name === 'qapla_error')) { | ||
new_attributes.push({ name: "qapla_error", value: "qapla_error" }); | ||
} | ||
variableList.userDefined = [...variableList.userDefined, ...new_attributes]; | ||
this.logger.debug("[ACTION GPT-TASK] Initialized variableList.userDefined: ", variableList.userDefined); | ||
} | ||
|
||
changeTextarea($event: string, property: string) { | ||
this.logger.debug("[ACTION QAPLA] changeTextarea event: ", $event); | ||
this.logger.debug("[ACTION QAPLA] changeTextarea propery: ", property); | ||
this.action[property] = $event; | ||
console.log("[ACTION QAPLA] Action updated: ", this.action); | ||
this.updateAndSaveAction.emit(); | ||
} | ||
|
||
onSelectedAttribute(event, property) { | ||
this.logger.log("[ACTION QAPLA] onEditableDivTextChange event", event) | ||
this.logger.log("[ACTION QAPLA] onEditableDivTextChange property", property) | ||
this.action[property] = event.value; | ||
console.log("[ACTION QAPLA] Action updated: ", this.action); | ||
this.updateAndSaveAction.emit(); | ||
} | ||
|
||
goToPricing() { | ||
let dashbordBaseUrl = this.appConfigService.getConfig().dashboardBaseUrl + '#/project/'+ this.dashboardService.projectID + '/pricing' | ||
window.open(dashbordBaseUrl, '_self') | ||
//this.hideShowWidget('show'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.