@api-client/ui 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +8 -0
- package/demo/elements/authorization/cc.ts +56 -27
- package/demo/elements/index.html +3 -0
- package/demo/elements/store/file-picker.html +15 -0
- package/demo/elements/store/file-picker.ts +134 -0
- package/demo/elements/store/index.html +19 -0
- package/demo/store/StorePlugin.js +1 -0
- package/dist/bindings/base/FileBindings.d.ts +4 -0
- package/dist/bindings/base/FileBindings.d.ts.map +1 -1
- package/dist/bindings/base/FileBindings.js +21 -1
- package/dist/bindings/base/FileBindings.js.map +1 -1
- package/dist/bindings/base/StoreBindings.d.ts +6 -17
- package/dist/bindings/base/StoreBindings.d.ts.map +1 -1
- package/dist/bindings/base/StoreBindings.js +15 -60
- package/dist/bindings/base/StoreBindings.js.map +1 -1
- package/dist/bindings/web/WebFileBindings.js +1 -1
- package/dist/bindings/web/WebFileBindings.js.map +1 -1
- package/dist/define/http/certificate-add.d.ts +9 -0
- package/dist/define/http/certificate-add.d.ts.map +1 -0
- package/dist/define/http/certificate-add.js +10 -0
- package/dist/define/http/certificate-add.js.map +1 -0
- package/dist/define/store/file-picker.d.ts +9 -0
- package/dist/define/store/file-picker.d.ts.map +1 -0
- package/dist/define/store/file-picker.js +10 -0
- package/dist/define/store/file-picker.js.map +1 -0
- package/dist/define/{files → store}/share-file.d.ts +1 -1
- package/dist/define/store/share-file.d.ts.map +1 -0
- package/dist/define/{files → store}/share-file.js +2 -2
- package/dist/define/store/share-file.js.map +1 -0
- package/dist/define/ui/ui-segmented-button-set.d.ts +1 -1
- package/dist/define/ui/ui-segmented-button-set.d.ts.map +1 -1
- package/dist/define/ui/ui-segmented-button-set.js.map +1 -1
- package/dist/elements/authorization/ui/CC.styles.d.ts.map +1 -1
- package/dist/elements/authorization/ui/CC.styles.js +4 -9
- package/dist/elements/authorization/ui/CC.styles.js.map +1 -1
- package/dist/elements/authorization/ui/CcAuthorization.d.ts +14 -29
- package/dist/elements/authorization/ui/CcAuthorization.d.ts.map +1 -1
- package/dist/elements/authorization/ui/CcAuthorization.js +67 -158
- package/dist/elements/authorization/ui/CcAuthorization.js.map +1 -1
- package/dist/elements/http/CertificateAdd.element.d.ts +91 -0
- package/dist/elements/http/CertificateAdd.element.d.ts.map +1 -0
- package/dist/elements/http/CertificateAdd.element.js +389 -0
- package/dist/elements/http/CertificateAdd.element.js.map +1 -0
- package/dist/elements/http/CertificateAdd.styles.d.ts +3 -0
- package/dist/elements/http/CertificateAdd.styles.d.ts.map +1 -0
- package/dist/elements/http/CertificateAdd.styles.js +61 -0
- package/dist/elements/http/CertificateAdd.styles.js.map +1 -0
- package/dist/elements/project/ProjectRunReport.d.ts +2 -1
- package/dist/elements/project/ProjectRunReport.d.ts.map +1 -1
- package/dist/elements/project/ProjectRunReport.js.map +1 -1
- package/dist/elements/store/FilePicker.element.d.ts +87 -0
- package/dist/elements/store/FilePicker.element.d.ts.map +1 -0
- package/dist/elements/store/FilePicker.element.js +263 -0
- package/dist/elements/store/FilePicker.element.js.map +1 -0
- package/dist/elements/store/FilePicker.styles.d.ts +3 -0
- package/dist/elements/store/FilePicker.styles.d.ts.map +1 -0
- package/dist/elements/store/FilePicker.styles.js +73 -0
- package/dist/elements/store/FilePicker.styles.js.map +1 -0
- package/dist/elements/store/FilesLib.d.ts +10 -0
- package/dist/elements/store/FilesLib.d.ts.map +1 -0
- package/dist/elements/store/FilesLib.js +38 -0
- package/dist/elements/store/FilesLib.js.map +1 -0
- package/dist/elements/{files/ShareFile.d.ts → store/ShareFile.element.d.ts} +1 -1
- package/dist/elements/store/ShareFile.element.d.ts.map +1 -0
- package/dist/elements/{files/ShareFile.js → store/ShareFile.element.js} +1 -1
- package/dist/elements/store/ShareFile.element.js.map +1 -0
- package/dist/elements/store/ShareFile.styles.d.ts.map +1 -0
- package/dist/elements/{files → store}/ShareFile.styles.js.map +1 -1
- package/dist/events/EventTypes.d.ts +7 -7
- package/dist/events/EventTypes.d.ts.map +1 -1
- package/dist/events/EventTypes.js +8 -7
- package/dist/events/EventTypes.js.map +1 -1
- package/dist/events/Events.d.ts +7 -1
- package/dist/events/Events.d.ts.map +1 -1
- package/dist/events/Events.js +2 -0
- package/dist/events/Events.js.map +1 -1
- package/dist/events/FilesystemEvents.d.ts +8 -0
- package/dist/events/FilesystemEvents.d.ts.map +1 -0
- package/dist/events/FilesystemEvents.js +59 -0
- package/dist/events/FilesystemEvents.js.map +1 -0
- package/dist/events/HttpClientEvents.d.ts +0 -2
- package/dist/events/HttpClientEvents.d.ts.map +1 -1
- package/dist/events/HttpClientEvents.js +0 -2
- package/dist/events/HttpClientEvents.js.map +1 -1
- package/dist/events/StoreEvents.d.ts +8 -1
- package/dist/events/StoreEvents.d.ts.map +1 -1
- package/dist/events/StoreEvents.js +19 -0
- package/dist/events/StoreEvents.js.map +1 -1
- package/dist/http-client/idb/Arc18DataUpgrade.d.ts +0 -8
- package/dist/http-client/idb/Arc18DataUpgrade.d.ts.map +1 -1
- package/dist/http-client/idb/Arc18DataUpgrade.js +11 -206
- package/dist/http-client/idb/Arc18DataUpgrade.js.map +1 -1
- package/dist/http-client/store/StoreBroadcast.d.ts +0 -5
- package/dist/http-client/store/StoreBroadcast.d.ts.map +1 -1
- package/dist/http-client/store/StoreBroadcast.js +0 -7
- package/dist/http-client/store/StoreBroadcast.js.map +1 -1
- package/dist/lib/files/FileUtils.d.ts +9 -0
- package/dist/lib/files/FileUtils.d.ts.map +1 -0
- package/dist/lib/files/FileUtils.js +13 -0
- package/dist/lib/files/FileUtils.js.map +1 -0
- package/dist/mixins/RouteMixin.d.ts +4 -0
- package/dist/mixins/RouteMixin.d.ts.map +1 -1
- package/dist/mixins/RouteMixin.js +1 -0
- package/dist/mixins/RouteMixin.js.map +1 -1
- package/dist/pages/ApplicationScreen.d.ts +1 -1
- package/dist/pages/ApplicationScreen.d.ts.map +1 -1
- package/dist/pages/ApplicationScreen.js +4 -2
- package/dist/pages/ApplicationScreen.js.map +1 -1
- package/dist/pages/api-client/ApiClient.screen.d.ts +4 -6
- package/dist/pages/api-client/ApiClient.screen.d.ts.map +1 -1
- package/dist/pages/api-client/ApiClient.screen.js +39 -31
- package/dist/pages/api-client/ApiClient.screen.js.map +1 -1
- package/dist/pages/api-client/ApiClient.styles.d.ts.map +1 -1
- package/dist/pages/api-client/ApiClient.styles.js +0 -12
- package/dist/pages/api-client/ApiClient.styles.js.map +1 -1
- package/dist/pages/api-client/Authenticate.screen.d.ts +1 -1
- package/dist/pages/api-client/Authenticate.screen.d.ts.map +1 -1
- package/dist/pages/api-client/Authenticate.screen.js +2 -2
- package/dist/pages/api-client/Authenticate.screen.js.map +1 -1
- package/dist/pages/api-client/pages/Files.page.d.ts +6 -35
- package/dist/pages/api-client/pages/Files.page.d.ts.map +1 -1
- package/dist/pages/api-client/pages/Files.page.js +45 -141
- package/dist/pages/api-client/pages/Files.page.js.map +1 -1
- package/dist/pages/api-client/pages/Shared.page.d.ts +1 -5
- package/dist/pages/api-client/pages/Shared.page.d.ts.map +1 -1
- package/dist/pages/api-client/pages/Shared.page.js +1 -40
- package/dist/pages/api-client/pages/Shared.page.js.map +1 -1
- package/dist/pages/demo/DemoPage.d.ts +7 -0
- package/dist/pages/demo/DemoPage.d.ts.map +1 -1
- package/dist/pages/demo/DemoPage.js +14 -0
- package/dist/pages/demo/DemoPage.js.map +1 -1
- package/dist/store/FileSystem.d.ts +90 -0
- package/dist/store/FileSystem.d.ts.map +1 -0
- package/dist/store/FileSystem.js +260 -0
- package/dist/store/FileSystem.js.map +1 -0
- package/dist/styles/global-styles.d.ts.map +1 -1
- package/dist/styles/global-styles.js +7 -0
- package/dist/styles/global-styles.js.map +1 -1
- package/dist/ui/button/SegmentedButtonsSet.d.ts +14 -0
- package/dist/ui/button/SegmentedButtonsSet.d.ts.map +1 -1
- package/dist/ui/button/SegmentedButtonsSet.js.map +1 -1
- package/dist/ui/icons/Icons.d.ts +2 -1
- package/dist/ui/icons/Icons.d.ts.map +1 -1
- package/dist/ui/icons/Icons.js +1 -0
- package/dist/ui/icons/Icons.js.map +1 -1
- package/dist/ui/list/UiDropdownList.d.ts +9 -1
- package/dist/ui/list/UiDropdownList.d.ts.map +1 -1
- package/dist/ui/list/UiDropdownList.js +39 -17
- package/dist/ui/list/UiDropdownList.js.map +1 -1
- package/dist/ui/list/UiList.d.ts +6 -1
- package/dist/ui/list/UiList.d.ts.map +1 -1
- package/dist/ui/list/UiList.js +24 -9
- package/dist/ui/list/UiList.js.map +1 -1
- package/dist/ui/notification/SnackNotifications.d.ts +1 -0
- package/dist/ui/notification/SnackNotifications.d.ts.map +1 -1
- package/dist/ui/notification/SnackNotifications.js +7 -0
- package/dist/ui/notification/SnackNotifications.js.map +1 -1
- package/dist/ui/table/DataTable.d.ts +4 -0
- package/dist/ui/table/DataTable.d.ts.map +1 -1
- package/dist/ui/table/DataTable.js +23 -1
- package/dist/ui/table/DataTable.js.map +1 -1
- package/package.json +1 -1
- package/src/bindings/base/FileBindings.ts +25 -1
- package/src/bindings/base/StoreBindings.ts +16 -73
- package/src/bindings/web/WebFileBindings.ts +1 -1
- package/src/define/http/certificate-add.ts +12 -0
- package/src/define/store/file-picker.ts +12 -0
- package/src/define/{files → store}/share-file.ts +2 -2
- package/src/define/ui/ui-segmented-button-set.ts +1 -1
- package/src/elements/authorization/ui/CC.styles.ts +4 -9
- package/src/elements/authorization/ui/CcAuthorization.ts +67 -167
- package/src/elements/http/CertificateAdd.element.ts +443 -0
- package/src/elements/http/CertificateAdd.styles.ts +61 -0
- package/src/elements/project/ProjectRunReport.ts +2 -1
- package/src/elements/store/FilePicker.element.ts +297 -0
- package/src/elements/store/FilePicker.styles.ts +73 -0
- package/src/elements/store/FilesLib.ts +32 -0
- package/src/events/EventTypes.ts +8 -7
- package/src/events/Events.ts +2 -0
- package/src/events/FilesystemEvents.ts +63 -0
- package/src/events/HttpClientEvents.ts +0 -2
- package/src/events/StoreEvents.ts +21 -1
- package/src/http-client/idb/Arc18DataUpgrade.ts +84 -84
- package/src/http-client/store/StoreBroadcast.ts +0 -8
- package/src/lib/files/FileUtils.ts +12 -0
- package/src/mixins/RouteMixin.ts +8 -1
- package/src/pages/ApplicationScreen.ts +5 -3
- package/src/pages/api-client/ApiClient.screen.ts +42 -33
- package/src/pages/api-client/ApiClient.styles.ts +0 -12
- package/src/pages/api-client/Authenticate.screen.ts +2 -2
- package/src/pages/api-client/pages/Files.page.ts +48 -164
- package/src/pages/api-client/pages/Shared.page.ts +2 -40
- package/src/pages/demo/DemoPage.ts +17 -0
- package/src/store/FileSystem.ts +325 -0
- package/src/styles/global-styles.ts +7 -0
- package/src/ui/button/SegmentedButtonsSet.ts +16 -1
- package/src/ui/icons/Icons.ts +2 -1
- package/src/ui/list/UiDropdownList.ts +44 -17
- package/src/ui/list/UiList.ts +26 -10
- package/src/ui/notification/SnackNotifications.ts +8 -0
- package/src/ui/table/DataTable.ts +29 -3
- package/test/elements/http/BodyFormdataEditorElement.test.ts +458 -454
- package/test/elements/http/BodyMultipartEditorElement.test.ts +609 -605
- package/test/elements/http/BodyRawEditorElement.test.ts +60 -56
- package/test/elements/http/CertificateAdd.test.ts +430 -0
- package/test/elements/store/FilePicker.test.ts +241 -0
- package/test/env.js +3 -0
- package/test/events/EventTypes.test.ts +0 -22
- package/test/helpers/StoreHelper.ts +390 -0
- package/test/helpers/UiMock.ts +19 -2
- package/tsconfig.eslint.json +3 -1
- package/web-test-runner.config.mjs +50 -3
- package/dist/define/files/share-file.d.ts.map +0 -1
- package/dist/define/files/share-file.js.map +0 -1
- package/dist/elements/files/ShareFile.d.ts.map +0 -1
- package/dist/elements/files/ShareFile.js.map +0 -1
- package/dist/elements/files/ShareFile.styles.d.ts.map +0 -1
- package/dist/events/http-client/models/CertificatesEvents.d.ts +0 -12
- package/dist/events/http-client/models/CertificatesEvents.d.ts.map +0 -1
- package/dist/events/http-client/models/CertificatesEvents.js +0 -18
- package/dist/events/http-client/models/CertificatesEvents.js.map +0 -1
- package/dist/http-client/idb/AuthDataModel.d.ts +0 -60
- package/dist/http-client/idb/AuthDataModel.d.ts.map +0 -1
- package/dist/http-client/idb/AuthDataModel.js +0 -150
- package/dist/http-client/idb/AuthDataModel.js.map +0 -1
- package/dist/http-client/idb/HostsModel.d.ts +0 -25
- package/dist/http-client/idb/HostsModel.d.ts.map +0 -1
- package/dist/http-client/idb/HostsModel.js +0 -82
- package/dist/http-client/idb/HostsModel.js.map +0 -1
- package/dist/http-client/idb/LegacyMockedStore.d.ts +0 -214
- package/dist/http-client/idb/LegacyMockedStore.d.ts.map +0 -1
- package/dist/http-client/idb/LegacyMockedStore.js +0 -486
- package/dist/http-client/idb/LegacyMockedStore.js.map +0 -1
- package/src/events/http-client/models/CertificatesEvents.ts +0 -23
- package/src/http-client/idb/AuthDataModel.ts +0 -175
- package/src/http-client/idb/HostsModel.ts +0 -125
- package/src/http-client/idb/LegacyMockedStore.ts +0 -544
- package/test/apic-ui.test.ts +0 -31
- /package/dist/elements/{files → store}/ShareFile.styles.d.ts +0 -0
- /package/dist/elements/{files → store}/ShareFile.styles.js +0 -0
- /package/src/elements/{files/ShareFile.ts → store/ShareFile.element.ts} +0 -0
- /package/src/elements/{files → store}/ShareFile.styles.ts +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* eslint-disable class-methods-use-this */
|
|
2
2
|
import 'pouchdb/dist/pouchdb.js';
|
|
3
|
-
import { get
|
|
4
|
-
import { IAuthorizationData, IHostRule, HostRuleKind, } from '@api-client/core/build/browser.js'; // Certificate, HttpProject
|
|
5
|
-
import { ARCAuthData, HostRule as LegacyHostRule } from '@api-client/core/build/legacy.js'; // Normalizer, ARCProject, ARCSavedRequest, ARCCertificateIndex, ARCRequestCertificate,
|
|
3
|
+
import { get } from 'idb-keyval';
|
|
4
|
+
// import { IAuthorizationData, IHostRule, HostRuleKind, } from '@api-client/core/build/browser.js'; // Certificate, HttpProject
|
|
5
|
+
// import { ARCAuthData, HostRule as LegacyHostRule } from '@api-client/core/build/legacy.js'; // Normalizer, ARCProject, ARCSavedRequest, ARCCertificateIndex, ARCRequestCertificate,
|
|
6
6
|
// import { LegacyBodyProcessor } from './LegacyBodyProcessor.js';
|
|
7
7
|
// import { HistoryModel } from './HistoryModel.js';
|
|
8
8
|
// import { ProjectModel } from './ProjectModel.js';
|
|
9
|
-
import { AuthDataModel } from './AuthDataModel.js';
|
|
9
|
+
// import { AuthDataModel } from './AuthDataModel.js';
|
|
10
10
|
// import { CertificateModel } from './CertificateModel.js';
|
|
11
|
-
import { HostsModel } from './HostsModel.js';
|
|
11
|
+
// import { HostsModel } from './HostsModel.js';
|
|
12
12
|
|
|
13
13
|
const upgradeKey = 'CHL5v3fUMx';
|
|
14
14
|
|
|
@@ -27,38 +27,38 @@ export default class Arc18DataUpgrade {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
static async runIfNeeded(): Promise<void> {
|
|
30
|
-
const needed = await Arc18DataUpgrade.needsUpgrade();
|
|
31
|
-
if (!needed) {
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
const instance = new Arc18DataUpgrade();
|
|
35
|
-
return instance.run();
|
|
30
|
+
// const needed = await Arc18DataUpgrade.needsUpgrade();
|
|
31
|
+
// if (!needed) {
|
|
32
|
+
// return undefined;
|
|
33
|
+
// }
|
|
34
|
+
// const instance = new Arc18DataUpgrade();
|
|
35
|
+
// return instance.run();
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
async seal(): Promise<void> {
|
|
42
|
-
|
|
43
|
-
}
|
|
38
|
+
// /**
|
|
39
|
+
// * Sets a flag sealing the upgrade. Next call to the `run()` will result with no operation.
|
|
40
|
+
// */
|
|
41
|
+
// async seal(): Promise<void> {
|
|
42
|
+
// await set(upgradeKey, true);
|
|
43
|
+
// }
|
|
44
44
|
|
|
45
|
-
async run(): Promise<void> {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
// async run(): Promise<void> {
|
|
46
|
+
// await this.upgradeHistory();
|
|
47
|
+
// await this.upgradeProjects();
|
|
48
|
+
// await this.upgradeSaved();
|
|
49
|
+
// await this.upgradeAuthData();
|
|
50
|
+
// await this.upgradeCertificates();
|
|
51
|
+
// await this.hostRules();
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
}
|
|
53
|
+
// await this.seal();
|
|
54
|
+
// }
|
|
55
55
|
|
|
56
|
-
async upgradeHistory(): Promise<void> {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
56
|
+
// async upgradeHistory(): Promise<void> {
|
|
57
|
+
// const sourceDb = new PouchDB('history-requests');
|
|
58
|
+
// await sourceDb.compact();
|
|
59
|
+
// const targetDb = new HistoryModel();
|
|
60
|
+
// await this._upgradeHistoryPage(sourceDb, targetDb);
|
|
61
|
+
// }
|
|
62
62
|
|
|
63
63
|
// async upgradeProjects(): Promise<void> {
|
|
64
64
|
// const projectsDb = new PouchDB<ARCProject>('legacy-projects');
|
|
@@ -128,32 +128,32 @@ export default class Arc18DataUpgrade {
|
|
|
128
128
|
// await targetDb.put(project.toJSON());
|
|
129
129
|
// }
|
|
130
130
|
|
|
131
|
-
async upgradeAuthData(): Promise<void> {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
131
|
+
// async upgradeAuthData(): Promise<void> {
|
|
132
|
+
// const src = new PouchDB<ARCAuthData>('auth-data');
|
|
133
|
+
// const response = await src.allDocs({ include_docs: true });
|
|
134
|
+
// const items: IAuthorizationData[] = [];
|
|
135
|
+
// response.rows.forEach(item => {
|
|
136
|
+
// const { doc } = item;
|
|
137
|
+
// if (!doc) {
|
|
138
|
+
// return;
|
|
139
|
+
// }
|
|
140
|
+
// const transformed: IAuthorizationData = {
|
|
141
|
+
// key: doc._id,
|
|
142
|
+
// };
|
|
143
|
+
// if (doc.domain) {
|
|
144
|
+
// transformed.domain = doc.domain;
|
|
145
|
+
// }
|
|
146
|
+
// if (doc.password) {
|
|
147
|
+
// transformed.password = doc.password;
|
|
148
|
+
// }
|
|
149
|
+
// if (doc.password) {
|
|
150
|
+
// transformed.password = doc.password;
|
|
151
|
+
// }
|
|
152
|
+
// items.push(transformed);
|
|
153
|
+
// });
|
|
154
|
+
// const model = new AuthDataModel();
|
|
155
|
+
// await model.putBulk(items);
|
|
156
|
+
// }
|
|
157
157
|
|
|
158
158
|
// protected async _upgradeHistoryPage(sourceDb: PouchDB.Database, targetDb: HistoryModel, lastKey?: string): Promise<void> {
|
|
159
159
|
// const opts: PouchDB.Core.AllDocsOptions | PouchDB.Core.AllDocsWithinRangeOptions = {
|
|
@@ -216,30 +216,30 @@ export default class Arc18DataUpgrade {
|
|
|
216
216
|
// await model.putBulk(upgrades);
|
|
217
217
|
// }
|
|
218
218
|
|
|
219
|
-
async hostRules(): Promise<void> {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
219
|
+
// async hostRules(): Promise<void> {
|
|
220
|
+
// const srcDb = new PouchDB<LegacyHostRule>('host-rules');
|
|
221
|
+
// const response = await srcDb.allDocs({ include_docs: true });
|
|
222
|
+
// const items: IHostRule[] = [];
|
|
223
|
+
// response.rows.forEach(item => {
|
|
224
|
+
// const { doc } = item;
|
|
225
|
+
// if (!doc) {
|
|
226
|
+
// return;
|
|
227
|
+
// }
|
|
228
|
+
// const transformed: IHostRule = {
|
|
229
|
+
// kind: HostRuleKind,
|
|
230
|
+
// from: doc.from,
|
|
231
|
+
// to: doc.to,
|
|
232
|
+
// key: doc._id,
|
|
233
|
+
// };
|
|
234
|
+
// if (doc.comment) {
|
|
235
|
+
// transformed.comment = doc.comment;
|
|
236
|
+
// }
|
|
237
|
+
// if (typeof doc.enabled === 'boolean') {
|
|
238
|
+
// transformed.enabled = doc.enabled;
|
|
239
|
+
// }
|
|
240
|
+
// items.push(transformed);
|
|
241
|
+
// });
|
|
242
|
+
// const model = new HostsModel();
|
|
243
|
+
// await model.putBulk(items);
|
|
244
|
+
// }
|
|
245
245
|
}
|
|
@@ -55,14 +55,6 @@ export class StoreBroadcast {
|
|
|
55
55
|
return '/store/history/ws';
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
/**
|
|
59
|
-
* The path used to construct a `BroadcastChannel` (or similar)
|
|
60
|
-
* to communicate changes between contexts for the Certificates store.
|
|
61
|
-
*/
|
|
62
|
-
static get certificates(): string {
|
|
63
|
-
return '/store/certificates';
|
|
64
|
-
}
|
|
65
|
-
|
|
66
58
|
/**
|
|
67
59
|
* The path used to construct a `BroadcastChannel` (or similar)
|
|
68
60
|
* to communicate changes between contexts for the History store.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class FileUtils {
|
|
2
|
+
/**
|
|
3
|
+
* Reads the last segment of the file path and returns it as a file name.
|
|
4
|
+
*
|
|
5
|
+
* @param path THe file path.
|
|
6
|
+
*/
|
|
7
|
+
static getFileName(path: string): string {
|
|
8
|
+
const delimiter = path.includes('/') ? '/' : '\\';
|
|
9
|
+
const last = path.split(delimiter).pop();
|
|
10
|
+
return last || '';
|
|
11
|
+
}
|
|
12
|
+
}
|
package/src/mixins/RouteMixin.ts
CHANGED
|
@@ -101,6 +101,11 @@ export declare class RouteMixinInterface {
|
|
|
101
101
|
*/
|
|
102
102
|
static get routes(): IRoute[];
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* The current route parameters. This is the same what is passed to the route handler.
|
|
106
|
+
*/
|
|
107
|
+
protected currentRoute?: IRouteResult;
|
|
108
|
+
|
|
104
109
|
/**
|
|
105
110
|
* Initializes the routing.
|
|
106
111
|
*/
|
|
@@ -119,6 +124,8 @@ export function RouteMixin<T extends Constructor<Object>>(superClass: T): Constr
|
|
|
119
124
|
return []
|
|
120
125
|
}
|
|
121
126
|
|
|
127
|
+
protected currentRoute?: IRouteResult;
|
|
128
|
+
|
|
122
129
|
constructor(...args: any[]) {
|
|
123
130
|
super(...args);
|
|
124
131
|
this._routeHandler = this._routeHandler.bind(this);
|
|
@@ -159,7 +166,7 @@ export function RouteMixin<T extends Constructor<Object>>(superClass: T): Constr
|
|
|
159
166
|
argument.params = params;
|
|
160
167
|
}
|
|
161
168
|
}
|
|
162
|
-
|
|
169
|
+
this.currentRoute = argument;
|
|
163
170
|
this._callRoute(activeRoute, argument);
|
|
164
171
|
if (activeRoute.title) {
|
|
165
172
|
document.title = activeRoute.title;
|
|
@@ -144,7 +144,9 @@ export abstract class ApplicationScreen extends RouteMixin(RenderableMixin(Event
|
|
|
144
144
|
window.onunhandledrejection = this.unhandledRejectionHandler.bind(this);
|
|
145
145
|
this.initMediaQueries();
|
|
146
146
|
this.initStoreChange();
|
|
147
|
-
this.configBroadcast.addEventListener('message', this.handleConfigBroadcast.bind(this))
|
|
147
|
+
this.configBroadcast.addEventListener('message', this.handleConfigBroadcast.bind(this));
|
|
148
|
+
// this will use the system-default theme until config is read.
|
|
149
|
+
this.themeActiveCallback();
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
/**
|
|
@@ -325,7 +327,7 @@ export abstract class ApplicationScreen extends RouteMixin(RenderableMixin(Event
|
|
|
325
327
|
* Called from the initialize store init flow when the user is not authenticated
|
|
326
328
|
* and the auth screen is rendered.
|
|
327
329
|
*/
|
|
328
|
-
protected async
|
|
330
|
+
protected async handleAuthenticate(): Promise<void> {
|
|
329
331
|
const { store } = this.bindings;
|
|
330
332
|
await store.auth.authenticate({ updateEnvironment: true });
|
|
331
333
|
this.authenticated = true;
|
|
@@ -509,7 +511,7 @@ export abstract class ApplicationScreen extends RouteMixin(RenderableMixin(Event
|
|
|
509
511
|
<div class="auth-required-screen">
|
|
510
512
|
<h1 class="display-large">Authentication required</h1>
|
|
511
513
|
<p class="body-large">You are not authenticated. To continue, please, authenticate your account.</p>
|
|
512
|
-
<ui-button type="tonal" @click="${this.
|
|
514
|
+
<ui-button type="tonal" @click="${this.handleAuthenticate}">Authenticate</ui-button>
|
|
513
515
|
</div>
|
|
514
516
|
`;
|
|
515
517
|
}
|
|
@@ -6,6 +6,7 @@ import { IRoute, IRouteResult } from '../../mixins/RouteMixin.js';
|
|
|
6
6
|
import pageStyles from './ApiClient.styles.js';
|
|
7
7
|
import globalStyles from '../../styles/global-styles.js';
|
|
8
8
|
import typography from '../../styles/m3/typography.module.js';
|
|
9
|
+
import surface from '../../styles/m3/surface.module.js';
|
|
9
10
|
import dialogStyles from '../../styles/m3/dialog.module.js';
|
|
10
11
|
import { navigate } from '../../lib/route.js';
|
|
11
12
|
import { reactive } from '../../lib/decorators.js';
|
|
@@ -27,6 +28,7 @@ import '../../define/ui/ui-icon-button.js';
|
|
|
27
28
|
import '../../define/ui/ui-text-field.js';
|
|
28
29
|
import '../../define/ui/ui-dropdown-list.js';
|
|
29
30
|
import '../../define/ui/ui-divider.js';
|
|
31
|
+
import '../../define/http/certificate-add.js';
|
|
30
32
|
|
|
31
33
|
export interface PageInit extends ApplicationInit {
|
|
32
34
|
idb: HttpClientStoreBindings;
|
|
@@ -48,11 +50,12 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
48
50
|
{ pattern: '/shared/(?<key>.*)', method: 'sharedRoute', name: 'Shares', title: 'Shared with you' },
|
|
49
51
|
{ pattern: '/trash', method: 'trashRoute', name: 'Trash', title: 'Trash' },
|
|
50
52
|
{ pattern: '/settings', method: 'settingsRoute', name: 'Settings', title: 'Settings' },
|
|
53
|
+
{ pattern: '/certificates/add/?(?<parent>.*)', method: 'addCertRoute', name: 'Add certificate', title: 'Add certificate' },
|
|
51
54
|
];
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
static get styles(): CSSResult[] {
|
|
55
|
-
return [globalStyles, pageStyles, typography, dialogStyles, DataTable.styles];
|
|
58
|
+
return [globalStyles, pageStyles, typography, dialogStyles, DataTable.styles, surface];
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
/**
|
|
@@ -99,8 +102,6 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
99
102
|
|
|
100
103
|
protected settings = new SettingsPage(this);
|
|
101
104
|
|
|
102
|
-
filesChannel = new BroadcastChannel(StoreBroadcast.files);
|
|
103
|
-
|
|
104
105
|
spacesChannel = new BroadcastChannel(StoreBroadcast.spaces);
|
|
105
106
|
|
|
106
107
|
trashChannel = new BroadcastChannel(StoreBroadcast.trash);
|
|
@@ -136,7 +137,6 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
136
137
|
await this.bindings.store.observeTrash();
|
|
137
138
|
}
|
|
138
139
|
await this.loadUser();
|
|
139
|
-
this.filesChannel.addEventListener('message', this.fileMetaMessageHandler.bind(this));
|
|
140
140
|
this.spacesChannel.addEventListener('message', this.spacesMessageHandler.bind(this));
|
|
141
141
|
this.trashChannel.addEventListener('message', this.trashMessageHandler.bind(this));
|
|
142
142
|
this.initializeRouting();
|
|
@@ -146,8 +146,8 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
146
146
|
reset(): void {
|
|
147
147
|
this.spaces = [];
|
|
148
148
|
this.spacesCursor = undefined;
|
|
149
|
-
this.files.resetList();
|
|
150
|
-
this.shared.resetList();
|
|
149
|
+
this.files.fs.resetList();
|
|
150
|
+
this.shared.fs.resetList();
|
|
151
151
|
this.trash.resetList();
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -249,16 +249,16 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
249
249
|
this.bindings.store.space = this.selectedSpace;
|
|
250
250
|
|
|
251
251
|
this.render();
|
|
252
|
-
this.files.resetList();
|
|
253
|
-
this.shared.resetList();
|
|
252
|
+
this.files.fs.resetList();
|
|
253
|
+
this.shared.fs.resetList();
|
|
254
254
|
this.trash.resetList();
|
|
255
255
|
if (this.page === 'files') {
|
|
256
|
-
this.files.
|
|
256
|
+
this.files.fs.debounceQuery();
|
|
257
257
|
navigate('files'); // remove any folder info
|
|
258
258
|
} else if (this.page === 'trash') {
|
|
259
259
|
this.trash.readFiles();
|
|
260
260
|
} else if (this.page === 'shared') {
|
|
261
|
-
this.shared.
|
|
261
|
+
this.shared.fs.debounceQuery();
|
|
262
262
|
}
|
|
263
263
|
this.storeLastSpaceKey(this.selectedSpace);
|
|
264
264
|
}
|
|
@@ -279,18 +279,6 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
279
279
|
this.spacesCursor = cursor;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
/**
|
|
283
|
-
* A handler for the broadcast channel message which informs about changes to files meta.
|
|
284
|
-
* The function distributes changes between pages
|
|
285
|
-
*/
|
|
286
|
-
protected fileMetaMessageHandler(e: MessageEvent): void {
|
|
287
|
-
const event = e.data as BroadcastEvent;
|
|
288
|
-
if (event.space === this.selectedSpace) {
|
|
289
|
-
this.files.handleFileEvent(event);
|
|
290
|
-
}
|
|
291
|
-
this.shared.handleFileEvent(event);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
282
|
protected trashMessageHandler(e: MessageEvent): void {
|
|
295
283
|
const event = e.data as BroadcastEvent;
|
|
296
284
|
if (event.space !== this.selectedSpace) {
|
|
@@ -343,13 +331,13 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
343
331
|
this.resetRoute();
|
|
344
332
|
this.page = 'files';
|
|
345
333
|
const folder = info.params && info.params.key as string | undefined;
|
|
346
|
-
const folderChanged = this.files.
|
|
334
|
+
const folderChanged = this.files.fs.parent !== folder;
|
|
347
335
|
if (folderChanged) {
|
|
348
|
-
this.files.
|
|
349
|
-
this.files.resetList();
|
|
336
|
+
this.files.fs.parent = folder;
|
|
337
|
+
this.files.fs.resetList();
|
|
350
338
|
}
|
|
351
|
-
if (!this.files.files.length || folderChanged) {
|
|
352
|
-
this.files.
|
|
339
|
+
if (!this.files.fs.files.length || folderChanged) {
|
|
340
|
+
this.files.fs.debounceQuery();
|
|
353
341
|
}
|
|
354
342
|
}
|
|
355
343
|
|
|
@@ -357,13 +345,13 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
357
345
|
this.resetRoute();
|
|
358
346
|
this.page = 'shared';
|
|
359
347
|
const folder = info.params && info.params.key as string | undefined;
|
|
360
|
-
const folderChanged = this.shared.
|
|
348
|
+
const folderChanged = this.shared.fs.parent !== folder;
|
|
361
349
|
if (folderChanged) {
|
|
362
|
-
this.shared.
|
|
363
|
-
this.shared.resetList();
|
|
350
|
+
this.shared.fs.parent = folder;
|
|
351
|
+
this.shared.fs.resetList();
|
|
364
352
|
}
|
|
365
|
-
if (!this.shared.files.length || folderChanged) {
|
|
366
|
-
this.shared.
|
|
353
|
+
if (!this.shared.fs.files.length || folderChanged) {
|
|
354
|
+
this.shared.fs.debounceQuery();
|
|
367
355
|
}
|
|
368
356
|
}
|
|
369
357
|
|
|
@@ -380,6 +368,15 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
380
368
|
this.page = 'settings';
|
|
381
369
|
}
|
|
382
370
|
|
|
371
|
+
protected addCertRoute(): void {
|
|
372
|
+
this.resetRoute();
|
|
373
|
+
this.page = 'add-cert';
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
protected handleCertificateClose(): void {
|
|
377
|
+
window.history.back();
|
|
378
|
+
}
|
|
379
|
+
|
|
383
380
|
protected mainNavHandler(e: Event): void {
|
|
384
381
|
const target = e.target as HTMLElement;
|
|
385
382
|
const { page } = target.dataset;
|
|
@@ -637,7 +634,7 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
637
634
|
protected override mainTemplate(): TemplateResult {
|
|
638
635
|
return html`
|
|
639
636
|
<main class="body-medium">
|
|
640
|
-
<div class="content">
|
|
637
|
+
<div class="content surface1">
|
|
641
638
|
${this.renderPage()}
|
|
642
639
|
</div>
|
|
643
640
|
</main>
|
|
@@ -653,6 +650,7 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
653
650
|
case 'shared': return this.shared.render();
|
|
654
651
|
case 'trash': return this.trash.render();
|
|
655
652
|
case 'settings': return this.settings.render();
|
|
653
|
+
case 'add-cert': return this.renderAddCertificate();
|
|
656
654
|
default: return this.render404();
|
|
657
655
|
}
|
|
658
656
|
}
|
|
@@ -739,4 +737,15 @@ export default class ApiClientScreen extends ApplicationScreen {
|
|
|
739
737
|
</dialog>
|
|
740
738
|
`;
|
|
741
739
|
}
|
|
740
|
+
|
|
741
|
+
protected renderAddCertificate(): TemplateResult {
|
|
742
|
+
const { currentRoute, currentSpace } = this;
|
|
743
|
+
const parent = currentRoute && currentRoute.params && currentRoute.params.parent as string | undefined;
|
|
744
|
+
const space = currentSpace && currentSpace.key;
|
|
745
|
+
return html`
|
|
746
|
+
<h2 class="headline-small">Add Certificate</h2>
|
|
747
|
+
<p class="body-medium">Import a certificate to use it in your HTTP projects. Note, imported certificate cannot be changed.</p>
|
|
748
|
+
<certificate-add .folder="${parent}" .space="${space}" @close="${this.handleCertificateClose}"></certificate-add>
|
|
749
|
+
`;
|
|
750
|
+
}
|
|
742
751
|
}
|
|
@@ -174,8 +174,6 @@ main {
|
|
|
174
174
|
|
|
175
175
|
main .content {
|
|
176
176
|
padding: 20px;
|
|
177
|
-
position: relative;
|
|
178
|
-
z-index: 0;
|
|
179
177
|
border-radius: inherit;
|
|
180
178
|
|
|
181
179
|
flex: 1;
|
|
@@ -184,16 +182,6 @@ main .content {
|
|
|
184
182
|
|
|
185
183
|
overflow: hidden;
|
|
186
184
|
}
|
|
187
|
-
|
|
188
|
-
main .content::before {
|
|
189
|
-
content: '';
|
|
190
|
-
background-color: var(--md-sys-color-primary);
|
|
191
|
-
opacity: .05;
|
|
192
|
-
position: absolute;
|
|
193
|
-
inset: 0;
|
|
194
|
-
border-radius: inherit;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
185
|
main .content > * {
|
|
198
186
|
position: relative;
|
|
199
187
|
z-index: 1;
|
|
@@ -66,7 +66,7 @@ export default class AuthenticateScreen extends ApplicationScreen {
|
|
|
66
66
|
return env;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
protected
|
|
69
|
+
protected async handleAuth(): Promise<void> {
|
|
70
70
|
const { environment } = this;
|
|
71
71
|
if (!environment) {
|
|
72
72
|
this.environmentError = 'Environment information not found. Go back to the previous page.';
|
|
@@ -146,7 +146,7 @@ export default class AuthenticateScreen extends ApplicationScreen {
|
|
|
146
146
|
<div class="action">
|
|
147
147
|
<ui-button
|
|
148
148
|
type="filled"
|
|
149
|
-
@click="${this.
|
|
149
|
+
@click="${this.handleAuth}"
|
|
150
150
|
>Authenticate</ui-button>
|
|
151
151
|
</div>
|
|
152
152
|
`;
|