-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* re-enable publish page in settings * add description to publish plugin, fix behavior of "Default" local test target * add publish page in nav * add publish page * remove unrelevant * add publish page and add getHistory method in localpublish plugin * fix bug * polish style * add mock remote publish for development/testing purposes * add alerts on failed validation * add validation chck * update typedefs flatten and standardize result payload * poll for updated stats if status is 202 * fix build fail * add sensitive setting back and polish UI * fix localpublish * add testInEmulator button * add group in detail list * add log output * bind the log button to the actual log content from the publish process * add supported features to return value of types api * add default into profile * remove default show in profile list * add rollback methods * add rollback endpoint, mock rollback feature, rollback button in ui * fix build * change status show in list to icon * polish * fix e2e test * disable open in emulator button, clean consoles * change date format * add targetName into url * add delete in target list, add edit placehold in target list * fix save target * fix selectVersion after changing target * implement confirm on delete of target implement edit of target * add error correction implement edit/delete * fix name undefined when adding target: * fix some comments * fix comment * redirect to new target after create and edit, and fix date sort * fix comments * fix history update after publish fail * resolve comments from cwhitten * fix some code issues Co-authored-by: Wenyi Luo <wenyluo@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
- Loading branch information
1 parent
d493b11
commit 5e4b35a
Showing
40 changed files
with
2,644 additions
and
404 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
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
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
88 changes: 88 additions & 0 deletions
88
Composer/packages/client/src/pages/publish/createPublishTarget.tsx
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,88 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
/** @jsx jsx */ | ||
import { jsx } from '@emotion/core'; | ||
import formatMessage from 'format-message'; | ||
import { Dropdown } from 'office-ui-fabric-react/lib/Dropdown'; | ||
import { TextField } from 'office-ui-fabric-react/lib/TextField'; | ||
import { DialogFooter } from 'office-ui-fabric-react/lib/Dialog'; | ||
import { Fragment, useState } from 'react'; | ||
import { PrimaryButton, DefaultButton } from 'office-ui-fabric-react/lib/Button'; | ||
import { JsonEditor } from '@bfc/code-editor'; | ||
|
||
import { label } from './styles'; | ||
|
||
export const CreatePublishTarget = props => { | ||
const [targetType, setTargetType] = useState(props.current ? props.current.type : ''); | ||
const [name, setName] = useState(props.current ? props.current.name : ''); | ||
const [config, setConfig] = useState(props.current ? JSON.parse(props.current.configuration) : {}); | ||
const [errorMessage, setErrorMsg] = useState(''); | ||
|
||
const updateType = (e, type) => { | ||
setTargetType(type.key); | ||
}; | ||
const updateConfig = newConfig => { | ||
setConfig(newConfig); | ||
}; | ||
|
||
const updateName = (e, newName) => { | ||
setErrorMsg(''); | ||
setName(newName); | ||
isNameValid(newName); | ||
}; | ||
|
||
const isNameValid = newName => { | ||
if (!newName || newName.trim() === '') { | ||
setErrorMsg(formatMessage('Must have a name')); | ||
} else { | ||
const exists = | ||
props.targets?.filter(t => { | ||
return t.name.toLowerCase() === newName?.toLowerCase(); | ||
}).length > 0; | ||
if (exists) { | ||
setErrorMsg(formatMessage('A profile with that name already exists.')); | ||
} | ||
} | ||
}; | ||
|
||
const isDisable = () => { | ||
if (!targetType || !name || errorMessage) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
}; | ||
|
||
const submit = async () => { | ||
await props.updateSettings(name, targetType, JSON.stringify(config, null, 2) || '{}'); | ||
props.closeDialog(); | ||
}; | ||
|
||
return ( | ||
<Fragment> | ||
<form onSubmit={submit}> | ||
<TextField | ||
placeholder="My Publish Profile" | ||
defaultValue={props.current ? props.current.name : null} | ||
label={formatMessage('Name')} | ||
onChange={updateName} | ||
errorMessage={errorMessage} | ||
/> | ||
<Dropdown | ||
placeholder={formatMessage('Choose One')} | ||
label={formatMessage('Publish Destination Type')} | ||
options={props.targetTypes} | ||
defaultSelectedKey={props.current ? props.current.type : null} | ||
onChange={updateType} | ||
/> | ||
<div css={label}>{formatMessage('Paste Configuration')}</div> | ||
<JsonEditor onChange={updateConfig} height={200} value={config} /> | ||
</form> | ||
<DialogFooter> | ||
<DefaultButton onClick={props.closeDialog} text={formatMessage('Cancel')} /> | ||
<PrimaryButton onClick={submit} disabled={isDisable()} text={formatMessage('Save')} /> | ||
</DialogFooter> | ||
</Fragment> | ||
); | ||
}; |
Oops, something went wrong.