Skip to content
Merged

lint #333

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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

.idea
/src/config/index.js

# dependencies
Expand Down
51 changes: 0 additions & 51 deletions .idea/workspace.xml

This file was deleted.

49 changes: 45 additions & 4 deletions src/assets/styles/components/_web-ide.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,30 @@
color: white;

.name-input {
.name-input-container {
input.invalid:focus {
border: 1px solid #ea4c89 !important;
outline-color: #ea4c89 !important;
}
}
.validation-message {
margin-top: 8px;
color: $color-danger;
}

& > input.invalid {
border: 1px solid red !important;
outline-color: 1px solid red !important;
border: 1px solid $color-danger !important;
outline-color: $color-danger !important;
}



.invalid-text {
color: red !important;
}

.invalid-project-name {
color: purple;
color: $color-danger;
}
}

Expand All @@ -117,7 +126,6 @@

.package-install-window {
background: white;

}

.editor.current-file-path {
Expand Down Expand Up @@ -182,6 +190,26 @@


.light {

.name-input {

.validation-message {
color: $color-danger;
}

.name-input-container {
input.invalid {
border: 1px solid $color-danger !important;
outline-color: $color-danger !important;
}

.invalid-project-name {
color: $color-danger;
}
}
}


.no-projects {
color: rgb(105, 105, 105);
}
Expand Down Expand Up @@ -704,6 +732,19 @@
}

.package-install-window {

.install-package-button {
width: 105px;
display: inline-flex;
align-items: center;
justify-content: center;

.install-package-status-icon {
}
}
&.github {
line-height:0.5em;
}
display: flex;
flex-direction: column;
height: 100%;
Expand Down
15 changes: 0 additions & 15 deletions src/components/instance/functions/manage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,6 @@ function ManageIndex({ refreshCustomFunctions, loading }) {

}


async function restartWithLoadingState({ auth: instanceAuth, url: instanceUrl }) {

setRestartingInstance(true);

setTimeout(async () => {
await restartInstance({ auth: instanceAuth, url: instanceUrl });
setRestartingInstance(false);
}, 100);


}


// save file to instance
async function saveCodeToInstance(selectedFile, restartRequired) {

Expand Down Expand Up @@ -328,7 +314,6 @@ function ManageIndex({ refreshCustomFunctions, loading }) {
alert.error(message);
}


// TODO: what do we actually want to do about an invalid package?
// change to restartService({ auth, url, service: 'http_worker' });
await restartInstance({ auth: t.auth, url: t.instance.url });
Expand Down
1 change: 1 addition & 0 deletions src/components/shared/webide/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function Editor({ active, file, onChange, theme }) {
theme={editorTheme}
onChange={ onChange }
options={{
readOnly: file.readOnly,
automaticLayout: true,
minimap: {
enabled: false
Expand Down
6 changes: 1 addition & 5 deletions src/components/shared/webide/FileBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function ProjectIcon() {
return <i className={cn(`project-icon fas fa-file-code`)} />;

}
function FolderIcon({ isOpen, toggleClosed }) {
function FolderIcon({ toggleClosed }) {
return <i onClick={toggleClosed} className={cn(`folder-icon fas fa-folder-open`)} />;
}

Expand Down Expand Up @@ -166,10 +166,6 @@ function Folder({ directoryEntry, userOnSelect, onFolderSelect, onDeployProject,
const entries = [...(directoryEntry.entries || [])].sort(directorySortComparator);
const fileExtension = parseFileExtension(directoryEntry.name);

if (directoryEntry.path.endsWith('asdf')) {
console.log('directoryEntry: ', directoryEntry.path);
console.log('open: ', open);
}
let Icon;
// top-level dir === package
// FolderIcon/PackageIcon is func so we can give it open args now, but instantiate it later.
Expand Down
1 change: 0 additions & 1 deletion src/components/shared/webide/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ function WebIDE({
const canDeleteFolder = Boolean(hasProjects && (selectedFolder || selectedPackage)); // can only delete a folder if a target folder is selected
const canAddProjectFolder = Boolean(selectedFolder); // can only add a folder toa project if a target folder is selected


function updateActiveEditorWindow(to, from) {
// TODO: figure out correct logic here.
setActiveEditorWindow(to);
Expand Down
31 changes: 22 additions & 9 deletions src/components/shared/webide/windows/PackageInstallWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function PackageInstallWindow({ selectedPackage, onConfirm, onCan
const [ projectNameIsValid, setProjectNameIsValid ] = useState(true);

const [ packageSpec, setPackageSpec ] = useState('');
const [ loading, setLoading ] = useState(false);

// result: 'packageSpec' gets sent to harperdb and installed by npm

Expand Down Expand Up @@ -50,7 +51,11 @@ export default function PackageInstallWindow({ selectedPackage, onConfirm, onCan
useEffect(validateProjectName, [ projectName ]);

return (
<Card className="package-install-window">
<Card className={ cn("package-install-window", {
'github': packageType === 'github',
'npm': packageType === 'npm',
'url': packageType === 'url'
}) }>
<div className="package-install-window-title">Package Install</div>
<div className="package-install-source-form">
{
Expand Down Expand Up @@ -109,7 +114,6 @@ export default function PackageInstallWindow({ selectedPackage, onConfirm, onCan
{
packageType === 'npm' &&
<NpmPackageSelector
onConfirm={ onConfirm }
projectName={ projectName }
installed={ installed }
pkg={ packageInfo }
Expand All @@ -118,7 +122,6 @@ export default function PackageInstallWindow({ selectedPackage, onConfirm, onCan
{
packageType === 'github' &&
<GithubRepoSelector
onConfirm={ onConfirm }
projectName={ projectName }
installed={ installed }
pkg={ packageInfo }
Expand All @@ -127,7 +130,6 @@ export default function PackageInstallWindow({ selectedPackage, onConfirm, onCan
{
packageType === 'url' &&
<UrlInstallField
onConfirm={onConfirm}
projectName={projectName}
installed={installed}
pkg={ packageInfo }
Expand Down Expand Up @@ -161,19 +163,30 @@ export default function PackageInstallWindow({ selectedPackage, onConfirm, onCan
<Button
onClick={
async () => {
await onConfirm(projectName, packageSpec, deployTargets);
setLoading(true);

try {
await onConfirm(projectName, packageSpec, deployTargets);
} catch(e) {
setLoading(false);
}

setLoading(false);

}
}
className={
cn("get-package-button", {
'btn-success': true
// 'loading': loadingTags
cn("install-package-button", {
'btn-success': true,
'loading': loading
})
}
disabled={
!isValidProjectName(projectName) || !packageSpec || !deployTargets.length
}>
Deploy Package
{
loading ? <i className="install-package-status-icon fa fa-spinner fa-spin" /> : 'Install Package'
}
</Button>
<Button
onClick={ onCancel }
Expand Down
7 changes: 4 additions & 3 deletions src/functions/api/instance/getComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import queryInstance from '../queryInstance';

// this 'addMetadata' logic probably belongs in src/functions/instance
// by convention
function addMetadata(fileTree, path, rootDir) {
function addMetadata(fileTree, path, rootDir, readOnly=false) {

if (!fileTree || !fileTree.entries) {
return;
Expand All @@ -28,8 +28,9 @@ function addMetadata(fileTree, path, rootDir) {
entry.project = project;
entry.path = newPath;
entry.key = uuid();
entry.readOnly = readOnly || !!entry.package;

addMetadata(entry, newPath, rootDir);
addMetadata(entry, newPath, rootDir, entry.readOnly);

};

Expand All @@ -43,7 +44,7 @@ export default async ({ auth, url }) => {
url,
});

addMetadata(fileTree, fileTree.name, fileTree.name);
addMetadata(fileTree, fileTree.name, fileTree.name, false);

return fileTree;

Expand Down