Skip to content

Commit

Permalink
tidy up document comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJump committed Apr 12, 2024
1 parent b7e63a6 commit 988784d
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@ import { SyncActionGroup } from '../api'
import { UUIButtonState } from '@umbraco-cms/backoffice/external/uui'

/**
* @exports
* @class uSyncActionBox
* @fires perform-action - when the user clicks the buttons.
* displays the action buttons for a given group
*/
@customElement('usync-action-box')
export class uSyncActionBox extends LitElement {
/**
* @type: {uSyncActionGroup}
* @memberof uSyncActionBox
* @description collection of buttons to display.
* Collection of buttons to display.
*/
@property({ type: Object })
group!: SyncActionGroup

/**
* state to display on buttons
*/
@property({ type: String })
state?: UUIButtonState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import { USYNC_SIGNALR_CONTEXT_TOKEN } from '../signalr/signalr.context.token'
import type { SyncUpdateMessage } from '../signalr/types'

/**
* @class uSyncProcessBox
* @description provides the progress box while things happen.
* Provides the progress box while things happen.
*/
@customElement('usync-progress-box')
export class uSyncProcessBox extends UmbElementMixin(LitElement) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,37 @@ import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'
import { uSyncSettingsDataSource } from './sources/SyncSettings.source'
import { uSyncMigrationDataSource } from './sources/SyncMigration.source'

/**
* Request object when peforming an action.
*/
export type SyncPerformRequest = {
/** Id of the request */
id: string

/** group (e.g settings, content) */
group: string

/** action (report, export, etc) */
action: string

/** current step number */
step: number

/** force (import) */
force?: boolean

/** clean disk first (export) */
clean?: boolean

/** name of the set to use */
set?: string

/** signalR client id */
clientId: string
}

/**
* @export
* @class uSyncActionRepository
* @description repository for all things actions.
* Repository for all things actions.
*/
export class uSyncActionRepository extends UmbControllerBase {
#actionDataSource: uSyncActionDataSource
Expand All @@ -33,17 +49,15 @@ export class uSyncActionRepository extends UmbControllerBase {
}

/**
* @method getActions
* @description get the list of possible actions from the server
* Get the list of possible actions from the server
* @returns Promise
*/
async getActions() {
return this.#actionDataSource.getActions()
}

/**
* @method performAction
* @param request request of the action to perform
* Request of the action to perform
* @returns PerformActionResponse.
*/
async performAction(request: SyncPerformRequest) {
Expand All @@ -62,16 +76,15 @@ export class uSyncActionRepository extends UmbControllerBase {
}

/**
* @method getSettings
* @description retreives the current uSync settings
* Retreives the current uSync settings
* @returns the current uSync settings
*/
async getSettings() {
return await this.#settingsDataSource.getSettings()
}

/**
* @method getHandlerSetSettings
* Get the handler settings based on the set.
* @param setName name of the handler set in the configuration
* @returns the settings for the named handler set.
*/
Expand All @@ -80,8 +93,7 @@ export class uSyncActionRepository extends UmbControllerBase {
}

/**
* @method checkLegacy
* @description checks to see if there are legacy datatypes on disk.
* Checks to see if there are legacy datatypes on disk.
* @returns results of a check for legacy files
*/
async checkLegacy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@umbraco-cms/backoffice/extension-registry'

/**
* @description defines a sub menu item extension for the uSync menu
* Defines a sub menu item extension for the uSync menu
*/
export interface ManifestuSyncMenuItem
extends ManifestElement<UmbMenuItemElement> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ const context: ManifestWorkspaceContext = {
js: () => import('./workspace.context.js'),
}

/**
* this isn't working, don't know why :( - going to go hardwired for now
*/
const workspaceViews: Array<ManifestWorkspaceView> = [
{
type: 'workspaceView',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SyncActionGroup } from '../api'

/**
* @description options passed to the performAction method on the workspace context
* Options passed to the performAction method on the workspace context
*/
export type SyncPerformActionOptions = {
group: SyncActionGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ import { uSyncIconRegistry } from '../icons'
import { SyncPerformActionOptions } from './types'

/**
* @exports
* @class uSyncWorkspaceActionContext
* @description context for getting and seting up actions.
* Context for getting and seting up actions.
*/
export class uSyncWorkspaceContext
extends UmbControllerBase
Expand All @@ -46,50 +44,43 @@ export class uSyncWorkspaceContext
#signalRContext: uSyncSignalRContext | null = null

/**
* @type Array<SyncActionGroup>
* @description list of actions that have been returned
* list of actions that have been returned from the process
*/
#actions = new UmbArrayState<SyncActionGroup>([], (x) => x.key)
public readonly actions = this.#actions.asObservable()

/**
* @type Array<SyncHandlerSummary>
* @description the summary objects that show the handler boxes
* The summary objects that show the handler boxes
*/
#workingActions = new UmbArrayState<SyncHandlerSummary>([], (x) => x.name)
public readonly currentAction = this.#workingActions.asObservable()

/**
* @type Boolean
* @description flag to say if things are currently being processed
* Flag to say if things are currently being processed
*/
#working = new UmbBooleanState(false)
public readonly working = this.#working.asObservable()

/**
* @type Boolean
* @description flat to say that the last run has been completed (so results will show)
* Flag to say that the last run has been completed (so results will show)
*/
#completed = new UmbBooleanState(false)
public readonly completed = this.#completed.asObservable()

/**
* @type Array<uSyncActionView>
* @description the results of a run.
* The results of a run.
*/
#results = new UmbArrayState<uSyncActionView>([], (x) => x.name)
public readonly results = this.#results.asObservable()

/**
* @type uSyncSettings
* @description current settings for uSync
* Current settings for uSync
*/
#settings = new UmbObjectState<uSyncSettings | undefined>(undefined)
public readonly settings = this.#settings?.asObservable()

/**
* @type uSyncHandlerSettings
* @description handler settings object
* Handler settings object
*/
#handlerSettings = new UmbObjectState<uSyncHandlerSetSettings | undefined>(
undefined,
Expand All @@ -112,6 +103,9 @@ export class uSyncWorkspaceContext
this.#signalRContext = new uSyncSignalRContext(this)
}

/**
* Return the current actions from the repository
*/
async getActions() {
const { data } = await this.#repository.getActions()

Expand All @@ -120,6 +114,9 @@ export class uSyncWorkspaceContext
}
}

/**
* Get the current uSync settings
*/
async getSettings() {
const { data } = await this.#repository.getSettings()

Expand All @@ -128,13 +125,19 @@ export class uSyncWorkspaceContext
}
}

/**
* Check to see if there is a legacy uSync folder on disk.
*/
async checkLegacy() {
const { data } = await this.#repository.checkLegacy()
if (data) {
this.#legacy.setValue(data)
}
}

/**
* Get handler defaults.
*/
async getDefaultHandlerSetSettings() {
const { data } = await this.#repository.getHandlerSettings('Default')

Expand All @@ -143,6 +146,10 @@ export class uSyncWorkspaceContext
}
}

/**
* Perform an action (e.g import, export, etc) with options
* @param options options for the action
*/
async performAction(options: SyncPerformActionOptions) {
var clientId = this.#signalRContext?.getClientId() ?? ''

Expand Down

0 comments on commit 988784d

Please sign in to comment.