|
|
import { |
|
|
ATOMIC_SOFTWARE_INITIATE_INSTALL, |
|
|
ATOMIC_SOFTWARE_REQUEST_STATUS, |
|
|
ATOMIC_SOFTWARE_SET_STATUS, |
|
|
} from 'calypso/state/action-types'; |
|
|
import 'calypso/state/data-layer/wpcom/sites/atomic/software'; |
|
|
import 'calypso/state/atomic/init'; |
|
|
|
|
|
export interface AtomicSoftwareStatus { |
|
|
blog_id: number; |
|
|
software_set: Record< string, { path: string; state: string } >; |
|
|
applied: boolean; |
|
|
} |
|
|
|
|
|
export interface AtomicSoftwareError { |
|
|
name: string; |
|
|
status: number; |
|
|
message: string; |
|
|
code: string; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const requestAtomicSoftwareInstall = ( siteId: number, softwareSet: string ) => |
|
|
( { |
|
|
type: ATOMIC_SOFTWARE_INITIATE_INSTALL, |
|
|
siteId, |
|
|
softwareSet, |
|
|
} ) as const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const requestAtomicSoftwareStatus = ( siteId: number, softwareSet: string ) => |
|
|
( { |
|
|
type: ATOMIC_SOFTWARE_REQUEST_STATUS, |
|
|
siteId, |
|
|
softwareSet, |
|
|
} ) as const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const setAtomicSoftwareStatus = ( |
|
|
siteId: number, |
|
|
softwareSet: string, |
|
|
status: AtomicSoftwareStatus |
|
|
) => |
|
|
( { |
|
|
type: ATOMIC_SOFTWARE_SET_STATUS, |
|
|
siteId, |
|
|
softwareSet, |
|
|
status, |
|
|
} ) as const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const setAtomicSoftwareError = ( |
|
|
siteId: number, |
|
|
softwareSet: string, |
|
|
error: AtomicSoftwareError |
|
|
) => |
|
|
( { |
|
|
type: ATOMIC_SOFTWARE_SET_STATUS, |
|
|
siteId, |
|
|
softwareSet, |
|
|
error, |
|
|
} ) as const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const cleanAtomicSoftwareStatus = ( siteId: number, softwareSet: string ) => |
|
|
( { |
|
|
type: ATOMIC_SOFTWARE_SET_STATUS, |
|
|
siteId, |
|
|
softwareSet, |
|
|
status: null, |
|
|
error: null, |
|
|
} ) as const; |
|
|
|