| 126 | ]; |
| 127 | |
| 128 | export class WaveConfigViewModel implements ViewModel { |
| 129 | blockId: string; |
| 130 | viewType = "waveconfig"; |
| 131 | viewIcon = atom("gear"); |
| 132 | viewName = atom("Wave Config"); |
| 133 | viewComponent = WaveConfigView; |
| 134 | noPadding = atom(true); |
| 135 | nodeModel: BlockNodeModel; |
| 136 | tabModel: TabModel; |
| 137 | env: WaveConfigEnv; |
| 138 | |
| 139 | selectedFileAtom: PrimitiveAtom<ConfigFile>; |
| 140 | fileContentAtom: PrimitiveAtom<string>; |
| 141 | originalContentAtom: PrimitiveAtom<string>; |
| 142 | hasEditedAtom: PrimitiveAtom<boolean>; |
| 143 | isLoadingAtom: PrimitiveAtom<boolean>; |
| 144 | isSavingAtom: PrimitiveAtom<boolean>; |
| 145 | errorMessageAtom: PrimitiveAtom<string>; |
| 146 | validationErrorAtom: PrimitiveAtom<string>; |
| 147 | isMenuOpenAtom: PrimitiveAtom<boolean>; |
| 148 | presetsJsonExistsAtom: PrimitiveAtom<boolean>; |
| 149 | activeTabAtom: PrimitiveAtom<"visual" | "json">; |
| 150 | configErrorFilesAtom: Atom<Set<string>>; |
| 151 | configDir: string; |
| 152 | saveShortcut: string; |
| 153 | editorRef: React.RefObject<MonacoTypes.editor.IStandaloneCodeEditor>; |
| 154 | |
| 155 | secretNamesAtom: PrimitiveAtom<string[]>; |
| 156 | selectedSecretAtom: PrimitiveAtom<string | null>; |
| 157 | secretValueAtom: PrimitiveAtom<string>; |
| 158 | secretShownAtom: PrimitiveAtom<boolean>; |
| 159 | isAddingNewAtom: PrimitiveAtom<boolean>; |
| 160 | newSecretNameAtom: PrimitiveAtom<string>; |
| 161 | newSecretValueAtom: PrimitiveAtom<string>; |
| 162 | storageBackendErrorAtom: PrimitiveAtom<string | null>; |
| 163 | secretValueRef: HTMLTextAreaElement | null = null; |
| 164 | |
| 165 | constructor({ blockId, nodeModel, tabModel, waveEnv }: ViewModelInitType) { |
| 166 | this.blockId = blockId; |
| 167 | this.nodeModel = nodeModel; |
| 168 | this.tabModel = tabModel; |
| 169 | this.env = waveEnv as WaveConfigEnv; |
| 170 | this.configDir = this.env.electron.getConfigDir(); |
| 171 | const platform = this.env.electron.getPlatform(); |
| 172 | this.saveShortcut = platform === "darwin" ? "Cmd+S" : "Alt+S"; |
| 173 | |
| 174 | this.selectedFileAtom = atom(null) as PrimitiveAtom<ConfigFile>; |
| 175 | this.fileContentAtom = atom(""); |
| 176 | this.originalContentAtom = atom(""); |
| 177 | this.hasEditedAtom = atom(false); |
| 178 | this.isLoadingAtom = atom(false); |
| 179 | this.isSavingAtom = atom(false); |
| 180 | this.errorMessageAtom = atom(null) as PrimitiveAtom<string>; |
| 181 | this.validationErrorAtom = atom(null) as PrimitiveAtom<string>; |
| 182 | this.isMenuOpenAtom = atom(false); |
| 183 | this.presetsJsonExistsAtom = atom(false); |
| 184 | this.activeTabAtom = atom<"visual" | "json">("visual"); |
| 185 | this.configErrorFilesAtom = atom((get) => { |
nothing calls this directly
no outgoing calls
no test coverage detected