Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/metadata deploy bundle modal #184

Open
wants to merge 4 commits into
base: feature/metadata-deploy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<c-key
bundle={bundle}
is-setup="true"
oneditbundle={handleEditBundle}
oneditindicator={handleEditIndicator}>
</c-key>
</lightning-layout-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import getIndicatorBundleWrapper from '@salesforce/apex/IndicatorController.getI

import { refreshApex } from '@salesforce/apex';

import IndicatorEditModal from "c/indicatorEditModal";
import indicatorBuilderModal from 'c/indicatorBuilderModal';
import editIndicatorBundleModal from 'c/editIndicatorBundleModal';

import Indicator_Bundle from "@salesforce/schema/Indicator_Bundle__mdt";
import Indicator_Item from "@salesforce/schema/Indicator_Item__mdt";
Expand Down Expand Up @@ -95,16 +95,12 @@ export default class ConfigurationManager extends LightningElement {

handleNewClick(event) {
const developerName = (event.currentTarget.dataset || {}).developerName;

console.log(developerName);
/**This can be removed after proof of concept**/
switch (developerName) {
case Indicator_Bundle.objectApiName.replace('__c',''):
IndicatorEditModal.open({
masterLabel:event.currentTarget.label,
objectApiName:Indicator_Bundle.objectApiName,
isNew:true,
size:'full'
}).then((result) => {
case Indicator_Bundle.objectApiName.replace('__c', ''):
console.log('here');
editIndicatorBundleModal.open().then((result) => {
console.log(result);
});
break;
Expand Down Expand Up @@ -135,4 +131,10 @@ export default class ConfigurationManager extends LightningElement {
this.openModal(event.detail);
}

handleEditBundle(event) {
editIndicatorBundleModal.open().then((result) => {
console.log(result);
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,10 @@
</lightning-layout-item>

<lightning-layout-item padding="horizontal-small" size=12>
<lightning-input
data-field-api-name={bundleInfo.sObject_FIELD.fieldApiName}
required={bundleInfo.sObject_FIELD.required}
type={bundleInfo.sObject_FIELD.dataType}
label={bundleInfo.sObject_FIELD.label}
value={bundleInfo.sObject_FIELD.value}
field-level-help={bundleInfo.sObject_FIELD.inlineHelpText}
onchange={handleChange}>
</lightning-input>
<c-fsc_object-selector
onchange={handleChange}
data-field-api-name={bundleInfo.sObject_FIELD.fieldApiName}>
</c-fsc_object-selector>
</lightning-layout-item>

<lightning-layout-item padding="horizontal-small" size=4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ export default class EditIndicatorBundle extends LightningElement {


saveMetaDataRecord() {
deployIndicatorBundles({wrapper: [this.indicator_Bundle]})
deployIndicatorBundles({ wrapper: JSON.stringify({ 'indicatorBundle': this.indicator_Bundle }) })
.then(result => {
console.log('deploymentId = result');
console.log('deploymentId = ' + result);
})
.catch(error => {
console.log(error);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { createElement } from 'lwc';
import EditIndicatorBundleModal from 'c/editIndicatorBundleModal';

describe('c-edit-indicator-bundle-modal', () => {
afterEach(() => {
// The jsdom instance is shared across test cases in a single file so reset the DOM
while (document.body.firstChild) {
document.body.removeChild(document.body.firstChild);
}
});

it('TODO: test case generated by CLI command, please fill in test logic', () => {
// Arrange
const element = createElement('c-edit-indicator-bundle-modal', {
is: EditIndicatorBundleModal
});

// Act
document.body.appendChild(element);

// Assert
// const div = element.shadowRoot.querySelector('div');
expect(1).toBe(1);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<lightning-modal-header>
</lightning-modal-header>

<lightning-modal-body>
<div class="slds-is-relative slds-container_fluid">
<c-edit-indicator-bundle></c-edit-indicator-bundle>
</div>
</lightning-modal-body>

<lightning-modal-footer>
</lightning-modal-footer>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { LightningElement } from 'lwc';
import LightningModal from 'lightning/modal';

export default class EditIndicatorBundleModal extends LightningModal {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>62.0</apiVersion>
<isExposed>false</isExposed>
</LightningComponentBundle>

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 2 additions & 1 deletion force-app/main/default/lwc/key/key.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ <h2>Bundle is not active.</h2>
<template lwc:if={isBundle}>
<lightning-button
name={bundleDetails.BundleId}
data-event-type="editbundle"
onclick={handleClick}
label="Edit Bundle"
title="Edit Bundle"
Expand Down Expand Up @@ -132,7 +133,7 @@ <h2>Item is not active. No indicators will be shown, even if they are active.</
</lightning-layout-item>
<lightning-layout-item padding="horizontal-small" size="2" class="slds-text-align_right">
<template lwc:if={isManageEnabled}>
<lightning-button name={indicatorItem.IndicatorId} onclick={handleClick} label="Edit Indicator" title="Edit Indicator" icon-name="utility:setup"></lightning-button>
<lightning-button name={indicatorItem.IndicatorId} onclick={handleClick} data-event-type="editindicator" label="Edit Indicator" title="Edit Indicator" icon-name="utility:setup"></lightning-button>
</template>
</lightning-layout-item>
</lightning-layout>
Expand Down
6 changes: 2 additions & 4 deletions force-app/main/default/lwc/key/key.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,9 @@ export default class Key extends LightningElement {
}

handleClick(event){
console.log(event.target.name);
const editindicatorEvent = new CustomEvent('editindicator', {
this.dispatchEvent(new CustomEvent(event.target.dataset.eventType, {
detail: event.target.name
});
this.dispatchEvent(editindicatorEvent);
}));
//window.open('/lightning/setup/CustomMetadata/page?address=%2F' + event.target.name,'_blank');
}

Expand Down
Loading