-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from ui5-community/fix/smaller_issues
Fix/smaller issues
- Loading branch information
Showing
9 changed files
with
330 additions
and
91 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Event from "sap/ui/base/Event"; | ||
import BaseController from "../BaseController"; | ||
import Dialog from "sap/m/Dialog"; | ||
|
||
/** | ||
* @namespace com.ui5.journeyrecorder.controller.dialogs | ||
*/ | ||
export default class BaseDialogController extends BaseController { | ||
closeBySuccess(oPressEvent: Event, data?: Record<string, unknown>) { | ||
const oResult: { | ||
origin: unknown, | ||
result: "Confirm" | "Abort", | ||
data?: Record<string, unknown> | ||
} = { | ||
origin: oPressEvent.getSource(), | ||
result: "Confirm", | ||
}; | ||
if (data) { | ||
oResult.data = data; | ||
} | ||
(this.getView().getParent() as Dialog).fireBeforeClose(oResult) | ||
} | ||
|
||
closeByAbort(oPressEvent: Event) { | ||
(this.getView().getParent() as Dialog).fireBeforeClose({ | ||
origin: oPressEvent.getSource(), | ||
result: "Abort" | ||
}) | ||
} | ||
} |
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,35 @@ | ||
import BaseDialogController from "./BaseDialogController"; | ||
import { Themes } from "../../model/enum/Themes"; | ||
import Theming from "sap/ui/core/Theming"; | ||
import JSONModel from "sap/ui/model/json/JSONModel"; | ||
import SettingsStorageService, { AppSettings } from "../../service/SettingsStorage.service"; | ||
import ListItem from "sap/ui/core/ListItem"; | ||
import Event from "sap/ui/base/Event"; | ||
import Dialog from "sap/m/Dialog"; | ||
|
||
/** | ||
* @namespace com.ui5.journeyrecorder.controller.dialogs | ||
*/ | ||
export default class Settings extends BaseDialogController { | ||
settings = { | ||
initialHeight: '91vh', | ||
initialWidth: '30rem' | ||
} | ||
|
||
onThemeSelect(oEvent: Event) { | ||
const oItem = oEvent.getParameter("selectedItem" as never) as ListItem; | ||
const oModel = this.getModel("settings") as JSONModel; | ||
oModel.setProperty('/theme', oItem.getKey()); | ||
Theming.setTheme(oItem.getKey()); | ||
} | ||
|
||
onCloseDialog(oEvent: Event, bSave: boolean) { | ||
if (bSave) { | ||
void SettingsStorageService.save((this.getModel("settings") as JSONModel).getData() as AppSettings); | ||
} | ||
(this.getView().getParent() as Dialog).fireBeforeClose({ | ||
origin: oEvent.getSource(), | ||
result: bSave ? 'Confirm' : 'Reject' | ||
}); | ||
} | ||
} |
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.