-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Program renaming feature #140
Conversation
✅ Deploy Preview for nimble-praline-605cf6 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
…ng to delete a program
|
||
const ProgramOptionsContent = ({ program }: { program: IPCProgram }): JSX.Element => ( | ||
const ProgramOptionsContent = ({ program }: { program: IPCProgram}): JSX.Element => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like it's still not properly linted 👀
try { | ||
if (this.account) { | ||
await forget.Publish({ | ||
const test = await forget.Publish({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const test = await forget.Publish({ | |
await forget.Publish({ |
@@ -53,16 +54,15 @@ class Computing { | |||
} | |||
} | |||
|
|||
public async deleteProgram(programHash: string): Promise<ResponseType> { | |||
public async UpdateDeleteProgram(programHash: string): Promise<ResponseType> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public async UpdateDeleteProgram(programHash: string): Promise<ResponseType> { | |
public async deleteProgram(programHash: string): Promise<ResponseType> { |
This function is only deleting a program, not updating it ?
const copy = concernedProgram; | ||
await Promise.all( | ||
this.programs.map(async () => { | ||
copy.name = newName; | ||
copy.log.push({ | ||
action: `Renamed program to ${newName}`, | ||
date: Date.now(), | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will work 🤔
Maybe something like this:
const copy = concernedProgram; | |
await Promise.all( | |
this.programs.map(async () => { | |
copy.name = newName; | |
copy.log.push({ | |
action: `Renamed program to ${newName}`, | |
date: Date.now(), | |
}); | |
await Promise.all( | |
this.programs = this.programs.map(async (prog) => { | |
if (prog.id === concernedProgram.id) { | |
const newLog = { | |
action: `Renamed program to ${newName}`, | |
date: Date.now(), | |
}; | |
return {...prog, name: newName, logs: [...prog.logs, newLog]} | |
} | |
return prog; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw you can remove the async
and Promise.all
here, nothing is awaited
@@ -82,20 +105,18 @@ class Computing { | |||
if (this.account) { | |||
// remove old program from user's programs array | |||
if (isRedeploy && oldProgramHash) { | |||
const newProgramsArray: IPCProgram[] = this.programs.filter( | |||
const newProgramsArray: IPCProgram[] = this.programs.filter ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const newProgramsArray: IPCProgram[] = this.programs.filter ( | |
const newProgramsArray: IPCProgram[] = this.programs.filter( |
@@ -7,11 +7,12 @@ import fileDownload from 'js-file-download'; | |||
|
|||
import { ALEPH_CHANNEL } from 'config/constants'; | |||
|
|||
import type { AggregateType, IPCContact, IPCFile, IPCFolder, ResponseType, UploadResponse } from 'types/types'; | |||
import type { AggregateType, IPCContact, IPCFile, IPCFolder, ResponseType, UploadResponse} from 'types/types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import type { AggregateType, IPCContact, IPCFile, IPCFolder, ResponseType, UploadResponse} from 'types/types'; | |
import type { AggregateType, IPCContact, IPCFile, IPCFolder, ResponseType, UploadResponse } from 'types/types'; |
linting again
export type ProgramLog = { | ||
action: string; | ||
date: number; | ||
}; | ||
|
||
export type FileLog = { | ||
action: string; | ||
date: number; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are literally the same type, you can just use a single type Log
it will be cleaner
hash: string; | ||
name: string; | ||
createdAt: number; | ||
entrypoint: string; | ||
size: number; | ||
log: ProgramLog[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log: ProgramLog[]; | |
logs: ProgramLog[]; |
An array of log, adding an s
looks better
const textColor = useColorModeValue(textColorMode.light, textColorMode.dark); | ||
const { colorMode } = useColorMode(); | ||
|
||
const DeleteActualProgram = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const DeleteActualProgram = async () => { | |
const deleteActualProgram = async () => { |
Use PascalCase only for component names, not for functions 😉
Description
I added the fronted for the program rename and also the backend.
Changes include
Checklist