From 3a226bbda95c2a731f65859c1a798931cdc22c44 Mon Sep 17 00:00:00 2001 From: sosguns2002 Date: Thu, 8 Mar 2018 12:19:06 +0200 Subject: [PATCH] New stepsnavbar --- .../configuration.component.html | 7 +- .../resultspreview.component.html | 8 +- .../settings/settings.component.html | 5 +- .../settings/settings.component.ts | 1 - .../src/app/contents/contents.component.html | 4 +- .../contentstable.component.html | 70 ++++----- .../manageprofiles.component.ts | 12 +- .../manageprofiles/manageprofiles.service.ts | 3 +- .../stepsnvabar/stepsnvabar.component.html | 63 +++++--- .../app/stepsnvabar/stepsnvabar.component.ts | 4 + .../src/assets/css/dl119_files/custom.css | 134 +++++++++++++++--- .../madoap/src/madserverv3.py | 17 ++- 12 files changed, 221 insertions(+), 107 deletions(-) diff --git a/interactive-mining-angular-frontend/src/app/configuration/configuration.component.html b/interactive-mining-angular-frontend/src/app/configuration/configuration.component.html index 7bfb9dd..1d5256d 100644 --- a/interactive-mining-angular-frontend/src/app/configuration/configuration.component.html +++ b/interactive-mining-angular-frontend/src/app/configuration/configuration.component.html @@ -1,6 +1,5 @@ -
- - +
+ +
- diff --git a/interactive-mining-angular-frontend/src/app/configuration/resultspreview/resultspreview.component.html b/interactive-mining-angular-frontend/src/app/configuration/resultspreview/resultspreview.component.html index 5608adb..c9dcc47 100644 --- a/interactive-mining-angular-frontend/src/app/configuration/resultspreview/resultspreview.component.html +++ b/interactive-mining-angular-frontend/src/app/configuration/resultspreview/resultspreview.component.html @@ -2,9 +2,9 @@
-

Matching test area

+

Test area

Choose a document sample to test your matchin results!

-
+
@@ -26,7 +26,7 @@
-
+
{{documentsLoaded}} document{{documentsLoaded===1?'':'s'}} loaded No documents selected
@@ -44,7 +44,7 @@

Test results

- + {{matches_number}} matche{{matches_number===1?'':'s'}} found , {{prev_matches_number}} matche{{prev_matches_number===1?'':'s'}} found previously
diff --git a/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.html b/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.html index 4432654..ac54d1d 100644 --- a/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.html +++ b/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.html @@ -230,8 +230,5 @@

-
- - -
+
diff --git a/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.ts b/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.ts index 19b75a3..0534a71 100644 --- a/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.ts +++ b/interactive-mining-angular-frontend/src/app/configuration/settings/settings.component.ts @@ -221,7 +221,6 @@ export class SettingsComponent implements OnInit { return; } localStorage.setItem('wordssplitnum', value); - this.getSettingsFromLocalStorage(); } stopwordsCheckBoxChange(value: boolean): void { diff --git a/interactive-mining-angular-frontend/src/app/contents/contents.component.html b/interactive-mining-angular-frontend/src/app/contents/contents.component.html index 8bcd7c9..68a895e 100644 --- a/interactive-mining-angular-frontend/src/app/contents/contents.component.html +++ b/interactive-mining-angular-frontend/src/app/contents/contents.component.html @@ -1,6 +1,6 @@
-
-

Content to match

+
+

Fill the table below, with your content you want to match!

diff --git a/interactive-mining-angular-frontend/src/app/contents/contentstable/contentstable.component.html b/interactive-mining-angular-frontend/src/app/contents/contentstable/contentstable.component.html index 30de0fb..863721f 100644 --- a/interactive-mining-angular-frontend/src/app/contents/contentstable/contentstable.component.html +++ b/interactive-mining-angular-frontend/src/app/contents/contentstable/contentstable.component.html @@ -7,40 +7,6 @@ - - - - - - - - - -
-
-
-
- - Drop file with content here to fill the table! -
-
- TSV - file type, maximum 50kB - -
-
-
- - -
-
-
- - - - @@ -55,6 +21,40 @@ + + + + + + + + + +
+
+
+
+ + Drop file with content here to fill the table! +
+
+ TSV + file type, maximum 50kB + +
+
+
+ + +
+
+
+ + + + - + diff --git a/interactive-mining-angular-frontend/src/app/manageprofiles/manageprofiles.component.ts b/interactive-mining-angular-frontend/src/app/manageprofiles/manageprofiles.component.ts index 611a711..f7468d2 100644 --- a/interactive-mining-angular-frontend/src/app/manageprofiles/manageprofiles.component.ts +++ b/interactive-mining-angular-frontend/src/app/manageprofiles/manageprofiles.component.ts @@ -33,9 +33,9 @@ export class ManageprofilesComponent implements OnInit { } getUserId(): void { - this.manageProfilesService.getUserIdToLocalStorage() - .subscribe(() => { - localStorage.setItem('user_id', this.cookieService.get('madgikmining')); + this.manageProfilesService.getUserId() + .subscribe(res => { + localStorage.setItem('user_id', res); this.getSavedProfiles(); this.getExampleProfiles(); }); @@ -43,7 +43,11 @@ export class ManageprofilesComponent implements OnInit { getSavedProfiles(): void { this.manageProfilesService.getSavedProfiles() - .subscribe(res => this.userSavedProfiles = res); + .subscribe(res => { + if (res) { + this.userSavedProfiles = res; + } + }); } loadSavedProfile(id: string, name: string): void { diff --git a/interactive-mining-angular-frontend/src/app/manageprofiles/manageprofiles.service.ts b/interactive-mining-angular-frontend/src/app/manageprofiles/manageprofiles.service.ts index b563c06..8d96d4b 100644 --- a/interactive-mining-angular-frontend/src/app/manageprofiles/manageprofiles.service.ts +++ b/interactive-mining-angular-frontend/src/app/manageprofiles/manageprofiles.service.ts @@ -24,8 +24,9 @@ export class ManageprofilesService { constructor(private http: HttpClient) { } - getUserIdToLocalStorage(): Observable { + getUserId(): Observable { return this.http.get(this.getUserIdUrl, { withCredentials: true }) + .map(res => res['user_id']) .catch(this.util.handleError); } diff --git a/interactive-mining-angular-frontend/src/app/stepsnvabar/stepsnvabar.component.html b/interactive-mining-angular-frontend/src/app/stepsnvabar/stepsnvabar.component.html index ab00339..b4e44f2 100644 --- a/interactive-mining-angular-frontend/src/app/stepsnvabar/stepsnvabar.component.html +++ b/interactive-mining-angular-frontend/src/app/stepsnvabar/stepsnvabar.component.html @@ -1,25 +1,42 @@ -
-
-
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/interactive-mining-angular-frontend/src/app/stepsnvabar/stepsnvabar.component.ts b/interactive-mining-angular-frontend/src/app/stepsnvabar/stepsnvabar.component.ts index f095638..640175b 100644 --- a/interactive-mining-angular-frontend/src/app/stepsnvabar/stepsnvabar.component.ts +++ b/interactive-mining-angular-frontend/src/app/stepsnvabar/stepsnvabar.component.ts @@ -33,4 +33,8 @@ export class StepsnvabarComponent implements OnInit { } } + cancelHandle(): void { + this.router.navigate(['/manage-profiles']); + } + } diff --git a/interactive-mining-angular-frontend/src/assets/css/dl119_files/custom.css b/interactive-mining-angular-frontend/src/assets/css/dl119_files/custom.css index 34b46d4..acb7a77 100644 --- a/interactive-mining-angular-frontend/src/assets/css/dl119_files/custom.css +++ b/interactive-mining-angular-frontend/src/assets/css/dl119_files/custom.css @@ -879,6 +879,105 @@ background:rgba(255,255,255, 0.4); .cm-nav-disabled span.cm-nav-title { color: #91919d; } + +/* Custom Navigation V2 + ========================================================================== */ +:root { + --cm-nav2-theme-1: #245bcc; + --cm-nav2-theme-2: #fff; + --cm-nav2-theme-3: #ffc800; + --cm-nav2-theme-4: #cbcbcb; + --cm-nav2-theme-5: #537fdf; +} +.cm-nav2 { + text-align: center; + display: inline-block; + overflow: hidden; + counter-reset: flag; +} +.cm-nav2-step { + text-decoration: none; + outline: none; + display: block; + float: left; + font-family: Roboto; + font-size: 15px; + line-height: 50px; + padding: 0 16px 0 60px; + position: relative; + background: var(--cm-nav2-theme-2); + color: var(--cm-nav2-theme-1); + transition: background 0.3s; + border: 2px solid var(--cm-nav2-theme-1); +} +.cm-nav2-step:first-child { + padding-left: 46px; + border-radius: 2px 0 0 2px; +} +.cm-nav2-step:first-child::before { + left: 14px; +} +.cm-nav2-step:last-child { + border-radius: 0 2px 2px 0; + padding-right: 20px; +} +.cm-nav2-step:last-child::after { + content: none; +} +.cm-nav2-step::before { + content: counter(flag); + counter-increment: flag; + width: 20px; + height: auto; + line-height: 32px; + margin: 8px 0; + position: absolute; + top: 0; + left: 30px; + font-size: 24px; + font-weight: bold; +} +.cm-nav2-step::after { + content: ''; + position: absolute; + top: 0; + right: -25px; + width: 50px; + height: 50px; + transform: scale(0.707) rotate(45deg); + z-index: 1; + border-radius: 0 5px 0 50px; + background: var(--cm-nav2-theme-2); + transition: background 0.3s; + box-shadow: 2px -2px 0 1px var(--cm-nav2-theme-1); +} +.cm-nav2-step:hover, +.cm-nav2-step-active, +.cm-nav2-step:hover::after, +.cm-nav2-step-active::after{ + background: var(--cm-nav2-theme-5); + color: var(--cm-nav2-theme-2); +} +.cm-nav2-step:hover::before, +.cm-nav2-step-active::before { + color: var(--cm-nav2-theme-2); +} +.cm-nav2-step-disabled, +.cm-nav2-step-disabled:hover { + border: 2px solid var(--cm-nav2-theme-4); +} +.cm-nav2-step-disabled::after { + box-shadow: 2px -2px 0 1px var(--cm-nav2-theme-4); +} +.cm-nav2-step-disabled, +.cm-nav2-step-disabled:hover, +.cm-nav2-step-disabled:hover::before, +.cm-nav2-step-disabled:hover::after { + background: var(--cm-nav2-theme-2); + color: var(--cm-nav2-theme-4); + cursor: default; +} + /* Custom File drop Area Upload ========================================================================== */ .cm-file-drop-area { @@ -910,15 +1009,15 @@ background:rgba(255,255,255, 0.4); ========================================================================== */ .cm-table { border-collapse: collapse; - /*border-radius: 3px;*/ - border-style: hidden; /* hide standard table (collapsed) border */ - box-shadow: 0 0 0 1px #f7c800; /* this draws the table border */ } .cm-table th { padding: 16px 14px; -webkit-transition: color .1s linear; transition: color .1s linear; } +.cm-table tbody tr, .cm-table tfoot tr { + border: 1px solid #cbcbcb; +} .cm-table td { padding: 0px; font-size: 14px; @@ -935,11 +1034,11 @@ background:rgba(255,255,255, 0.4); padding: 14px; } .cm-table td.keyword, .cm-table td.context, .cm-table td.delete, .cm-table td.edit, .cm-table-footer { - border-top: 1px solid #e8e8e8; + border-top: 1px solid #cbcbcb; font-weight: 400; } .cm-table td.keyword, .cm-table td.context { - border-right: 1px solid #e8e8e8; + border-right: 1px solid #cbcbcb; } .cm-table tr.editing td.keyword, .cm-table tr.editing td.context { background-color: #ffd149 !important; @@ -971,9 +1070,6 @@ background:rgba(255,255,255, 0.4); /*.cm-table td.keyword:hover, .cm-table td.context:hover, .cm-table td.edit:hover a {*/ /*color: #55546d;*/ /*}*/ -.cm-table thead tr { - background-color: #fef4d7; -} .cm-table tr th { color: #5b6065; font-weight: bold; @@ -1004,7 +1100,7 @@ background:rgba(255,255,255, 0.4); } .cm-easy-config-section { - padding: 20px; + padding: 30px 20px 20px 20px; } .cm-config-options-container { display: block; @@ -1116,7 +1212,7 @@ background:rgba(255,255,255, 0.4); } .cm-advanced-tools-section { padding: 0px 20px 20px 20px; - min-height: 296px; + min-height: 160px; } .cm-advanced-tools-section .uk-accordion-title { font-size: 16px; @@ -1243,11 +1339,11 @@ background:rgba(255,255,255, 0.4); /* Custom Results Section ========================================================================== */ .cm-results-section { - background-color: rgb(242, 242, 242); - min-height: 700px; + background-color: #f5f5f5; + min-height: 686px; position: relative; - border-bottom: 1px solid #f7c800; - border-left: 1px solid #f7c800; + border: 1px dashed #cbcbcb; + margin-left: 20px; } .cm-results-section header { padding: 0; @@ -1259,7 +1355,7 @@ background:rgba(255,255,255, 0.4); box-shadow: rgba(0, 0, 0, 0.07) 0px 3px 0px; } .cm-results-controls { - padding: 40px 20px 20px 20px; + padding: 20px 20px 20px 20px; } header.uk-sticky-fixed .cm-results-controls { background-color: rgb(242, 242, 242) !important; @@ -1423,7 +1519,6 @@ header.uk-sticky-fixed .cm-results-count-section { margin-bottom: 64px; } #child1 { - padding-top: 20px; -webkit-flex: 0.35; flex: 0.35; will-change: min-height; @@ -1436,10 +1531,9 @@ header.uk-sticky-fixed .cm-results-count-section { transform: translate3d(0, 0, 0); will-change: position, transform; padding-bottom: 20px; - border-bottom: 1px solid #f7c800; - border-right: 1px solid #f7c800; - margin-right: -1px; - min-height: 640px; + /*border: 1px solid #f7c800;*/ + /*padding-top: 20px;*/ + min-height: 667px; } #child2 { position: relative; diff --git a/interactive-mining-backend/madoap/src/madserverv3.py b/interactive-mining-backend/madoap/src/madserverv3.py index e4d2d9e..8944696 100644 --- a/interactive-mining-backend/madoap/src/madserverv3.py +++ b/interactive-mining-backend/madoap/src/madserverv3.py @@ -395,9 +395,10 @@ class GetUserIdHandler(BaseHandler): self.finish() def get(self): try: - # check if we already gave client a user_id + # check if we already gave client a user_id, and it exists on the server user_id = self.get_secure_cookie('madgikmining') - if not user_id: + database_file_name = "/tmp/OAMiningProfilesDatabase_{0}.db".format(user_id) + if user_id is None or not os.path.isfile(database_file_name): # give him a unique user_id user_id = getNewUserId() self.set_secure_cookie('madgikmining', user_id) @@ -412,7 +413,7 @@ class GetUserIdHandler(BaseHandler): cursor.execute("drop table if exists database", parse=False) cursor.execute("create table database(id,name,datecreated,status,matches,docname,docsnumber)", parse=False) cursor.close() - self.write(json.dumps({})) + self.write({'user_id': user_id}) self.finish() except Exception as ints: self.set_status(400) @@ -448,6 +449,10 @@ class GetUserProfilesHandler(BaseHandler): import madis # database file name database_file_name = "/tmp/OAMiningProfilesDatabase_{0}.db".format(user_id) + if not os.path.isfile(database_file_name): + self.set_status(400) + self.write("Missing user\'s database") + return # get the database cursor cursor=madis.functions.Connection(database_file_name).cursor() # data to be sent @@ -589,12 +594,6 @@ class GetExampleProfilesHandler(BaseHandler): self.finish() def get(self): try: - # get user id from cookie. Must have - user_id = self.get_secure_cookie('madgikmining') - if user_id is None: - self.set_status(400) - self.write("Missing cookie containing user's id...") - return data = {} example_profiles = [] example_profiles.append({'name': 'Egi', 'contents': 25, 'documents': 104})