mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
Fix edit widget button
This commit is contained in:
parent
dd02c6df2c
commit
63a3b6b4c2
@ -1,4 +1,9 @@
|
|||||||
<my-ibox title="Add {{ defaultName }}">
|
<div *ngIf="isLoading">
|
||||||
|
<my-spinner></my-spinner>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="!isLoading">
|
||||||
|
<my-ibox title="Add {{ defaultName }}" [isCollapsible]="true" [defaultCollapsed]="defaultExpandedWidgetId">
|
||||||
<div class="my-ibox-content">
|
<div class="my-ibox-content">
|
||||||
<form (submit)="addWidget()" novalidate name="addForm">
|
<form (submit)="addWidget()" novalidate name="addForm">
|
||||||
<label class="label-block">
|
<label class="label-block">
|
||||||
@ -51,8 +56,9 @@
|
|||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-sm btn-white" [disabled]="isUpdating" (click)="resetWidget(widget)"
|
<button type="button" class="btn btn-sm btn-white" [disabled]="isUpdating" (click)="resetWidget(widget)"
|
||||||
*ngIf="hasChanges(widget)">
|
*ngIf="hasChanges(widget)">
|
||||||
<i class="fa fa-reset"></i> Undo Changes
|
<i class="fa fa-undo"></i> Undo Changes
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</my-ibox>
|
</my-ibox>
|
||||||
|
</div>
|
@ -71,11 +71,12 @@ export class NewWidgetComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See if we should request editing a particular widget
|
// See if we should request editing a particular widget
|
||||||
if (SessionStorage.editWidgetId && SessionStorage.editsRequested === 1) {
|
console.log(SessionStorage.editIntegrationId +" " +SessionStorage.editsRequested);
|
||||||
|
if (SessionStorage.editIntegrationId && SessionStorage.editsRequested === 1) {
|
||||||
let editWidget: EditableWidget = null;
|
let editWidget: EditableWidget = null;
|
||||||
let otherWidgets: EditableWidget[] = [];
|
let otherWidgets: EditableWidget[] = [];
|
||||||
for (let widget of this.widgets) {
|
for (let widget of this.widgets) {
|
||||||
if (widget.id === SessionStorage.editWidgetId) {
|
if (widget.id === SessionStorage.editIntegrationId) {
|
||||||
editWidget = widget;
|
editWidget = widget;
|
||||||
} else otherWidgets.push(widget);
|
} else otherWidgets.push(widget);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ export class RiotHomeComponent {
|
|||||||
private roomId: string;
|
private roomId: string;
|
||||||
private userId: string;
|
private userId: string;
|
||||||
private requestedScreen: string = null;
|
private requestedScreen: string = null;
|
||||||
private requestedIntegration: string = null;
|
private requestedIntegrationId: string = null;
|
||||||
public integrationsForCategory: { [category: string]: Integration[] } = {};
|
public integrationsForCategory: { [category: string]: Integration[] } = {};
|
||||||
private categoryMap: { [categoryName: string]: string[] } = CATEGORY_MAP;
|
private categoryMap: { [categoryName: string]: string[] } = CATEGORY_MAP;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ export class RiotHomeComponent {
|
|||||||
let params: any = this.activatedRoute.snapshot.queryParams;
|
let params: any = this.activatedRoute.snapshot.queryParams;
|
||||||
|
|
||||||
this.requestedScreen = params.screen;
|
this.requestedScreen = params.screen;
|
||||||
this.requestedIntegration = params.integ_id;
|
this.requestedIntegrationId = params.integ_id;
|
||||||
|
|
||||||
if (SessionStorage.roomId && SessionStorage.userId) {
|
if (SessionStorage.roomId && SessionStorage.userId) {
|
||||||
this.roomId = SessionStorage.roomId;
|
this.roomId = SessionStorage.roomId;
|
||||||
@ -208,8 +208,9 @@ export class RiotHomeComponent {
|
|||||||
console.log("Searching for integration for requested screen");
|
console.log("Searching for integration for requested screen");
|
||||||
for (const integration of this.getIntegrations()) {
|
for (const integration of this.getIntegrations()) {
|
||||||
if (integration.category === category && integration.type === type) {
|
if (integration.category === category && integration.type === type) {
|
||||||
console.log("Configuring integration " + this.requestedIntegration + " category=" + category + " type=" + type);
|
console.log("Configuring integration " + this.requestedIntegrationId + " category=" + category + " type=" + type);
|
||||||
SessionStorage.editIntegration = integration;
|
SessionStorage.editIntegration = integration;
|
||||||
|
SessionStorage.editIntegrationId = this.requestedIntegrationId;
|
||||||
this.modifyIntegration(integration);
|
this.modifyIntegration(integration);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ export class SessionStorage {
|
|||||||
public static userId: string;
|
public static userId: string;
|
||||||
public static roomId: string;
|
public static roomId: string;
|
||||||
public static editIntegration: Integration;
|
public static editIntegration: Integration;
|
||||||
public static editWidgetId: string;
|
public static editIntegrationId: string;
|
||||||
public static editsRequested: number = 0;
|
public static editsRequested: number = 0;
|
||||||
|
|
||||||
private constructor() {
|
private constructor() {
|
||||||
|
@ -53,11 +53,13 @@ export class IntegrationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static getIntegrationForScreen(screen: string): { category: string, type: string } {
|
static getIntegrationForScreen(screen: string): { category: string, type: string } {
|
||||||
for (const iType of Object.keys(IntegrationService.supportedIntegrationsMap)) {
|
for (const category of Object.keys(IntegrationService.supportedIntegrationsMap)) {
|
||||||
for (const iiType of Object.keys(IntegrationService.supportedIntegrationsMap[iType])) {
|
for (const type of Object.keys(IntegrationService.supportedIntegrationsMap[category])) {
|
||||||
const integrationTypes = IntegrationService.supportedIntegrationsMap[iType][iiType].types;
|
const integrationTypes = IntegrationService.supportedIntegrationsMap[category][type].types;
|
||||||
|
if (!integrationTypes) continue;
|
||||||
|
|
||||||
const integrationScreens = integrationTypes.map(t => "type_" + t);
|
const integrationScreens = integrationTypes.map(t => "type_" + t);
|
||||||
if (integrationScreens.includes(screen)) return {category: iType, type: iiType};
|
if (integrationScreens.includes(screen)) return {category: category, type: type};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user